aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bootloaders/CDC/BootloaderCDC.c127
-rw-r--r--Bootloaders/CDC/BootloaderCDC.h23
-rw-r--r--Bootloaders/CDC/BootloaderCDC.txt13
-rw-r--r--Bootloaders/CDC/Descriptors.c89
-rw-r--r--Bootloaders/CDC/Descriptors.h17
-rw-r--r--Bootloaders/CDC/makefile49
-rw-r--r--Bootloaders/DFU/BootloaderDFU.c117
-rw-r--r--Bootloaders/DFU/BootloaderDFU.h33
-rw-r--r--Bootloaders/DFU/BootloaderDFU.txt19
-rw-r--r--Bootloaders/DFU/Descriptors.c63
-rw-r--r--Bootloaders/DFU/Descriptors.h35
-rw-r--r--Bootloaders/DFU/makefile49
-rw-r--r--Bootloaders/makefile3
-rw-r--r--Demos/Device/ClassDriver/AudioInput/AudioInput.c21
-rw-r--r--Demos/Device/ClassDriver/AudioInput/AudioInput.h17
-rw-r--r--Demos/Device/ClassDriver/AudioInput/AudioInput.txt13
-rw-r--r--Demos/Device/ClassDriver/AudioInput/Descriptors.c75
-rw-r--r--Demos/Device/ClassDriver/AudioInput/Descriptors.h17
-rw-r--r--Demos/Device/ClassDriver/AudioInput/makefile49
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/AudioOutput.c17
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/AudioOutput.h23
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/AudioOutput.txt11
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/Descriptors.c117
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/Descriptors.h23
-rw-r--r--Demos/Device/ClassDriver/AudioOutput/makefile49
-rw-r--r--Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c143
-rw-r--r--Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h15
-rw-r--r--Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c23
-rw-r--r--Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h15
-rw-r--r--Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt13
-rw-r--r--Demos/Device/ClassDriver/DualVirtualSerial/makefile49
-rw-r--r--Demos/Device/ClassDriver/GenericHID/Descriptors.c77
-rw-r--r--Demos/Device/ClassDriver/GenericHID/Descriptors.h21
-rw-r--r--Demos/Device/ClassDriver/GenericHID/GenericHID.c23
-rw-r--r--Demos/Device/ClassDriver/GenericHID/GenericHID.h21
-rw-r--r--Demos/Device/ClassDriver/GenericHID/GenericHID.txt11
-rw-r--r--Demos/Device/ClassDriver/GenericHID/makefile49
-rw-r--r--Demos/Device/ClassDriver/Joystick/Descriptors.c79
-rw-r--r--Demos/Device/ClassDriver/Joystick/Descriptors.h15
-rw-r--r--Demos/Device/ClassDriver/Joystick/Joystick.c23
-rw-r--r--Demos/Device/ClassDriver/Joystick/Joystick.h19
-rw-r--r--Demos/Device/ClassDriver/Joystick/Joystick.txt13
-rw-r--r--Demos/Device/ClassDriver/Joystick/makefile49
-rw-r--r--Demos/Device/ClassDriver/Keyboard/Descriptors.c83
-rw-r--r--Demos/Device/ClassDriver/Keyboard/Descriptors.h21
-rw-r--r--Demos/Device/ClassDriver/Keyboard/Keyboard.c25
-rw-r--r--Demos/Device/ClassDriver/Keyboard/Keyboard.h19
-rw-r--r--Demos/Device/ClassDriver/Keyboard/Keyboard.txt11
-rw-r--r--Demos/Device/ClassDriver/Keyboard/makefile49
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c107
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h19
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c36
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h21
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.txt11
-rw-r--r--Demos/Device/ClassDriver/KeyboardMouse/makefile49
-rw-r--r--Demos/Device/ClassDriver/MIDI/Descriptors.c135
-rw-r--r--Demos/Device/ClassDriver/MIDI/Descriptors.h19
-rw-r--r--Demos/Device/ClassDriver/MIDI/MIDI.c35
-rw-r--r--Demos/Device/ClassDriver/MIDI/MIDI.h23
-rw-r--r--Demos/Device/ClassDriver/MIDI/MIDI.txt13
-rw-r--r--Demos/Device/ClassDriver/MIDI/makefile49
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Descriptors.c71
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Descriptors.h25
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c81
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h23
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c63
-rw-r--r--Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h25
-rw-r--r--Demos/Device/ClassDriver/MassStorage/MassStorage.c17
-rw-r--r--Demos/Device/ClassDriver/MassStorage/MassStorage.h19
-rw-r--r--Demos/Device/ClassDriver/MassStorage/MassStorage.txt13
-rw-r--r--Demos/Device/ClassDriver/MassStorage/makefile49
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c89
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h29
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.c81
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h27
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c63
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h25
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c28
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h19
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt13
-rw-r--r--Demos/Device/ClassDriver/MassStorageKeyboard/makefile49
-rw-r--r--Demos/Device/ClassDriver/Mouse/Descriptors.c64
-rw-r--r--Demos/Device/ClassDriver/Mouse/Descriptors.h19
-rw-r--r--Demos/Device/ClassDriver/Mouse/Mouse.c23
-rw-r--r--Demos/Device/ClassDriver/Mouse/Mouse.h21
-rw-r--r--Demos/Device/ClassDriver/Mouse/Mouse.txt9
-rw-r--r--Demos/Device/ClassDriver/Mouse/makefile49
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c95
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h19
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.c19
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.h25
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c27
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h31
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c29
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h35
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h17
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.c21
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.h23
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.c29
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h29
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c39
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h19
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c121
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h43
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.c25
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.h19
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.c35
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.h23
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c15
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h19
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt15
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/makefile50
-rw-r--r--Demos/Device/ClassDriver/VirtualSerial/Descriptors.c85
-rw-r--r--Demos/Device/ClassDriver/VirtualSerial/Descriptors.h15
-rw-r--r--Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c23
-rw-r--r--Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h15
-rw-r--r--Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.txt9
-rw-r--r--Demos/Device/ClassDriver/VirtualSerial/makefile49
-rw-r--r--Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c113
-rw-r--r--Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h21
-rw-r--r--Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c35
-rw-r--r--Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h17
-rw-r--r--Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt9
-rw-r--r--Demos/Device/ClassDriver/VirtualSerialMouse/makefile49
-rw-r--r--Demos/Device/ClassDriver/makefile9
-rw-r--r--Demos/Device/Incomplete/Sideshow/Descriptors.c57
-rw-r--r--Demos/Device/Incomplete/Sideshow/Descriptors.h37
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c17
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h23
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c113
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h43
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c23
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h30
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c23
-rw-r--r--Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h38
-rw-r--r--Demos/Device/Incomplete/Sideshow/Sideshow.c29
-rw-r--r--Demos/Device/Incomplete/Sideshow/Sideshow.h17
-rw-r--r--Demos/Device/Incomplete/Sideshow/makefile49
-rw-r--r--Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c65
-rw-r--r--Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h1
-rw-r--r--Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c1
-rw-r--r--Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h1
-rw-r--r--Demos/Device/Incomplete/TestAndMeasurement/makefile49
-rw-r--r--Demos/Device/LowLevel/AudioInput/AudioInput.c25
-rw-r--r--Demos/Device/LowLevel/AudioInput/AudioInput.h23
-rw-r--r--Demos/Device/LowLevel/AudioInput/AudioInput.txt13
-rw-r--r--Demos/Device/LowLevel/AudioInput/Descriptors.c137
-rw-r--r--Demos/Device/LowLevel/AudioInput/Descriptors.h69
-rw-r--r--Demos/Device/LowLevel/AudioInput/makefile49
-rw-r--r--Demos/Device/LowLevel/AudioOutput/AudioOutput.c31
-rw-r--r--Demos/Device/LowLevel/AudioOutput/AudioOutput.h19
-rw-r--r--Demos/Device/LowLevel/AudioOutput/AudioOutput.txt11
-rw-r--r--Demos/Device/LowLevel/AudioOutput/Descriptors.c135
-rw-r--r--Demos/Device/LowLevel/AudioOutput/Descriptors.h69
-rw-r--r--Demos/Device/LowLevel/AudioOutput/makefile49
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c153
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h29
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c45
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h19
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt13
-rw-r--r--Demos/Device/LowLevel/DualVirtualSerial/makefile49
-rw-r--r--Demos/Device/LowLevel/GenericHID/Descriptors.c81
-rw-r--r--Demos/Device/LowLevel/GenericHID/Descriptors.h25
-rw-r--r--Demos/Device/LowLevel/GenericHID/GenericHID.c35
-rw-r--r--Demos/Device/LowLevel/GenericHID/GenericHID.h23
-rw-r--r--Demos/Device/LowLevel/GenericHID/GenericHID.txt11
-rw-r--r--Demos/Device/LowLevel/GenericHID/makefile49
-rw-r--r--Demos/Device/LowLevel/Joystick/Descriptors.c79
-rw-r--r--Demos/Device/LowLevel/Joystick/Descriptors.h23
-rw-r--r--Demos/Device/LowLevel/Joystick/Joystick.c35
-rw-r--r--Demos/Device/LowLevel/Joystick/Joystick.h17
-rw-r--r--Demos/Device/LowLevel/Joystick/Joystick.txt13
-rw-r--r--Demos/Device/LowLevel/Joystick/makefile49
-rw-r--r--Demos/Device/LowLevel/Keyboard/Descriptors.c85
-rw-r--r--Demos/Device/LowLevel/Keyboard/Descriptors.h31
-rw-r--r--Demos/Device/LowLevel/Keyboard/Keyboard.c73
-rw-r--r--Demos/Device/LowLevel/Keyboard/Keyboard.h21
-rw-r--r--Demos/Device/LowLevel/Keyboard/Keyboard.txt11
-rw-r--r--Demos/Device/LowLevel/Keyboard/makefile49
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/Descriptors.c109
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/Descriptors.h25
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c35
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h27
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.txt11
-rw-r--r--Demos/Device/LowLevel/KeyboardMouse/makefile49
-rw-r--r--Demos/Device/LowLevel/MIDI/Descriptors.c139
-rw-r--r--Demos/Device/LowLevel/MIDI/Descriptors.h39
-rw-r--r--Demos/Device/LowLevel/MIDI/MIDI.c43
-rw-r--r--Demos/Device/LowLevel/MIDI/MIDI.h29
-rw-r--r--Demos/Device/LowLevel/MIDI/MIDI.txt13
-rw-r--r--Demos/Device/LowLevel/MIDI/makefile49
-rw-r--r--Demos/Device/LowLevel/MassStorage/Descriptors.c71
-rw-r--r--Demos/Device/LowLevel/MassStorage/Descriptors.h25
-rw-r--r--Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c81
-rw-r--r--Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h29
-rw-r--r--Demos/Device/LowLevel/MassStorage/Lib/SCSI.c61
-rw-r--r--Demos/Device/LowLevel/MassStorage/Lib/SCSI.h41
-rw-r--r--Demos/Device/LowLevel/MassStorage/Lib/SCSI_Codes.h15
-rw-r--r--Demos/Device/LowLevel/MassStorage/MassStorage.c47
-rw-r--r--Demos/Device/LowLevel/MassStorage/MassStorage.h31
-rw-r--r--Demos/Device/LowLevel/MassStorage/MassStorage.txt13
-rw-r--r--Demos/Device/LowLevel/MassStorage/makefile49
-rw-r--r--Demos/Device/LowLevel/Mouse/Descriptors.c70
-rw-r--r--Demos/Device/LowLevel/Mouse/Descriptors.h25
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.c61
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.h21
-rw-r--r--Demos/Device/LowLevel/Mouse/Mouse.txt9
-rw-r--r--Demos/Device/LowLevel/Mouse/makefile49
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Descriptors.c95
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Descriptors.h19
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c19
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h25
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c27
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h31
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c29
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h37
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h17
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c21
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h23
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c29
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h29
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c39
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h19
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c121
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h47
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/RNDISConstants.h27
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c119
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h41
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c25
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h19
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c37
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h23
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c41
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h23
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt15
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/makefile50
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/Descriptors.c103
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/Descriptors.h25
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c43
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h31
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt9
-rw-r--r--Demos/Device/LowLevel/VirtualSerial/makefile49
-rw-r--r--Demos/Device/LowLevel/makefile3
-rw-r--r--Demos/Device/makefile3
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c64
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h19
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c21
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h21
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c33
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.h17
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.c19
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.h21
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.txt15
-rw-r--r--Demos/DualRole/ClassDriver/MouseHostDevice/makefile49
-rw-r--r--Demos/DualRole/ClassDriver/makefile3
-rw-r--r--Demos/DualRole/makefile3
-rw-r--r--Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c39
-rw-r--r--Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.h23
-rw-r--r--Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.txt11
-rw-r--r--Demos/Host/ClassDriver/JoystickHostWithParser/makefile49
-rw-r--r--Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c43
-rw-r--r--Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h21
-rw-r--r--Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.txt13
-rw-r--r--Demos/Host/ClassDriver/KeyboardHost/makefile49
-rw-r--r--Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c41
-rw-r--r--Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h23
-rw-r--r--Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.txt13
-rw-r--r--Demos/Host/ClassDriver/KeyboardHostWithParser/makefile49
-rw-r--r--Demos/Host/ClassDriver/MIDIHost/MIDIHost.c49
-rw-r--r--Demos/Host/ClassDriver/MIDIHost/MIDIHost.h21
-rw-r--r--Demos/Host/ClassDriver/MIDIHost/MIDIHost.txt7
-rw-r--r--Demos/Host/ClassDriver/MIDIHost/makefile49
-rw-r--r--Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c55
-rw-r--r--Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.h21
-rw-r--r--Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.txt9
-rw-r--r--Demos/Host/ClassDriver/MassStorageHost/makefile49
-rw-r--r--Demos/Host/ClassDriver/MouseHost/MouseHost.c39
-rw-r--r--Demos/Host/ClassDriver/MouseHost/MouseHost.h21
-rw-r--r--Demos/Host/ClassDriver/MouseHost/MouseHost.txt15
-rw-r--r--Demos/Host/ClassDriver/MouseHost/makefile49
-rw-r--r--Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c43
-rw-r--r--Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.h23
-rw-r--r--Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.txt11
-rw-r--r--Demos/Host/ClassDriver/MouseHostWithParser/makefile49
-rw-r--r--Demos/Host/ClassDriver/PrinterHost/PrinterHost.c39
-rw-r--r--Demos/Host/ClassDriver/PrinterHost/PrinterHost.h21
-rw-r--r--Demos/Host/ClassDriver/PrinterHost/PrinterHost.txt11
-rw-r--r--Demos/Host/ClassDriver/PrinterHost/makefile49
-rw-r--r--Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c47
-rw-r--r--Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h21
-rw-r--r--Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.txt9
-rw-r--r--Demos/Host/ClassDriver/RNDISEthernetHost/makefile49
-rw-r--r--Demos/Host/ClassDriver/StillImageHost/StillImageHost.c35
-rw-r--r--Demos/Host/ClassDriver/StillImageHost/StillImageHost.h21
-rw-r--r--Demos/Host/ClassDriver/StillImageHost/StillImageHost.txt9
-rw-r--r--Demos/Host/ClassDriver/StillImageHost/makefile49
-rw-r--r--Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c29
-rw-r--r--Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.h21
-rw-r--r--Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.txt11
-rw-r--r--Demos/Host/ClassDriver/VirtualSerialHost/makefile49
-rw-r--r--Demos/Host/ClassDriver/makefile9
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c1
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h1
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c31
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h19
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c22
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h19
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c21
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h19
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c149
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h49
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h21
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c63
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h37
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c13
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h37
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c61
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h31
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c51
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h29
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c121
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h37
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c13
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h41
-rw-r--r--Demos/Host/Incomplete/BluetoothHost/makefile49
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c33
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h23
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c45
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h25
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt9
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/makefile49
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c25
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h19
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c19
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h25
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c58
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h17
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt11
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/makefile49
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c23
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c43
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h23
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt13
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/makefile49
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c31
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c17
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h23
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c49
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h19
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt13
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/makefile49
-rw-r--r--Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c27
-rw-r--r--Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h27
-rw-r--r--Demos/Host/LowLevel/MIDIHost/MIDIHost.c51
-rw-r--r--Demos/Host/LowLevel/MIDIHost/MIDIHost.h29
-rw-r--r--Demos/Host/LowLevel/MIDIHost/MIDIHost.txt7
-rw-r--r--Demos/Host/LowLevel/MIDIHost/makefile49
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c23
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h23
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c95
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h43
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.h15
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c77
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h19
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt9
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/makefile49
-rw-r--r--Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c23
-rw-r--r--Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/MouseHost/MouseHost.c41
-rw-r--r--Demos/Host/LowLevel/MouseHost/MouseHost.h23
-rw-r--r--Demos/Host/LowLevel/MouseHost/MouseHost.txt15
-rw-r--r--Demos/Host/LowLevel/MouseHost/makefile49
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c33
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c19
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h27
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c64
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h17
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt11
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/makefile49
-rw-r--r--Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c27
-rw-r--r--Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h23
-rw-r--r--Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c30
-rw-r--r--Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h21
-rw-r--r--Demos/Host/LowLevel/PrinterHost/PrinterHost.c41
-rw-r--r--Demos/Host/LowLevel/PrinterHost/PrinterHost.h21
-rw-r--r--Demos/Host/LowLevel/PrinterHost/PrinterHost.txt11
-rw-r--r--Demos/Host/LowLevel/PrinterHost/makefile49
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c29
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h27
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c55
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h41
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h27
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c50
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h23
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt9
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/makefile49
-rw-r--r--Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c21
-rw-r--r--Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h21
-rw-r--r--Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h15
-rw-r--r--Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c55
-rw-r--r--Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h27
-rw-r--r--Demos/Host/LowLevel/StillImageHost/StillImageHost.c81
-rw-r--r--Demos/Host/LowLevel/StillImageHost/StillImageHost.h23
-rw-r--r--Demos/Host/LowLevel/StillImageHost/StillImageHost.txt9
-rw-r--r--Demos/Host/LowLevel/StillImageHost/makefile49
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c29
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h27
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c33
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h23
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt11
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/makefile49
-rw-r--r--Demos/Host/LowLevel/makefile3
-rw-r--r--Demos/Host/makefile3
-rw-r--r--Demos/makefile3
-rw-r--r--LUFA/CodeTemplates/DriverStubs/Buttons.h21
-rw-r--r--LUFA/CodeTemplates/DriverStubs/Dataflash.h33
-rw-r--r--LUFA/CodeTemplates/DriverStubs/Joystick.h21
-rw-r--r--LUFA/CodeTemplates/DriverStubs/LEDs.h21
-rw-r--r--LUFA/Common/Attributes.h33
-rw-r--r--LUFA/Common/BoardTypes.h33
-rw-r--r--LUFA/Common/Common.h41
-rw-r--r--LUFA/Drivers/Board/ATAVRUSBRF01/Buttons.h21
-rw-r--r--LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h27
-rw-r--r--LUFA/Drivers/Board/BENITO/Buttons.h21
-rw-r--r--LUFA/Drivers/Board/BENITO/LEDs.h21
-rw-r--r--LUFA/Drivers/Board/BUI/LEDs.h21
-rw-r--r--LUFA/Drivers/Board/BUMBLEB/Buttons.h19
-rw-r--r--LUFA/Drivers/Board/BUMBLEB/Joystick.h17
-rw-r--r--LUFA/Drivers/Board/BUMBLEB/LEDs.h21
-rw-r--r--LUFA/Drivers/Board/Buttons.h21
-rw-r--r--LUFA/Drivers/Board/CULV3/Buttons.h19
-rw-r--r--LUFA/Drivers/Board/CULV3/LEDs.h23
-rw-r--r--LUFA/Drivers/Board/Dataflash.h27
-rw-r--r--LUFA/Drivers/Board/EVK527/AT45DB321C.h27
-rw-r--r--LUFA/Drivers/Board/EVK527/Buttons.h19
-rw-r--r--LUFA/Drivers/Board/EVK527/Dataflash.h29
-rw-r--r--LUFA/Drivers/Board/EVK527/Joystick.h21
-rw-r--r--LUFA/Drivers/Board/EVK527/LEDs.h23
-rw-r--r--LUFA/Drivers/Board/JMDBU2/Buttons.h21
-rw-r--r--LUFA/Drivers/Board/JMDBU2/LEDs.h23
-rw-r--r--LUFA/Drivers/Board/Joystick.h19
-rw-r--r--LUFA/Drivers/Board/LEDs.h23
-rw-r--r--LUFA/Drivers/Board/OLIMEX162/Buttons.h21
-rw-r--r--LUFA/Drivers/Board/OLIMEX162/LEDs.h25
-rw-r--r--LUFA/Drivers/Board/RZUSBSTICK/LEDs.h29
-rw-r--r--LUFA/Drivers/Board/STK525/AT45DB321C.h27
-rw-r--r--LUFA/Drivers/Board/STK525/Buttons.h19
-rw-r--r--LUFA/Drivers/Board/STK525/Dataflash.h29
-rw-r--r--LUFA/Drivers/Board/STK525/Joystick.h27
-rw-r--r--LUFA/Drivers/Board/STK525/LEDs.h25
-rw-r--r--LUFA/Drivers/Board/STK526/AT45DB642D.h27
-rw-r--r--LUFA/Drivers/Board/STK526/Buttons.h19
-rw-r--r--LUFA/Drivers/Board/STK526/Dataflash.h27
-rw-r--r--LUFA/Drivers/Board/STK526/Joystick.h23
-rw-r--r--LUFA/Drivers/Board/STK526/LEDs.h27
-rw-r--r--LUFA/Drivers/Board/TEENSY/LEDs.h25
-rw-r--r--LUFA/Drivers/Board/Temperature.c13
-rw-r--r--LUFA/Drivers/Board/Temperature.h23
-rw-r--r--LUFA/Drivers/Board/UDIP/Buttons.h21
-rw-r--r--LUFA/Drivers/Board/UDIP/LEDs.h25
-rw-r--r--LUFA/Drivers/Board/UNO/LEDs.h21
-rw-r--r--LUFA/Drivers/Board/USBFOO/Buttons.h21
-rw-r--r--LUFA/Drivers/Board/USBFOO/LEDS.h25
-rw-r--r--LUFA/Drivers/Board/USBKEY/AT45DB642D.h29
-rw-r--r--LUFA/Drivers/Board/USBKEY/Buttons.h21
-rw-r--r--LUFA/Drivers/Board/USBKEY/Dataflash.h37
-rw-r--r--LUFA/Drivers/Board/USBKEY/Joystick.h21
-rw-r--r--LUFA/Drivers/Board/USBKEY/LEDs.h23
-rw-r--r--LUFA/Drivers/Board/USBTINYMKII/Buttons.h19
-rw-r--r--LUFA/Drivers/Board/USBTINYMKII/LEDs.h21
-rw-r--r--LUFA/Drivers/Board/XPLAIN/AT45DB642D.h29
-rw-r--r--LUFA/Drivers/Board/XPLAIN/Dataflash.h33
-rw-r--r--LUFA/Drivers/Board/XPLAIN/LEDs.h27
-rw-r--r--LUFA/Drivers/Misc/TerminalCodes.h25
-rw-r--r--LUFA/Drivers/Peripheral/ADC.h17
-rw-r--r--LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h55
-rw-r--r--LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h25
-rw-r--r--LUFA/Drivers/Peripheral/SPI.h29
-rw-r--r--LUFA/Drivers/Peripheral/Serial.c13
-rw-r--r--LUFA/Drivers/Peripheral/Serial.h29
-rw-r--r--LUFA/Drivers/Peripheral/SerialStream.c17
-rw-r--r--LUFA/Drivers/Peripheral/SerialStream.h25
-rw-r--r--LUFA/Drivers/Peripheral/TWI.c19
-rw-r--r--LUFA/Drivers/Peripheral/TWI.h17
-rw-r--r--LUFA/Drivers/USB/Class/Audio.h19
-rw-r--r--LUFA/Drivers/USB/Class/CDC.h19
-rw-r--r--LUFA/Drivers/USB/Class/Common/Audio.h131
-rw-r--r--LUFA/Drivers/USB/Class/Common/CDC.h41
-rw-r--r--LUFA/Drivers/USB/Class/Common/HID.h39
-rw-r--r--LUFA/Drivers/USB/Class/Common/MIDI.h47
-rw-r--r--LUFA/Drivers/USB/Class/Common/MassStorage.h43
-rw-r--r--LUFA/Drivers/USB/Class/Common/Printer.h19
-rw-r--r--LUFA/Drivers/USB/Class/Common/RNDIS.h51
-rw-r--r--LUFA/Drivers/USB/Class/Common/RNDISConstants.h27
-rw-r--r--LUFA/Drivers/USB/Class/Common/StillImage.h29
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.c20
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.h41
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.c55
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.h49
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.c41
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.h43
-rw-r--r--LUFA/Drivers/USB/Class/Device/MIDI.c29
-rw-r--r--LUFA/Drivers/USB/Class/Device/MIDI.h27
-rw-r--r--LUFA/Drivers/USB/Class/Device/MassStorage.c45
-rw-r--r--LUFA/Drivers/USB/Class/Device/MassStorage.h31
-rw-r--r--LUFA/Drivers/USB/Class/Device/RNDIS.c135
-rw-r--r--LUFA/Drivers/USB/Class/Device/RNDIS.h39
-rw-r--r--LUFA/Drivers/USB/Class/HID.h25
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.c79
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.h45
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.c85
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.h39
-rw-r--r--LUFA/Drivers/USB/Class/Host/HIDParser.c109
-rw-r--r--LUFA/Drivers/USB/Class/Host/HIDParser.h51
-rw-r--r--LUFA/Drivers/USB/Class/Host/HIDReportData.h23
-rw-r--r--LUFA/Drivers/USB/Class/Host/MIDI.c41
-rw-r--r--LUFA/Drivers/USB/Class/Host/MIDI.h29
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.c85
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.h45
-rw-r--r--LUFA/Drivers/USB/Class/Host/Printer.c83
-rw-r--r--LUFA/Drivers/USB/Class/Host/Printer.h37
-rw-r--r--LUFA/Drivers/USB/Class/Host/RNDIS.c91
-rw-r--r--LUFA/Drivers/USB/Class/Host/RNDIS.h31
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.c89
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.h39
-rw-r--r--LUFA/Drivers/USB/Class/MIDI.h17
-rw-r--r--LUFA/Drivers/USB/Class/MassStorage.h19
-rw-r--r--LUFA/Drivers/USB/Class/Printer.h17
-rw-r--r--LUFA/Drivers/USB/Class/RNDIS.h19
-rw-r--r--LUFA/Drivers/USB/Class/StillImage.h19
-rw-r--r--LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c35
-rw-r--r--LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h35
-rw-r--r--LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c79
-rw-r--r--LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h39
-rw-r--r--LUFA/Drivers/USB/HighLevel/EndpointStream.c2
-rw-r--r--LUFA/Drivers/USB/HighLevel/EndpointStream.h1
-rw-r--r--LUFA/Drivers/USB/HighLevel/Events.c13
-rw-r--r--LUFA/Drivers/USB/HighLevel/Events.h35
-rw-r--r--LUFA/Drivers/USB/HighLevel/HostStandardReq.c41
-rw-r--r--LUFA/Drivers/USB/HighLevel/HostStandardReq.h27
-rw-r--r--LUFA/Drivers/USB/HighLevel/PipeStream.c1
-rw-r--r--LUFA/Drivers/USB/HighLevel/PipeStream.h1
-rw-r--r--LUFA/Drivers/USB/HighLevel/StdDescriptors.h67
-rw-r--r--LUFA/Drivers/USB/HighLevel/StdRequestType.h19
-rw-r--r--LUFA/Drivers/USB/HighLevel/StreamCallbacks.h23
-rw-r--r--LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c16
-rw-r--r--LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c12
-rw-r--r--LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c8
-rw-r--r--LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c9
-rw-r--r--LUFA/Drivers/USB/HighLevel/USBMode.h28
-rw-r--r--LUFA/Drivers/USB/HighLevel/USBTask.c21
-rw-r--r--LUFA/Drivers/USB/HighLevel/USBTask.h35
-rw-r--r--LUFA/Drivers/USB/LowLevel/Device.c13
-rw-r--r--LUFA/Drivers/USB/LowLevel/Device.h39
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.c23
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.h125
-rw-r--r--LUFA/Drivers/USB/LowLevel/Host.c67
-rw-r--r--LUFA/Drivers/USB/LowLevel/Host.h73
-rw-r--r--LUFA/Drivers/USB/LowLevel/OTG.h37
-rw-r--r--LUFA/Drivers/USB/LowLevel/Pipe.c29
-rw-r--r--LUFA/Drivers/USB/LowLevel/Pipe.h141
-rw-r--r--LUFA/Drivers/USB/LowLevel/USBController.c41
-rw-r--r--LUFA/Drivers/USB/LowLevel/USBController.h75
-rw-r--r--LUFA/Drivers/USB/LowLevel/USBInterrupt.c67
-rw-r--r--LUFA/Drivers/USB/LowLevel/USBInterrupt.h23
-rw-r--r--LUFA/Drivers/USB/USB.h70
-rw-r--r--LUFA/License.txt1
-rw-r--r--LUFA/ManPages/AboutLUFA.txt2
-rw-r--r--LUFA/ManPages/AlternativeStacks.txt6
-rw-r--r--LUFA/ManPages/BuildingLinkableLibraries.txt1
-rw-r--r--LUFA/ManPages/ChangeLog.txt21
-rw-r--r--LUFA/ManPages/CompileTimeTokens.txt3
-rw-r--r--LUFA/ManPages/CompilingApps.txt4
-rw-r--r--LUFA/ManPages/ConfiguringApps.txt4
-rw-r--r--LUFA/ManPages/DevelopingWithLUFA.txt2
-rw-r--r--LUFA/ManPages/DeviceSupport.txt2
-rw-r--r--LUFA/ManPages/DirectorySummaries.txt65
-rw-r--r--LUFA/ManPages/Donating.txt2
-rw-r--r--LUFA/ManPages/FutureChanges.txt1
-rw-r--r--LUFA/ManPages/GettingStarted.txt1
-rw-r--r--LUFA/ManPages/Groups.txt3
-rw-r--r--LUFA/ManPages/LUFAPoweredProjects.txt6
-rw-r--r--LUFA/ManPages/LUFAvsAtmelStack.txt2
-rw-r--r--LUFA/ManPages/LibraryApps.txt3
-rw-r--r--LUFA/ManPages/LibraryResources.txt4
-rw-r--r--LUFA/ManPages/LicenseInfo.txt1
-rw-r--r--LUFA/ManPages/MainPage.txt3
-rw-r--r--LUFA/ManPages/MigrationInformation.txt13
-rw-r--r--LUFA/ManPages/ProgrammingApps.txt4
-rw-r--r--LUFA/ManPages/SoftwareBootloaderJump.txt9
-rw-r--r--LUFA/ManPages/VIDAndPIDValues.txt1
-rw-r--r--LUFA/ManPages/WhyUseLUFA.txt2
-rw-r--r--LUFA/ManPages/WritingBoardDrivers.txt1
-rw-r--r--LUFA/Scheduler/Scheduler.c31
-rw-r--r--LUFA/Scheduler/Scheduler.h53
-rw-r--r--LUFA/Version.h15
-rw-r--r--LUFA/makefile6
-rw-r--r--Projects/AVRISP-MKII/AVRISP-MKII.c24
-rw-r--r--Projects/AVRISP-MKII/AVRISP-MKII.h23
-rw-r--r--Projects/AVRISP-MKII/AVRISP-MKII.txt21
-rw-r--r--Projects/AVRISP-MKII/Descriptors.c77
-rw-r--r--Projects/AVRISP-MKII/Descriptors.h15
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c132
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h19
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c31
-rw-r--r--Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h19
-rw-r--r--Projects/AVRISP-MKII/Lib/V2Protocol.c41
-rw-r--r--Projects/AVRISP-MKII/Lib/V2Protocol.h24
-rw-r--r--Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h13
-rw-r--r--Projects/AVRISP-MKII/Lib/V2ProtocolParams.c29
-rw-r--r--Projects/AVRISP-MKII/Lib/V2ProtocolParams.h20
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c31
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h23
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c63
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h27
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c105
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h33
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c21
-rw-r--r--Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h37
-rw-r--r--Projects/AVRISP-MKII/makefile49
-rw-r--r--Projects/Benito/Benito.c49
-rw-r--r--Projects/Benito/Benito.h21
-rw-r--r--Projects/Benito/Benito.txt7
-rw-r--r--Projects/Benito/Descriptors.c103
-rw-r--r--Projects/Benito/Descriptors.h19
-rw-r--r--Projects/Benito/Lib/LightweightRingBuff.h39
-rw-r--r--Projects/Benito/makefile49
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Descriptors.c69
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Descriptors.h25
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskDevice.c17
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskDevice.h15
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskHost.c35
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/DiskHost.h17
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c81
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h21
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt1
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h1
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h1
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c2
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h1
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c25
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h15
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c63
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h25
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c21
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h23
-rw-r--r--Projects/Incomplete/StandaloneProgrammer/makefile49
-rw-r--r--Projects/LEDNotifier/Descriptors.c85
-rw-r--r--Projects/LEDNotifier/Descriptors.h15
-rw-r--r--Projects/LEDNotifier/LEDNotifier.c29
-rw-r--r--Projects/LEDNotifier/LEDNotifier.h17
-rw-r--r--Projects/LEDNotifier/LEDNotifier.txt7
-rw-r--r--Projects/LEDNotifier/makefile49
-rw-r--r--Projects/Magstripe/Descriptors.c69
-rw-r--r--Projects/Magstripe/Descriptors.h17
-rw-r--r--Projects/Magstripe/Lib/CircularBitBuffer.c35
-rw-r--r--Projects/Magstripe/Lib/CircularBitBuffer.h31
-rw-r--r--Projects/Magstripe/Lib/MagstripeHW.h11
-rw-r--r--Projects/Magstripe/Magstripe.c29
-rw-r--r--Projects/Magstripe/Magstripe.h25
-rw-r--r--Projects/Magstripe/Magstripe.txt13
-rw-r--r--Projects/Magstripe/makefile49
-rw-r--r--Projects/MissileLauncher/ConfigDescriptor.c31
-rw-r--r--Projects/MissileLauncher/ConfigDescriptor.h21
-rw-r--r--Projects/MissileLauncher/MissileLauncher.c39
-rw-r--r--Projects/MissileLauncher/MissileLauncher.h23
-rw-r--r--Projects/MissileLauncher/MissileLauncher.txt7
-rw-r--r--Projects/MissileLauncher/makefile49
-rw-r--r--Projects/RelayBoard/Descriptors.c1
-rw-r--r--Projects/RelayBoard/Descriptors.h1
-rw-r--r--Projects/RelayBoard/RelayBoard.c7
-rw-r--r--Projects/RelayBoard/RelayBoard.h1
-rw-r--r--Projects/RelayBoard/RelayBoard.txt2
-rw-r--r--Projects/RelayBoard/makefile49
-rw-r--r--Projects/TempDataLogger/Descriptors.c95
-rw-r--r--Projects/TempDataLogger/Descriptors.h19
-rw-r--r--Projects/TempDataLogger/Lib/DS1307.c23
-rw-r--r--Projects/TempDataLogger/Lib/DS1307.h23
-rw-r--r--Projects/TempDataLogger/Lib/DataflashManager.c81
-rw-r--r--Projects/TempDataLogger/Lib/DataflashManager.h23
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/00readme.txt1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/diskio.c1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/diskio.h1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/ff.c5
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/ff.h1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/ffconf.h1
-rw-r--r--Projects/TempDataLogger/Lib/FATFs/integer.h1
-rw-r--r--Projects/TempDataLogger/Lib/SCSI.c63
-rw-r--r--Projects/TempDataLogger/Lib/SCSI.h25
-rw-r--r--Projects/TempDataLogger/TempDataLogger.c41
-rw-r--r--Projects/TempDataLogger/TempDataLogger.h25
-rw-r--r--Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt5
-rw-r--r--Projects/TempDataLogger/TempLogHostApp/COPYING.txt1
-rw-r--r--Projects/TempDataLogger/TempLogHostApp/README.txt1
-rw-r--r--Projects/TempDataLogger/TemperatureDataLogger.txt7
-rw-r--r--Projects/TempDataLogger/makefile49
-rw-r--r--Projects/USBtoSerial/Descriptors.c103
-rw-r--r--Projects/USBtoSerial/Descriptors.h21
-rw-r--r--Projects/USBtoSerial/Lib/LightweightRingBuff.h39
-rw-r--r--Projects/USBtoSerial/USBtoSerial.c31
-rw-r--r--Projects/USBtoSerial/USBtoSerial.h17
-rw-r--r--Projects/USBtoSerial/USBtoSerial.txt9
-rw-r--r--Projects/USBtoSerial/makefile51
-rw-r--r--Projects/Webserver/Descriptors.c71
-rw-r--r--Projects/Webserver/Descriptors.h25
-rw-r--r--Projects/Webserver/Lib/DHCPClientApp.c63
-rw-r--r--Projects/Webserver/Lib/DHCPClientApp.h37
-rw-r--r--Projects/Webserver/Lib/DataflashManager.c81
-rw-r--r--Projects/Webserver/Lib/DataflashManager.h23
-rw-r--r--Projects/Webserver/Lib/FATFs/00readme.txt1
-rw-r--r--Projects/Webserver/Lib/FATFs/diskio.c1
-rw-r--r--Projects/Webserver/Lib/FATFs/diskio.h1
-rw-r--r--Projects/Webserver/Lib/FATFs/ff.c5
-rw-r--r--Projects/Webserver/Lib/FATFs/ff.h1
-rw-r--r--Projects/Webserver/Lib/FATFs/ffconf.h1
-rw-r--r--Projects/Webserver/Lib/FATFs/integer.h1
-rw-r--r--Projects/Webserver/Lib/HTTPServerApp.c61
-rw-r--r--Projects/Webserver/Lib/HTTPServerApp.h25
-rw-r--r--Projects/Webserver/Lib/SCSI.c63
-rw-r--r--Projects/Webserver/Lib/SCSI.h25
-rw-r--r--Projects/Webserver/Lib/TELNETServerApp.c31
-rw-r--r--Projects/Webserver/Lib/TELNETServerApp.h25
-rw-r--r--Projects/Webserver/Lib/uIPManagement.c31
-rw-r--r--Projects/Webserver/Lib/uIPManagement.h29
-rw-r--r--Projects/Webserver/Lib/uip/clock.c1
-rw-r--r--Projects/Webserver/Lib/uip/clock.h1
-rw-r--r--Projects/Webserver/Lib/uip/timer.c1
-rw-r--r--Projects/Webserver/Lib/uip/timer.h1
-rw-r--r--Projects/Webserver/Lib/uip/uip-split.c13
-rw-r--r--Projects/Webserver/Lib/uip/uip-split.h51
-rw-r--r--Projects/Webserver/Lib/uip/uip.c153
-rw-r--r--Projects/Webserver/Lib/uip/uip.h29
-rw-r--r--Projects/Webserver/Lib/uip/uip_arp.c27
-rw-r--r--Projects/Webserver/Lib/uip/uip_arp.h5
-rw-r--r--Projects/Webserver/Lib/uip/uipopt.h23
-rw-r--r--Projects/Webserver/USBDeviceMode.c19
-rw-r--r--Projects/Webserver/USBDeviceMode.h17
-rw-r--r--Projects/Webserver/USBHostMode.c35
-rw-r--r--Projects/Webserver/USBHostMode.h21
-rw-r--r--Projects/Webserver/Webserver.c15
-rw-r--r--Projects/Webserver/Webserver.h21
-rw-r--r--Projects/Webserver/Webserver.txt7
-rw-r--r--Projects/Webserver/makefile53
-rw-r--r--Projects/XPLAINBridge/AVRISPDescriptors.c77
-rw-r--r--Projects/XPLAINBridge/AVRISPDescriptors.h19
-rw-r--r--Projects/XPLAINBridge/Lib/LightweightRingBuff.h39
-rw-r--r--Projects/XPLAINBridge/Lib/SoftUART.c17
-rw-r--r--Projects/XPLAINBridge/Lib/SoftUART.h20
-rw-r--r--Projects/XPLAINBridge/USARTDescriptors.c103
-rw-r--r--Projects/XPLAINBridge/USARTDescriptors.h21
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.c23
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.h19
-rw-r--r--Projects/XPLAINBridge/XPLAINBridge.txt7
-rw-r--r--Projects/XPLAINBridge/makefile49
-rw-r--r--Projects/makefile7
-rw-r--r--README.txt9
-rw-r--r--makefile3
760 files changed, 12881 insertions, 12162 deletions
diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c
index 234b5ce88..38f78daf3 100644
--- a/Bootloaders/CDC/BootloaderCDC.c
+++ b/Bootloaders/CDC/BootloaderCDC.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Main source file for the CDC class bootloader. This file contains the complete bootloader logic.
*/
-
+
#define INCLUDE_FROM_BOOTLOADERCDC_C
#include "BootloaderCDC.h"
@@ -57,7 +57,7 @@ uint32_t CurrAddress;
bool RunBootloader = true;
-/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
+/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start
* the loaded application code.
*/
@@ -74,7 +74,7 @@ int main(void)
CDC_Task();
USB_USBTask();
}
-
+
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
@@ -93,11 +93,11 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Relocate the interrupt vector table to the bootloader section */
MCUCR = (1 << IVCE);
MCUCR = (1 << IVSEL);
-
+
/* Initialize USB Subsystem */
USB_Init();
}
@@ -132,14 +132,14 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
case REQ_GetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
- {
+ {
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));
Endpoint_ClearOUT();
}
-
+
break;
case REQ_SetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -150,7 +150,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));
Endpoint_ClearIN();
}
-
+
break;
}
}
@@ -164,20 +164,20 @@ static void ReadWriteMemoryBlock(const uint8_t Command)
{
uint16_t BlockSize;
char MemoryType;
-
+
bool HighByte = false;
uint8_t LowByte = 0;
-
+
BlockSize = (FetchNextCommandByte() << 8);
BlockSize |= FetchNextCommandByte();
-
+
MemoryType = FetchNextCommandByte();
if ((MemoryType != 'E') && (MemoryType != 'F'))
{
/* Send error byte back to the host */
WriteNextResponseByte('?');
-
+
return;
}
@@ -195,13 +195,13 @@ static void ReadWriteMemoryBlock(const uint8_t Command)
#if (FLASHEND > 0xFFFF)
WriteNextResponseByte(pgm_read_byte_far(CurrAddress | HighByte));
#else
- WriteNextResponseByte(pgm_read_byte(CurrAddress | HighByte));
+ WriteNextResponseByte(pgm_read_byte(CurrAddress | HighByte));
#endif
-
+
/* If both bytes in current word have been read, increment the address counter */
if (HighByte)
CurrAddress += 2;
-
+
HighByte = !HighByte;
}
else
@@ -211,7 +211,7 @@ static void ReadWriteMemoryBlock(const uint8_t Command)
/* Increment the address counter after use */
CurrAddress += 2;
- }
+ }
}
}
else
@@ -223,11 +223,11 @@ static void ReadWriteMemoryBlock(const uint8_t Command)
boot_page_erase(PageStartAddress);
boot_spm_busy_wait();
}
-
+
while (BlockSize--)
{
if (MemoryType == 'F')
- {
+ {
/* If both bytes in current word have been written, increment the address counter */
if (HighByte)
{
@@ -242,14 +242,14 @@ static void ReadWriteMemoryBlock(const uint8_t Command)
else
{
LowByte = FetchNextCommandByte();
-
+
HighByte = true;
}
}
else
{
/* Write the next EEPROM byte from the endpoint */
- eeprom_write_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte());
+ eeprom_write_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte());
/* Increment the address counter after use */
CurrAddress += 2;
@@ -261,13 +261,13 @@ static void ReadWriteMemoryBlock(const uint8_t Command)
{
/* Commit the flash page to memory */
boot_page_write(PageStartAddress);
-
+
/* Wait until write operation has completed */
boot_spm_busy_wait();
}
-
+
/* Send response byte back to the host */
- WriteNextResponseByte('\r');
+ WriteNextResponseByte('\r');
}
}
@@ -280,7 +280,7 @@ static uint8_t FetchNextCommandByte(void)
{
/* Select the OUT endpoint so that the next data byte can be read */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
-
+
/* If OUT endpoint empty, clear it and wait for the next packet from the host */
while (!(Endpoint_IsReadWriteAllowed()))
{
@@ -292,7 +292,7 @@ static uint8_t FetchNextCommandByte(void)
return 0;
}
}
-
+
/* Fetch the next byte from the OUT endpoint */
return Endpoint_Read_Byte();
}
@@ -306,19 +306,19 @@ static void WriteNextResponseByte(const uint8_t Response)
{
/* Select the IN endpoint so that the next data byte can be written */
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
-
+
/* If IN endpoint full, clear it and wait until ready for the next packet to the host */
if (!(Endpoint_IsReadWriteAllowed()))
{
Endpoint_ClearIN();
-
+
while (!(Endpoint_IsINReady()))
{
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
}
-
+
/* Write the next byte to the OUT endpoint */
Endpoint_Write_Byte(Response);
}
@@ -330,7 +330,7 @@ void CDC_Task(void)
{
/* Select the OUT endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
-
+
/* Check if endpoint has a command in it sent from the host */
if (Endpoint_IsOUTReceived())
{
@@ -345,7 +345,7 @@ void CDC_Task(void)
FetchNextCommandByte();
/* Send confirmation byte back to the host */
- WriteNextResponseByte('\r');
+ WriteNextResponseByte('\r');
}
else if (Command == 't')
{
@@ -370,13 +370,13 @@ void CDC_Task(void)
else if (Command == 'p')
{
/* Indicate serial programmer back to the host */
- WriteNextResponseByte('S');
+ WriteNextResponseByte('S');
}
else if (Command == 'S')
{
/* Write the 7-byte software identifier to the endpoint */
for (uint8_t CurrByte = 0; CurrByte < 7; CurrByte++)
- WriteNextResponseByte(SOFTWARE_IDENTIFIER[CurrByte]);
+ WriteNextResponseByte(SOFTWARE_IDENTIFIER[CurrByte]);
}
else if (Command == 'V')
{
@@ -385,17 +385,17 @@ void CDC_Task(void)
}
else if (Command == 's')
{
- WriteNextResponseByte(AVR_SIGNATURE_3);
+ WriteNextResponseByte(AVR_SIGNATURE_3);
WriteNextResponseByte(AVR_SIGNATURE_2);
WriteNextResponseByte(AVR_SIGNATURE_1);
}
else if (Command == 'b')
{
WriteNextResponseByte('Y');
-
+
/* Send block size to the host */
WriteNextResponseByte(SPM_PAGESIZE >> 8);
- WriteNextResponseByte(SPM_PAGESIZE & 0xFF);
+ WriteNextResponseByte(SPM_PAGESIZE & 0xFF);
}
else if (Command == 'e')
{
@@ -409,9 +409,9 @@ void CDC_Task(void)
CurrFlashAddress += SPM_PAGESIZE;
}
-
+
/* Send confirmation byte back to the host */
- WriteNextResponseByte('\r');
+ WriteNextResponseByte('\r');
}
else if (Command == 'l')
{
@@ -423,7 +423,7 @@ void CDC_Task(void)
}
else if (Command == 'r')
{
- WriteNextResponseByte(boot_lock_fuse_bits_get(GET_LOCK_BITS));
+ WriteNextResponseByte(boot_lock_fuse_bits_get(GET_LOCK_BITS));
}
else if (Command == 'F')
{
@@ -431,41 +431,41 @@ void CDC_Task(void)
}
else if (Command == 'N')
{
- WriteNextResponseByte(boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS));
+ WriteNextResponseByte(boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS));
}
else if (Command == 'Q')
{
- WriteNextResponseByte(boot_lock_fuse_bits_get(GET_EXTENDED_FUSE_BITS));
+ WriteNextResponseByte(boot_lock_fuse_bits_get(GET_EXTENDED_FUSE_BITS));
}
else if (Command == 'C')
- {
+ {
/* Write the high byte to the current flash page */
boot_page_fill(CurrAddress, FetchNextCommandByte());
/* Send confirmation byte back to the host */
- WriteNextResponseByte('\r');
+ WriteNextResponseByte('\r');
}
else if (Command == 'c')
- {
+ {
/* Write the low byte to the current flash page */
boot_page_fill(CurrAddress | 1, FetchNextCommandByte());
-
+
/* Increment the address */
CurrAddress += 2;
/* Send confirmation byte back to the host */
- WriteNextResponseByte('\r');
+ WriteNextResponseByte('\r');
}
else if (Command == 'm')
{
/* Commit the flash page to memory */
boot_page_write(CurrAddress);
-
+
/* Wait until write operation has completed */
boot_spm_busy_wait();
/* Send confirmation byte back to the host */
- WriteNextResponseByte('\r');
+ WriteNextResponseByte('\r');
}
else if ((Command == 'B') || (Command == 'g'))
{
@@ -477,9 +477,9 @@ void CDC_Task(void)
#if (FLASHEND > 0xFFFF)
uint16_t ProgramWord = pgm_read_word_far(CurrAddress);
#else
- uint16_t ProgramWord = pgm_read_word(CurrAddress);
+ uint16_t ProgramWord = pgm_read_word(CurrAddress);
#endif
-
+
WriteNextResponseByte(ProgramWord >> 8);
WriteNextResponseByte(ProgramWord & 0xFF);
}
@@ -487,12 +487,12 @@ void CDC_Task(void)
{
/* Read the byte from the endpoint and write it to the EEPROM */
eeprom_write_byte((uint8_t*)((intptr_t)(CurrAddress >> 1)), FetchNextCommandByte());
-
- /* Increment the address after use */
+
+ /* Increment the address after use */
CurrAddress += 2;
-
+
/* Send confirmation byte back to the host */
- WriteNextResponseByte('\r');
+ WriteNextResponseByte('\r');
}
else if (Command == 'd')
{
@@ -520,12 +520,12 @@ void CDC_Task(void)
/* Send the endpoint data to the host */
Endpoint_ClearIN();
-
+
/* If a full endpoint's worth of data was sent, we need to send an empty packet afterwards to signal end of transfer */
if (IsEndpointFull)
{
while (!(Endpoint_IsINReady()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
@@ -535,11 +535,11 @@ void CDC_Task(void)
/* Wait until the data has been sent to the host */
while (!(Endpoint_IsINReady()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
-
+
/* Select the OUT endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
@@ -547,3 +547,4 @@ void CDC_Task(void)
Endpoint_ClearOUT();
}
}
+
diff --git a/Bootloaders/CDC/BootloaderCDC.h b/Bootloaders/CDC/BootloaderCDC.h
index 98154c2b9..492fbdd92 100644
--- a/Bootloaders/CDC/BootloaderCDC.h
+++ b/Bootloaders/CDC/BootloaderCDC.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for BootloaderCDC.c.
*/
-
+
#ifndef _CDC_H_
#define _CDC_H_
@@ -55,7 +55,7 @@
/** Version minor of the CDC bootloader. */
#define BOOTLOADER_VERSION_MINOR 0x00
-
+
/** Hardware version major of the CDC bootloader. */
#define BOOTLOADER_HWVERSION_MAJOR 0x01
@@ -64,7 +64,7 @@
/** Eight character bootloader firmware identifier reported to the host when requested */
#define SOFTWARE_IDENTIFIER "LUFACDC"
-
+
/** CDC Class specific request to get the current virtual serial port configuration settings. */
#define REQ_GetLineEncoding 0x21
@@ -89,7 +89,7 @@
/** Type define for a non-returning pointer to the start of the loaded application in flash memory. */
typedef void (*AppPtr_t)(void) ATTR_NO_RETURN;
-
+
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
@@ -98,7 +98,7 @@
OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
TwoStopBits = 2, /**< Each frame contains two stop bits */
};
-
+
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t
{
@@ -122,3 +122,4 @@
#endif
#endif
+
diff --git a/Bootloaders/CDC/BootloaderCDC.txt b/Bootloaders/CDC/BootloaderCDC.txt
index f4208ee4c..ae1da0804 100644
--- a/Bootloaders/CDC/BootloaderCDC.txt
+++ b/Bootloaders/CDC/BootloaderCDC.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage CDC Class USB AVR Bootloader
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -42,15 +42,15 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* This bootloader enumerates to the host as a CDC Class device (virtual serial port), allowing for AVR109
- * protocol compatible programming software to load firmware onto the AVR.
- *
+ * protocol compatible programming software to load firmware onto the AVR.
+ *
* Out of the box this bootloader builds for the USB1287, and will fit into 4KB of bootloader space. If
* you wish to enlarge this space and/or change the AVR model, you will need to edit the BOOT_START and MCU
* values in the accompanying makefile.
- *
+ *
* This bootloader is compatible with the open source application AVRDUDE, or Atmel's AVRPROG.
*
* After running this bootloader for the first time on a new computer, you will need to supply the .INF
@@ -70,3 +70,4 @@
* </tr>
* </table>
*/
+
diff --git a/Bootloaders/CDC/Descriptors.c b/Bootloaders/CDC/Descriptors.c
index ae9a986a6..ae04fbd67 100644
--- a/Bootloaders/CDC/Descriptors.c
+++ b/Bootloaders/CDC/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x02,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204A,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = NO_DESCRIPTOR,
.ProductStrIndex = 0x01,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,102 +71,102 @@ USB_Descriptor_Device_t DeviceDescriptor =
*/
USB_Descriptor_Configuration_t ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = 0x00,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = 0x02,
-
+
.Capabilities = 0x04,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = 0x06,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0x02
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_DataOutEndpoint =
+ .CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC_DataInEndpoint =
+
+ .CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -181,7 +181,7 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor =
USB_Descriptor_String_t LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -192,7 +192,7 @@ USB_Descriptor_String_t LanguageString =
USB_Descriptor_String_t ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
+
.UnicodeString = L"AVR CDC Bootloader"
};
@@ -233,10 +233,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &ProductString;
Size = ProductString.Header.Size;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Bootloaders/CDC/Descriptors.h b/Bootloaders/CDC/Descriptors.h
index 15941338b..9af079b9c 100644
--- a/Bootloaders/CDC/Descriptors.h
+++ b/Bootloaders/CDC/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -96,7 +96,7 @@
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint number for the CDC data interface TX (data IN) endpoint. */
- #define CDC_TX_EPNUM 3
+ #define CDC_TX_EPNUM 3
/** Endpoint number for the CDC data interface RX (data OUT) endpoint. */
#define CDC_RX_EPNUM 4
@@ -130,7 +130,7 @@
uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
} USB_Descriptor_CDC_FunctionalACM_t;
-
+
/** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
* CDC control and data interfaces are related. See the CDC class specification for more details.
*/
@@ -166,3 +166,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Bootloaders/CDC/makefile b/Bootloaders/CDC/makefile
index c23424b9f..305c732b9 100644
--- a/Bootloaders/CDC/makefile
+++ b/Bootloaders/CDC/makefile
@@ -35,7 +35,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -52,14 +52,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -72,7 +72,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -136,7 +136,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -149,7 +149,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -266,7 +266,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -279,7 +279,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -291,7 +291,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -303,7 +303,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -327,7 +327,7 @@ EXTMEMOPTS =
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--section-start=.text=$(BOOT_START)
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -361,7 +361,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -395,7 +395,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -424,7 +424,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -443,10 +443,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -511,19 +511,19 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -621,14 +621,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -650,7 +650,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -693,3 +693,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program debug gdb-config
+
diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c
index 6f8acc80d..d7bec1f46 100644
--- a/Bootloaders/DFU/BootloaderDFU.c
+++ b/Bootloaders/DFU/BootloaderDFU.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -93,7 +93,7 @@ uint16_t StartAddr = 0x0000;
uint16_t EndAddr = 0x0000;
-/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
+/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously
* runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start
* the loaded application code.
*/
@@ -101,17 +101,17 @@ int main(void)
{
/* Configure hardware required by the bootloader */
SetupHardware();
-
+
/* Enable global interrupts so that the USB stack can function */
sei();
/* Run the USB management task while the bootloader is supposed to be running */
while (RunBootloader || WaitForExit)
USB_USBTask();
-
+
/* Reset configured hardware back to their original states for the user application */
ResetHardware();
-
+
/* Start the user application */
AppStartPtr();
}
@@ -125,7 +125,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Relocate the interrupt vector table to the bootloader section */
MCUCR = (1 << IVCE);
MCUCR = (1 << IVSEL);
@@ -139,7 +139,7 @@ void ResetHardware(void)
{
/* Shut down the USB subsystem */
USB_ShutDown();
-
+
/* Relocate the interrupt vector table back to the application section */
MCUCR = (1 << IVCE);
MCUCR = 0;
@@ -158,32 +158,32 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
case REQ_DFU_DNLOAD:
Endpoint_ClearSETUP();
-
+
/* Check if bootloader is waiting to terminate */
if (WaitForExit)
{
/* Bootloader is terminating - process last received command */
ProcessBootloaderCommand();
-
+
/* Indicate that the last command has now been processed - free to exit bootloader */
WaitForExit = false;
}
-
+
/* If the request has a data stage, load it into the command struct */
if (SentCommand.DataSize)
{
while (!(Endpoint_IsOUTReceived()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
/* First byte of the data stage is the DNLOAD request's command */
SentCommand.Command = Endpoint_Read_Byte();
-
+
/* One byte of the data stage is the command, so subtract it from the total data bytes */
SentCommand.DataSize--;
-
+
/* Load in the rest of the data stage as command parameters */
for (uint8_t DataByte = 0; (DataByte < sizeof(SentCommand.Data)) &&
Endpoint_BytesInEndpoint(); DataByte++)
@@ -191,14 +191,14 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
SentCommand.Data[DataByte] = Endpoint_Read_Byte();
SentCommand.DataSize--;
}
-
+
/* Process the command */
ProcessBootloaderCommand();
}
-
+
/* Check if currently downloading firmware */
if (DFU_State == dfuDNLOAD_IDLE)
- {
+ {
if (!(SentCommand.DataSize))
{
DFU_State = dfuIDLE;
@@ -210,21 +210,21 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Throw away the packet alignment filler bytes before the start of the firmware */
DiscardFillerBytes(StartAddr % FIXED_CONTROL_ENDPOINT_SIZE);
-
+
/* Calculate the number of bytes remaining to be written */
uint16_t BytesRemaining = ((EndAddr - StartAddr) + 1);
-
+
if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00)) // Write flash
{
/* Calculate the number of words to be written from the number of bytes to be written */
uint16_t WordsRemaining = (BytesRemaining >> 1);
-
+
union
{
uint16_t Words[2];
uint32_t Long;
} CurrFlashAddress = {.Words = {StartAddr, Flash64KBPage}};
-
+
uint32_t CurrFlashPageStartAddress = CurrFlashAddress.Long;
uint8_t WordsInFlashPage = 0;
@@ -236,7 +236,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_ClearOUT();
while (!(Endpoint_IsOUTReceived()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
@@ -255,7 +255,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Commit the flash page to memory */
boot_page_write(CurrFlashPageStartAddress);
boot_spm_busy_wait();
-
+
/* Check if programming incomplete */
if (WordsRemaining)
{
@@ -268,10 +268,10 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
}
}
-
+
/* Once programming complete, start address equals the end address */
StartAddr = EndAddr;
-
+
/* Re-enable the RWW section of flash */
boot_rww_enable();
}
@@ -285,7 +285,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_ClearOUT();
while (!(Endpoint_IsOUTReceived()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
@@ -293,12 +293,12 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Read the byte from the USB interface and write to to the EEPROM */
eeprom_write_byte((uint8_t*)StartAddr, Endpoint_Read_Byte());
-
+
/* Adjust counters */
StartAddr++;
}
}
-
+
/* Throw away the currently unused DFU file suffix */
DiscardFillerBytes(DFU_FILE_SUFFIX_SIZE);
}
@@ -313,11 +313,11 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_ClearSETUP();
while (!(Endpoint_IsINReady()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
-
+
if (DFU_State != dfuUPLOAD_IDLE)
{
if ((DFU_State == dfuERROR) && IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Blank Check
@@ -356,7 +356,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_ClearIN();
while (!(Endpoint_IsINReady()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
@@ -366,13 +366,13 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
#if (FLASHEND > 0xFFFF)
Endpoint_Write_Word_LE(pgm_read_word_far(CurrFlashAddress.Long));
#else
- Endpoint_Write_Word_LE(pgm_read_word(CurrFlashAddress.Long));
+ Endpoint_Write_Word_LE(pgm_read_word(CurrFlashAddress.Long));
#endif
/* Adjust counters */
CurrFlashAddress.Long += 2;
}
-
+
/* Once reading is complete, start address equals the end address */
StartAddr = EndAddr;
}
@@ -384,9 +384,9 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
if (Endpoint_BytesInEndpoint() == FIXED_CONTROL_ENDPOINT_SIZE)
{
Endpoint_ClearIN();
-
+
while (!(Endpoint_IsINReady()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
@@ -410,14 +410,14 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
break;
case REQ_DFU_GETSTATUS:
Endpoint_ClearSETUP();
-
+
/* Write 8-bit status value */
Endpoint_Write_Byte(DFU_Status);
-
+
/* Write 24-bit poll timeout value */
Endpoint_Write_Byte(0);
Endpoint_Write_Word_LE(0);
-
+
/* Write 8-bit state value */
Endpoint_Write_Byte(DFU_State);
@@ -425,12 +425,12 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_Write_Byte(0);
Endpoint_ClearIN();
-
+
Endpoint_ClearStatusStage();
- break;
+ break;
case REQ_DFU_CLRSTATUS:
Endpoint_ClearSETUP();
-
+
/* Reset the status value variable to the default OK status */
DFU_Status = OK;
@@ -438,17 +438,17 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
break;
case REQ_DFU_GETSTATE:
Endpoint_ClearSETUP();
-
+
/* Write the current device state to the endpoint */
Endpoint_Write_Byte(DFU_State);
-
+
Endpoint_ClearIN();
-
+
Endpoint_ClearStatusStage();
break;
case REQ_DFU_ABORT:
Endpoint_ClearSETUP();
-
+
/* Reset the current state variable to the default idle state */
DFU_State = dfuIDLE;
@@ -472,7 +472,7 @@ static void DiscardFillerBytes(uint8_t NumberOfBytes)
/* Wait until next data packet received */
while (!(Endpoint_IsOUTReceived()))
- {
+ {
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
@@ -501,10 +501,10 @@ static void ProcessBootloaderCommand(void)
/* Set the state and status variables to indicate the error */
DFU_State = dfuERROR;
DFU_Status = errWRITE;
-
+
/* Stall command */
Endpoint_StallTransaction();
-
+
/* Don't process the command */
return;
}
@@ -544,7 +544,7 @@ static void LoadStartEndAddresses(void)
uint16_t Word;
} Address[2] = {{.Bytes = {SentCommand.Data[2], SentCommand.Data[1]}},
{.Bytes = {SentCommand.Data[4], SentCommand.Data[3]}}};
-
+
/* Load in the start and ending read addresses from the sent data packet */
StartAddr = Address[0].Word;
EndAddr = Address[1].Word;
@@ -560,7 +560,7 @@ static void ProcessMemProgCommand(void)
{
/* Load in the start and ending read addresses */
LoadStartEndAddresses();
-
+
/* If FLASH is being written to, we need to pre-erase the first page to write to */
if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00))
{
@@ -569,12 +569,12 @@ static void ProcessMemProgCommand(void)
uint16_t Words[2];
uint32_t Long;
} CurrFlashAddress = {.Words = {StartAddr, Flash64KBPage}};
-
+
/* Erase the current page's temp buffer */
boot_page_erase(CurrFlashAddress.Long);
boot_spm_busy_wait();
}
-
+
/* Set the state so that the next DNLOAD requests reads in the firmware */
DFU_State = dfuDNLOAD_IDLE;
}
@@ -611,7 +611,7 @@ static void ProcessMemReadCommand(void)
/* Save the location of the first non-blank byte for response back to the host */
Flash64KBPage = (CurrFlashAddress >> 16);
StartAddr = CurrFlashAddress;
-
+
/* Set state and status variables to the appropriate error values */
DFU_State = dfuERROR;
DFU_Status = errCHECK_ERASED;
@@ -680,7 +680,7 @@ static void ProcessWriteCommand(void)
/* Re-enable the RWW section of flash as writing to the flash locks it out */
boot_rww_enable();
-
+
/* Memory has been erased, reset the security bit so that programming/reading is allowed */
IsSecure = false;
}
@@ -701,3 +701,4 @@ static void ProcessReadCommand(void)
else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Read signature byte
ResponseByte = SignatureInfo[DataIndexToRead - 0x30];
}
+
diff --git a/Bootloaders/DFU/BootloaderDFU.h b/Bootloaders/DFU/BootloaderDFU.h
index 3ddd395c1..ce07c9f78 100644
--- a/Bootloaders/DFU/BootloaderDFU.h
+++ b/Bootloaders/DFU/BootloaderDFU.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,11 +45,11 @@
#include <avr/power.h>
#include <avr/interrupt.h>
#include <stdbool.h>
-
+
#include "Descriptors.h"
-
+
#include <LUFA/Drivers/USB/USB.h>
-
+
/* Macros: */
/** Configuration define. Define this token to true to case the bootloader to reject all memory commands
* until a memory erase has been performed. When used in conjunction with the lockbits of the AVR, this
@@ -64,7 +64,7 @@
/** Minor bootloader version number. */
#define BOOTLOADER_VERSION_REV 0
- /** Complete bootloader version number expressed as a packed byte, constructed from the
+ /** Complete bootloader version number expressed as a packed byte, constructed from the
* two individual bootloader version macros.
*/
#define BOOTLOADER_VERSION ((BOOTLOADER_VERSION_MINOR << 4) | BOOTLOADER_VERSION_REV)
@@ -74,7 +74,7 @@
/** Second byte of the bootloader identification bytes, used to identify a device's bootloader. */
#define BOOTLOADER_ID_BYTE2 0xFB
-
+
/** Convenience macro, used to determine if the issued command is the given one-byte long command.
*
* \param[in] dataarr Command byte array to check against
@@ -89,7 +89,7 @@
* \param[in] cb2 Second command byte to check
*/
#define IS_TWOBYTE_COMMAND(dataarr, cb1, cb2) ((dataarr[0] == (cb1)) && (dataarr[1] == (cb2)))
-
+
/** Length of the DFU file suffix block, appended to the end of each complete memory write command.
* The DFU file suffix is currently unused (but is designed to give extra file information, such as
* a CRC of the complete firmware for error checking) and so is discarded.
@@ -100,7 +100,7 @@
* Filler bytes are added to the start of each complete memory write command, and must be discarded.
*/
#define DFU_FILLER_BYTES_SIZE 26
-
+
/** DFU class command request to detach from the host. */
#define REQ_DFU_DETATCH 0x00
@@ -141,7 +141,7 @@
/* Type Defines: */
/** Type define for a non-returning function pointer to the loaded application. */
typedef void (*AppPtr_t)(void) ATTR_NO_RETURN;
-
+
/** Type define for a structure containing a complete DFU command issued by the host. */
typedef struct
{
@@ -187,7 +187,7 @@
errUNKNOWN = 14,
errSTALLEDPKT = 15
};
-
+
/* Function Prototypes: */
void SetupHardware(void);
void ResetHardware(void);
@@ -203,5 +203,6 @@
static void ProcessWriteCommand(void);
static void ProcessReadCommand(void);
#endif
-
+
#endif
+
diff --git a/Bootloaders/DFU/BootloaderDFU.txt b/Bootloaders/DFU/BootloaderDFU.txt
index a61ca3913..38f83a6f4 100644
--- a/Bootloaders/DFU/BootloaderDFU.txt
+++ b/Bootloaders/DFU/BootloaderDFU.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage DFU Class USB AVR Bootloader
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Device Firmware Update Class (DFU)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>None</td>
* </tr>
@@ -42,29 +42,29 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* This bootloader enumerates to the host as a DFU Class device, allowing for DFU-compatible programming
* software to load firmware onto the AVR.
- *
+ *
* This bootloader is compatible with Atmel's FLIP application. However, it requires the use of Atmel's
* DFU drivers. You will need to install Atmel's DFU drivers prior to using this bootloader. If you are
* using a 64 bit Windows OS, you will need to either disable the driver signing requirement (see online
* tutorials for details) or use a digitally signed version of the official Atmel driver provided by a
* third party AVR user at
* <a>http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=2196&item_type=project</a>.
- *
+ *
* As an open-source option, this bootloader is also compatible with the Linux Atmel USB DFU Programmer
* software, available for download at <a>http://sourceforge.net/projects/dfu-programmer/</a>.
- *
+ *
* If SECURE_MODE is defined as true, upon start-up the bootloader will be locked, with only the chip erase
- * function available (similar to Atmel's DFU bootloader). If SECURE_MODE is defined as false, all functions
+ * function available (similar to Atmel's DFU bootloader). If SECURE_MODE is defined as false, all functions
* are usable on start-up without the prerequisite firmware erase.
- *
+ *
* Out of the box this bootloader builds for the USB1287, and should fit into 4KB of bootloader space. If
* you wish to enlarge this space and/or change the AVR model, you will need to edit the BOOT_START and MCU
* values in the accompanying makefile.
- *
+ *
* <b>NOTE:</b> This device spoofs Atmel's DFU Bootloader USB VID and PID so that the Atmel DFU bootloader
* drivers included with FLIP will work. If you do not wish to use Atmel's ID codes, please
* manually change them in Descriptors.c and alter your driver's INF file accordingly.
@@ -88,3 +88,4 @@
* </tr>
* </table>
*/
+
diff --git a/Bootloaders/DFU/Descriptors.c b/Bootloaders/DFU/Descriptors.c
index 46cb86835..e7051a75a 100644
--- a/Bootloaders/DFU/Descriptors.c
+++ b/Bootloaders/DFU/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = PRODUCT_ID_CODE,
.ReleaseNumber = VERSION_BCD(00.00),
-
+
.ManufacturerStrIndex = NO_DESCRIPTOR,
.ProductStrIndex = 0x01,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,7 +71,7 @@ USB_Descriptor_Device_t DeviceDescriptor =
*/
USB_Descriptor_Configuration_t ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
@@ -80,37 +80,37 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor =
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .DFU_Interface =
+
+ .DFU_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
-
+
.Class = 0xFE,
.SubClass = 0x01,
.Protocol = 0x02,
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .DFU_Functional =
+
+ .DFU_Functional =
{
.Header = {.Size = sizeof(USB_Descriptor_DFU_Functional_t), .Type = DTYPE_DFUFunctional},
-
+
.Attributes = (ATTR_CAN_UPLOAD | ATTR_CAN_DOWNLOAD),
.DetachTimeout = 0x0000,
.TransferSize = 0x0c00,
-
+
.DFUSpecification = VERSION_BCD(01.01)
}
};
@@ -118,11 +118,11 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor =
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
* via the language ID table available at USB.org what languages the device supports for its string descriptors.
- */
+ */
USB_Descriptor_String_t LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -133,7 +133,7 @@ USB_Descriptor_String_t LanguageString =
USB_Descriptor_String_t ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
+
.UnicodeString = L"AVR DFU Bootloader"
};
@@ -159,11 +159,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
if (!(DescriptorNumber))
{
Address = &LanguageString;
@@ -174,10 +174,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &ProductString;
Size = ProductString.Header.Size;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Bootloaders/DFU/Descriptors.h b/Bootloaders/DFU/Descriptors.h
index 5b38e60fc..a2211fdd7 100644
--- a/Bootloaders/DFU/Descriptors.h
+++ b/Bootloaders/DFU/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
/* Macros: */
/** Descriptor type value for a DFU class functional descriptor. */
#define DTYPE_DFUFunctional 0x21
-
+
/** DFU attribute mask, indicating that the DFU device will detach and re-attach when a DFU_DETACH
* command is issued, rather than the host issuing a USB Reset.
*/
@@ -52,15 +52,15 @@
* (memory programming phase).
*/
#define ATTR_MANEFESTATION_TOLLERANT (1 << 2)
-
+
/** DFU attribute mask, indicating that the DFU device can accept DFU_UPLOAD requests to send data from
* the device to the host.
- */
+ */
#define ATTR_CAN_UPLOAD (1 << 1)
/** DFU attribute mask, indicating that the DFU device can accept DFU_DNLOAD requests to send data from
* the host to the device.
- */
+ */
#define ATTR_CAN_DOWNLOAD (1 << 0)
#if defined(__AVR_AT90USB1287__)
@@ -126,11 +126,11 @@
#else
#error The selected AVR part is not currently supported by this bootloader.
#endif
-
+
#if !defined(PRODUCT_ID_CODE)
#error Current AVR model is not supported by this bootloader.
#endif
-
+
/* Type Defines: */
/** Type define for a DFU class function descriptor. This descriptor gives DFU class information
* to the host when read, indicating the DFU device's capabilities.
@@ -138,22 +138,22 @@
typedef struct
{
USB_Descriptor_Header_t Header; /**< Standard descriptor header structure */
-
+
uint8_t Attributes; /**< DFU device attributes, a mask comprising of the
* ATTR_* macros listed in this source file
*/
uint16_t DetachTimeout; /**< Timeout in milliseconds between a USB_DETACH
* command being issued and the device detaching
* from the USB bus
- */
+ */
uint16_t TransferSize; /**< Maximum number of bytes the DFU device can accept
* from the host in a transaction
- */
+ */
uint16_t DFUSpecification; /**< BCD packed DFU specification number this DFU
* device complies with
*/
} USB_Descriptor_DFU_Functional_t;
-
+
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@@ -164,7 +164,7 @@
USB_Descriptor_Interface_t DFU_Interface;
USB_Descriptor_DFU_Functional_t DFU_Functional;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -172,3 +172,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Bootloaders/DFU/makefile b/Bootloaders/DFU/makefile
index 4a44562dd..67b8b2dce 100644
--- a/Bootloaders/DFU/makefile
+++ b/Bootloaders/DFU/makefile
@@ -35,7 +35,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -52,14 +52,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -72,7 +72,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -137,7 +137,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -150,7 +150,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -267,7 +267,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -280,7 +280,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -292,7 +292,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -304,7 +304,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -328,7 +328,7 @@ EXTMEMOPTS =
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--section-start=.text=$(BOOT_START)
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -362,7 +362,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -396,7 +396,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -425,7 +425,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -444,10 +444,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -512,19 +512,19 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -622,14 +622,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -651,7 +651,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -694,3 +694,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program debug gdb-config
+
diff --git a/Bootloaders/makefile b/Bootloaders/makefile
index 962d3bbe8..0e0cd3f44 100644
--- a/Bootloaders/makefile
+++ b/Bootloaders/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -23,3 +23,4 @@ all:
%:
$(MAKE) -C DFU $@
$(MAKE) -C CDC $@
+
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c
index ceaeb89a1..dc7a076e4 100644
--- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c
+++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -60,7 +60,7 @@ int main(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
ProcessNextSample();
@@ -79,13 +79,13 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
LEDs_Init();
USB_Init();
ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32);
ADC_SetupChannel(MIC_IN_ADC_CHANNEL);
-
+
/* Start the ADC conversion in free running mode */
ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_MUX_MASK);
}
@@ -103,7 +103,7 @@ void ProcessNextSample(void)
/* Audio sample is ADC value scaled to fit the entire range */
int16_t AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult());
-
+
#if defined(MICROPHONE_BIASED_TO_HALF_RAIL)
/* Microphone is biased to half rail voltage, subtract the bias from the sample value */
AudioSample -= (SAMPLE_MAX_RANGE / 2);
@@ -148,3 +148,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
Audio_Device_ProcessControlRequest(&Microphone_Audio_Interface);
}
+
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.h b/Demos/Device/ClassDriver/AudioInput/AudioInput.h
index 9231f8962..8ed6096f0 100644
--- a/Demos/Device/ClassDriver/AudioInput/AudioInput.h
+++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for AudioInput.c.
*/
-
+
#ifndef _AUDIO_INPUT_H_
#define _AUDIO_INPUT_H_
@@ -53,7 +53,7 @@
/* Macros: */
/** ADC channel number for the microphone input. */
#define MIC_IN_ADC_CHANNEL 2
-
+
/** ADC channel MUX mask for the microphone input. */
#define MIC_IN_ADC_MUX_MASK ADC_CHANNEL2
@@ -85,3 +85,4 @@
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.txt b/Demos/Device/ClassDriver/AudioInput/AudioInput.txt
index aba582d67..830163f3b 100644
--- a/Demos/Device/ClassDriver/AudioInput/AudioInput.txt
+++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Audio Input Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -27,7 +27,7 @@
* <td><b>USB Class:</b></td>
* <td>Audio Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Standard Audio Device</td>
* </tr>
@@ -43,19 +43,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Audio demonstration application. This gives a simple reference
* application for implementing a USB Audio Input device using the
* basic USB Audio 1.0 drivers in all modern OSes (i.e. no special drivers
* required).
- *
+ *
* On start-up the system will automatically enumerate and function
* as a USB microphone. Incoming audio from the ADC channel 1 will
* be sampled and sent to the host computer.
- *
+ *
* To use, connect a microphone to the ADC channel 1.
- *
+ *
* Under Windows, if a driver request dialogue pops up, select the option
* to automatically install the appropriate drivers.
*
@@ -81,3 +81,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.c b/Demos/Device/ClassDriver/AudioInput/Descriptors.c
index c01e10129..8ac88bd82 100644
--- a/Demos/Device/ClassDriver/AudioInput/Descriptors.c
+++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,11 +30,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
-
+
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
@@ -71,7 +71,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
@@ -86,13 +86,13 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
- .Audio_ControlInterface =
+ .Audio_ControlInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
.Class = 0x01,
@@ -102,7 +102,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .Audio_ControlInterface_SPC =
+ .Audio_ControlInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_Header,
@@ -111,12 +111,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.TotalLength = (sizeof(USB_Audio_Descriptor_Interface_AC_t) +
sizeof(USB_Audio_Descriptor_InputTerminal_t) +
sizeof(USB_Audio_Descriptor_OutputTerminal_t)),
-
+
.InCollection = 1,
.InterfaceNumber = 1,
},
- .Audio_InputTerminal =
+ .Audio_InputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_InputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
@@ -132,7 +132,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.TerminalStrIndex = NO_DESCRIPTOR
},
- .Audio_OutputTerminal =
+ .Audio_OutputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_OutputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
@@ -146,7 +146,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.TerminalStrIndex = NO_DESCRIPTOR
},
- .Audio_StreamInterface_Alt0 =
+ .Audio_StreamInterface_Alt0 =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
@@ -162,7 +162,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .Audio_StreamInterface_Alt1 =
+ .Audio_StreamInterface_Alt1 =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
@@ -178,7 +178,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .Audio_StreamInterface_SPC =
+ .Audio_StreamInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_General,
@@ -189,24 +189,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.AudioFormat = 0x0001
},
- .Audio_AudioFormat =
+ .Audio_AudioFormat =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_Format_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_FormatType,
.FormatType = 0x01,
.Channels = 0x01,
-
+
.SubFrameSize = 0x02,
.BitResolution = 16,
.SampleFrequencyType = AUDIO_TOTAL_SAMPLE_RATES,
-
+
.SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
-
- .Audio_StreamEndpoint =
+
+ .Audio_StreamEndpoint =
{
- .Endpoint =
+ .Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
@@ -215,18 +215,18 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = AUDIO_STREAM_EPSIZE,
.PollingIntervalMS = 1
},
-
+
.Refresh = 0,
.SyncEndpointNumber = 0
},
-
- .Audio_StreamEndpoint_SPC =
+
+ .Audio_StreamEndpoint_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
-
+
.Attributes = AUDIO_EP_ACCEPTS_SMALL_PACKETS,
-
+
.LockDelayUnits = 0x00,
.LockDelay = 0x0000
}
@@ -287,30 +287,31 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/AudioInput/Descriptors.h b/Demos/Device/ClassDriver/AudioInput/Descriptors.h
index caf6075cc..5ca7afbf5 100644
--- a/Demos/Device/ClassDriver/AudioInput/Descriptors.h
+++ b/Demos/Device/ClassDriver/AudioInput/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -45,7 +45,7 @@
/* Macros: */
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
-
+
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires
* at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller
* USB AVR models will result in unavoidable distorted output.
@@ -82,3 +82,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/AudioInput/makefile b/Demos/Device/ClassDriver/AudioInput/makefile
index 636637dbc..8eda3c68b 100644
--- a/Demos/Device/ClassDriver/AudioInput/makefile
+++ b/Demos/Device/ClassDriver/AudioInput/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -137,7 +137,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -150,7 +150,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -264,7 +264,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -277,7 +277,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -289,7 +289,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -301,7 +301,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -324,7 +324,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -358,7 +358,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -392,7 +392,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -421,7 +421,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -440,10 +440,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -508,11 +508,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -539,9 +539,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -639,14 +639,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -668,7 +668,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -712,3 +712,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
index cf2eb2d30..33b52a184 100644
--- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
+++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -60,7 +60,7 @@ int main(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
ProcessNextSample();
@@ -135,7 +135,7 @@ void ProcessNextSample(void)
void EVENT_USB_Device_Connect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
/* Sample reload timer initialization */
OCR0A = (F_CPU / 8 / AUDIO_SAMPLE_FREQUENCY) - 1;
TCCR0A = (1 << WGM01); // CTC mode
@@ -200,3 +200,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
Audio_Device_ProcessControlRequest(&Speaker_Audio_Interface);
}
+
diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h
index 5a7b2efe8..62498cb7f 100644
--- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h
+++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -44,13 +44,13 @@
#include <stdlib.h>
#include "Descriptors.h"
-
+
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Audio.h>
-
- /* Macros: */
+
+ /* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -62,14 +62,15 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void ProcessNextSample(void);
-
+
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.txt b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.txt
index 079b537b0..c42fc744b 100644
--- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.txt
+++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Audio Output Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -27,7 +27,7 @@
* <td><b>USB Class:</b></td>
* <td>Audio Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Standard Audio Device</td>
* </tr>
@@ -43,13 +43,13 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Audio demonstration application. This gives a simple reference
* application for implementing a USB Audio Output device using the
* basic USB Audio 1.0 drivers in all modern OSes (i.e. no special drivers
* required).
- *
+ *
* On start-up the system will automatically enumerate and function
* as a USB speaker. Outgoing audio will output in 8-bit PWM onto
* the timer 3 output compare channel A for AUDIO_OUT_MONO mode, on
@@ -57,7 +57,7 @@
* mono sample for AUDIO_OUT_PORTC. Audio output will also be indicated on
* the board LEDs in all modes. Decouple audio outputs with a capacitor and
* attach to a speaker to hear the audio.
- *
+ *
* Under Windows, if a driver request dialogue pops up, select the option
* to automatically install the appropriate drivers.
*
@@ -94,3 +94,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c b/Demos/Device/ClassDriver/AudioOutput/Descriptors.c
index b82d5ab22..35ceeb29a 100644
--- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.c
+++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,11 +30,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
-
+
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
@@ -71,7 +71,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
@@ -80,133 +80,133 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .Audio_ControlInterface =
+
+ .Audio_ControlInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
-
+
.Class = 0x01,
.SubClass = 0x01,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_ControlInterface_SPC =
+
+ .Audio_ControlInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_Header,
-
+
.ACSpecification = VERSION_BCD(01.00),
.TotalLength = (sizeof(USB_Audio_Descriptor_Interface_AC_t) +
sizeof(USB_Audio_Descriptor_InputTerminal_t) +
sizeof(USB_Audio_Descriptor_OutputTerminal_t)),
-
+
.InCollection = 1,
.InterfaceNumber = 1,
},
- .Audio_InputTerminal =
+ .Audio_InputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_InputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
-
+
.TerminalID = 0x01,
.TerminalType = AUDIO_TERMINAL_STREAMING,
.AssociatedOutputTerminal = 0x00,
-
+
.TotalChannels = 2,
.ChannelConfig = (AUDIO_CHANNEL_LEFT_FRONT | AUDIO_CHANNEL_RIGHT_FRONT),
-
+
.ChannelStrIndex = NO_DESCRIPTOR,
.TerminalStrIndex = NO_DESCRIPTOR
},
- .Audio_OutputTerminal =
+ .Audio_OutputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_OutputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
-
+
.TerminalID = 0x02,
.TerminalType = AUDIO_TERMINAL_OUT_SPEAKER,
.AssociatedInputTerminal = 0x00,
-
+
.SourceID = 0x01,
-
+
.TerminalStrIndex = NO_DESCRIPTOR
},
- .Audio_StreamInterface_Alt0 =
+ .Audio_StreamInterface_Alt0 =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
-
+
.Class = 0x01,
.SubClass = 0x02,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .Audio_StreamInterface_Alt1 =
+ .Audio_StreamInterface_Alt1 =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 1,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x01,
.SubClass = 0x02,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_StreamInterface_SPC =
+
+ .Audio_StreamInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_General,
-
+
.TerminalLink = 0x01,
-
+
.FrameDelay = 1,
.AudioFormat = 0x0001
},
-
- .Audio_AudioFormat =
+
+ .Audio_AudioFormat =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_Format_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_FormatType,
.FormatType = 0x01,
.Channels = 0x02,
-
+
.SubFrameSize = 0x02,
.BitResolution = 16,
- .SampleFrequencyType = AUDIO_TOTAL_SAMPLE_RATES,
+ .SampleFrequencyType = AUDIO_TOTAL_SAMPLE_RATES,
.SampleFrequencies = {AUDIO_SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
-
- .Audio_StreamEndpoint =
+
+ .Audio_StreamEndpoint =
{
- .Endpoint =
+ .Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
@@ -215,18 +215,18 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = AUDIO_STREAM_EPSIZE,
.PollingIntervalMS = 1
},
-
+
.Refresh = 0,
.SyncEndpointNumber = 0
},
-
- .Audio_StreamEndpoint_SPC =
+
+ .Audio_StreamEndpoint_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
-
+
.Attributes = AUDIO_EP_ACCEPTS_SMALL_PACKETS,
-
+
.LockDelayUnits = 0x00,
.LockDelay = 0x0000
}
@@ -291,26 +291,27 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h
index 588f584e9..5ca7afbf5 100644
--- a/Demos/Device/ClassDriver/AudioOutput/Descriptors.h
+++ b/Demos/Device/ClassDriver/AudioOutput/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -45,16 +45,16 @@
/* Macros: */
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
-
+
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires
* at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller
* USB AVR models will result in unavoidable distorted output.
*/
#define AUDIO_STREAM_EPSIZE ENDPOINT_MAX_SIZE(AUDIO_STREAM_EPNUM)
-
+
/** Sample frequency of the data being transmitted through the streaming endpoint. */
#define AUDIO_SAMPLE_FREQUENCY 48000
-
+
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
@@ -74,7 +74,7 @@
USB_Audio_Descriptor_StreamEndpoint_Std_t Audio_StreamEndpoint;
USB_Audio_Descriptor_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -82,3 +82,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/AudioOutput/makefile b/Demos/Device/ClassDriver/AudioOutput/makefile
index 660399b43..9ff71b2e1 100644
--- a/Demos/Device/ClassDriver/AudioOutput/makefile
+++ b/Demos/Device/ClassDriver/AudioOutput/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -139,7 +139,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -152,7 +152,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -266,7 +266,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -279,7 +279,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -291,7 +291,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -303,7 +303,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -326,7 +326,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -360,7 +360,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -394,7 +394,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -423,7 +423,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -442,10 +442,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -510,11 +510,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -541,9 +541,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -641,14 +641,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -670,7 +670,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -714,3 +714,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c
index 592f488b9..775ab0828 100644
--- a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c
+++ b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -57,22 +57,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0xEF,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204E,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,22 +83,22 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 4,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC1_IAD =
+
+ .CDC1_IAD =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_Association_t), .Type = DTYPE_InterfaceAssociation},
@@ -112,94 +112,94 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.IADStrIndex = NO_DESCRIPTOR
},
- .CDC1_CCI_Interface =
+ .CDC1_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC1_Functional_Header =
+ .CDC1_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC1_Functional_ACM =
+ .CDC1_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC1_Functional_Union =
+
+ .CDC1_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC1_ManagementEndpoint =
+ .CDC1_ManagementEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC1_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC1_DCI_Interface =
+ .CDC1_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC1_DataOutEndpoint =
+ .CDC1_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC1_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC1_DataInEndpoint =
+
+ .CDC1_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC1_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
- .CDC2_IAD =
+ .CDC2_IAD =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_Association_t), .Type = DTYPE_InterfaceAssociation},
@@ -213,87 +213,87 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.IADStrIndex = NO_DESCRIPTOR
},
- .CDC2_CCI_Interface =
+ .CDC2_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 2,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC2_Functional_Header =
+ .CDC2_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC2_Functional_ACM =
+ .CDC2_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC2_Functional_Union =
+
+ .CDC2_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 2,
.SlaveInterfaceNumber = 3,
},
- .CDC2_ManagementEndpoint =
+ .CDC2_ManagementEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC2_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC2_DCI_Interface =
+ .CDC2_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 3,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC2_DataOutEndpoint =
+ .CDC2_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC2_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC2_DataInEndpoint =
+
+ .CDC2_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC2_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -356,30 +356,31 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h
index 5c1bf53bb..fba85e805 100644
--- a/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h
+++ b/Demos/Device/ClassDriver/DualVirtualSerial/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -102,3 +102,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c
index 915c8fc98..c6e7b423e 100644
--- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c
+++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -92,7 +92,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial2_CDC_Interface =
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -107,7 +107,7 @@ int main(void)
int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial2_CDC_Interface);
if (!(ReceivedByte < 0))
CDC_Device_SendByte(&VirtualSerial2_CDC_Interface, (uint8_t)ReceivedByte);
-
+
CDC_Device_USBTask(&VirtualSerial1_CDC_Interface);
CDC_Device_USBTask(&VirtualSerial2_CDC_Interface);
USB_USBTask();
@@ -151,12 +151,12 @@ void CheckJoystickMovement(void)
ReportString = "Joystick Pressed\r\n";
else
ActionSent = false;
-
+
if ((ReportString != NULL) && (ActionSent == false))
{
ActionSent = true;
-
- CDC_Device_SendString(&VirtualSerial1_CDC_Interface, ReportString, strlen(ReportString));
+
+ CDC_Device_SendString(&VirtualSerial1_CDC_Interface, ReportString, strlen(ReportString));
}
}
@@ -189,3 +189,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
CDC_Device_ProcessControlRequest(&VirtualSerial1_CDC_Interface);
CDC_Device_ProcessControlRequest(&VirtualSerial2_CDC_Interface);
}
+
diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h
index e1ac0bb5a..eccb4d859 100644
--- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h
+++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -63,7 +63,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void CheckJoystickMovement(void);
@@ -74,3 +74,4 @@
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt
index 3959f89c4..662ec9199 100644
--- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt
+++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Dual Communications Device Class (Dual Virtual Serial Port) Device
*
* \section SSec_Compat Demo Compatibility:
@@ -27,7 +27,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -46,7 +46,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Dual Communications Device Class demonstration application.
* This gives a simple reference application for implementing
@@ -56,13 +56,13 @@
* descriptors for each virtual serial port, which may not be
* supported in all OSes - Windows Vista is supported, as is
* XP (although the latter may need a hotfix to function).
- *
+ *
* Joystick actions are transmitted to the host as strings
* through the first serial port. The device does not respond to
* serial data sent from the host in the first serial port.
- *
+ *
* The second serial port echoes back data sent from the host.
- *
+ *
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* project's directory as the device's driver when running under
@@ -83,3 +83,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/makefile b/Demos/Device/ClassDriver/DualVirtualSerial/makefile
index 880afe691..c9c034924 100644
--- a/Demos/Device/ClassDriver/DualVirtualSerial/makefile
+++ b/Demos/Device/ClassDriver/DualVirtualSerial/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/GenericHID/Descriptors.c b/Demos/Device/ClassDriver/GenericHID/Descriptors.c
index 2d9ec83a8..1e78837cd 100644
--- a/Demos/Device/ClassDriver/GenericHID/Descriptors.c
+++ b/Demos/Device/ClassDriver/GenericHID/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -71,22 +71,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM GenericReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204F,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -97,41 +97,41 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x00,
.Protocol = HID_BOOTP_NonBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_GenericHID =
+ .HID_GenericHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
@@ -139,10 +139,10 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(GenericReport)
},
- .HID_ReportINEndpoint =
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | GENERIC_IN_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = GENERIC_EPSIZE,
@@ -157,7 +157,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -168,7 +168,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -179,7 +179,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(21), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Generic HID Demo"
};
@@ -205,38 +205,39 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case HID_DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_GenericHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case HID_DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &GenericReport;
Size = sizeof(GenericReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/GenericHID/Descriptors.h b/Demos/Device/ClassDriver/GenericHID/Descriptors.h
index 23396f3f5..de427e626 100644
--- a/Demos/Device/ClassDriver/GenericHID/Descriptors.h
+++ b/Demos/Device/ClassDriver/GenericHID/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -61,14 +61,15 @@
/** Size in bytes of the Generic HID reporting endpoint. */
#define GENERIC_EPSIZE 8
-
+
/** Size in bytes of the Generic HID reports (including report ID byte). */
#define GENERIC_REPORT_SIZE 8
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c
index d64c1648e..d982d94a9 100644
--- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c
+++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -60,7 +60,7 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface =
.ReportINEndpointNumber = GENERIC_IN_EPNUM,
.ReportINEndpointSize = GENERIC_EPSIZE,
.ReportINEndpointDoubleBank = false,
-
+
.PrevReportINBuffer = PrevHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevHIDReportBuffer),
},
@@ -72,10 +72,10 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface =
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
HID_Device_USBTask(&Generic_HID_Interface);
@@ -101,7 +101,7 @@ void SetupHardware(void)
/** Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the library USB Disconnection event. */
@@ -154,7 +154,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
*ReportID = HIDReportEcho.ReportID;
memcpy(ReportData, HIDReportEcho.ReportData, HIDReportEcho.ReportSize);
-
+
*ReportSize = HIDReportEcho.ReportSize;
return true;
}
@@ -177,3 +177,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
HIDReportEcho.ReportSize = ReportSize;
memcpy(HIDReportEcho.ReportData, ReportData, ReportSize);
}
+
diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h
index e61e9571f..28a2c440e 100644
--- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h
+++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for GenericHID.c.
*/
-
+
#ifndef _GENERICHID_H_
#define _GENERICHID_H_
@@ -42,7 +42,7 @@
#include <avr/power.h>
#include <avr/interrupt.h>
#include <string.h>
-
+
#include "Descriptors.h"
#include <LUFA/Version.h>
@@ -78,9 +78,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.txt b/Demos/Device/ClassDriver/GenericHID/GenericHID.txt
index b73a9512d..60920c7fb 100644
--- a/Demos/Device/ClassDriver/GenericHID/GenericHID.txt
+++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Generic HID Device
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -44,19 +44,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Generic HID device demonstration application. This gives a simple reference application
* for implementing a generic HID device, using the basic USB HID drivers in all modern
* OSes (i.e. no special drivers required). By default it accepts and sends up to 8 byte reports
* to and from a USB Host, and transmits the last sent report back to the host.
- *
+ *
* On start-up the system will automatically enumerate and function as a vendor HID device.
* When controlled by a custom HID class application, reports can be sent and received by
* both the standard data endpoint and control request methods defined in the HID specification.
*
* \section SSec_Options Project Options
- *
+ *
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
@@ -73,3 +73,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/GenericHID/makefile b/Demos/Device/ClassDriver/GenericHID/makefile
index e38cb96ad..5c7e78ee7 100644
--- a/Demos/Device/ClassDriver/GenericHID/makefile
+++ b/Demos/Device/ClassDriver/GenericHID/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/Joystick/Descriptors.c b/Demos/Device/ClassDriver/Joystick/Descriptors.c
index 6000e0e20..4b8dae4f5 100644
--- a/Demos/Device/ClassDriver/Joystick/Descriptors.c
+++ b/Demos/Device/ClassDriver/Joystick/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -81,22 +81,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2043,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -107,41 +107,41 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x00,
.Protocol = HID_BOOTP_NonBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_JoystickHID =
+ .HID_JoystickHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
@@ -149,15 +149,15 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(JoystickReport)
},
- .HID_ReportINEndpoint =
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | JOYSTICK_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = JOYSTICK_EPSIZE,
.PollingIntervalMS = 0x0A
- }
+ }
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
@@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -178,7 +178,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -189,7 +189,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Joystick Demo"
};
@@ -215,38 +215,39 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case HID_DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_JoystickHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case HID_DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &JoystickReport;
Size = sizeof(JoystickReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/Joystick/Descriptors.h b/Demos/Device/ClassDriver/Joystick/Descriptors.h
index 0d7d45660..878b0380c 100644
--- a/Demos/Device/ClassDriver/Joystick/Descriptors.h
+++ b/Demos/Device/ClassDriver/Joystick/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -69,3 +69,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c
index c759e1346..72cff3606 100644
--- a/Demos/Device/ClassDriver/Joystick/Joystick.c
+++ b/Demos/Device/ClassDriver/Joystick/Joystick.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,10 +64,10 @@ USB_ClassInfo_HID_Device_t Joystick_HID_Interface =
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
HID_Device_USBTask(&Joystick_HID_Interface);
@@ -145,7 +145,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
uint16_t* const ReportSize)
{
USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;
-
+
uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
@@ -161,10 +161,10 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (JoyStatus_LCL & JOY_PRESS)
JoystickReport->Button = (1 << 1);
-
+
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
JoystickReport->Button |= (1 << 0);
-
+
*ReportSize = sizeof(USB_JoystickReport_Data_t);
return false;
}
@@ -185,3 +185,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
}
+
diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.h b/Demos/Device/ClassDriver/Joystick/Joystick.h
index a8151cdf1..821400196 100644
--- a/Demos/Device/ClassDriver/Joystick/Joystick.h
+++ b/Demos/Device/ClassDriver/Joystick/Joystick.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Joystick.c.
*/
-
+
#ifndef _JOYSTICK_H_
#define _JOYSTICK_H_
@@ -62,7 +62,7 @@
int8_t Y; /**< Current absolute joystick Y position, as a signed 8-bit integer */
uint8_t Button; /**< Bit mask of the currently pressed joystick buttons */
} USB_JoystickReport_Data_t;
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -91,9 +91,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif
+
diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.txt b/Demos/Device/ClassDriver/Joystick/Joystick.txt
index 5b1495cbc..0a8dff697 100644
--- a/Demos/Device/ClassDriver/Joystick/Joystick.txt
+++ b/Demos/Device/ClassDriver/Joystick/Joystick.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Joystick Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -44,19 +44,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Joystick demonstration application. This gives a simple reference
* application for implementing a USB Keyboard device, for USB Joysticks
* using the standard Keyboard HID profile.
- *
+ *
* This device will show up as a generic joystick device, with two buttons.
* Pressing the joystick inwards is the first button, and the HWB button
* is the second.
- *
+ *
* Moving the joystick on the selected board moves the joystick location on
* the host computer.
- *
+ *
* Currently only single interface joysticks are supported.
*
* \section SSec_Options Project Options
@@ -71,3 +71,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/Joystick/makefile b/Demos/Device/ClassDriver/Joystick/makefile
index 40debcb4c..ff8ffea13 100644
--- a/Demos/Device/ClassDriver/Joystick/makefile
+++ b/Demos/Device/ClassDriver/Joystick/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/Keyboard/Descriptors.c b/Demos/Device/ClassDriver/Keyboard/Descriptors.c
index 3b2acdd7f..90952ef17 100644
--- a/Demos/Device/ClassDriver/Keyboard/Descriptors.c
+++ b/Demos/Device/ClassDriver/Keyboard/Descriptors.c
@@ -1,21 +1,21 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -87,22 +87,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2042,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -113,49 +113,49 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = HID_BOOTP_KeyboardBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_KeyboardHID =
- {
+ .HID_KeyboardHID =
+ {
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
-
- .HID_ReportINEndpoint =
+
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -173,7 +173,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -184,7 +184,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -195,7 +195,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Keyboard Demo"
};
@@ -217,42 +217,43 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case HID_DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_KeyboardHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case HID_DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &KeyboardReport;
Size = sizeof(KeyboardReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/Keyboard/Descriptors.h b/Demos/Device/ClassDriver/Keyboard/Descriptors.h
index 25629fd64..d94beb718 100644
--- a/Demos/Device/ClassDriver/Keyboard/Descriptors.h
+++ b/Demos/Device/ClassDriver/Keyboard/Descriptors.h
@@ -1,21 +1,21 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,12 +54,12 @@
USB_HID_Descriptor_HID_t HID_KeyboardHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPNUM 1
-
- /** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
+
+ /** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
#define KEYBOARD_EPSIZE 8
/* Function Prototypes: */
@@ -69,3 +69,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c
index 755c25a72..33f52d662 100644
--- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c
+++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -67,7 +67,7 @@ int main(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
HID_Device_USBTask(&Keyboard_HID_Interface);
@@ -142,12 +142,12 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
const uint8_t ReportType, void* ReportData, uint16_t* const ReportSize)
{
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
-
+
uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
uint8_t UsedKeyCodes = 0;
-
+
if (JoyStatus_LCL & JOY_UP)
KeyboardReport->KeyCode[UsedKeyCodes++] = 0x04; // A
else if (JoyStatus_LCL & JOY_DOWN)
@@ -160,7 +160,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (JoyStatus_LCL & JOY_PRESS)
KeyboardReport->KeyCode[UsedKeyCodes++] = 0x08; // E
-
+
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
KeyboardReport->KeyCode[UsedKeyCodes++] = 0x09; // F
@@ -190,12 +190,13 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
if (*LEDReport & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
-
+
if (*LEDReport & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
if (*LEDReport & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
-
+
LEDs_SetAllLEDs(LEDMask);
}
+
diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h
index fd7bf5198..b2b29a379 100644
--- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h
+++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -52,7 +52,7 @@
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -65,7 +65,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
@@ -81,9 +81,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif
+
diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.txt b/Demos/Device/ClassDriver/Keyboard/Keyboard.txt
index d4b414471..447b81f89 100644
--- a/Demos/Device/ClassDriver/Keyboard/Keyboard.txt
+++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Keyboard Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Keyboard Subclass</td>
* </tr>
@@ -50,8 +50,8 @@
* for implementing a USB Keyboard using the basic USB HID drivers in all modern
* OSes (i.e. no special drivers required). It is boot protocol compatible, and thus
* works under compatible BIOS as if it was a native keyboard (e.g. PS/2).
- *
- * On start-up the system will automatically enumerate and function as a keyboard
+ *
+ * On start-up the system will automatically enumerate and function as a keyboard
* when the USB connection to a host is present. To use the keyboard example,
* manipulate the joystick to send the letters a, b, c, d and e. See the USB HID
* documentation for more information on sending keyboard event and key presses. Unlike
@@ -59,7 +59,7 @@
* inside the same report to the host.
*
* \section SSec_Options Project Options
- *
+ *
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
@@ -70,3 +70,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/Keyboard/makefile b/Demos/Device/ClassDriver/Keyboard/makefile
index a16fafb28..d31b068dd 100644
--- a/Demos/Device/ClassDriver/Keyboard/makefile
+++ b/Demos/Device/ClassDriver/Keyboard/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c
index 1f2411662..b18920fa6 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c
+++ b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.c
@@ -1,21 +1,21 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -120,22 +120,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204D,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -146,49 +146,49 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID1_KeyboardInterface =
+
+ .HID1_KeyboardInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = HID_BOOTP_KeyboardBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID1_KeyboardHID =
- {
+ .HID1_KeyboardHID =
+ {
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
-
- .HID1_ReportINEndpoint =
+
+ .HID1_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -198,34 +198,34 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x0A
},
- .HID2_MouseInterface =
+ .HID2_MouseInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x01,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = HID_BOOTP_MouseBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID2_MouseHID =
- {
+ .HID2_MouseHID =
+ {
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(MouseReport)
},
-
- .HID2_ReportINEndpoint =
+
+ .HID2_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -243,7 +243,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -254,7 +254,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -265,7 +265,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(28), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Mouse and Keyboard Demo"
};
@@ -287,33 +287,33 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case HID_DTYPE_HID:
+ case HID_DTYPE_HID:
if (!(wIndex))
{
Address = &ConfigurationDescriptor.HID1_KeyboardHID;
@@ -322,24 +322,25 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
else
{
Address = &ConfigurationDescriptor.HID2_MouseHID;
- Size = sizeof(USB_HID_Descriptor_HID_t);
+ Size = sizeof(USB_HID_Descriptor_HID_t);
}
break;
- case HID_DTYPE_Report:
+ case HID_DTYPE_Report:
if (!(wIndex))
{
Address = &KeyboardReport;
Size = sizeof(KeyboardReport);
}
else
- {
+ {
Address = &MouseReport;
Size = sizeof(MouseReport);
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h
index b0d8f5a6b..83636e0fa 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h
+++ b/Demos/Device/ClassDriver/KeyboardMouse/Descriptors.h
@@ -1,21 +1,21 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -57,7 +57,7 @@
USB_HID_Descriptor_HID_t HID2_MouseHID;
USB_Descriptor_Endpoint_t HID2_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_IN_EPNUM 1
@@ -75,3 +75,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
index 96c430a22..45bb06b6e 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
+++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c
@@ -1,21 +1,21 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -61,7 +61,7 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
.PrevReportINBufferSize = sizeof(PrevKeyboardHIDReportBuffer),
},
};
-
+
/** LUFA HID Class driver interface configuration and state information. This structure is
* passed to all HID Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another. This is for the mouse HID
@@ -78,7 +78,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
.PrevReportINBuffer = PrevMouseHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
- },
+ },
};
/** Main program entry point. This routine contains the overall program flow, including initial
@@ -177,11 +177,11 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (HIDInterfaceInfo == &Keyboard_HID_Interface)
{
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
-
+
/* If first board button not being held down, no keyboard report */
if (!(ButtonStatus_LCL & BUTTONS_BUTTON1))
return 0;
-
+
KeyboardReport->Modifier = HID_KEYBOARD_MODIFER_LEFTSHIFT;
if (JoyStatus_LCL & JOY_UP)
@@ -196,7 +196,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (JoyStatus_LCL & JOY_PRESS)
KeyboardReport->KeyCode[0] = 0x08; // E
-
+
*ReportSize = sizeof(USB_KeyboardReport_Data_t);
return false;
}
@@ -207,7 +207,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
/* If first board button being held down, no mouse report */
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
return 0;
-
+
if (JoyStatus_LCL & JOY_UP)
MouseReport->Y = -1;
else if (JoyStatus_LCL & JOY_DOWN)
@@ -220,9 +220,9 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (JoyStatus_LCL & JOY_PRESS)
MouseReport->Button |= (1 << 0);
-
+
*ReportSize = sizeof(USB_MouseReport_Data_t);
- return true;
+ return true;
}
}
@@ -247,13 +247,13 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
if (*LEDReport & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
-
+
if (*LEDReport & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
if (*LEDReport & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
-
+
LEDs_SetAllLEDs(LEDMask);
}
-} \ No newline at end of file
+}
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
index 5c385fd42..186602f63 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h
@@ -1,21 +1,21 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -60,7 +60,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
@@ -76,9 +76,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.txt b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.txt
index f13087885..984493056 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.txt
+++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Dual HID Keyboard and Mouse Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -44,7 +44,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Keyboard/Mouse demonstration application. This gives a simple reference
* application for implementing a composite device containing both USB Keyboard
@@ -52,13 +52,13 @@
* (i.e. no special drivers required). This example uses two separate HID
* interfaces for each function. It is boot protocol compatible, and thus works under
* compatible BIOS as if it was a native keyboard and mouse (e.g. PS/2).
- *
+ *
* On start-up the system will automatically enumerate and function
* as a keyboard when the USB connection to a host is present and the HWB is not
* pressed. When enabled, manipulate the joystick to send the letters
* a, b, c, d and e. See the USB HID documentation for more information
* on sending keyboard event and key presses.
- *
+ *
* When the HWB is pressed, the mouse mode is enabled. When enabled, move the
* joystick to move the pointer, and push the joystick inwards to simulate a
* left-button click.
@@ -75,3 +75,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/KeyboardMouse/makefile b/Demos/Device/ClassDriver/KeyboardMouse/makefile
index 8b2fb9d6e..8ef931962 100644
--- a/Demos/Device/ClassDriver/KeyboardMouse/makefile
+++ b/Demos/Device/ClassDriver/KeyboardMouse/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/MIDI/Descriptors.c b/Demos/Device/ClassDriver/MIDI/Descriptors.c
index 98e6ae508..d6092bbd4 100644
--- a/Demos/Device/ClassDriver/MIDI/Descriptors.c
+++ b/Demos/Device/ClassDriver/MIDI/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,11 +30,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
-
+
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2048,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,7 +71,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
@@ -80,122 +80,122 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .Audio_ControlInterface =
+
+ .Audio_ControlInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
-
+
.Class = 0x01,
.SubClass = 0x01,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_ControlInterface_SPC =
+
+ .Audio_ControlInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_Header,
-
+
.ACSpecification = VERSION_BCD(01.00),
.TotalLength = sizeof(USB_Audio_Descriptor_Interface_AC_t),
-
+
.InCollection = 1,
.InterfaceNumber = 1,
},
- .Audio_StreamInterface =
+ .Audio_StreamInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x01,
.SubClass = 0x03,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_StreamInterface_SPC =
+
+ .Audio_StreamInterface_SPC =
{
.Header = {.Size = sizeof(USB_MIDI_Descriptor_AudioInterface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_General,
.AudioSpecification = VERSION_BCD(01.00),
-
+
.TotalLength = (sizeof(USB_Descriptor_Configuration_t) -
offsetof(USB_Descriptor_Configuration_t, Audio_StreamInterface_SPC))
},
- .MIDI_In_Jack_Emb =
+ .MIDI_In_Jack_Emb =
{
.Header = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
-
+
.JackType = MIDI_JACKTYPE_Embedded,
.JackID = 0x01,
-
+
.JackStrIndex = NO_DESCRIPTOR
},
- .MIDI_In_Jack_Ext =
+ .MIDI_In_Jack_Ext =
{
.Header = {.Size = sizeof(USB_MIDI_Descriptor_InputJack_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_InputTerminal,
-
+
.JackType = MIDI_JACKTYPE_External,
.JackID = 0x02,
-
+
.JackStrIndex = NO_DESCRIPTOR
},
-
- .MIDI_Out_Jack_Emb =
+
+ .MIDI_Out_Jack_Emb =
{
.Header = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
-
+
.JackType = MIDI_JACKTYPE_Embedded,
.JackID = 0x03,
.NumberOfPins = 1,
.SourceJackID = {0x02},
.SourcePinID = {0x01},
-
+
.JackStrIndex = NO_DESCRIPTOR
},
- .MIDI_Out_Jack_Ext =
+ .MIDI_Out_Jack_Ext =
{
.Header = {.Size = sizeof(USB_MIDI_Descriptor_OutputJack_t), .Type = DTYPE_CSInterface},
.Subtype = AUDIO_DSUBTYPE_CSInterface_OutputTerminal,
-
+
.JackType = MIDI_JACKTYPE_External,
.JackID = 0x04,
.NumberOfPins = 1,
.SourceJackID = {0x01},
.SourcePinID = {0x01},
-
+
.JackStrIndex = NO_DESCRIPTOR
},
- .MIDI_In_Jack_Endpoint =
+ .MIDI_In_Jack_Endpoint =
{
- .Endpoint =
+ .Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
@@ -204,12 +204,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0
},
-
+
.Refresh = 0,
.SyncEndpointNumber = 0
},
-
- .MIDI_In_Jack_Endpoint_SPC =
+
+ .MIDI_In_Jack_Endpoint_SPC =
{
.Header = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
@@ -218,9 +218,9 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.AssociatedJackID = {0x01}
},
- .MIDI_Out_Jack_Endpoint =
+ .MIDI_Out_Jack_Endpoint =
{
- .Endpoint =
+ .Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_Descriptor_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
@@ -229,12 +229,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0
},
-
+
.Refresh = 0,
.SyncEndpointNumber = 0
},
-
- .MIDI_Out_Jack_Endpoint_SPC =
+
+ .MIDI_Out_Jack_Endpoint_SPC =
{
.Header = {.Size = sizeof(USB_MIDI_Descriptor_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
.Subtype = AUDIO_DSUBTYPE_CSEndpoint_General,
@@ -251,7 +251,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -262,7 +262,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -273,7 +273,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(14), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA MIDI Demo"
};
@@ -295,34 +295,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/MIDI/Descriptors.h b/Demos/Device/ClassDriver/MIDI/Descriptors.h
index 52ba98f06..06020c8f9 100644
--- a/Demos/Device/ClassDriver/MIDI/Descriptors.h
+++ b/Demos/Device/ClassDriver/MIDI/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -51,7 +51,7 @@
/** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
#define MIDI_STREAM_EPSIZE 64
-
+
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
@@ -73,7 +73,7 @@
USB_Audio_Descriptor_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
USB_MIDI_Descriptor_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -81,3 +81,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c
index bfeeaa38e..cae7277fd 100644
--- a/Demos/Device/ClassDriver/MIDI/MIDI.c
+++ b/Demos/Device/ClassDriver/MIDI/MIDI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -65,11 +65,11 @@ int main(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
CheckJoystickMovement();
-
+
MIDI_EventPacket_t ReceivedMIDIEvent;
if (MIDI_Device_ReceiveEventPacket(&Keyboard_MIDI_Interface, &ReceivedMIDIEvent))
{
@@ -78,7 +78,7 @@ int main(void)
else
LEDs_SetAllLEDs(LEDS_NO_LEDS);
}
-
+
MIDI_Device_USBTask(&Keyboard_MIDI_Interface);
USB_USBTask();
}
@@ -93,7 +93,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
@@ -108,11 +108,11 @@ void CheckJoystickMovement(void)
uint8_t MIDICommand = 0;
uint8_t MIDIPitch;
-
+
/* Get current joystick mask, XOR with previous to detect joystick changes */
uint8_t JoystickStatus = Joystick_GetStatus();
uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus);
-
+
/* Get board button status - if pressed use channel 10 (percussion), otherwise use channel 1 */
uint8_t Channel = ((Buttons_GetStatus() & BUTTONS_BUTTON1) ? MIDI_CHANNEL(10) : MIDI_CHANNEL(1));
@@ -133,7 +133,7 @@ void CheckJoystickMovement(void)
MIDICommand = ((JoystickStatus & JOY_RIGHT)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
MIDIPitch = 0x3E;
}
-
+
if (JoystickChanges & JOY_DOWN)
{
MIDICommand = ((JoystickStatus & JOY_DOWN)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
@@ -145,19 +145,19 @@ void CheckJoystickMovement(void)
MIDICommand = ((JoystickStatus & JOY_PRESS)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
MIDIPitch = 0x3B;
}
-
+
if (MIDICommand)
{
MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
-
+
.Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch,
- .Data3 = MIDI_STANDARD_VELOCITY,
+ .Data3 = MIDI_STANDARD_VELOCITY,
};
-
+
MIDI_Device_SendEventPacket(&Keyboard_MIDI_Interface, &MIDIEvent);
MIDI_Device_Flush(&Keyboard_MIDI_Interface);
}
@@ -192,3 +192,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface);
}
+
diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.h b/Demos/Device/ClassDriver/MIDI/MIDI.h
index 6fd304e7a..c97311654 100644
--- a/Demos/Device/ClassDriver/MIDI/MIDI.h
+++ b/Demos/Device/ClassDriver/MIDI/MIDI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for AudioOutput.c.
*/
-
+
#ifndef _AUDIO_OUTPUT_H_
#define _AUDIO_OUTPUT_H_
@@ -45,7 +45,7 @@
#include <string.h>
#include "Descriptors.h"
-
+
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Joystick.h>
@@ -65,14 +65,15 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void CheckJoystickMovement(void);
-
+
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.txt b/Demos/Device/ClassDriver/MIDI/MIDI.txt
index e9522f2ed..0629832b2 100644
--- a/Demos/Device/ClassDriver/MIDI/MIDI.txt
+++ b/Demos/Device/ClassDriver/MIDI/MIDI.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage MIDI Input Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Audio Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Standard Audio Device</td>
* </tr>
@@ -44,19 +44,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* MIDI demonstration application. This gives a simple reference
* application for implementing the USB-MIDI class in USB devices.
* It is built upon the USB Audio class.
- *
+ *
* Joystick movements are translated into note on/off messages and
* are sent to the host PC as MIDI streams which can be read by any
* MIDI program supporting MIDI IN devices.
- *
+ *
* If the HWB is not pressed, channel 1 (default piano) is used. If
* the HWB is set, then channel 10 (default percussion) is selected.
- *
+ *
* This device implements MIDI-THRU mode, with the IN MIDI data being
* generated by the device itself. OUT MIDI data is discarded.
*
@@ -72,3 +72,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/MIDI/makefile b/Demos/Device/ClassDriver/MIDI/makefile
index 9e748ddb4..c60aff97d 100644
--- a/Demos/Device/ClassDriver/MIDI/makefile
+++ b/Demos/Device/ClassDriver/MIDI/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/MassStorage/Descriptors.c b/Demos/Device/ClassDriver/MassStorage/Descriptors.c
index b6e03a359..d06161049 100644
--- a/Demos/Device/ClassDriver/MassStorage/Descriptors.c
+++ b/Demos/Device/ClassDriver/MassStorage/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -57,22 +57,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2045,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,38 +83,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .MS_Interface =
+
+ .MS_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x08,
.SubClass = 0x06,
.Protocol = 0x50,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .MS_DataInEndpoint =
+ .MS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -124,7 +124,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .MS_DataOutEndpoint =
+ .MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -142,7 +142,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -153,7 +153,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -164,7 +164,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Mass Storage Demo"
};
@@ -186,34 +186,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/MassStorage/Descriptors.h b/Demos/Device/ClassDriver/MassStorage/Descriptors.h
index 1b40df159..c816e2383 100644
--- a/Demos/Device/ClassDriver/MassStorage/Descriptors.h
+++ b/Demos/Device/ClassDriver/MassStorage/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -44,15 +44,15 @@
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
+ #define MASS_STORAGE_IN_EPNUM 3
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
+ #define MASS_STORAGE_OUT_EPNUM 4
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
-
- /* Type Defines: */
+
+ /* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@@ -64,7 +64,7 @@
USB_Descriptor_Endpoint_t MS_DataInEndpoint;
USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -72,3 +72,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c
index ce2ac8151..2c63f6098 100644
--- a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c
+++ b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -77,7 +77,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -86,7 +86,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
/* Clear the current endpoint bank */
Endpoint_ClearOUT();
-
+
/* Wait until the host has sent another packet */
if (Endpoint_WaitUntilReady())
return;
@@ -125,7 +125,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Send the Dataflash buffer write command */
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
+ Dataflash_SendAddressBytes(0, 0);
}
/* Write one 16-byte chunk of data to the Dataflash */
@@ -145,7 +145,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
@@ -154,9 +154,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Check if the current command is being aborted by the host */
if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
+ return;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -201,15 +201,15 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
-
+
/* Wait until endpoint is ready before continuing */
if (Endpoint_WaitUntilReady())
return;
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -218,12 +218,12 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
{
/* Clear the endpoint bank to send its contents to the host */
Endpoint_ClearIN();
-
+
/* Wait until the endpoint is ready for more data */
if (Endpoint_WaitUntilReady())
return;
}
-
+
/* Check if end of Dataflash page reached */
if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
{
@@ -233,7 +233,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -241,7 +241,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
Endpoint_Write_Byte(Dataflash_ReceiveByte());
@@ -260,10 +260,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
@@ -271,11 +271,11 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
-
+
/* If the endpoint is full, send its contents to the host */
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearIN();
@@ -315,11 +315,11 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
/* Send the Dataflash buffer write command */
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -359,18 +359,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, 0);
}
-
+
/* Write one 16-byte chunk of data to the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
Dataflash_SendByte(*(BufferPtr++));
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
/* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
+ BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -416,7 +416,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -429,7 +429,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -437,19 +437,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
*(BufferPtr++) = Dataflash_ReceiveByte();
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
@@ -464,7 +464,7 @@ void DataflashManager_ResetDataflashProtections(void)
/* Select first Dataflash chip, send the read status register command */
Dataflash_SelectChip(DATAFLASH_CHIP1);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -476,12 +476,12 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
-
+
/* Select second Dataflash chip (if present on selected board), send read status register command */
#if (DATAFLASH_TOTALCHIPS == 2)
Dataflash_SelectChip(DATAFLASH_CHIP2);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -494,7 +494,7 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
#endif
-
+
/* Deselect current Dataflash chip */
Dataflash_DeselectChip();
}
@@ -528,6 +528,7 @@ bool DataflashManager_CheckDataflashOperation(void)
if (ReturnByte != DF_MANUFACTURER_ATMEL)
return false;
#endif
-
+
return true;
}
+
diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
index a7652bcad..d3949f23e 100644
--- a/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
+++ b/Demos/Device/ClassDriver/MassStorage/Lib/DataflashManager.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,13 +32,13 @@
*
* Header file for DataflashManager.c.
*/
-
+
#ifndef _DATAFLASH_MANAGER_H_
#define _DATAFLASH_MANAGER_H_
/* Includes: */
#include <avr/io.h>
-
+
#include "MassStorage.h"
#include "Descriptors.h"
@@ -60,12 +60,12 @@
* storage media (Dataflash) using a different native block size. Do not change this value.
*/
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
-
+
/** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
* change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
*/
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
-
+
/* Function Prototypes: */
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const uint32_t BlockAddress,
@@ -81,5 +81,6 @@
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
void DataflashManager_ResetDataflashProtections(void);
bool DataflashManager_CheckDataflashOperation(void);
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c
index fed57f7b9..8c31b2b80 100644
--- a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c
+++ b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,29 +34,29 @@
* devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
* which wrap around standard SCSI device commands for controlling the actual storage medium.
*/
-
+
#define INCLUDE_FROM_SCSI_C
#include "SCSI.h"
/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
* features and capabilities.
*/
-SCSI_Inquiry_Response_t InquiryData =
+SCSI_Inquiry_Response_t InquiryData =
{
.DeviceType = DEVICE_TYPE_BLOCK,
.PeripheralQualifier = 0,
-
+
.Removable = true,
-
+
.Version = 0,
-
+
.ResponseDataFormat = 2,
.NormACA = false,
.TrmTsk = false,
.AERC = false,
.AdditionalLength = 0x1F,
-
+
.SoftReset = false,
.CmdQue = false,
.Linked = false,
@@ -64,7 +64,7 @@ SCSI_Inquiry_Response_t InquiryData =
.WideBus16Bit = false,
.WideBus32Bit = false,
.RelAddr = false,
-
+
.VendorID = "LUFA",
.ProductID = "Dataflash Disk",
.RevisionID = {'0','.','0','0'},
@@ -96,13 +96,13 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
{
case SCSI_CMD_INQUIRY:
- CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
break;
case SCSI_CMD_READ_CAPACITY_10:
- CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
@@ -134,7 +134,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
SCSI_ASENSEQ_NO_QUALIFIER);
-
+
return true;
}
@@ -165,11 +165,11 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
-
+
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
-
+
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
@@ -178,7 +178,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-
+
return true;
}
@@ -193,7 +193,7 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
{
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
-
+
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
@@ -221,10 +221,10 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_ClearIN();
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
-
+
return true;
}
@@ -248,21 +248,21 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
return false;
}
-
+
/* Check to see if all attached Dataflash ICs are functional */
if (!(DataflashManager_CheckDataflashOperation()))
{
/* Update SENSE key with a hardware error condition and return command fail */
SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
return false;
}
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-
+
return true;
}
@@ -280,13 +280,13 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
{
uint32_t BlockAddress;
uint16_t TotalBlocks;
-
+
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
/* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
-
+
/* Check if the block address is outside the maximum allowable value for the LUN */
if (BlockAddress >= LUN_MEDIA_BLOCKS)
{
@@ -302,7 +302,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Adjust the given block address to the real media address based on the selected LUN */
BlockAddress += ((uint32_t)MSInterfaceInfo->State.CommandBlock.LUN * LUN_MEDIA_BLOCKS);
#endif
-
+
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ)
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
@@ -311,6 +311,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
+
return true;
}
+
diff --git a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h
index bf3c13850..6c7071dcd 100644
--- a/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h
+++ b/Demos/Device/ClassDriver/MassStorage/Lib/SCSI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for SCSI.c.
*/
-
+
#ifndef _SCSI_H_
#define _SCSI_H_
@@ -46,7 +46,7 @@
#include "MassStorage.h"
#include "Descriptors.h"
#include "DataflashManager.h"
-
+
/* Macros: */
/** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
* is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
@@ -68,13 +68,13 @@
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
#define DEVICE_TYPE_BLOCK 0x00
-
+
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
#define DEVICE_TYPE_CDROM 0x05
-
+
/* Function Prototypes: */
bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
-
+
#if defined(INCLUDE_FROM_SCSI_C)
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
@@ -83,5 +83,6 @@
static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const bool IsDataRead);
#endif
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c
index 94f9f8415..993d5a5f9 100644
--- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c
+++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -130,10 +130,11 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
bool CommandSuccess;
-
+
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
+
return CommandSuccess;
}
+
diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.h b/Demos/Device/ClassDriver/MassStorage/MassStorage.h
index a9abd0edb..3e829e7b5 100644
--- a/Demos/Device/ClassDriver/MassStorage/MassStorage.h
+++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -68,13 +68,13 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/** Total number of logical drives within the device - must be non-zero. */
#define TOTAL_LUNS 1
-
+
/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */
#define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS)
-
+
/* Function Prototypes: */
void SetupHardware(void);
@@ -86,3 +86,4 @@
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
#endif
+
diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.txt b/Demos/Device/ClassDriver/MassStorage/MassStorage.txt
index 934cb50aa..2b4c68235 100644
--- a/Demos/Device/ClassDriver/MassStorage/MassStorage.txt
+++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mass Storage Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Mass Storage Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Bulk-Only Transport</td>
* </tr>
@@ -45,23 +45,23 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Dual LUN Mass Storage demonstration application. This gives a simple
* reference application for implementing a multiple LUN USB Mass Storage
* device using the basic USB UFI drivers in all modern OSes (i.e. no
* special drivers required).
- *
+ *
* On start-up the system will automatically enumerate and function as an
* external mass storage device with two LUNs (separate disks) which may
* be formatted and used in the same manner as commercial USB Mass Storage
* devices.
- *
+ *
* You will need to format the mass storage drives upon first run of this
* demonstration - as the device acts only as a data block transport between
* the host and the storage media, it does not matter what file system is used,
* as the data interpretation is performed by the host and not the USB device.
- *
+ *
* This demo is not restricted to only two LUNs; by changing the TOTAL_LUNS
* value in MassStorageDualLUN.h, any number of LUNs can be used (from 1 to
* 255), with each LUN being allocated an equal portion of the available
@@ -90,3 +90,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/MassStorage/makefile b/Demos/Device/ClassDriver/MassStorage/makefile
index 8941b80db..54b4b7f17 100644
--- a/Demos/Device/ClassDriver/MassStorage/makefile
+++ b/Demos/Device/ClassDriver/MassStorage/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -138,7 +138,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -151,7 +151,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -265,7 +265,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -278,7 +278,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -290,7 +290,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -302,7 +302,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -325,7 +325,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -359,7 +359,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -393,7 +393,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -422,7 +422,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -441,10 +441,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -509,11 +509,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -540,9 +540,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -640,14 +640,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -669,7 +669,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -713,3 +713,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
index 7be7bed92..0a42af7be 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Matthias Hullin (lufa [at] matthias [dot] hullin [dot] net)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -31,9 +31,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -100,22 +100,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2061,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -126,38 +126,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .MS_Interface =
+
+ .MS_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x08,
.SubClass = 0x06,
.Protocol = 0x50,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .MS_DataInEndpoint =
+ .MS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .MS_DataOutEndpoint =
+ .MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -177,34 +177,34 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .HID_KeyboardInterface =
+ .HID_KeyboardInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = HID_BOOTP_KeyboardBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_KeyboardHID =
- {
+ .HID_KeyboardHID =
+ {
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
-
- .HID_ReportINEndpoint =
+
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -222,7 +222,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -233,7 +233,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -244,7 +244,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(35), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Mass Storage and Keyboard Demo"
};
@@ -266,31 +266,31 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_KeyboardHID;
@@ -301,7 +301,8 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = sizeof(KeyboardReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
index 678c8ec85..dd861e6b8 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Matthias Hullin (lufa [at] matthias [dot] hullin [dot] net)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -47,20 +47,20 @@
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_EPNUM 1
-
- /** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
+
+ /** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
#define KEYBOARD_EPSIZE 8
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
+ #define MASS_STORAGE_IN_EPNUM 3
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
+ #define MASS_STORAGE_OUT_EPNUM 4
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
-
- /* Type Defines: */
+
+ /* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@@ -75,7 +75,7 @@
USB_HID_Descriptor_HID_t HID_KeyboardHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -83,3 +83,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.c
index ce2ac8151..2c63f6098 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.c
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -77,7 +77,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -86,7 +86,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
/* Clear the current endpoint bank */
Endpoint_ClearOUT();
-
+
/* Wait until the host has sent another packet */
if (Endpoint_WaitUntilReady())
return;
@@ -125,7 +125,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Send the Dataflash buffer write command */
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
+ Dataflash_SendAddressBytes(0, 0);
}
/* Write one 16-byte chunk of data to the Dataflash */
@@ -145,7 +145,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
@@ -154,9 +154,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Check if the current command is being aborted by the host */
if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
+ return;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -201,15 +201,15 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
-
+
/* Wait until endpoint is ready before continuing */
if (Endpoint_WaitUntilReady())
return;
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -218,12 +218,12 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
{
/* Clear the endpoint bank to send its contents to the host */
Endpoint_ClearIN();
-
+
/* Wait until the endpoint is ready for more data */
if (Endpoint_WaitUntilReady())
return;
}
-
+
/* Check if end of Dataflash page reached */
if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
{
@@ -233,7 +233,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -241,7 +241,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
Endpoint_Write_Byte(Dataflash_ReceiveByte());
@@ -260,10 +260,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
@@ -271,11 +271,11 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
-
+
/* If the endpoint is full, send its contents to the host */
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearIN();
@@ -315,11 +315,11 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
/* Send the Dataflash buffer write command */
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -359,18 +359,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, 0);
}
-
+
/* Write one 16-byte chunk of data to the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
Dataflash_SendByte(*(BufferPtr++));
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
/* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
+ BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -416,7 +416,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -429,7 +429,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -437,19 +437,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
*(BufferPtr++) = Dataflash_ReceiveByte();
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
@@ -464,7 +464,7 @@ void DataflashManager_ResetDataflashProtections(void)
/* Select first Dataflash chip, send the read status register command */
Dataflash_SelectChip(DATAFLASH_CHIP1);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -476,12 +476,12 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
-
+
/* Select second Dataflash chip (if present on selected board), send read status register command */
#if (DATAFLASH_TOTALCHIPS == 2)
Dataflash_SelectChip(DATAFLASH_CHIP2);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -494,7 +494,7 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
#endif
-
+
/* Deselect current Dataflash chip */
Dataflash_DeselectChip();
}
@@ -528,6 +528,7 @@ bool DataflashManager_CheckDataflashOperation(void)
if (ReturnByte != DF_MANUFACTURER_ATMEL)
return false;
#endif
-
+
return true;
}
+
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h
index d5a9fd5b0..6ccc5dfe1 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/DataflashManager.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,13 +32,13 @@
*
* Header file for DataflashManager.c.
*/
-
+
#ifndef _DATAFLASH_MANAGER_H_
#define _DATAFLASH_MANAGER_H_
/* Includes: */
#include <avr/io.h>
-
+
#include "MassStorageKeyboard.h"
#include "Descriptors.h"
@@ -59,16 +59,16 @@
* storage media (Dataflash) using a different native block size.
*/
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
-
+
/** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. */
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
-
+
/** Total number of logical drives within the device - must be non-zero. */
#define TOTAL_LUNS 1
-
+
/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */
#define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS)
-
+
/* Function Prototypes: */
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const uint32_t BlockAddress,
@@ -84,5 +84,6 @@
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
void DataflashManager_ResetDataflashProtections(void);
bool DataflashManager_CheckDataflashOperation(void);
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c
index fed57f7b9..8c31b2b80 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,29 +34,29 @@
* devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
* which wrap around standard SCSI device commands for controlling the actual storage medium.
*/
-
+
#define INCLUDE_FROM_SCSI_C
#include "SCSI.h"
/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
* features and capabilities.
*/
-SCSI_Inquiry_Response_t InquiryData =
+SCSI_Inquiry_Response_t InquiryData =
{
.DeviceType = DEVICE_TYPE_BLOCK,
.PeripheralQualifier = 0,
-
+
.Removable = true,
-
+
.Version = 0,
-
+
.ResponseDataFormat = 2,
.NormACA = false,
.TrmTsk = false,
.AERC = false,
.AdditionalLength = 0x1F,
-
+
.SoftReset = false,
.CmdQue = false,
.Linked = false,
@@ -64,7 +64,7 @@ SCSI_Inquiry_Response_t InquiryData =
.WideBus16Bit = false,
.WideBus32Bit = false,
.RelAddr = false,
-
+
.VendorID = "LUFA",
.ProductID = "Dataflash Disk",
.RevisionID = {'0','.','0','0'},
@@ -96,13 +96,13 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
{
case SCSI_CMD_INQUIRY:
- CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
break;
case SCSI_CMD_READ_CAPACITY_10:
- CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
@@ -134,7 +134,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
SCSI_ASENSEQ_NO_QUALIFIER);
-
+
return true;
}
@@ -165,11 +165,11 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
-
+
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
-
+
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
@@ -178,7 +178,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-
+
return true;
}
@@ -193,7 +193,7 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
{
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
-
+
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
@@ -221,10 +221,10 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_ClearIN();
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
-
+
return true;
}
@@ -248,21 +248,21 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
return false;
}
-
+
/* Check to see if all attached Dataflash ICs are functional */
if (!(DataflashManager_CheckDataflashOperation()))
{
/* Update SENSE key with a hardware error condition and return command fail */
SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
return false;
}
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-
+
return true;
}
@@ -280,13 +280,13 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
{
uint32_t BlockAddress;
uint16_t TotalBlocks;
-
+
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
/* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
-
+
/* Check if the block address is outside the maximum allowable value for the LUN */
if (BlockAddress >= LUN_MEDIA_BLOCKS)
{
@@ -302,7 +302,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Adjust the given block address to the real media address based on the selected LUN */
BlockAddress += ((uint32_t)MSInterfaceInfo->State.CommandBlock.LUN * LUN_MEDIA_BLOCKS);
#endif
-
+
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ)
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
@@ -311,6 +311,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
+
return true;
}
+
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h
index f39134d35..b2dd70feb 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/Lib/SCSI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for SCSI.c.
*/
-
+
#ifndef _SCSI_H_
#define _SCSI_H_
@@ -46,7 +46,7 @@
#include "MassStorageKeyboard.h"
#include "Descriptors.h"
#include "DataflashManager.h"
-
+
/* Macros: */
/** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
* is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
@@ -68,13 +68,13 @@
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
#define DEVICE_TYPE_BLOCK 0x00
-
+
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
#define DEVICE_TYPE_CDROM 0x05
-
+
/* Function Prototypes: */
bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
-
+
#if defined(INCLUDE_FROM_SCSI_C)
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
@@ -83,5 +83,6 @@
static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const bool IsDataRead);
#endif
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
index e5dbfb675..e71bffa7a 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Matthias Hullin (lufa [at] matthias [dot] hullin [dot] net)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
*/
#include "MassStorageKeyboard.h"
-
+
/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
* passed to all Mass Storage Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
@@ -160,11 +160,11 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
bool CommandSuccess;
-
+
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
+
return CommandSuccess;
}
@@ -191,7 +191,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
uint16_t* const ReportSize)
{
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
-
+
uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
@@ -209,10 +209,10 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (JoyStatus_LCL & JOY_PRESS)
KeyboardReport->KeyCode[0] = 0x08; // E
-
+
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
KeyboardReport->KeyCode[0] = 0x09; // F
-
+
*ReportSize = sizeof(USB_KeyboardReport_Data_t);
return false;
}
@@ -236,13 +236,13 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
if (*LEDReport & HID_KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
-
+
if (*LEDReport & HID_KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
if (*LEDReport & HID_KEYBOARD_LED_SCROLLLOCK)
LEDMask |= LEDS_LED4;
-
+
LEDs_SetAllLEDs(LEDMask);
}
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
index 482969b93..43e04d0b1 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Matthias Hullin (lufa [at] matthias [dot] hullin [dot] net)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -58,7 +58,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/USB/Class/Device/HID.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -74,7 +74,7 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* Function Prototypes: */
void SetupHardware(void);
@@ -92,9 +92,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif
+
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt
index 2a579c8c7..f93a5ff49 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Combined Mass Storage and Keyboard Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -29,7 +29,7 @@
* <td>Mass Storage Device \n
* Human Interface Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclasses:</b></td>
* <td>Bulk-Only Transport \n
* Keyboard Subclass</td>
@@ -49,24 +49,24 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Combined Mass Storage and Keyboard demonstration application. This gives a
* simple reference application for implementing a dual class USB Mass Storage
* and USB HID Keyboard device using the basic USB UFI and HID drivers in all
* modern OSes (i.e. no special drivers required).
- *
+ *
* On start-up the system will automatically enumerate and function as an
* external mass storage device (which may be formatted and used in the same
* manner as commercial USB Mass Storage devices) and a USB keyboard.
- *
+ *
* You will need to format the mass storage drive upon first run of this
* demonstration - as the device acts only as a data block transport between
* the host and the storage media, it does not matter what file system is used,
* as the data interpretation is performed by the host and not the USB device.
*
* Keys on the USB keyboard can be pressed by moving the board's Joystick.
- *
+ *
* The USB control endpoint is managed entirely by the library using endpoint
* interrupts, as the INTERRUPT_CONTROL_ENDPOINT option is enabled. This allows for
* the host to reset the Mass Storage device state during long transfers without
@@ -90,3 +90,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/makefile b/Demos/Device/ClassDriver/MassStorageKeyboard/makefile
index 09c480620..bdc0a9b64 100644
--- a/Demos/Device/ClassDriver/MassStorageKeyboard/makefile
+++ b/Demos/Device/ClassDriver/MassStorageKeyboard/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -138,7 +138,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -151,7 +151,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -265,7 +265,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -278,7 +278,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -290,7 +290,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -302,7 +302,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -325,7 +325,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -359,7 +359,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -393,7 +393,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -422,7 +422,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -441,10 +441,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -509,11 +509,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -540,9 +540,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -640,14 +640,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -669,7 +669,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -713,3 +713,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/Mouse/Descriptors.c b/Demos/Device/ClassDriver/Mouse/Descriptors.c
index 02066ba93..866ba272f 100644
--- a/Demos/Device/ClassDriver/Mouse/Descriptors.c
+++ b/Demos/Device/ClassDriver/Mouse/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -81,22 +81,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2041,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -107,38 +107,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = HID_BOOTP_MouseBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_MouseHID =
+ .HID_MouseHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
@@ -149,7 +149,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(MouseReport)
},
- .HID_ReportINEndpoint =
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -178,7 +178,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -189,7 +189,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(15), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Mouse Demo"
};
@@ -235,19 +235,19 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case HID_DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_MouseHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case HID_DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &MouseReport;
Size = sizeof(MouseReport);
break;
}
-
- *DescriptorAddress = Address;
+
+ *DescriptorAddress = Address;
return Size;
}
diff --git a/Demos/Device/ClassDriver/Mouse/Descriptors.h b/Demos/Device/ClassDriver/Mouse/Descriptors.h
index f482a6946..243c88d35 100644
--- a/Demos/Device/ClassDriver/Mouse/Descriptors.h
+++ b/Demos/Device/ClassDriver/Mouse/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -54,11 +54,11 @@
USB_HID_Descriptor_HID_t HID_MouseHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPNUM 1
-
+
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
@@ -69,3 +69,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c
index aabd96138..ac6a91259 100644
--- a/Demos/Device/ClassDriver/Mouse/Mouse.c
+++ b/Demos/Device/ClassDriver/Mouse/Mouse.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -62,9 +62,9 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
* setup of all components and the main program loop.
*/
int main(void)
-{
+{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -145,7 +145,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
uint16_t* const ReportSize)
{
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
-
+
uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
@@ -161,10 +161,10 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (JoyStatus_LCL & JOY_PRESS)
MouseReport->Button |= (1 << 0);
-
+
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
MouseReport->Button |= (1 << 1);
-
+
*ReportSize = sizeof(USB_MouseReport_Data_t);
return true;
}
@@ -185,3 +185,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
}
+
diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.h b/Demos/Device/ClassDriver/Mouse/Mouse.h
index 48b129100..602783718 100644
--- a/Demos/Device/ClassDriver/Mouse/Mouse.h
+++ b/Demos/Device/ClassDriver/Mouse/Mouse.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -44,7 +44,7 @@
#include <avr/interrupt.h>
#include <stdbool.h>
#include <string.h>
-
+
#include "Descriptors.h"
#include <LUFA/Version.h>
@@ -53,7 +53,7 @@
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -66,7 +66,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
@@ -82,9 +82,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif
+
diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.txt b/Demos/Device/ClassDriver/Mouse/Mouse.txt
index 36f566f57..8f299283a 100644
--- a/Demos/Device/ClassDriver/Mouse/Mouse.txt
+++ b/Demos/Device/ClassDriver/Mouse/Mouse.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mouse Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Mouse Subclass</td>
* </tr>
@@ -44,14 +44,14 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mouse demonstration application. This gives a simple reference
* application for implementing a USB Mouse using the basic USB HID
* drivers in all modern OSes (i.e. no special drivers required). It is
* boot protocol compatible, and thus works under compatible BIOS as if
* it was a native mouse (e.g. PS/2).
- *
+ *
* On start-up the system will automatically enumerate and function
* as a mouse when the USB connection to a host is present. To use
* the mouse, move the joystick to move the pointer, and push the
@@ -70,3 +70,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/Mouse/makefile b/Demos/Device/ClassDriver/Mouse/makefile
index 9fab31078..76e6d7dfc 100644
--- a/Demos/Device/ClassDriver/Mouse/makefile
+++ b/Demos/Device/ClassDriver/Mouse/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c
index 2eaa1eb5b..33f1dfe93 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,11 +30,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
-
+
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x02,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204C,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,102 +71,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0xFF,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x00,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0x02
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .RNDIS_DataOutEndpoint =
+ .RNDIS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .RNDIS_DataInEndpoint =
+
+ .RNDIS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -181,7 +181,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -192,7 +192,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -203,7 +203,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(19), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA RNDIS CDC Demo"
};
@@ -229,7 +229,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
@@ -249,10 +249,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h
index 26bd57127..7f67bc09b 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/RNDIS.h>
-
+
#include <avr/pgmspace.h>
/* Macros: */
@@ -47,10 +47,10 @@
#define CDC_NOTIFICATION_EPNUM 3
/** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 1
+ #define CDC_TX_EPNUM 1
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 2
+ #define CDC_RX_EPNUM 2
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
@@ -83,3 +83,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.c
index 18da19cdb..fe6c5bef2 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* conversion of physical MAC addresses to protocol IP addresses between the host and the
* device.
*/
-
+
#include "ARP.h"
/** Processes an ARP packet inside an Ethernet frame, and writes the appropriate response
@@ -59,7 +59,7 @@ int16_t ARP_ProcessARPPacket(void* InDataStart,
(SwapEndian_16(ARPHeaderIN->Operation) == ARP_OPERATION_REQUEST))
{
/* If the ARP packet is requesting the MAC or IP of the virtual webserver, return the response */
- if (IP_COMPARE(&ARPHeaderIN->TPA, &ServerIPAddress) ||
+ if (IP_COMPARE(&ARPHeaderIN->TPA, &ServerIPAddress) ||
MAC_COMPARE(&ARPHeaderIN->THA, &ServerMACAddress))
{
/* Fill out the ARP response header */
@@ -81,6 +81,7 @@ int16_t ARP_ProcessARPPacket(void* InDataStart,
return sizeof(ARP_Header_t);
}
}
-
+
return NO_RESPONSE;
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.h
index 8de76f3b6..d97761539 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ARP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,18 +32,18 @@
*
* Header file for ARP.c.
*/
-
+
#ifndef _ARP_H_
#define _ARP_H_
/* Includes: */
#include <avr/io.h>
#include <string.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
-
+
/* Macros: */
/** ARP header operation constant, indicating a request from a host for an address translation. */
#define ARP_OPERATION_REQUEST 1
@@ -57,19 +57,20 @@
{
uint16_t HardwareType; /**< Hardware type constant, indicating the hardware used */
uint16_t ProtocolType; /**< Protocol being resolved, usually ETHERTYPE_IPV4 */
-
+
uint8_t HLEN; /**< Length in bytes of the source/destination hardware addresses */
uint8_t PLEN; /**< Length in bytes of the source/destination protocol addresses */
uint16_t Operation; /**< Type of operation, either ARP_OPERATION_REQUEST or ARP_OPERATION_REPLY */
-
+
MAC_Address_t SHA; /**< Sender's hardware address */
IP_Address_t SPA; /**< Sender's protocol address */
MAC_Address_t THA; /**< Target's hardware address */
IP_Address_t TPA; /**< Target's protocol address */
} ARP_Header_t;
-
+
/* Function Prototypes: */
int16_t ARP_ProcessARPPacket(void* InDataStart,
void* OutDataStart);
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c
index f694f2c81..18ad6a5e9 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* handles the automatic IP negotiation to the host, so that the host will use the provided
* IP address given to it by the device.
*/
-
+
#include "DHCP.h"
/** Processes a DHCP packet inside an Ethernet frame, and writes the appropriate response
@@ -53,7 +53,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
IP_Header_t* IPHeaderIN = (IP_Header_t*)IPHeaderInStart;
DHCP_Header_t* DHCPHeaderIN = (DHCP_Header_t*)DHCPHeaderInStart;
DHCP_Header_t* DHCPHeaderOUT = (DHCP_Header_t*)DHCPHeaderOutStart;
-
+
uint8_t* DHCPOptionsINStart = (uint8_t*)(DHCPHeaderInStart + sizeof(DHCP_Header_t));
uint8_t* DHCPOptionsOUTStart = (uint8_t*)(DHCPHeaderOutStart + sizeof(DHCP_Header_t));
@@ -73,7 +73,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
DHCPHeaderOUT->YourIP = ClientIPAddress;
memmove(&DHCPHeaderOUT->ClientHardwareAddress, &DHCPHeaderIN->ClientHardwareAddress, sizeof(MAC_Address_t));
DHCPHeaderOUT->Cookie = SwapEndian_32(DHCP_MAGIC_COOKIE);
-
+
/* Alter the incoming IP packet header so that the corrected IP source and destinations are used - this means that
when the response IP header is generated, it will use the corrected addresses and not the null/broatcast addresses */
IPHeaderIN->SourceAddress = ClientIPAddress;
@@ -81,7 +81,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
/* Process the incoming DHCP packet options */
while (DHCPOptionsINStart[0] != DHCP_OPTION_END)
- {
+ {
/* Find the Message Type DHCP option, to determine the type of DHCP packet */
if (DHCPOptionsINStart[0] == DHCP_OPTION_MESSAGETYPE)
{
@@ -107,14 +107,15 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
DHCPOptionsOUTStart += sizeof(IP_Address_t);
*(DHCPOptionsOUTStart++) = DHCP_OPTION_END;
-
+
return (sizeof(DHCP_Header_t) + 12 + sizeof(IP_Address_t));
}
}
-
+
/* Go to the next DHCP option - skip one byte if option is a padding byte, else skip the complete option's size */
DHCPOptionsINStart += ((DHCPOptionsINStart[0] == DHCP_OPTION_PAD) ? 1 : (DHCPOptionsINStart[1] + 2));
}
-
+
return NO_RESPONSE;
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h
index 3bfdb29be..a4dc00dbb 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/DHCP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,14 +32,14 @@
*
* Header file for DHCP.c.
*/
-
+
#ifndef _DHCP_H_
#define _DHCP_H_
/* Includes: */
#include <avr/io.h>
#include <string.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
@@ -50,13 +50,13 @@
/** DHCP operation constant, indicating a reply from a DHCP server to a host. */
#define DHCP_OP_BOOTREPLY 0x02
-
+
/** Hardware type constant, indicating Ethernet as a carrier. */
#define DHCP_HTYPE_ETHERNET 0x01
-
+
/** Magic boot protocol "cookie", inserted into all BOOTP packets (BOOTP is the carrier of DHCP). */
#define DHCP_MAGIC_COOKIE 0x63825363
-
+
/** DHCP option list entry header, indicating that a subnet mask will follow. */
#define DHCP_OPTION_SUBNETMASK 1
@@ -71,7 +71,7 @@
/** DHCP option list entry header, indicating the end of option data. */
#define DHCP_OPTION_END 255
-
+
/** Message type constant, used in the DHCP option data field, requesting that a DHCP server offer an IP address. */
#define DHCP_MESSAGETYPE_DISCOVER 1
@@ -106,16 +106,16 @@
uint16_t ElapsedSeconds; /**< Elapsed seconds since the request was made */
uint16_t Flags; /**< BOOTP packet flags */
-
+
IP_Address_t ClientIP; /**< Client IP address, if already leased an IP */
IP_Address_t YourIP; /**< Client IP address */
IP_Address_t NextServerIP; /**< Legacy BOOTP protocol field, unused for DHCP */
IP_Address_t RelayAgentIP; /**< Legacy BOOTP protocol field, unused for DHCP */
-
+
uint8_t ClientHardwareAddress[16]; /**< Hardware (MAC) address of the client making a request to the DHCP server */
uint8_t ServerHostnameString[64]; /**< Legacy BOOTP protocol field, unused for DHCP */
uint8_t BootFileName[128]; /**< Legacy BOOTP protocol field, unused for DHCP */
-
+
uint32_t Cookie; /**< Magic BOOTP protocol cookie to indicate a valid packet */
} DHCP_Header_t;
@@ -125,3 +125,4 @@
void* DHCPHeaderOutStart);
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c
index 899b81f7e..687efe0c1 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* frames sent and received, deferring the processing of sub-packet protocols to the appropriate
* protocol handlers, such as DHCP or ARP.
*/
-
+
#include "Ethernet.h"
/** Constant for convenience when checking against or setting a MAC address to the virtual server MAC address. */
@@ -64,9 +64,9 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN,
/* Cast the incoming Ethernet frame to the Ethernet header type */
Ethernet_Frame_Header_t* FrameINHeader = (Ethernet_Frame_Header_t*)&FrameIN->FrameData;
Ethernet_Frame_Header_t* FrameOUTHeader = (Ethernet_Frame_Header_t*)&FrameOUT->FrameData;
-
+
int16_t RetSize = NO_RESPONSE;
-
+
/* Ensure frame is addressed to either all (broadcast) or the virtual webserver, and is a type II frame */
if ((MAC_COMPARE(&FrameINHeader->Destination, &ServerMACAddress) ||
MAC_COMPARE(&FrameINHeader->Destination, &BroadcastMACAddress)) &&
@@ -78,14 +78,14 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN,
case ETHERTYPE_ARP:
RetSize = ARP_ProcessARPPacket(&FrameIN->FrameData[sizeof(Ethernet_Frame_Header_t)],
&FrameOUT->FrameData[sizeof(Ethernet_Frame_Header_t)]);
- break;
+ break;
case ETHERTYPE_IPV4:
RetSize = IP_ProcessIPPacket(FrameIN,
&FrameIN->FrameData[sizeof(Ethernet_Frame_Header_t)],
&FrameOUT->FrameData[sizeof(Ethernet_Frame_Header_t)]);
break;
}
-
+
/* Protocol processing routine has filled a response, complete the ethernet frame header */
if (RetSize > 0)
{
@@ -93,7 +93,7 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN,
FrameOUTHeader->Source = ServerMACAddress;
FrameOUTHeader->Destination = FrameINHeader->Source;
FrameOUTHeader->EtherType = FrameINHeader->EtherType;
-
+
/* Set the response length in the buffer and indicate that a response is ready to be sent */
FrameOUT->FrameLength = (sizeof(Ethernet_Frame_Header_t) + RetSize);
FrameOUT->FrameInBuffer = true;
@@ -124,9 +124,10 @@ uint16_t Ethernet_Checksum16(void* Data,
for (uint16_t CurrWord = 0; CurrWord < (Bytes >> 1); CurrWord++)
Checksum += Words[CurrWord];
-
+
while (Checksum & 0xFFFF0000)
Checksum = ((Checksum & 0xFFFF) + (Checksum >> 16));
-
+
return ~Checksum;
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h
index 233f48d1b..cd2cd8b4d 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,14 +32,14 @@
*
* Header file for Ethernet.c.
*/
-
+
#ifndef _ETHERNET_H_
#define _ETHERNET_H_
/* Includes: */
#include <avr/io.h>
#include <string.h>
-
+
#include <LUFA/Drivers/USB/Class/RNDIS.h>
#include "EthernetProtocols.h"
@@ -50,31 +50,31 @@
#include "DHCP.h"
#include "ARP.h"
#include "IP.h"
-
+
/* Macros: */
/** Physical MAC address of the USB RNDIS network adapter. */
#define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00}
/** Physical MAC address of the virtual server on the network. */
- #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01}
+ #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01}
/** Physical MAC address of the network broadcast address. */
#define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
-
+
/** Performs a comparison between two MAC addresses, indicating if they are identical.
- *
+ *
* \param[in] MAC1 First MAC address
* \param[in] MAC2 Second MAC address
*
* \return True if the addresses match, false otherwise
*/
#define MAC_COMPARE(MAC1, MAC2) (memcmp(MAC1, MAC2, sizeof(MAC_Address_t)) == 0)
-
+
/** Minimum size of an Ethernet packet in bytes, to conform to the Ethernet V2 packet standard. */
#define ETHERNET_VER2_MINSIZE 0x0600
/** Return value for all sub protocol handling routines, indicating that no response packet has been generated. */
- #define NO_RESPONSE 0
+ #define NO_RESPONSE 0
/** Return value for all sub protocol handling routines, indicating that the packet has not yet been handled. */
#define NO_PROCESS -1
@@ -87,18 +87,19 @@
MAC_Address_t Source; /**< Physics MAC address of the packet source */
uint16_t EtherType; /**< Ethernet packet sub-protocol type, for Ethernet V2 packets */
} Ethernet_Frame_Header_t;
-
+
/* External Variables: */
extern const MAC_Address_t ServerMACAddress;
extern const IP_Address_t ServerIPAddress;
extern const MAC_Address_t BroadcastMACAddress;
extern const IP_Address_t BroadcastIPAddress;
extern const IP_Address_t ClientIPAddress;
-
+
/* Function Prototypes: */
void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN,
Ethernet_Frame_Info_t* const FrameOUT);
uint16_t Ethernet_Checksum16(void* Data,
uint16_t Bytes);
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h
index d5c93c695..2b0a71d01 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -63,7 +63,7 @@
#define ETHERTYPE_FIBRECHANNEL 0x8906
#define ETHERTYPE_QINQ 0x9100
#define ETHERTYPE_VLLT 0xCAFE
-
+
#define PROTOCOL_ICMP 1
#define PROTOCOL_IGMP 2
#define PROTOCOL_TCP 6
@@ -71,7 +71,7 @@
#define PROTOCOL_OSPF 89
#define PROTOCOL_SCTP 132
- /* Type Defines: */
+ /* Type Defines: */
/** Type define for a protocol IP address of a device on a network. */
typedef struct
{
@@ -79,3 +79,4 @@
} IP_Address_t;
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.c
index fec74b37b..11a09afb9 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* Echo requests from the host, to indicate a successful network connection between the host
* and the virtual server.
*/
-
+
#include "ICMP.h"
/** Processes an ICMP packet inside an Ethernet frame, and writes the appropriate response
@@ -64,9 +64,9 @@ int16_t ICMP_ProcessICMPPacket(Ethernet_Frame_Info_t* const FrameIN,
ICMPHeaderOUT->Checksum = 0;
ICMPHeaderOUT->Id = ICMPHeaderIN->Id;
ICMPHeaderOUT->Sequence = ICMPHeaderIN->Sequence;
-
+
intptr_t DataSize = FrameIN->FrameLength - ((((intptr_t)InDataStart + sizeof(ICMP_Header_t)) - (intptr_t)FrameIN->FrameData));
-
+
/* Copy the remaining payload to the response - echo requests should echo back any sent data */
memmove(&((uint8_t*)OutDataStart)[sizeof(ICMP_Header_t)],
&((uint8_t*)InDataStart)[sizeof(ICMP_Header_t)],
@@ -77,6 +77,7 @@ int16_t ICMP_ProcessICMPPacket(Ethernet_Frame_Info_t* const FrameIN,
/* Return the size of the response so far */
return (DataSize + sizeof(ICMP_Header_t));
}
-
+
return NO_RESPONSE;
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.h
index 9982560b1..26cd7cd1c 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ICMP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,18 +39,18 @@
/* Includes: */
#include <avr/io.h>
#include <string.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
-
+
/* Macros: */
/** ICMP message type constant, indicating an ICMP ECHO Reply message. */
#define ICMP_TYPE_ECHOREPLY 0
/** ICMP message type constant, indicating a packet destination is unreachable. */
#define ICMP_TYPE_DESTINATIONUNREACHABLE 3
-
+
/** ICMP message type constant, indicating an ICMP Source Quench message. */
#define ICMP_TYPE_SOURCEQUENCH 4
@@ -62,7 +62,7 @@
/** ICMP message type constant, indicating an ICMP Time Exceeded message. */
#define ICMP_TYPE_TIMEEXCEEDED 11
-
+
/* Type Defines: */
/** Type define for an ICMP message header. */
typedef struct
@@ -73,10 +73,11 @@
uint16_t Id; /**< Id of the ICMP message */
uint16_t Sequence; /**< Sequence number of the ICMP message, to link together message responses */
} ICMP_Header_t;
-
+
/* Function Prototypes: */
int16_t ICMP_ProcessICMPPacket(Ethernet_Frame_Info_t* const FrameIN,
void* InDataStart,
void* OutDataStart);
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.c
index 6f49eac88..5a2285c6d 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Internet Protocol (IP) packet handling routines. This protocol handles IP packets from the
* host which typically encapsulate other protocols such as ICMP, UDP and TCP.
*/
-
+
#include "IP.h"
/** Processes an IP packet inside an Ethernet frame, and writes the appropriate response
@@ -67,7 +67,7 @@ int16_t IP_ProcessIPPacket(Ethernet_Frame_Info_t* const FrameIN,
{
return NO_RESPONSE;
}
-
+
/* Pass off the IP payload to the appropriate protocol processing routine */
switch (IPHeaderIN->Protocol)
{
@@ -79,15 +79,15 @@ int16_t IP_ProcessIPPacket(Ethernet_Frame_Info_t* const FrameIN,
case PROTOCOL_TCP:
RetSize = TCP_ProcessTCPPacket(InDataStart,
&((uint8_t*)InDataStart)[HeaderLengthBytes],
- &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
+ &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
break;
case PROTOCOL_UDP:
RetSize = UDP_ProcessUDPPacket(InDataStart,
&((uint8_t*)InDataStart)[HeaderLengthBytes],
- &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
+ &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
break;
}
-
+
/* Check to see if the protocol processing routine has filled out a response */
if (RetSize > 0)
{
@@ -104,12 +104,13 @@ int16_t IP_ProcessIPPacket(Ethernet_Frame_Info_t* const FrameIN,
IPHeaderOUT->TTL = DEFAULT_TTL;
IPHeaderOUT->SourceAddress = IPHeaderIN->DestinationAddress;
IPHeaderOUT->DestinationAddress = IPHeaderIN->SourceAddress;
-
+
IPHeaderOUT->HeaderChecksum = Ethernet_Checksum16(IPHeaderOUT, sizeof(IP_Header_t));
-
+
/* Return the size of the response so far */
return (sizeof(IP_Header_t) + RetSize);
}
-
+
return RetSize;
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h
index 215695756..da9dc1549 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/IP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,18 +32,18 @@
*
* Header file for IP.c.
*/
-
+
#ifndef _IP_H_
#define _IP_H_
/* Includes: */
#include <avr/io.h>
#include <string.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
-
+
/* Macros: */
/** Protocol IP address of the host (client) machine, once assigned by DHCP. */
#define CLIENT_IP_ADDRESS { 10, 0, 0, 1}
@@ -58,16 +58,16 @@
* is reached.
*/
#define DEFAULT_TTL 128
-
+
/** Performs a comparison between two IP addresses, indicating if they are identical.
- *
+ *
* \param[in] IP1 First IP address
* \param[in] IP2 Second IP address
*
* \return True if the addresses match, false otherwise
*/
#define IP_COMPARE(IP1, IP2) (memcmp(IP1, IP2, sizeof(IP_Address_t)) == 0)
-
+
/* Type Defines: */
/** Type define of an IP packet header. */
typedef struct
@@ -84,14 +84,15 @@
uint8_t TTL; /**< Maximum allowable number of hops to reach the packet destination */
uint8_t Protocol; /**< Encapsulated protocol type */
uint16_t HeaderChecksum; /**< Ethernet checksum of the IP header */
-
+
IP_Address_t SourceAddress; /**< Source protocol IP address of the packet */
IP_Address_t DestinationAddress; /**< Destination protocol IP address of the packet */
} IP_Header_t;
-
+
/* Function Prototypes: */
int16_t IP_ProcessIPPacket(Ethernet_Frame_Info_t* const FrameIN,
void* InDataStart,
void* OutDataStart);
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c
index 676bf7a94..99e3ab46b 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -31,7 +31,7 @@
/* Protocol decoders for Ethernet, TCP, IP, ICMP and ARP. Each of these routines
accepts a header to the appropriate protocol and prints out pertinent information
on the packet through the serial port.
-
+
To disable printing of a specific protocol, define the token NO_DECODE_{Protocol}
in the project makefile, and pass it to the compiler using the -D switch.
*/
@@ -46,7 +46,7 @@
* Packet decoding routines can be disabled by defining NO_DECODE_{Protocol Name} in the project makefile
* and passing it to the compiler via the -D switch.
*/
-
+
#include "ProtocolDecoders.h"
/** Decodes an Ethernet frame header and prints its contents to through the USART in a human readable format.
@@ -57,9 +57,9 @@ void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* const FrameINData)
{
#if !defined(NO_DECODE_ETHERNET)
Ethernet_Frame_Header_t* FrameHeader = (Ethernet_Frame_Header_t*)FrameINData->FrameData;
-
+
printf_P(PSTR("\r\n"));
-
+
printf_P(PSTR(" ETHERNET\r\n"));
printf_P(PSTR(" + Frame Size: %u\r\n"), FrameINData->FrameLength);
@@ -98,7 +98,7 @@ void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* const FrameINData)
void DecodeARPHeader(void* InDataStart)
{
#if !defined(NO_DECODE_ARP)
- ARP_Header_t* ARPHeader = (ARP_Header_t*)InDataStart;
+ ARP_Header_t* ARPHeader = (ARP_Header_t*)InDataStart;
printf_P(PSTR(" \\\r\n ARP\r\n"));
@@ -106,12 +106,12 @@ void DecodeARPHeader(void* InDataStart)
!(MAC_COMPARE(&ARPHeader->THA, &ServerMACAddress)))
{
printf_P(PSTR(" + NOT ADDRESSED TO DEVICE\r\n"));
- return;
+ return;
}
printf_P(PSTR(" + Protocol: %x\r\n"), SwapEndian_16(ARPHeader->ProtocolType));
printf_P(PSTR(" + Operation: %u\r\n"), SwapEndian_16(ARPHeader->Operation));
-
+
if (SwapEndian_16(ARPHeader->ProtocolType) == ETHERTYPE_IPV4)
{
printf_P(PSTR(" + SHA MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n"), ARPHeader->SHA.Octets[0],
@@ -163,14 +163,14 @@ void DecodeIPHeader(void* InDataStart)
printf_P(PSTR(" + Header Length: %u Bytes\r\n"), HeaderLengthBytes);
printf_P(PSTR(" + Packet Version: %u\r\n"), IPHeader->Version);
printf_P(PSTR(" + Total Length: %u\r\n"), SwapEndian_16(IPHeader->TotalLength));
-
+
printf_P(PSTR(" + Protocol: %u\r\n"), IPHeader->Protocol);
printf_P(PSTR(" + TTL: %u\r\n"), IPHeader->TTL);
-
+
printf_P(PSTR(" + IP Src: %u.%u.%u.%u\r\n"), IPHeader->SourceAddress.Octets[0],
IPHeader->SourceAddress.Octets[1],
IPHeader->SourceAddress.Octets[2],
- IPHeader->SourceAddress.Octets[3]);
+ IPHeader->SourceAddress.Octets[3]);
printf_P(PSTR(" + IP Dst: %u.%u.%u.%u\r\n"), IPHeader->DestinationAddress.Octets[0],
IPHeader->DestinationAddress.Octets[1],
@@ -215,9 +215,9 @@ void DecodeTCPHeader(void* InDataStart)
printf_P(PSTR(" + Sequence Number: %lu\r\n"), SwapEndian_32(TCPHeader->SequenceNumber));
printf_P(PSTR(" + Acknowledgment Number: %lu\r\n"), SwapEndian_32(TCPHeader->AcknowledgmentNumber));
-
+
printf_P(PSTR(" + Flags: 0x%02X\r\n"), TCPHeader->Flags);
-
+
if (TCP_GetPortState(TCPHeader->DestinationPort) == TCP_Port_Closed)
printf_P(PSTR(" + NOT LISTENING ON DESTINATION PORT\r\n"));
#endif
@@ -272,9 +272,10 @@ void DecodeDHCPHeader(void* InDataStart)
break;
}
}
-
+
DHCPOptions += ((DHCPOptions[0] == DHCP_OPTION_PAD) ? 1 : (DHCPOptions[1] + 2));
}
#endif
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h
index c1d3b395d..572fdeb82 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,13 +40,13 @@
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <stdio.h>
-
+
#include <LUFA/Drivers/USB/Class/RNDIS.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
-
+
/* Function Prototypes: */
void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* const FrameINData);
void DecodeARPHeader(void* InDataStart);
@@ -57,3 +57,4 @@
void DecodeDHCPHeader(void* InDataStart);
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c
index 5889c45b3..dda9883ea 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* and reception of packets to and from devices on a network, to "ports" on the device. It is used in situations where data
* delivery must be reliable and correct, e.g. HTTP, TELNET and most other non-streaming protocols.
*/
-
+
#define INCLUDE_FROM_TCP_C
#include "TCP.h"
@@ -64,7 +64,7 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
for (uint8_t PTableEntry = 0; PTableEntry < MAX_OPEN_TCP_PORTS; PTableEntry++)
{
/* Run the application handler for the port */
- if ((PortStateTable[PTableEntry].Port == ConnectionStateTable[CSTableEntry].Port) &&
+ if ((PortStateTable[PTableEntry].Port == ConnectionStateTable[CSTableEntry].Port) &&
(PortStateTable[PTableEntry].State == TCP_Port_Open))
{
PortStateTable[PTableEntry].ApplicationHandler(&ConnectionStateTable[CSTableEntry],
@@ -72,14 +72,14 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
}
}
}
-
+
/* Get pointer to the output frame info struct for convenience */
Ethernet_Frame_Info_t* FrameOUT = &RNDISInterfaceInfo->State.FrameOUT;
-
+
/* Bail out early if there is already a frame waiting to be sent in the Ethernet OUT buffer */
if (FrameOUT->FrameInBuffer)
return;
-
+
/* Send response packets from each application as the TCP packet buffers are filled by the applications */
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
{
@@ -111,7 +111,7 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
TCPHeaderOUT->Reserved = 0;
memcpy(TCPDataOUT, ConnectionStateTable[CSTableEntry].Info.Buffer.Data, PacketSize);
-
+
ConnectionStateTable[CSTableEntry].Info.SequenceNumberOut += PacketSize;
TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, ServerIPAddress,
@@ -133,11 +133,11 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
IPHeaderOUT->TTL = DEFAULT_TTL;
IPHeaderOUT->SourceAddress = ServerIPAddress;
IPHeaderOUT->DestinationAddress = ConnectionStateTable[CSTableEntry].RemoteAddress;
-
+
IPHeaderOUT->HeaderChecksum = Ethernet_Checksum16(IPHeaderOUT, sizeof(IP_Header_t));
-
+
PacketSize += sizeof(IP_Header_t);
-
+
/* Fill out the response Ethernet frame header */
FrameOUTHeader->Source = ServerMACAddress;
FrameOUTHeader->Destination = (MAC_Address_t){{0x02, 0x00, 0x02, 0x00, 0x02, 0x00}};
@@ -148,9 +148,9 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
/* Set the response length in the buffer and indicate that a response is ready to be sent */
FrameOUT->FrameLength = PacketSize;
FrameOUT->FrameInBuffer = true;
-
+
ConnectionStateTable[CSTableEntry].Info.Buffer.Ready = false;
-
+
break;
}
}
@@ -210,7 +210,7 @@ bool TCP_SetPortState(const uint16_t Port,
return true;
}
}
-
+
/* Port not in table and no room to add it, return failure */
return false;
}
@@ -237,7 +237,7 @@ uint8_t TCP_GetPortState(const uint16_t Port)
if (PortStateTable[PTableEntry].Port == Port)
return PortStateTable[PTableEntry].State;
}
-
+
/* Port not in table, assume closed */
return TCP_Port_Closed;
}
@@ -270,20 +270,20 @@ bool TCP_SetConnectionState(const uint16_t Port,
return true;
}
}
-
+
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
{
/* Find empty entry in the table */
if (ConnectionStateTable[CSTableEntry].State == TCP_Connection_Closed)
{
ConnectionStateTable[CSTableEntry].Port = Port;
- ConnectionStateTable[CSTableEntry].RemoteAddress = RemoteAddress;
+ ConnectionStateTable[CSTableEntry].RemoteAddress = RemoteAddress;
ConnectionStateTable[CSTableEntry].RemotePort = RemotePort;
ConnectionStateTable[CSTableEntry].State = State;
return true;
}
}
-
+
return false;
}
@@ -307,12 +307,12 @@ uint8_t TCP_GetConnectionState(const uint16_t Port,
if ((ConnectionStateTable[CSTableEntry].Port == Port) &&
IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, &RemoteAddress) &&
ConnectionStateTable[CSTableEntry].RemotePort == RemotePort)
-
+
{
return ConnectionStateTable[CSTableEntry].State;
}
}
-
+
return TCP_Connection_Closed;
}
@@ -340,7 +340,7 @@ TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port,
return &ConnectionStateTable[CSTableEntry].Info;
}
}
-
+
return NULL;
}
@@ -364,11 +364,11 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCP_Header_t* TCPHeaderOUT = (TCP_Header_t*)TCPHeaderOutStart;
TCP_ConnectionInfo_t* ConnectionInfo;
-
+
DecodeTCPHeader(TCPHeaderInStart);
bool PacketResponse = false;
-
+
/* Check if the destination port is open and allows incoming connections */
if (TCP_GetPortState(TCPHeaderIN->DestinationPort) == TCP_Port_Open)
{
@@ -382,8 +382,8 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_Closed))
{
- TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
- PacketResponse = true;
+ TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
+ PacketResponse = true;
}
}
else
@@ -398,7 +398,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_SYNReceived))
{
- TCPHeaderOUT->Flags = (TCP_FLAG_SYN | TCP_FLAG_ACK);
+ TCPHeaderOUT->Flags = (TCP_FLAG_SYN | TCP_FLAG_ACK);
ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort);
@@ -410,10 +410,10 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
{
TCPHeaderOUT->Flags = TCP_FLAG_RST;
}
-
+
PacketResponse = true;
}
-
+
break;
case TCP_Connection_SYNReceived:
if (TCPHeaderIN->Flags == TCP_FLAG_ACK)
@@ -425,19 +425,19 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort);
-
+
ConnectionInfo->SequenceNumberOut++;
}
-
+
break;
case TCP_Connection_Established:
if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK))
{
/* FIN ACK when connected to a peer starts the finalization process */
-
- TCPHeaderOUT->Flags = (TCP_FLAG_FIN | TCP_FLAG_ACK);
+
+ TCPHeaderOUT->Flags = (TCP_FLAG_FIN | TCP_FLAG_ACK);
PacketResponse = true;
-
+
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_CloseWait);
@@ -452,14 +452,14 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort);
- /* Check if the buffer is currently in use either by a buffered data to send, or receive */
+ /* Check if the buffer is currently in use either by a buffered data to send, or receive */
if ((ConnectionInfo->Buffer.InUse == false) && (ConnectionInfo->Buffer.Ready == false))
- {
+ {
ConnectionInfo->Buffer.Direction = TCP_PACKETDIR_IN;
ConnectionInfo->Buffer.InUse = true;
ConnectionInfo->Buffer.Length = 0;
}
-
+
/* Check if the buffer has been claimed by us to read in data from the peer */
if ((ConnectionInfo->Buffer.Direction == TCP_PACKETDIR_IN) &&
(ConnectionInfo->Buffer.Length != TCP_WINDOW_SIZE))
@@ -475,7 +475,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo->SequenceNumberIn += DataLength;
ConnectionInfo->Buffer.Length += DataLength;
-
+
/* Check if the buffer is full or if the PSH flag is set, if so indicate buffer ready */
if ((!(TCP_WINDOW_SIZE - ConnectionInfo->Buffer.Length)) || (TCPHeaderIN->Flags & TCP_FLAG_PSH))
{
@@ -492,7 +492,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
return NO_PROCESS;
}
}
-
+
break;
case TCP_Connection_Closing:
ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
@@ -500,9 +500,9 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCPHeaderOUT->Flags = (TCP_FLAG_ACK | TCP_FLAG_FIN);
PacketResponse = true;
-
+
ConnectionInfo->Buffer.InUse = false;
-
+
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_FINWait1);
@@ -518,7 +518,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo->SequenceNumberIn++;
ConnectionInfo->SequenceNumberOut++;
-
+
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_Closed);
}
@@ -527,7 +527,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_FINWait2);
}
-
+
break;
case TCP_Connection_FINWait2:
if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK))
@@ -540,11 +540,11 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo->SequenceNumberIn++;
ConnectionInfo->SequenceNumberOut++;
-
+
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_Closed);
}
-
+
break;
case TCP_Connection_CloseWait:
if (TCPHeaderIN->Flags == TCP_FLAG_ACK)
@@ -552,7 +552,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_Closed);
}
-
+
break;
}
}
@@ -560,10 +560,10 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
else
{
/* Port is not open, indicate via a RST/ACK response to the sender */
- TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
+ TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
PacketResponse = true;
}
-
+
/* Check if we need to respond to the sent packet */
if (PacketResponse)
{
@@ -575,7 +575,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCPHeaderOUT->SequenceNumber = SwapEndian_32(ConnectionInfo->SequenceNumberOut);
TCPHeaderOUT->AcknowledgmentNumber = SwapEndian_32(ConnectionInfo->SequenceNumberIn);
TCPHeaderOUT->DataOffset = (sizeof(TCP_Header_t) / sizeof(uint32_t));
-
+
if (!(ConnectionInfo->Buffer.InUse))
TCPHeaderOUT->WindowSize = SwapEndian_16(TCP_WINDOW_SIZE);
else
@@ -584,11 +584,11 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCPHeaderOUT->UrgentPointer = 0;
TCPHeaderOUT->Checksum = 0;
TCPHeaderOUT->Reserved = 0;
-
+
TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, IPHeaderIN->DestinationAddress,
- IPHeaderIN->SourceAddress, sizeof(TCP_Header_t));
+ IPHeaderIN->SourceAddress, sizeof(TCP_Header_t));
- return sizeof(TCP_Header_t);
+ return sizeof(TCP_Header_t);
}
return NO_RESPONSE;
@@ -610,10 +610,10 @@ static uint16_t TCP_Checksum16(void* TCPHeaderOutStart,
const uint16_t TCPOutSize)
{
uint32_t Checksum = 0;
-
+
/* TCP/IP checksums are the addition of the one's compliment of each word including the IP pseudo-header,
complimented */
-
+
Checksum += ((uint16_t*)&SourceAddress)[0];
Checksum += ((uint16_t*)&SourceAddress)[1];
Checksum += ((uint16_t*)&DestinationAddress)[0];
@@ -623,12 +623,13 @@ static uint16_t TCP_Checksum16(void* TCPHeaderOutStart,
for (uint16_t CurrWord = 0; CurrWord < (TCPOutSize >> 1); CurrWord++)
Checksum += ((uint16_t*)TCPHeaderOutStart)[CurrWord];
-
+
if (TCPOutSize & 0x01)
Checksum += (((uint16_t*)TCPHeaderOutStart)[TCPOutSize >> 1] & 0x00FF);
-
+
while (Checksum & 0xFFFF0000)
Checksum = ((Checksum & 0xFFFF) + (Checksum >> 16));
-
+
return ~Checksum;
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h
index d412647eb..721657e4a 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/TCP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,11 +39,11 @@
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
-
+
/* Macros: */
/** Maximum number of TCP ports which can be open at the one time. */
#define MAX_OPEN_TCP_PORTS 1
@@ -53,16 +53,16 @@
/** TCP window size, giving the maximum number of bytes which can be buffered at the one time. */
#define TCP_WINDOW_SIZE 512
-
+
/** Port number for HTTP transmissions. */
#define TCP_PORT_HTTP SwapEndian_16(80)
-
+
/** Data direction indicator for a TCP application buffer, indicating data from host-to-device. */
#define TCP_PACKETDIR_IN false
/** Data direction indicator for a TCP application buffer, indicating data from device-to-host. */
#define TCP_PACKETDIR_OUT true
-
+
/** Congestion Window Reduced TCP flag mask. */
#define TCP_FLAG_CWR (1 << 7)
@@ -86,7 +86,7 @@
/** Connection Finalize TCP flag mask. */
#define TCP_FLAG_FIN (1 << 0)
-
+
/** Application macro: Determines if the given application buffer contains a packet received from the host
*
* \param[in] Buffer Application buffer to check
@@ -138,7 +138,7 @@
* \param[in] Buffer Application buffer to clear
*/
#define TCP_APP_CLEAR_BUFFER(Buffer) MACROS{ Buffer->Ready = false; Buffer->Length = 0; }MACROE
-
+
/** Application macro: Closes an open connection to a host.
*
* \param[in] Connection Open TCP connection to close
@@ -152,7 +152,7 @@
TCP_Port_Closed = 0, /**< TCP port closed, no connections to a host may be made on this port. */
TCP_Port_Open = 1, /**< TCP port open, connections to a host may be made on this port. */
};
-
+
/** Enum for possible TCP connection states. */
enum TCP_ConnectionStates_t
{
@@ -166,9 +166,9 @@
TCP_Connection_Closing = 7, /**< Unused */
TCP_Connection_LastACK = 8, /**< Unused */
TCP_Connection_TimeWait = 9, /**< Unused */
- TCP_Connection_Closed = 10, /**< Connection closed in both directions */
+ TCP_Connection_Closed = 10, /**< Connection closed in both directions */
};
-
+
/* Type Defines: */
/** Type define for a TCP connection buffer structure, including size, data and direction. */
typedef struct
@@ -185,7 +185,7 @@
/** Type define for a TCP connection information structure. */
typedef struct
{
- uint32_t SequenceNumberIn; /**< Current TCP sequence number for host-to-device */
+ uint32_t SequenceNumberIn; /**< Current TCP sequence number for host-to-device */
uint32_t SequenceNumberOut; /**< Current TCP sequence number for device-to-host */
TCP_ConnectionBuffer_t Buffer; /**< Connection application data buffer */
} TCP_ConnectionInfo_t;
@@ -214,19 +214,19 @@
{
uint16_t SourcePort; /**< Source port of the TCP packet */
uint16_t DestinationPort; /**< Destination port of the TCP packet */
-
+
uint32_t SequenceNumber; /**< Data sequence number of the packet */
uint32_t AcknowledgmentNumber; /**< Data acknowledgment number of the packet */
-
+
unsigned char Reserved : 4; /**< Reserved, must be all 0 */
unsigned char DataOffset : 4; /**< Offset of the data from the start of the header, in 4 byte chunks */
uint8_t Flags; /**< TCP packet flags */
uint16_t WindowSize; /**< Current data window size (bytes remaining in reception buffer) */
-
+
uint16_t Checksum; /**< TCP checksum */
uint16_t UrgentPointer; /**< Urgent data pointer */
} TCP_Header_t;
-
+
/* Function Prototypes: */
void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo);
void TCP_Init(void);
@@ -256,3 +256,4 @@
#endif
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.c
index 15b065656..9637bebcb 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* User Datagram Protocol (UDP) packet handling routines. This protocol handles high throughput, low
* reliability packets which are typically used to encapsulate streaming data.
*/
-
+
#define INCLUDE_FROM_UDP_C
#include "UDP.h"
@@ -52,11 +52,11 @@ int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
{
UDP_Header_t* UDPHeaderIN = (UDP_Header_t*)UDPHeaderInStart;
UDP_Header_t* UDPHeaderOUT = (UDP_Header_t*)UDPHeaderOutStart;
-
+
int16_t RetSize = NO_RESPONSE;
-
+
DecodeUDPHeader(UDPHeaderInStart);
-
+
switch (SwapEndian_16(UDPHeaderIN->DestinationPort))
{
case UDP_PORT_DHCP_REQUEST:
@@ -65,7 +65,7 @@ int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
&((uint8_t*)UDPHeaderOutStart)[sizeof(UDP_Header_t)]);
break;
}
-
+
/* Check to see if the protocol processing routine has filled out a response */
if (RetSize > 0)
{
@@ -78,6 +78,7 @@ int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
/* Return the size of the response so far */
return (sizeof(UDP_Header_t) + RetSize);
}
-
+
return NO_RESPONSE;
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.h
index 57abd0dc7..425bbe30d 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/UDP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,12 +38,12 @@
/* Includes: */
#include <avr/io.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
#include "DHCP.h"
-
+
/* Macros: */
/** Source UDP port for a DHCP request. */
#define UDP_PORT_DHCP_REQUEST 67
@@ -60,10 +60,11 @@
uint16_t Length; /**< Total packet length, in bytes */
uint16_t Checksum; /**< Optional UDP packet checksum */
} UDP_Header_t;
-
+
/* Function Prototypes: */
int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
void* UDPHeaderInStart,
void* UDPHeaderOutStart);
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.c
index 4fab86cfb..08ab0687b 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,7 +54,7 @@ char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"
/** HTTP page to serve to the host when a HTTP request is made. This page is too long for a single response, thus it is automatically
* broken up into smaller blocks and sent as a series of packets each time the webserver application callback is run.
*/
-char PROGMEM HTTPPage[] =
+char PROGMEM HTTPPage[] =
"<html>"
" <head>"
" <title>"
@@ -108,7 +108,7 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
char* BufferDataStr = (char*)Buffer->Data;
static uint8_t PageBlock = 0;
-
+
/* Check to see if a packet has been received on the HTTP port from a remote host */
if (TCP_APP_HAS_RECEIVED_PACKET(Buffer))
{
@@ -120,7 +120,7 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
/* Copy the HTTP 200 response header into the packet buffer */
strcpy_P(BufferDataStr, HTTP200Header);
-
+
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
@@ -131,10 +131,10 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
/* Copy the HTTP 404 response header into the packet buffer */
strcpy_P(BufferDataStr, HTTP404Header);
-
+
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
-
+
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
@@ -155,9 +155,9 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
strcpy_P(BufferDataStr, HTTP404Header);
/* Send the buffer contents to the host */
- TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
+ TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
}
-
+
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
@@ -165,7 +165,7 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
/* Echo the host's query back to the host */
TCP_APP_SEND_BUFFER(Buffer, Buffer->Length);
-
+
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
@@ -179,13 +179,13 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
uint16_t RemLength = strlen_P(&HTTPPage[PageBlock * HTTP_REPLY_BLOCK_SIZE]);
uint16_t Length;
-
+
/* Determine the length of the loaded block */
Length = ((RemLength > HTTP_REPLY_BLOCK_SIZE) ? HTTP_REPLY_BLOCK_SIZE : RemLength);
/* Copy the next buffer sized block of the page to the packet buffer */
strncpy_P(BufferDataStr, &HTTPPage[PageBlock * HTTP_REPLY_BLOCK_SIZE], Length);
-
+
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, Length);
@@ -194,9 +194,10 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
/* Unlock the buffer so that the host can fill it with future packets */
TCP_APP_RELEASE_BUFFER(Buffer);
-
+
/* Close the connection to the host */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
}
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.h
index 87fe1c91d..7abd6adc9 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Webserver.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,25 +32,26 @@
*
* Header file for Webserver.c.
*/
-
+
#ifndef _WEBSERVER_H_
#define _WEBSERVER_H_
/* Includes: */
#include <avr/io.h>
#include <avr/pgmspace.h>
-
+
#include <LUFA/Version.h>
-
+
#include "TCP.h"
-
+
/* Macros: */
/** Maximum size of a HTTP response per transmission */
#define HTTP_REPLY_BLOCK_SIZE 128
-
+
/* Function Prototypes: */
void Webserver_Init(void);
void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
TCP_ConnectionBuffer_t* const Buffer);
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c
index d332b206a..1dbd7db5a 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -57,7 +57,7 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface =
.NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
.NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
.NotificationEndpointDoubleBank = false,
-
+
.AdapterVendorDescription = "LUFA RNDIS Demo Adapter",
.AdapterMACAddress = {ADAPTER_MAC_ADDRESS},
},
@@ -135,3 +135,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
RNDIS_Device_ProcessControlRequest(&Ethernet_RNDIS_Interface);
}
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h
index a689ee819..2cbdb3104 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for RNDISEthernet.c.
*/
-
+
#ifndef _RNDISETHERNET_H_
#define _RNDISETHERNET_H_
@@ -71,7 +71,7 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* Function Prototypes: */
void SetupHardware(void);
@@ -79,5 +79,6 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
-
+
#endif
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt
index f9cd651d0..906ea0101 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt
+++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage RNDIS Class Ethernet Demo (with Webserver/Telnet)
*
* \section SSec_Compat Demo Compatibility:
@@ -26,7 +26,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard)</td>
* </tr>
@@ -40,7 +40,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Remote Network Driver Interface demonstration application.
* This gives a simple reference application for implementing
@@ -49,7 +49,7 @@
* standard; this demo will only work on Windows 2000 (manually
* patched with the Microsoft RNDIS hotfix) and above (with no
* manual patches), or on the latest Linux kernels.
- *
+ *
* Before running, you will need to install the INF file that
* is located in the RNDISEthernet project directory. This will
* enable Windows to use its inbuilt RNDIS drivers, negating the
@@ -58,7 +58,7 @@
* Windows 2000 is used, the Microsoft INF file in the hotfix
* will need to be altered to use the VID/PID of the demo and
* then chosen instead of the LUFA RNDIS INF file when prompted.
- *
+ *
* When enumerated, this demo will install as a new network
* adapter which ethernet packets can be sent to and received
* from. Running on top of the adapter is a very simple TCP/IP
@@ -66,10 +66,10 @@
* accessed through a web browser at IP address 10.0.0.2:80 or
* through a TELNET client at 10.0.0.2:25. This device also supports
* ping echos via the ICMP protocol.
- *
+ *
* \note The TCP/IP stack in this demo has a number of limitations
* and should serve as an example only - it is not fully featured nor
- * compliant to the TCP/IP specification. For complete projects, it is
+ * compliant to the TCP/IP specification. For complete projects, it is
* recommended that it be replaced with an external open source TCP/IP
* stack that is feature complete, such as the uIP stack.
*
@@ -120,3 +120,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/makefile b/Demos/Device/ClassDriver/RNDISEthernet/makefile
index 2d0a6ef40..2d3e5d541 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/makefile
+++ b/Demos/Device/ClassDriver/RNDISEthernet/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -154,7 +154,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -167,7 +167,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -281,7 +281,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -294,7 +294,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -306,7 +306,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -318,7 +318,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -341,7 +341,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -375,7 +375,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -409,7 +409,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -438,7 +438,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -457,10 +457,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -525,11 +525,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -556,9 +556,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -656,14 +656,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -685,7 +685,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -728,4 +728,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
-debug gdb-config \ No newline at end of file
+debug gdb-config
diff --git a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c
index ac45d0f64..1d98fbb81 100644
--- a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c
+++ b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -83,102 +83,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_DataOutEndpoint =
+ .CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC_DataInEndpoint =
+
+ .CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -241,30 +241,31 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h
index 159d8d265..ddd9495ea 100644
--- a/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h
+++ b/Demos/Device/ClassDriver/VirtualSerial/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -83,3 +83,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c
index 1ee0b344c..258164f8a 100644
--- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c
+++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the VirtualSerial demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "VirtualSerial.h"
/** LUFA CDC Class driver interface configuration and state information. This structure is
@@ -71,7 +71,7 @@ static FILE USBSerialStream;
int main(void)
{
SetupHardware();
-
+
/* Create a regular character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
@@ -81,7 +81,7 @@ int main(void)
for (;;)
{
CheckJoystickMovement();
-
+
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
@@ -112,7 +112,7 @@ void CheckJoystickMovement(void)
uint8_t JoyStatus_LCL = Joystick_GetStatus();
char* ReportString = NULL;
static bool ActionSent = false;
-
+
if (JoyStatus_LCL & JOY_UP)
ReportString = "Joystick Up\r\n";
else if (JoyStatus_LCL & JOY_DOWN)
@@ -125,7 +125,7 @@ void CheckJoystickMovement(void)
ReportString = "Joystick Pressed\r\n";
else
ActionSent = false;
-
+
if ((ReportString != NULL) && (ActionSent == false))
{
ActionSent = true;
@@ -165,3 +165,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
}
+
diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h
index e4d79139c..a16e4a7a1 100644
--- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h
+++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,7 +64,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void CheckJoystickMovement(void);
@@ -75,3 +75,4 @@
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.txt b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.txt
index 571168948..4190c2f7d 100644
--- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.txt
+++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Communications Device Class (Virtual Serial Port) Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -42,14 +42,14 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Communications Device Class demonstration application.
* This gives a simple reference application for implementing
* a CDC device acting as a virtual serial port. Joystick
* actions are transmitted to the host as strings. The device
* does not respond to serial data sent from the host.
- *
+ *
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* project's directory as the device's driver when running under
@@ -70,3 +70,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/VirtualSerial/makefile b/Demos/Device/ClassDriver/VirtualSerial/makefile
index a2e8eb366..1f43438ab 100644
--- a/Demos/Device/ClassDriver/VirtualSerial/makefile
+++ b/Demos/Device/ClassDriver/VirtualSerial/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c
index 2a52edcd4..8591195cf 100644
--- a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c
+++ b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -93,22 +93,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0xEF,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2062,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -119,22 +119,22 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 3,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
- .CDC_IAD =
+ .CDC_IAD =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_Association_t), .Type = DTYPE_InterfaceAssociation},
@@ -147,111 +147,111 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.IADStrIndex = NO_DESCRIPTOR
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_DataOutEndpoint =
+ .CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC_DataInEndpoint =
+
+ .CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
- .HID_Interface =
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 2,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = HID_BOOTP_MouseBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_MouseHID =
+ .HID_MouseHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
@@ -262,7 +262,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(MouseReport)
},
- .HID_ReportINEndpoint =
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -328,38 +328,39 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case HID_DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_MouseHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case HID_DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &MouseReport;
Size = sizeof(MouseReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h
index 6b6178a93..85a5aed84 100644
--- a/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h
+++ b/Demos/Device/ClassDriver/VirtualSerialMouse/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -42,7 +42,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
@@ -61,10 +61,10 @@
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPNUM 1
-
+
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
-
+
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
@@ -94,3 +94,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c
index 8372d4e1b..d5b45edd8 100644
--- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c
+++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the VirtualSerialMouse demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "VirtualSerialMouse.h"
/** LUFA CDC Class driver interface configuration and state information. This structure is
@@ -88,14 +88,14 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Interface =
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
CheckJoystickMovement();
-
+
/* Must throw away unused bytes from the host, or it will lock up while waiting for the device */
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
@@ -127,7 +127,7 @@ void CheckJoystickMovement(void)
uint8_t JoyStatus_LCL = Joystick_GetStatus();
char* ReportString = NULL;
static bool ActionSent = false;
-
+
if (JoyStatus_LCL & JOY_UP)
ReportString = "Joystick Up\r\n";
else if (JoyStatus_LCL & JOY_DOWN)
@@ -140,12 +140,12 @@ void CheckJoystickMovement(void)
ReportString = "Joystick Pressed\r\n";
else
ActionSent = false;
-
+
if ((ReportString != NULL) && (ActionSent == false))
{
ActionSent = true;
-
- CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString, strlen(ReportString));
+
+ CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString, strlen(ReportString));
}
}
@@ -171,7 +171,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
USB_Device_EnableSOFEvents();
- LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the library USB Unhandled Control Request event. */
@@ -204,7 +204,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
uint16_t* const ReportSize)
{
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
-
+
uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
@@ -220,10 +220,10 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (JoyStatus_LCL & JOY_PRESS)
MouseReport->Button |= (1 << 0);
-
+
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
MouseReport->Button |= (1 << 1);
-
+
*ReportSize = sizeof(USB_MouseReport_Data_t);
return true;
}
@@ -244,3 +244,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
}
+
diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h
index 9081253ea..16c7891ae 100644
--- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h
+++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -65,7 +65,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void CheckJoystickMovement(void);
@@ -82,8 +82,9 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif
+
diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt
index f43ef0de7..882d47dcd 100644
--- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt
+++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Combined Communications Device Class (Virtual Serial Port) and Mouse Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -29,7 +29,7 @@
* <td>Communications Device Class (CDC) \n
* Human Interface Device Class (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM) \n
* Mouse Subclass</td>
@@ -46,14 +46,14 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Combined Communications Device Class/Mouse demonstration application.
* This gives a simple reference application for implementing a combined
* CDC and HID device acting as a both a virtual serial port and a mouse.
* Joystick actions are transmitted to the host as strings and as mouse
* movements. The device does not respond to serial data sent from the host.
- *
+ *
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* project's directory as the device's driver when running under
@@ -74,3 +74,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/makefile b/Demos/Device/ClassDriver/VirtualSerialMouse/makefile
index 62d95dbf8..3aa0b487f 100644
--- a/Demos/Device/ClassDriver/VirtualSerialMouse/makefile
+++ b/Demos/Device/ClassDriver/VirtualSerialMouse/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/ClassDriver/makefile b/Demos/Device/ClassDriver/makefile
index 271b6a426..38924273f 100644
--- a/Demos/Device/ClassDriver/makefile
+++ b/Demos/Device/ClassDriver/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -52,10 +52,10 @@ all:
$(MAKE) -C VirtualSerial clean
$(MAKE) -C VirtualSerial all
-
+
$(MAKE) -C VirtualSerialMouse clean
- $(MAKE) -C VirtualSerialMouse all
-
+ $(MAKE) -C VirtualSerialMouse all
+
%:
$(MAKE) -C AudioInput $@
$(MAKE) -C AudioOutput $@
@@ -71,3 +71,4 @@ all:
$(MAKE) -C RNDISEthernet $@
$(MAKE) -C VirtualSerial $@
$(MAKE) -C VirtualSerialMouse $@
+
diff --git a/Demos/Device/Incomplete/Sideshow/Descriptors.c b/Demos/Device/Incomplete/Sideshow/Descriptors.c
index 6860ac459..5bab58702 100644
--- a/Demos/Device/Incomplete/Sideshow/Descriptors.c
+++ b/Demos/Device/Incomplete/Sideshow/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,25 +33,25 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
Header: {Size: sizeof(USB_Descriptor_Device_t), Type: DTYPE_Device},
-
+
USBSpecification: VERSION_BCD(01.10),
Class: 0x00,
SubClass: 0x00,
Protocol: 0x00,
-
+
Endpoint0Size: 8,
-
+
VendorID: 0x03EB,
ProductID: 0x2040,
ReleaseNumber: VERSION_BCD(00.01),
-
+
ManufacturerStrIndex: 0x01,
ProductStrIndex: 0x02,
SerialNumStrIndex: 0x03,
-
+
NumberOfConfigurations: 1
};
-
+
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
.Config =
@@ -60,28 +60,28 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
TotalConfigurationSize: sizeof(USB_Descriptor_Configuration_t),
TotalInterfaces: 1,
-
+
ConfigurationNumber: 1,
ConfigurationStrIndex: NO_DESCRIPTOR,
-
+
ConfigAttributes: (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
MaxPowerConsumption: USB_CONFIG_POWER_MA(100)
},
-
+
.SSHOW_Interface =
{
Header: {Size: sizeof(USB_Descriptor_Interface_t), Type: DTYPE_Interface},
InterfaceNumber: 0,
AlternateSetting: 0,
-
+
TotalEndpoints: 2,
-
+
Class: 0xFF,
SubClass: 0x00,
Protocol: 0x00,
-
+
InterfaceStrIndex: NO_DESCRIPTOR
},
@@ -109,35 +109,35 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
Header: {Size: USB_STRING_LEN(1), Type: DTYPE_String},
-
+
UnicodeString: {LANGUAGE_ID_ENG}
};
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
Header: {Size: USB_STRING_LEN(11), Type: DTYPE_String},
-
+
UnicodeString: L"Dean Camera"
};
USB_Descriptor_String_t PROGMEM ProductString =
{
Header: {Size: USB_STRING_LEN(22), Type: DTYPE_String},
-
+
UnicodeString: L"LUFA Sideshow Demo"
};
USB_Descriptor_String_t PROGMEM SerialNumberString =
{
Header: {Size: USB_STRING_LEN(12), Type: DTYPE_String},
-
+
UnicodeString: L"000000000000"
};
USB_OSDescriptor_t PROGMEM OSDescriptorString =
{
Header: {Size: sizeof(USB_OSDescriptor_t), Type: DTYPE_String},
-
+
Signature: L"MSFT100",
VendorCode: REQ_GetOSFeatureDescriptor
};
@@ -148,7 +148,7 @@ USB_OSCompatibleIDDescriptor_t PROGMEM DevCompatIDs =
Version: 0x0100,
Index: EXTENDED_COMPAT_ID_DESCRIPTOR,
TotalSections: 1,
-
+
SideshowCompatID: {FirstInterfaceNumber: 0x00,
CompatibleID: "SIDESHW",
SubCompatibleID: "UNIV1"}
@@ -201,11 +201,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = pgm_read_byte(&OSDescriptorString.Header.Size);
break;
}
-
+
break;
}
-
- *DescriptorAddress = Address;
+
+ *DescriptorAddress = Address;
return Size;
}
@@ -230,3 +230,4 @@ uint16_t USB_GetOSFeatureDescriptor(const uint16_t wValue,
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/Incomplete/Sideshow/Descriptors.h b/Demos/Device/Incomplete/Sideshow/Descriptors.h
index 5ba737b38..8f0f1c960 100644
--- a/Demos/Device/Incomplete/Sideshow/Descriptors.h
+++ b/Demos/Device/Incomplete/Sideshow/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,14 +35,14 @@
#include <LUFA/Drivers/USB/USB.h>
#include <avr/pgmspace.h>
-
+
#include "Sideshow.h"
/* Macros: */
- #define SIDESHOW_IN_EPNUM 3
- #define SIDESHOW_OUT_EPNUM 4
+ #define SIDESHOW_IN_EPNUM 3
+ #define SIDESHOW_OUT_EPNUM 4
#define SIDESHOW_IO_EPSIZE 64
-
+
/* Type Defines: */
typedef struct
{
@@ -51,36 +51,36 @@
USB_Descriptor_Endpoint_t SSHOW_DataInEndpoint;
USB_Descriptor_Endpoint_t SSHOW_DataOutEndpoint;
} USB_Descriptor_Configuration_t;
-
+
typedef struct
{
USB_Descriptor_Header_t Header;
-
+
int Signature[7];
uint16_t VendorCode;
} USB_OSDescriptor_t;
-
+
typedef struct
{
uint8_t FirstInterfaceNumber;
uint8_t Reserved;
-
+
uint8_t CompatibleID[8];
- uint8_t SubCompatibleID[8];
+ uint8_t SubCompatibleID[8];
uint8_t Reserved2[6];
} USB_OSCompatibleSection_t;
-
+
typedef struct
{
uint32_t TotalLength;
uint16_t Version;
uint16_t Index;
uint8_t TotalSections;
-
+
uint8_t Reserved[7];
-
+
USB_OSCompatibleSection_t SideshowCompatID;
} USB_OSCompatibleIDDescriptor_t;
@@ -96,3 +96,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
index e8631be8e..c7dca5ad7 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,7 +40,7 @@ SideShow_Application_t* SideShow_GetFreeApplication(void)
if (!(InstalledApplications[App].InUse))
return &InstalledApplications[App];
}
-
+
return NULL;
}
@@ -54,6 +54,7 @@ SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* const GUID)
return &InstalledApplications[App];
}
}
-
+
return NULL;
}
+
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h
index 9624c7c34..02b2ea4ca 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowApplications.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,10 +32,10 @@
#define _SIDESHOW_APPLICATIONS_H_
/* Includes: */
- #include <avr/io.h>
+ #include <avr/io.h>
#include <string.h>
#include <stdbool.h>
-
+
#include "SideshowCommon.h"
/* Type Defines: */
@@ -51,12 +51,13 @@
uint32_t CurrentContentID;
uint8_t CurrentContent[MAX_CONTENTBUFFER_PER_APP];
} SideShow_Application_t;
-
+
/* External Variables: */
extern SideShow_Application_t InstalledApplications[MAX_APPLICATIONS];
-
+
/* Function Prototypes: */
SideShow_Application_t* SideShow_GetFreeApplication(void);
SideShow_Application_t* SideShow_GetApplicationFromGUID(GUID_t* const GUID);
-
+
#endif
+
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
index eebc2ef35..bfcebce17 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,14 +42,14 @@ Unicode_String_t Manufacturer = {LengthInBytes: sizeof(L"Dean Camera"),
Unicode_String_t SupportedLanguage = {LengthInBytes: sizeof(L"en-US:1"),
UnicodeString: L"en-US:1"};
-
+
void Sideshow_ProcessCommandPacket(void)
{
SideShow_PacketHeader_t PacketHeader;
-
- Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);
+
+ Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);
Endpoint_Read_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t));
-
+
PacketHeader.Type.TypeFields.Response = true;
printf("\r\nCmd: %lX", (PacketHeader.Type.TypeLong & 0x00FFFFFF));
@@ -70,7 +70,7 @@ void Sideshow_ProcessCommandPacket(void)
break;
case SIDESHOW_CMD_GET_CAPABILITIES:
SideShow_GetCapabilities(&PacketHeader);
- break;
+ break;
case SIDESHOW_CMD_GET_DEVICE_NAME:
SideShow_GetString(&PacketHeader, &DeviceName);
break;
@@ -94,7 +94,7 @@ void Sideshow_ProcessCommandPacket(void)
break;
case SIDESHOW_CMD_DELETE_ALL_CONTENT:
SideShow_DeleteAllContent(&PacketHeader);
- break;
+ break;
case SIDESHOW_CMD_DELETE_APPLICATION:
SideShow_DeleteApplication(&PacketHeader);
break;
@@ -109,11 +109,11 @@ void Sideshow_ProcessCommandPacket(void)
PacketHeader.Length = sizeof(SideShow_PacketHeader_t);
PacketHeader.Type.TypeFields.NAK = true;
-
- Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
- Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t));
+
+ Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
+ Endpoint_Write_Stream_LE(&PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_ClearIN();
-
+
printf(" UNK");
}
}
@@ -122,8 +122,8 @@ static void SideShow_Ping(SideShow_PacketHeader_t* const PacketHeader)
{
Endpoint_ClearOUT();
- Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
- Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
+ Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
+ Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_ClearIN();
}
@@ -133,12 +133,12 @@ static void SideShow_Sync(SideShow_PacketHeader_t* const PacketHeader)
Endpoint_Read_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
Endpoint_ClearOUT();
-
+
if (!(GUID_COMPARE(&ProtocolGUID, (uint32_t[])STANDARD_PROTOCOL_GUID)))
PacketHeader->Type.TypeFields.NAK = true;
-
+
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
- Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
+ Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_Stream_LE(&ProtocolGUID, sizeof(GUID_t));
Endpoint_ClearIN();
}
@@ -159,7 +159,7 @@ static void SideShow_SetCurrentUser(SideShow_PacketHeader_t* const PacketHeader)
{
SideShow_Read_Unicode_String(&UserSID, sizeof(UserSID.UnicodeString));
Endpoint_ClearOUT();
-
+
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
@@ -174,7 +174,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
Endpoint_Read_Stream_LE(&Property, sizeof(SideShow_PropertyKey_t));
Endpoint_ClearOUT();
-
+
printf(" ID: %lu", Property.PropertyID);
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
@@ -187,46 +187,46 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
PropertyData.DataType = VT_I4;
PropertyData.Data.Data32 = ScreenText;
PacketHeader->Length += sizeof(uint32_t);
-
+
break;
case PROPERTY_SIDESHOW_SCREENWIDTH:
case PROPERTY_SIDESHOW_CLIENTWIDTH:
PropertyData.DataType = VT_UI2;
PropertyData.Data.Data16 = 16;
PacketHeader->Length += sizeof(uint16_t);
-
+
break;
case PROPERTY_SIDESHOW_SCREENHEIGHT:
case PROPERTY_SIDESHOW_CLIENTHEIGHT:
PropertyData.DataType = VT_UI2;
PropertyData.Data.Data16 = 2;
PacketHeader->Length += sizeof(uint16_t);
-
+
break;
case PROPERTY_SIDESHOW_COLORDEPTH:
PropertyData.DataType = VT_UI2;
PropertyData.Data.Data16 = 1;
PacketHeader->Length += sizeof(uint16_t);
-
+
break;
case PROPERTY_SIDESHOW_COLORTYPE:
PropertyData.DataType = VT_UI2;
PropertyData.Data.Data16 = BlackAndWhiteDisplay;
PacketHeader->Length += sizeof(uint16_t);
-
+
break;
case PROPERTY_SIDESHOW_DATACACHE:
PropertyData.DataType = VT_BOOL;
PropertyData.Data.Data16 = false;
PacketHeader->Length += sizeof(uint16_t);
-
+
break;
case PROPERTY_SIDESHOW_SUPPORTEDLANGS:
case PROPERTY_SIDESHOW_CURRENTLANG:
PropertyData.DataType = VT_LPWSTR;
PropertyData.Data.DataPointer = &SupportedLanguage;
PacketHeader->Length += SupportedLanguage.LengthInBytes;
-
+
break;
default:
PropertyData.DataType = VT_EMPTY;
@@ -241,22 +241,22 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
PropertyData.DataType = VT_UI4;
PropertyData.Data.Data32 = GenericDevice;
PacketHeader->Length += sizeof(uint32_t);
-
+
break;
}
- }
+ }
else
{
- PacketHeader->Type.TypeFields.NAK = true;
-
+ PacketHeader->Type.TypeFields.NAK = true;
+
printf(" WRONG GUID");
printf(" %lX %lX %lX %lX", Property.PropertyGUID.Chunks[0], Property.PropertyGUID.Chunks[1],
- Property.PropertyGUID.Chunks[2], Property.PropertyGUID.Chunks[3]);
+ Property.PropertyGUID.Chunks[2], Property.PropertyGUID.Chunks[3]);
}
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
-
+
if (!(PacketHeader->Type.TypeFields.NAK))
{
switch (PropertyData.DataType)
@@ -275,7 +275,7 @@ static void SideShow_GetCapabilities(SideShow_PacketHeader_t* const PacketHeader
break;
}
}
-
+
Endpoint_ClearIN();
return;
}
@@ -287,7 +287,7 @@ static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader,
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +
sizeof(uint32_t) + ((Unicode_String_t*)UnicodeStruct)->LengthInBytes;
-
+
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
SideShow_Write_Unicode_String(UnicodeStruct);
@@ -297,7 +297,7 @@ static void SideShow_GetString(SideShow_PacketHeader_t* const PacketHeader,
static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* const PacketHeader)
{
uint8_t TotalApplications = 0;
-
+
Endpoint_ClearOUT();
for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)
@@ -308,11 +308,11 @@ static void SideShow_GetApplicationOrder(SideShow_PacketHeader_t* const PacketHe
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) +
sizeof(uint32_t) + (TotalApplications * sizeof(GUID_t));
-
+
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_DWord_LE(TotalApplications);
-
+
for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)
{
if (InstalledApplications[App].InUse)
@@ -329,7 +329,7 @@ static void SideShow_GetSupportedEndpoints(SideShow_PacketHeader_t* const Packet
Endpoint_ClearOUT();
PacketHeader->Length = sizeof(SideShow_PacketHeader_t) + sizeof(uint32_t) + sizeof(GUID_t);
-
+
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
Endpoint_Write_DWord_LE(1);
@@ -369,7 +369,7 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader)
SideShow_Discard_Byte_Stream();
SideShow_Discard_Byte_Stream();
Endpoint_ClearOUT();
-
+
CurrApp->InUse = true;
CurrApp->HaveContent = false;
CurrApp->CurrentContentID = 1;
@@ -385,8 +385,8 @@ static void SideShow_AddApplication(SideShow_PacketHeader_t* const PacketHeader)
static void SideShow_DeleteApplication(SideShow_PacketHeader_t* const PacketHeader)
{
GUID_t ApplicationGUID;
-
- Endpoint_Read_Stream_LE(&ApplicationGUID, sizeof(GUID_t));
+
+ Endpoint_Read_Stream_LE(&ApplicationGUID, sizeof(GUID_t));
Endpoint_ClearOUT();
SideShow_Application_t* AppToDelete = SideShow_GetApplicationFromGUID(&ApplicationGUID);
@@ -406,7 +406,7 @@ static void SideShow_DeleteApplication(SideShow_PacketHeader_t* const PacketHead
static void SideShow_DeleteAllApplications(SideShow_PacketHeader_t* const PacketHeader)
{
Endpoint_ClearOUT();
-
+
for (uint8_t App = 0; App < MAX_APPLICATIONS; App++)
InstalledApplications[App].InUse = false;
@@ -420,12 +420,12 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* const PacketHeader)
GUID_t ApplicationID;
GUID_t EndpointID;
SideShow_Application_t* Application;
-
+
Endpoint_Read_Stream_LE(&ApplicationID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t));
-
+
Application = SideShow_GetApplicationFromGUID(&ApplicationID);
-
+
if (Application == NULL)
{
SideShow_Discard_Byte_Stream();
@@ -435,7 +435,7 @@ static void SideShow_AddContent(SideShow_PacketHeader_t* const PacketHeader)
{
PacketHeader->Type.TypeFields.NAK = true;
}
-
+
Endpoint_ClearOUT();
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
@@ -455,14 +455,14 @@ static void SideShow_DeleteContent(SideShow_PacketHeader_t* const PacketHeader)
Endpoint_Read_Stream_LE(&EndpointID, sizeof(GUID_t));
Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t));
Endpoint_ClearOUT();
-
+
SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID);
-
+
if ((Application != NULL) && (Application->CurrentContentID == ContentID))
Application->HaveContent = false;
else
PacketHeader->Type.TypeFields.NAK = true;
-
+
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
@@ -480,15 +480,16 @@ static void SideShow_DeleteAllContent(SideShow_PacketHeader_t* const PacketHeade
Endpoint_ClearOUT();
SideShow_Application_t* Application = SideShow_GetApplicationFromGUID(&ApplicationID);
-
+
if (Application != NULL)
Application->HaveContent = false;
else
- PacketHeader->Type.TypeFields.NAK = true;
+ PacketHeader->Type.TypeFields.NAK = true;
PacketHeader->Length = sizeof(SideShow_PacketHeader_t);
Endpoint_SelectEndpoint(SIDESHOW_IN_EPNUM);
Endpoint_Write_Stream_LE(PacketHeader, sizeof(SideShow_PacketHeader_t));
- Endpoint_ClearIN();
+ Endpoint_ClearIN();
}
+
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h
index 1395cd367..5026d5b5b 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommands.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,7 +35,7 @@
#include <avr/io.h>
#include <stdbool.h>
#include <string.h>
-
+
#include "Sideshow.h"
#include "SideshowCommon.h"
#include "SideshowApplications.h"
@@ -63,25 +63,25 @@
VT_UI4 = 19,
VT_LPWSTR = 31,
};
-
+
enum SideShow_ScreenTypeText_t
{
ScreenBitmap = 0,
ScreenText = 1,
};
-
+
enum SideShow_ColorTypes_t
{
ColorDisplay = 0,
GrayscaleDisplay = 1,
- BlackAndWhiteDisplay = 2,
+ BlackAndWhiteDisplay = 2,
};
enum SideShow_DeviceTypes_t
- {
- GenericDevice = 0,
- CameraDevice = 1,
- MediaPlayerDevice = 2,
+ {
+ GenericDevice = 0,
+ CameraDevice = 1,
+ MediaPlayerDevice = 2,
PhoneDevice = 3,
VideoDevice = 4,
PIMDevice = 5,
@@ -94,11 +94,11 @@
GUID_t PropertyGUID;
uint32_t PropertyID;
} SideShow_PropertyKey_t;
-
+
typedef struct
{
uint32_t DataType;
-
+
union
{
void* DataPointer;
@@ -107,12 +107,12 @@
uint32_t Data32;
} Data;
} SideShow_PropertyData_t;
-
+
/* Macros: */
#define SIDESHOW_CMD_PING 0x001
#define SIDESHOW_CMD_SET_CURRENT_USER 0x100
#define SIDESHOW_CMD_GET_CURRENT_USER 0x101
- #define SIDESHOW_CMD_GET_CAPABILITIES 0x103
+ #define SIDESHOW_CMD_GET_CAPABILITIES 0x103
#define SIDESHOW_CMD_GET_APPLICATION_ORDER 0x104
#define SIDESHOW_CMD_ADD_APPLICATION 0x10D
#define SIDESHOW_CMD_DELETE_APPLICATION 0x10E
@@ -139,12 +139,12 @@
#define PROPERTY_SIDESHOW_CLIENTWIDTH 15
#define PROPERTY_SIDESHOW_CLIENTHEIGHT 16
#define PROPERTY_SIDESHOW_DEVICEICON 17
-
+
#define PROPERTY_DEVICE_DEVICETYPE 15
-
+
/* Function Prototypes: */
void Sideshow_ProcessCommandPacket(void);
-
+
#if defined(INCLUDE_FROM_SIDESHOWCOMMANDS_H)
static void SideShow_Ping(SideShow_PacketHeader_t* const PacketHeader);
static void SideShow_Sync(SideShow_PacketHeader_t* const PacketHeader);
@@ -164,3 +164,4 @@
#endif
#endif
+
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c
index 02b681c50..95d3ee1de 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,20 +35,20 @@ uint16_t SideShow_Read_Unicode_String(void* const UnicodeString,
{
Unicode_String_t* const UnicodeStruct = (Unicode_String_t*)UnicodeString;
uint32_t UnicodeCharsToRead;
-
+
Endpoint_Read_Stream_LE(&UnicodeCharsToRead, sizeof(uint32_t));
-
+
int UnicodeData[UnicodeCharsToRead];
UnicodeStruct->LengthInBytes = (UnicodeCharsToRead << 1);
Endpoint_Read_Stream_LE(&UnicodeData, UnicodeStruct->LengthInBytes);
-
+
if (UnicodeStruct->LengthInBytes > MaxBytes)
UnicodeStruct->LengthInBytes = MaxBytes;
-
+
memcpy(&UnicodeStruct->UnicodeString, &UnicodeData, UnicodeStruct->LengthInBytes);
-
+
return ((UnicodeCharsToRead << 1) + sizeof(uint32_t));
}
@@ -69,3 +69,4 @@ void SideShow_Discard_Byte_Stream(void)
Endpoint_Read_Stream_LE(&StreamSize, sizeof(uint32_t));
Endpoint_Discard_Stream(StreamSize);
}
+
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
index 8a90c50cf..d72464f91 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowCommon.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,15 +33,15 @@
/* Includes: */
#include <avr/io.h>
- #include <string.h>
-
+ #include <string.h>
+
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
#define GUID_COMPARE(a, b) (memcmp(a, b, sizeof(GUID_t)) == 0)
-
+
#define ARRAY_ELEMENTS(x) (sizeof(x) / sizeof(x[0]))
-
+
#define UNICODE_STRING_t(x) struct \
{ \
uint16_t LengthInBytes; \
@@ -67,12 +67,12 @@
{
uint32_t Chunks[4];
} GUID_t;
-
+
typedef struct
{
uint16_t LengthInBytes;
int UnicodeString[];
- } Unicode_String_t;
+ } Unicode_String_t;
typedef union
{
@@ -84,10 +84,10 @@
int ErrorCode : 6;
int NAK : 1;
- int Response : 1;
+ int Response : 1;
} TypeFields;
} SideShowPacketType_t;
-
+
typedef struct
{
uint32_t Length;
@@ -101,4 +101,4 @@
void SideShow_Write_Unicode_String(void* UnicodeString);
void SideShow_Discard_Byte_Stream(void);
-#endif \ No newline at end of file
+#endif
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c
index 5bfae1b49..8c627fbe7 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader,
{
uint32_t ContentSize;
uint32_t ContentID;
-
+
Endpoint_Read_Stream_LE(&ContentID, sizeof(uint32_t));
PacketHeader->Length -= sizeof(uint32_t);
@@ -47,16 +47,16 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader,
return false;
}
-
+
Endpoint_Read_Stream_LE(&ContentSize, sizeof(uint32_t));
Endpoint_Read_Stream_LE(&Application->CurrentContent, sizeof(XML_START_TAG) - 1);
-
+
PacketHeader->Length -= sizeof(uint32_t) + (sizeof(XML_START_TAG) - 1);
if (!(memcmp(&Application->CurrentContent, XML_START_TAG, (sizeof(XML_START_TAG) - 1))))
{
SideShow_ProcessXMLContent(&Application->CurrentContent, (ContentSize - (sizeof(XML_END_TAG) - 1)));
-
+
Endpoint_Discard_Stream(sizeof(XML_END_TAG) - 1);
Application->HaveContent = true;
@@ -66,7 +66,7 @@ bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader,
printf(" BINARY");
Endpoint_Discard_Stream(ContentSize);
}
-
+
return true;
}
@@ -76,3 +76,4 @@ static void SideShow_ProcessXMLContent(void* ContentData,
printf(" XML");
Endpoint_Discard_Stream(ContentSize);
}
+
diff --git a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h
index 6e3031c13..20fe5de11 100644
--- a/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h
+++ b/Demos/Device/Incomplete/Sideshow/Lib/SideshowContent.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@
#include "SideshowCommon.h"
#include "SideshowApplications.h"
-
+
/* Enums: */
enum SideShow_ContentTypes_t
{
@@ -50,24 +50,24 @@
Content_Text = 4,
Content_EndOfContent = 5
};
-
+
enum SideShow_ActionTypes_t
{
TODO
};
-
+
enum SideShow_AlignmentTypes_t
{
TODO2
};
-
+
/* Type Defines: */
typedef struct
{
uint8_t ContentType;
- uint8_t ContentSize;
+ uint8_t ContentSize;
} SideShow_Content_Header_t;
-
+
typedef struct
{
SideShow_Content_Header_t Header;
@@ -86,7 +86,7 @@
bool IsSelected;
char Text[];
} SideShow_Content_MenuItem_t;
-
+
typedef struct
{
SideShow_Content_Header_t Header;
@@ -94,7 +94,7 @@
uint8_t Key;
uint32_t Target;
} SideShow_Content_Button_t;
-
+
typedef struct
{
SideShow_Content_Header_t Header;
@@ -108,13 +108,13 @@
{
SideShow_Content_Header_t Header;
- char Text[];
+ char Text[];
} SideShow_Content_Text_t;
-
+
/* Defines: */
#define XML_START_TAG "<body>"
#define XML_END_TAG "</body>"
-
+
/* Function Prototypes: */
bool SideShow_AddSimpleContent(SideShow_PacketHeader_t* const PacketHeader,
SideShow_Application_t* const Application);
@@ -123,5 +123,5 @@
static void SideShow_ProcessXMLContent(void* ContentData,
uint32_t ContentSize);
#endif
-
-#endif \ No newline at end of file
+
+#endif
diff --git a/Demos/Device/Incomplete/Sideshow/Sideshow.c b/Demos/Device/Incomplete/Sideshow/Sideshow.c
index 8b2842bdf..4882af9bd 100644
--- a/Demos/Device/Incomplete/Sideshow/Sideshow.c
+++ b/Demos/Device/Incomplete/Sideshow/Sideshow.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,12 +36,12 @@
externally connected interactive display. Upon enumeration, this will
appear as a new SideShow device which can have gadgets loaded onto
it.
-
+
Note that while the incoming content is buffered in packet struct
form, the data is not actually displayed. It is left to the user to
write sufficient code to read out the packed data for display to a
screen.
-
+
Installed gadgets can be accessed through the InstalledApplications
array, with entries that have their InUse flag set being active. As
only the active content is displayed on the device due to memory
@@ -59,7 +59,7 @@ int main(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
SideShow_Task();
@@ -76,7 +76,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
LEDs_Init();
USB_Init();
@@ -121,9 +121,9 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
if (DescriptorSize == NO_DESCRIPTOR)
return;
-
+
Endpoint_ClearSETUP();
-
+
Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
Endpoint_ClearOUT();
}
@@ -131,7 +131,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
break;
}
}
-
+
void SideShow_Task(void)
{
/* Device must be connected and configured for the task to run */
@@ -140,7 +140,7 @@ void SideShow_Task(void)
/* Select the SideShow data out endpoint */
Endpoint_SelectEndpoint(SIDESHOW_OUT_EPNUM);
-
+
/* Check to see if a new SideShow message has been received */
if (Endpoint_IsReadWriteAllowed())
{
@@ -148,3 +148,4 @@ void SideShow_Task(void)
Sideshow_ProcessCommandPacket();
}
}
+
diff --git a/Demos/Device/Incomplete/Sideshow/Sideshow.h b/Demos/Device/Incomplete/Sideshow/Sideshow.h
index 9e4b06226..367fb4b20 100644
--- a/Demos/Device/Incomplete/Sideshow/Sideshow.h
+++ b/Demos/Device/Incomplete/Sideshow/Sideshow.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
* descriptors of the device.
*/
#define REQ_GetOSFeatureDescriptor 0x01
-
+
/** Descriptor index for a Microsoft Proprietary Extended Device Compatibility descriptor. */
#define EXTENDED_COMPAT_ID_DESCRIPTOR 0x0004
@@ -65,7 +65,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void SideShow_Task(void);
@@ -76,3 +76,4 @@
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Demos/Device/Incomplete/Sideshow/makefile b/Demos/Device/Incomplete/Sideshow/makefile
index 217d0fd3d..6da7dd700 100644
--- a/Demos/Device/Incomplete/Sideshow/makefile
+++ b/Demos/Device/Incomplete/Sideshow/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -141,7 +141,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -154,7 +154,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -268,7 +268,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -281,7 +281,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -293,7 +293,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -305,7 +305,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -328,7 +328,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -362,7 +362,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -396,7 +396,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -425,7 +425,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -444,10 +444,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -512,11 +512,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -543,9 +543,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -643,14 +643,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -672,7 +672,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -716,3 +716,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c
index aac16909d..9c66459a8 100644
--- a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c
+++ b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Peter Lawrence (majbthrd [at] gmail [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -31,9 +31,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -84,61 +84,61 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .Interface =
+
+ .Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 3,
-
+
.Class = 0xFE,
.SubClass = 0x03,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .DataOutEndpoint =
+ .DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | TMC_OUT_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = TMC_IO_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .DataInEndpoint =
+
+ .DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | TMC_IN_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = TMC_IO_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .NotificationEndpoint =
+
+ .NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | TMC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = TMC_NOTIFICATION_EPSIZE,
@@ -201,30 +201,31 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h
index fefb6b555..dc3505f6d 100644
--- a/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h
+++ b/Demos/Device/Incomplete/TestAndMeasurement/Descriptors.h
@@ -79,3 +79,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c
index 7949a7ebd..01d3e66bc 100644
--- a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c
+++ b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c
@@ -429,3 +429,4 @@ uint8_t StreamCallback_AbortOUTOnRequest(void)
/* Continue with the current stream operation */
return STREAMCALLBACK_Continue;
}
+
diff --git a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h
index d0db01ef9..f069e8eb9 100644
--- a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h
+++ b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h
@@ -154,3 +154,4 @@
uint8_t StreamCallback_AbortOUTOnRequest(void);
#endif
+
diff --git a/Demos/Device/Incomplete/TestAndMeasurement/makefile b/Demos/Device/Incomplete/TestAndMeasurement/makefile
index c4c1c059b..7e282ed57 100644
--- a/Demos/Device/Incomplete/TestAndMeasurement/makefile
+++ b/Demos/Device/Incomplete/TestAndMeasurement/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c
index 4abc17422..a984a2ab8 100644
--- a/Demos/Device/LowLevel/AudioInput/AudioInput.c
+++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,7 +48,7 @@ int main(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
USB_Audio_Task();
@@ -65,13 +65,13 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
LEDs_Init();
ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_32);
ADC_SetupChannel(MIC_IN_ADC_CHANNEL);
USB_Init();
-
+
/* Start the ADC conversion in free running mode */
ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_MUX_MASK);
}
@@ -133,7 +133,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Set Interface is not handled by the library, as its function is application-specific */
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE))
{
- Endpoint_ClearSETUP();
+ Endpoint_ClearSETUP();
Endpoint_ClearStatusStage();
/* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */
@@ -157,7 +157,7 @@ void USB_Audio_Task(void)
/* Select the audio stream endpoint */
Endpoint_SelectEndpoint(AUDIO_STREAM_EPNUM);
-
+
/* Check if the current endpoint can be written to and that the next sample should be stored */
if (Endpoint_IsINReady() && (TIFR0 & (1 << OCF0A)))
{
@@ -166,7 +166,7 @@ void USB_Audio_Task(void)
/* Audio sample is ADC value scaled to fit the entire range */
int16_t AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult());
-
+
#if defined(MICROPHONE_BIASED_TO_HALF_RAIL)
/* Microphone is biased to half rail voltage, subtract the bias from the sample value */
AudioSample -= (SAMPLE_MAX_RANGE / 2);
@@ -183,3 +183,4 @@ void USB_Audio_Task(void)
}
}
}
+
diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.h b/Demos/Device/LowLevel/AudioInput/AudioInput.h
index 7be23e8dd..53b63517b 100644
--- a/Demos/Device/LowLevel/AudioInput/AudioInput.h
+++ b/Demos/Device/LowLevel/AudioInput/AudioInput.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for AudioInput.c.
*/
-
+
#ifndef _AUDIO_INPUT_H_
#define _AUDIO_INPUT_H_
@@ -43,7 +43,7 @@
#include <avr/interrupt.h>
#include "Descriptors.h"
-
+
#include <LUFA/Version.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
@@ -52,10 +52,10 @@
/* Macros: */
/** ADC channel number for the microphone input. */
#define MIC_IN_ADC_CHANNEL 2
-
+
/** ADC channel MUX mask for the microphone input. */
#define MIC_IN_ADC_MUX_MASK ADC_CHANNEL2
-
+
/** Maximum ADC sample value for the microphone input. */
#define SAMPLE_MAX_RANGE 0xFFFF
@@ -82,5 +82,6 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.txt b/Demos/Device/LowLevel/AudioInput/AudioInput.txt
index d61e77a52..39d78e784 100644
--- a/Demos/Device/LowLevel/AudioInput/AudioInput.txt
+++ b/Demos/Device/LowLevel/AudioInput/AudioInput.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Audio Input Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -27,7 +27,7 @@
* <td><b>USB Class:</b></td>
* <td>Audio Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Standard Audio Device</td>
* </tr>
@@ -43,19 +43,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Audio demonstration application. This gives a simple reference
* application for implementing a USB Audio Input device using the
* basic USB Audio 1.0 drivers in all modern OSes (i.e. no special drivers
* required).
- *
+ *
* On start-up the system will automatically enumerate and function
* as a USB microphone. Incoming audio from the ADC channel 1 will
* be sampled and sent to the host computer.
- *
+ *
* To use, connect a microphone to the ADC channel 2.
- *
+ *
* Under Windows, if a driver request dialogue pops up, select the option
* to automatically install the appropriate drivers.
*
@@ -81,3 +81,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.c b/Demos/Device/LowLevel/AudioInput/Descriptors.c
index 150fb3367..432f0c909 100644
--- a/Demos/Device/LowLevel/AudioInput/Descriptors.c
+++ b/Demos/Device/LowLevel/AudioInput/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,11 +30,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
-
+
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2047,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,7 +71,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
@@ -80,134 +80,134 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .Audio_ControlInterface =
+
+ .Audio_ControlInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
-
+
.Class = 0x01,
.SubClass = 0x01,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_ControlInterface_SPC =
+
+ .Audio_ControlInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_AudioHeader,
-
+
.ACSpecification = VERSION_BCD(01.00),
.TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
sizeof(USB_Audio_InputTerminal_t) +
sizeof(USB_Audio_OutputTerminal_t)),
-
+
.InCollection = 1,
.InterfaceNumbers = {1},
},
- .Audio_InputTerminal =
+ .Audio_InputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_InputTerminal,
-
+
.TerminalID = 0x01,
.TerminalType = TERMINAL_IN_MIC,
.AssociatedOutputTerminal = 0x00,
-
+
.TotalChannels = 1,
.ChannelConfig = 0,
-
+
.ChannelStrIndex = NO_DESCRIPTOR,
.TerminalStrIndex = NO_DESCRIPTOR
},
- .Audio_OutputTerminal =
+ .Audio_OutputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_OutputTerminal,
-
+
.TerminalID = 0x02,
.TerminalType = TERMINAL_STREAMING,
.AssociatedInputTerminal = 0x00,
-
+
.SourceID = 0x01,
-
+
.TerminalStrIndex = NO_DESCRIPTOR
},
- .Audio_StreamInterface_Alt0 =
+ .Audio_StreamInterface_Alt0 =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
-
+
.Class = 0x01,
.SubClass = 0x02,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .Audio_StreamInterface_Alt1 =
+ .Audio_StreamInterface_Alt1 =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 1,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x01,
.SubClass = 0x02,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_StreamInterface_SPC =
+
+ .Audio_StreamInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_General,
-
+
.TerminalLink = 0x02,
-
+
.FrameDelay = 1,
.AudioFormat = 0x0001
},
-
- .Audio_AudioFormat =
+
+ .Audio_AudioFormat =
{
.Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_Format,
.FormatType = 0x01,
.Channels = 0x01,
-
+
.SubFrameSize = 0x02,
.BitResolution = 16,
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.Audio_AudioFormat.SampleFrequencies) /
sizeof(Audio_SampleFreq_t)),
-
+
.SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
-
- .Audio_StreamEndpoint =
+
+ .Audio_StreamEndpoint =
{
- .Endpoint =
+ .Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
@@ -216,18 +216,18 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = AUDIO_STREAM_EPSIZE,
.PollingIntervalMS = 1
},
-
+
.Refresh = 0,
.SyncEndpointNumber = 0
},
-
- .Audio_StreamEndpoint_SPC =
+
+ .Audio_StreamEndpoint_SPC =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = DSUBTYPE_General,
-
+
.Attributes = EP_ACCEPTS_SMALL_PACKETS,
-
+
.LockDelayUnits = 0x00,
.LockDelay = 0x0000
}
@@ -240,7 +240,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -251,7 +251,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -262,7 +262,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Audio In Demo"
};
@@ -288,30 +288,31 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/AudioInput/Descriptors.h b/Demos/Device/LowLevel/AudioInput/Descriptors.h
index d154f01a4..c8b43b617 100644
--- a/Demos/Device/LowLevel/AudioInput/Descriptors.h
+++ b/Demos/Device/LowLevel/AudioInput/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -59,7 +59,7 @@
/** Audio class descriptor subtype value for an Audio class specific descriptor indicating the format of an audio stream. */
#define DSUBTYPE_Format 0x02
-
+
//@{
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
@@ -94,7 +94,7 @@
//@{
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
-
+
#define TERMINAL_UNDEFINED 0x0100
#define TERMINAL_STREAMING 0x0101
#define TERMINAL_VENDOR 0x01FF
@@ -120,7 +120,7 @@
* \param[in] freq Required audio sampling frequency in HZ
*/
#define SAMPLE_FREQ(freq) {LowWord: ((uint32_t)(freq) & 0x00FFFF), HighByte: (((uint32_t)(freq) >> 16) & 0x0000FF)}
-
+
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
* accepts only filled endpoint packets of audio samples.
*/
@@ -133,16 +133,16 @@
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
-
+
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires
* at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller
* USB AVR models will result in unavoidable distorted output.
*/
#define AUDIO_STREAM_EPSIZE ENDPOINT_MAX_SIZE(AUDIO_STREAM_EPNUM)
-
+
/** Sample frequency of the data being transmitted through the streaming endpoint. */
#define AUDIO_SAMPLE_FREQUENCY 48000
-
+
/* Type Defines: */
/** Type define for an Audio class specific interface descriptor. This follows a regular interface descriptor to
* supply extra information about the audio device's layout to the host. See the USB Audio specification for more
@@ -155,11 +155,11 @@
uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
-
+
uint8_t InCollection; /**< Total number of audio class interfaces within this device */
uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
} USB_Audio_Interface_AC_t;
-
+
/** Type define for an Audio class specific Feature Unit descriptor. This indicates to the host what features
* are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
* specification for more details.
@@ -168,13 +168,13 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device */
uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */
-
+
uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */
-
+
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_Audio_FeatureUnit_t;
@@ -186,7 +186,7 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
@@ -194,7 +194,7 @@
*/
uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */
-
+
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_Audio_InputTerminal_t;
@@ -207,17 +207,17 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset
*/
uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from */
-
+
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_Audio_OutputTerminal_t;
-
+
/** Type define for an Audio class specific streaming interface descriptor. This indicates to the host
* how audio streams within the device are formatted. See the USB Audio specification for more details.
*/
@@ -225,13 +225,13 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing */
-
+
uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output */
uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification */
} USB_Audio_Interface_AS_t;
-
+
/** Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype,
* this this structure is used to build up the value instead. Fill this structure with the SAMPLE_FREQ() macro.
*/
@@ -252,15 +252,15 @@
uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification */
uint8_t Channels; /**< Total number of discrete channels in the stream */
-
+
uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream */
uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream */
- uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */
+ uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */
Audio_SampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
} USB_Audio_Format_t;
-
- /** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
+
+ /** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details.
*/
typedef struct
@@ -270,7 +270,7 @@
uint8_t Refresh; /**< Always set to zero */
uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise) */
} USB_Audio_StreamEndpoint_Std_t;
-
+
/** Type define for an Audio class specific extended endpoint descriptor. This contains extra information
* on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
* class specific extended endpoint descriptor. See the USB Audio specification for more details.
@@ -279,13 +279,13 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t Attributes; /**< Audio class specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS */
uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification */
uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry */
} USB_Audio_StreamEndpoint_Spc_t;
-
+
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@@ -304,7 +304,7 @@
USB_Audio_StreamEndpoint_Std_t Audio_StreamEndpoint;
USB_Audio_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -312,3 +312,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/AudioInput/makefile b/Demos/Device/LowLevel/AudioInput/makefile
index 34d6b2545..1b7fd07a3 100644
--- a/Demos/Device/LowLevel/AudioInput/makefile
+++ b/Demos/Device/LowLevel/AudioInput/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -136,7 +136,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -149,7 +149,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -263,7 +263,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -276,7 +276,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -288,7 +288,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -300,7 +300,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -323,7 +323,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -357,7 +357,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -391,7 +391,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -420,7 +420,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -439,10 +439,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -507,11 +507,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -538,9 +538,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -638,14 +638,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -667,7 +667,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -711,3 +711,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c
index fbadf8d0b..e33eb401e 100644
--- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c
+++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the AudioOutput demo. This file contains the main tasks of the demo and
* is responsible for the initial application hardware configuration.
*/
-
+
#include "AudioOutput.h"
/** Flag to indicate if the streaming audio alternative interface has been selected by the host. */
@@ -48,7 +48,7 @@ int main(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
USB_Audio_Task();
@@ -65,7 +65,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
LEDs_Init();
USB_Init();
@@ -78,12 +78,12 @@ void EVENT_USB_Device_Connect(void)
{
/* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
/* Sample reload timer initialization */
OCR0A = (F_CPU / 8 / AUDIO_SAMPLE_FREQUENCY) - 1;
TCCR0A = (1 << WGM01); // CTC mode
TCCR0B = (1 << CS01); // Fcpu/8 speed
-
+
#if defined(AUDIO_OUT_MONO)
/* Set speaker as output */
DDRC |= (1 << 6);
@@ -100,7 +100,7 @@ void EVENT_USB_Device_Connect(void)
TCCR3A = ((1 << WGM30) | (1 << COM3A1) | (1 << COM3A0)
| (1 << COM3B1) | (1 << COM3B0)); // Set on match, clear on TOP
TCCR3B = ((1 << WGM32) | (1 << CS30)); // Fast 8-Bit PWM, F_CPU speed
-#endif
+#endif
}
/** Event handler for the USB_Disconnect event. This indicates that the device is no longer connected to a host via
@@ -112,7 +112,7 @@ void EVENT_USB_Device_Disconnect(void)
TCCR0B = 0;
#if (defined(AUDIO_OUT_MONO) || defined(AUDIO_OUT_STEREO))
TCCR3B = 0;
-#endif
+#endif
#if defined(AUDIO_OUT_MONO)
/* Set speaker as input to reduce current draw */
@@ -182,11 +182,11 @@ void USB_Audio_Task(void)
/* Check to see if the streaming interface is selected, if not the host is not receiving audio */
if (!(StreamingAudioInterfaceSelected))
- return;
+ return;
/* Select the audio stream endpoint */
Endpoint_SelectEndpoint(AUDIO_STREAM_EPNUM);
-
+
/* Check if the current endpoint can be read from (contains a packet) and that the next sample should be read */
if (Endpoint_IsOUTReceived() && (TIFR0 & (1 << OCF0A)))
{
@@ -234,3 +234,4 @@ void USB_Audio_Task(void)
LEDs_SetAllLEDs(LEDMask);
}
}
+
diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h
index de7b07175..7e224f23c 100644
--- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h
+++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,11 +43,11 @@
#include <avr/interrupt.h>
#include "Descriptors.h"
-
+
#include <LUFA/Version.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -60,7 +60,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void USB_Audio_Task(void);
@@ -71,3 +71,4 @@
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.txt b/Demos/Device/LowLevel/AudioOutput/AudioOutput.txt
index 079b537b0..c42fc744b 100644
--- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.txt
+++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Audio Output Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -27,7 +27,7 @@
* <td><b>USB Class:</b></td>
* <td>Audio Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Standard Audio Device</td>
* </tr>
@@ -43,13 +43,13 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Audio demonstration application. This gives a simple reference
* application for implementing a USB Audio Output device using the
* basic USB Audio 1.0 drivers in all modern OSes (i.e. no special drivers
* required).
- *
+ *
* On start-up the system will automatically enumerate and function
* as a USB speaker. Outgoing audio will output in 8-bit PWM onto
* the timer 3 output compare channel A for AUDIO_OUT_MONO mode, on
@@ -57,7 +57,7 @@
* mono sample for AUDIO_OUT_PORTC. Audio output will also be indicated on
* the board LEDs in all modes. Decouple audio outputs with a capacitor and
* attach to a speaker to hear the audio.
- *
+ *
* Under Windows, if a driver request dialogue pops up, select the option
* to automatically install the appropriate drivers.
*
@@ -94,3 +94,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/AudioOutput/Descriptors.c b/Demos/Device/LowLevel/AudioOutput/Descriptors.c
index 1194568ad..cc3d8ccae 100644
--- a/Demos/Device/LowLevel/AudioOutput/Descriptors.c
+++ b/Demos/Device/LowLevel/AudioOutput/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,11 +30,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
-
+
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2046,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,7 +71,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
@@ -80,134 +80,134 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .Audio_ControlInterface =
+
+ .Audio_ControlInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
-
+
.Class = 0x01,
.SubClass = 0x01,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_ControlInterface_SPC =
+
+ .Audio_ControlInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_AudioHeader,
-
+
.ACSpecification = VERSION_BCD(01.00),
.TotalLength = (sizeof(USB_Audio_Interface_AC_t) +
sizeof(USB_Audio_InputTerminal_t) +
sizeof(USB_Audio_OutputTerminal_t)),
-
+
.InCollection = 1,
.InterfaceNumbers = {1},
},
- .Audio_InputTerminal =
+ .Audio_InputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_InputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_InputTerminal,
-
+
.TerminalID = 0x01,
.TerminalType = TERMINAL_STREAMING,
.AssociatedOutputTerminal = 0x00,
-
+
.TotalChannels = 2,
.ChannelConfig = (CHANNEL_LEFT_FRONT | CHANNEL_RIGHT_FRONT),
-
+
.ChannelStrIndex = NO_DESCRIPTOR,
.TerminalStrIndex = NO_DESCRIPTOR
},
- .Audio_OutputTerminal =
+ .Audio_OutputTerminal =
{
.Header = {.Size = sizeof(USB_Audio_OutputTerminal_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_OutputTerminal,
-
+
.TerminalID = 0x02,
.TerminalType = TERMINAL_OUT_SPEAKER,
.AssociatedInputTerminal = 0x00,
-
+
.SourceID = 0x01,
-
- .TerminalStrIndex = NO_DESCRIPTOR
+
+ .TerminalStrIndex = NO_DESCRIPTOR
},
- .Audio_StreamInterface_Alt0 =
+ .Audio_StreamInterface_Alt0 =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
-
+
.Class = 0x01,
.SubClass = 0x02,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .Audio_StreamInterface_Alt1 =
+ .Audio_StreamInterface_Alt1 =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 1,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x01,
.SubClass = 0x02,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_StreamInterface_SPC =
+
+ .Audio_StreamInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AS_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_General,
-
+
.TerminalLink = 0x01,
-
+
.FrameDelay = 1,
.AudioFormat = 0x0001
},
-
- .Audio_AudioFormat =
+
+ .Audio_AudioFormat =
{
.Header = {.Size = sizeof(USB_Audio_Format_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_Format,
.FormatType = 0x01,
.Channels = 0x02,
-
+
.SubFrameSize = 0x02,
.BitResolution = 16,
.SampleFrequencyType = (sizeof(ConfigurationDescriptor.Audio_AudioFormat.SampleFrequencies) /
- sizeof(Audio_SampleFreq_t)),
+ sizeof(Audio_SampleFreq_t)),
.SampleFrequencies = {SAMPLE_FREQ(AUDIO_SAMPLE_FREQUENCY)}
},
-
- .Audio_StreamEndpoint =
+
+ .Audio_StreamEndpoint =
{
- .Endpoint =
+ .Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
@@ -216,18 +216,18 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = AUDIO_STREAM_EPSIZE,
.PollingIntervalMS = 1
},
-
+
.Refresh = 0,
.SyncEndpointNumber = 0
},
-
- .Audio_StreamEndpoint_SPC =
+
+ .Audio_StreamEndpoint_SPC =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Spc_t), .Type = DTYPE_CSEndpoint},
.Subtype = DSUBTYPE_General,
-
+
.Attributes = EP_ACCEPTS_SMALL_PACKETS,
-
+
.LockDelayUnits = 0x00,
.LockDelay = 0x0000
}
@@ -240,7 +240,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -251,7 +251,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -262,7 +262,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(19), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Audio Out Demo"
};
@@ -292,26 +292,27 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/AudioOutput/Descriptors.h b/Demos/Device/LowLevel/AudioOutput/Descriptors.h
index cd6b2b8cf..c8b43b617 100644
--- a/Demos/Device/LowLevel/AudioOutput/Descriptors.h
+++ b/Demos/Device/LowLevel/AudioOutput/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -59,7 +59,7 @@
/** Audio class descriptor subtype value for an Audio class specific descriptor indicating the format of an audio stream. */
#define DSUBTYPE_Format 0x02
-
+
//@{
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
@@ -94,7 +94,7 @@
//@{
/** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
-
+
#define TERMINAL_UNDEFINED 0x0100
#define TERMINAL_STREAMING 0x0101
#define TERMINAL_VENDOR 0x01FF
@@ -120,7 +120,7 @@
* \param[in] freq Required audio sampling frequency in HZ
*/
#define SAMPLE_FREQ(freq) {LowWord: ((uint32_t)(freq) & 0x00FFFF), HighByte: (((uint32_t)(freq) >> 16) & 0x0000FF)}
-
+
/** Mask for the attributes parameter of an Audio class specific Endpoint descriptor, indicating that the endpoint
* accepts only filled endpoint packets of audio samples.
*/
@@ -133,16 +133,16 @@
/** Endpoint number of the Audio isochronous streaming data endpoint. */
#define AUDIO_STREAM_EPNUM 1
-
+
/** Endpoint size in bytes of the Audio isochronous streaming data endpoint. The Windows audio stack requires
* at least 192 bytes for correct output, thus the smaller 128 byte maximum endpoint size on some of the smaller
* USB AVR models will result in unavoidable distorted output.
*/
#define AUDIO_STREAM_EPSIZE ENDPOINT_MAX_SIZE(AUDIO_STREAM_EPNUM)
-
+
/** Sample frequency of the data being transmitted through the streaming endpoint. */
#define AUDIO_SAMPLE_FREQUENCY 48000
-
+
/* Type Defines: */
/** Type define for an Audio class specific interface descriptor. This follows a regular interface descriptor to
* supply extra information about the audio device's layout to the host. See the USB Audio specification for more
@@ -155,11 +155,11 @@
uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
-
+
uint8_t InCollection; /**< Total number of audio class interfaces within this device */
uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
} USB_Audio_Interface_AC_t;
-
+
/** Type define for an Audio class specific Feature Unit descriptor. This indicates to the host what features
* are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio
* specification for more details.
@@ -168,13 +168,13 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device */
uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit */
-
+
uint8_t ControlSize; /**< Size of each element in the ChanelControlls array */
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel */
-
+
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_Audio_FeatureUnit_t;
@@ -186,7 +186,7 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
@@ -194,7 +194,7 @@
*/
uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal */
-
+
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device */
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_Audio_InputTerminal_t;
@@ -207,17 +207,17 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask */
uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset
*/
uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from */
-
+
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_Audio_OutputTerminal_t;
-
+
/** Type define for an Audio class specific streaming interface descriptor. This indicates to the host
* how audio streams within the device are formatted. See the USB Audio specification for more details.
*/
@@ -225,13 +225,13 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing */
-
+
uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output */
uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification */
} USB_Audio_Interface_AS_t;
-
+
/** Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype,
* this this structure is used to build up the value instead. Fill this structure with the SAMPLE_FREQ() macro.
*/
@@ -252,15 +252,15 @@
uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification */
uint8_t Channels; /**< Total number of discrete channels in the stream */
-
+
uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream */
uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream */
- uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */
+ uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device */
Audio_SampleFreq_t SampleFrequencies[1]; /**< Sample frequencies supported by the device */
} USB_Audio_Format_t;
-
- /** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
+
+ /** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details.
*/
typedef struct
@@ -270,7 +270,7 @@
uint8_t Refresh; /**< Always set to zero */
uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise) */
} USB_Audio_StreamEndpoint_Std_t;
-
+
/** Type define for an Audio class specific extended endpoint descriptor. This contains extra information
* on the usage of endpoints used to stream audio in and out of the USB Audio device, and follows an Audio
* class specific extended endpoint descriptor. See the USB Audio specification for more details.
@@ -279,12 +279,12 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint8_t Attributes; /**< Audio class specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS */
uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification */
uint16_t LockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry */
- } USB_Audio_StreamEndpoint_Spc_t;
+ } USB_Audio_StreamEndpoint_Spc_t;
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
@@ -304,7 +304,7 @@
USB_Audio_StreamEndpoint_Std_t Audio_StreamEndpoint;
USB_Audio_StreamEndpoint_Spc_t Audio_StreamEndpoint_SPC;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -312,3 +312,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/AudioOutput/makefile b/Demos/Device/LowLevel/AudioOutput/makefile
index 6bcfcafd5..1f526006c 100644
--- a/Demos/Device/LowLevel/AudioOutput/makefile
+++ b/Demos/Device/LowLevel/AudioOutput/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -138,7 +138,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -151,7 +151,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -265,7 +265,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -278,7 +278,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -290,7 +290,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -302,7 +302,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -325,7 +325,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -359,7 +359,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -393,7 +393,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -422,7 +422,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -441,10 +441,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -509,11 +509,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -540,9 +540,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -640,14 +640,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -669,7 +669,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -713,3 +713,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c
index ac9739fd7..ca5af2770 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c
+++ b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -57,22 +57,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0xEF,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204E,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,22 +83,22 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 4,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC1_IAD =
+
+ .CDC1_IAD =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_Association_t), .Type = DTYPE_InterfaceAssociation},
@@ -112,94 +112,94 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.IADStrIndex = NO_DESCRIPTOR
},
- .CDC1_CCI_Interface =
+ .CDC1_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC1_Functional_Header =
+ .CDC1_Functional_Header =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = 0x00,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC1_Functional_ACM =
+ .CDC1_Functional_ACM =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = 0x02,
-
+
.Capabilities = 0x06,
},
-
- .CDC1_Functional_Union =
+
+ .CDC1_Functional_Union =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = 0x06,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC1_ManagementEndpoint =
+ .CDC1_ManagementEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC1_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC1_DCI_Interface =
+ .CDC1_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC1_DataOutEndpoint =
+ .CDC1_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC1_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC1_DataInEndpoint =
+
+ .CDC1_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC1_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
- .CDC2_IAD =
+ .CDC2_IAD =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_Association_t), .Type = DTYPE_InterfaceAssociation},
@@ -213,87 +213,87 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.IADStrIndex = NO_DESCRIPTOR
},
- .CDC2_CCI_Interface =
+ .CDC2_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 2,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC2_Functional_Header =
+ .CDC2_Functional_Header =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = 0x00,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC2_Functional_ACM =
+ .CDC2_Functional_ACM =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = 0x02,
-
+
.Capabilities = 0x06,
},
-
- .CDC2_Functional_Union =
+
+ .CDC2_Functional_Union =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = 0x06,
-
+
.MasterInterfaceNumber = 2,
.SlaveInterfaceNumber = 3,
},
- .CDC2_ManagementEndpoint =
+ .CDC2_ManagementEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC2_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC2_DCI_Interface =
+ .CDC2_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 3,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC2_DataOutEndpoint =
+ .CDC2_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC2_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC2_DataInEndpoint =
+
+ .CDC2_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC2_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -308,7 +308,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -319,7 +319,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -330,7 +330,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Dual CDC Demo"
};
@@ -349,37 +349,38 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
-
+
switch (DescriptorType)
{
case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
- *DescriptorAddress = Address;
+
+ *DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
index 90091ea22..ba876f1df 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
+++ b/Demos/Device/LowLevel/DualVirtualSerial/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -40,22 +40,22 @@
#include <LUFA/Drivers/USB/USB.h>
#include <avr/pgmspace.h>
-
+
/* Macros: */
/** Endpoint number of the first CDC interface's device-to-host data IN endpoint. */
- #define CDC1_TX_EPNUM 1
+ #define CDC1_TX_EPNUM 1
/** Endpoint number of the first CDC interface's host-to-device data OUT endpoint. */
- #define CDC1_RX_EPNUM 2
+ #define CDC1_RX_EPNUM 2
/** Endpoint number of the first CDC interface's device-to-host notification IN endpoint. */
#define CDC1_NOTIFICATION_EPNUM 3
/** Endpoint number of the second CDC interface's device-to-host data IN endpoint. */
- #define CDC2_TX_EPNUM 4
+ #define CDC2_TX_EPNUM 4
/** Endpoint number of the second CDC interface's host-to-device data OUT endpoint. */
- #define CDC2_RX_EPNUM 5
+ #define CDC2_RX_EPNUM 5
/** Endpoint number of the second CDC interface's device-to-host notification IN endpoint. */
#define CDC2_NOTIFICATION_EPNUM 6
@@ -64,7 +64,7 @@
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
- #define CDC_TXRX_EPSIZE 16
+ #define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
@@ -89,7 +89,7 @@
uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
} USB_Descriptor_CDC_FunctionalACM_t;
-
+
/** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
* CDC control and data interfaces are related. See the CDC class specification for more details.
*/
@@ -135,3 +135,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
index 67463084e..45159a8f8 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
+++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the DualVirtualSerial demo. This file contains the main tasks of the demo and
* is responsible for the initial application hardware configuration.
*/
-
+
#include "DualVirtualSerial.h"
/** Contains the current baud rate and other settings of the first virtual serial port. While this demo does not use
@@ -69,7 +69,7 @@ CDC_Line_Coding_t LineEncoding2 = { .BaudRateBPS = 0,
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -160,14 +160,14 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
case REQ_GetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
- {
+ {
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
- Endpoint_Write_Control_Stream_LE(LineEncodingData, sizeof(CDC_Line_Coding_t));
+ Endpoint_Write_Control_Stream_LE(LineEncodingData, sizeof(CDC_Line_Coding_t));
Endpoint_ClearOUT();
}
-
+
break;
case REQ_SetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -178,7 +178,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_Read_Control_Stream_LE(LineEncodingData, sizeof(CDC_Line_Coding_t));
Endpoint_ClearIN();
}
-
+
break;
case REQ_SetControlLineState:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -186,7 +186,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_ClearSETUP();
Endpoint_ClearStatusStage();
}
-
+
break;
}
}
@@ -199,7 +199,7 @@ void CDC1_Task(void)
char* ReportString = NULL;
uint8_t JoyStatus_LCL = Joystick_GetStatus();
static bool ActionSent = false;
-
+
/* Device must be connected and configured for the task to run */
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
@@ -222,26 +222,26 @@ void CDC1_Task(void)
if ((ReportString != NULL) && (ActionSent == false) && LineEncoding1.BaudRateBPS)
{
ActionSent = true;
-
+
/* Select the Serial Tx Endpoint */
Endpoint_SelectEndpoint(CDC1_TX_EPNUM);
/* Write the String to the Endpoint */
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString));
-
+
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
/* Wait until the endpoint is ready for another packet */
Endpoint_WaitUntilReady();
-
+
/* Send an empty packet to ensure that the host does not buffer data sent to it */
Endpoint_ClearIN();
}
/* Select the Serial Rx Endpoint */
Endpoint_SelectEndpoint(CDC1_RX_EPNUM);
-
+
/* Throw away any received data from the host */
if (Endpoint_IsOUTReceived())
Endpoint_ClearOUT();
@@ -258,16 +258,16 @@ void CDC2_Task(void)
/* Select the Serial Rx Endpoint */
Endpoint_SelectEndpoint(CDC2_RX_EPNUM);
-
+
/* Check to see if any data has been received */
if (Endpoint_IsOUTReceived())
{
/* Create a temp buffer big enough to hold the incoming endpoint packet */
uint8_t Buffer[Endpoint_BytesInEndpoint()];
-
+
/* Remember how large the incoming packet is */
uint16_t DataLength = Endpoint_BytesInEndpoint();
-
+
/* Read in the incoming packet into the buffer */
Endpoint_Read_Stream_LE(&Buffer, DataLength);
@@ -276,7 +276,7 @@ void CDC2_Task(void)
/* Select the Serial Tx Endpoint */
Endpoint_SelectEndpoint(CDC2_TX_EPNUM);
-
+
/* Write the received data to the endpoint */
Endpoint_Write_Stream_LE(&Buffer, DataLength);
@@ -290,3 +290,4 @@ void CDC2_Task(void)
Endpoint_ClearIN();
}
}
+
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h
index 6cce44c5f..b66750112 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h
+++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -87,7 +87,7 @@
*/
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} CDC_Line_Coding_t;
-
+
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
@@ -96,7 +96,7 @@
OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
TwoStopBits = 2, /**< Each frame contains two stop bits */
};
-
+
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t
{
@@ -116,5 +116,6 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt
index 03a97cee9..2989e7adb 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt
+++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Dual Communications Device Class (Dual Virtual Serial Port) Device
*
* \section SSec_Compat Demo Compatibility:
@@ -27,7 +27,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -46,7 +46,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Dual Communications Device Class demonstration application.
* This gives a simple reference application for implementing
@@ -56,13 +56,13 @@
* descriptors for each virtual serial port, which may not be
* supported in all OSes - Windows Vista is supported, as is
* XP (although the latter may need a hotfix to function).
- *
+ *
* Joystick actions are transmitted to the host as strings
* through the first serial port. The device does not respond to
* serial data sent from the host in the first serial port.
- *
+ *
* The second serial port echoes back data sent from the host.
- *
+ *
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* project's directory as the device's driver when running under
@@ -83,3 +83,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/DualVirtualSerial/makefile b/Demos/Device/LowLevel/DualVirtualSerial/makefile
index bf8c8e0aa..7eb6bb44e 100644
--- a/Demos/Device/LowLevel/DualVirtualSerial/makefile
+++ b/Demos/Device/LowLevel/DualVirtualSerial/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.c b/Demos/Device/LowLevel/GenericHID/Descriptors.c
index 88388e641..440179645 100644
--- a/Demos/Device/LowLevel/GenericHID/Descriptors.c
+++ b/Demos/Device/LowLevel/GenericHID/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -71,22 +71,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM GenericReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204F,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -97,41 +97,41 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x03,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_GenericHID =
+ .HID_GenericHID =
{
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
@@ -139,20 +139,20 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(GenericReport)
},
- .HID_ReportINEndpoint =
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | GENERIC_IN_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = GENERIC_EPSIZE,
.PollingIntervalMS = 0x0A
},
- .HID_ReportOUTEndpoint =
+ .HID_ReportOUTEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | GENERIC_OUT_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = GENERIC_EPSIZE,
@@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -178,7 +178,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -189,7 +189,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(21), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Generic HID Demo"
};
@@ -215,38 +215,39 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case DTYPE_HID:
+ case DTYPE_HID:
Address = &ConfigurationDescriptor.HID_GenericHID;
Size = sizeof(USB_Descriptor_HID_t);
break;
- case DTYPE_Report:
+ case DTYPE_Report:
Address = &GenericReport;
Size = sizeof(GenericReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/GenericHID/Descriptors.h b/Demos/Device/LowLevel/GenericHID/Descriptors.h
index a6a5e35ad..2033c27e7 100644
--- a/Demos/Device/LowLevel/GenericHID/Descriptors.h
+++ b/Demos/Device/LowLevel/GenericHID/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -48,10 +48,10 @@
typedef struct
{
USB_Descriptor_Header_t Header;
-
+
uint16_t HIDSpec;
uint8_t CountryCode;
-
+
uint8_t TotalReportDescriptors;
uint8_t HIDReportType;
@@ -73,7 +73,7 @@
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the Generic HID reporting IN endpoint. */
#define GENERIC_IN_EPNUM 1
@@ -83,13 +83,13 @@
/** Size in bytes of the Generic HID reporting endpoint. */
#define GENERIC_EPSIZE 8
-
+
/** Size in bytes of the Generic HID reports (including report ID byte). */
#define GENERIC_REPORT_SIZE 8
/** Descriptor header type value, to indicate a HID class HID descriptor. */
#define DTYPE_HID 0x21
-
+
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
#define DTYPE_Report 0x22
@@ -100,3 +100,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.c b/Demos/Device/LowLevel/GenericHID/GenericHID.c
index a72cecb45..d7c2e3728 100644
--- a/Demos/Device/LowLevel/GenericHID/GenericHID.c
+++ b/Demos/Device/LowLevel/GenericHID/GenericHID.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@ static uint8_t LastReceived[GENERIC_REPORT_SIZE];
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -128,7 +128,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_Write_Control_Stream_LE(&GenericData, sizeof(GenericData));
Endpoint_ClearOUT();
}
-
+
break;
case REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -143,7 +143,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
ProcessGenericHIDReport(GenericData);
}
-
+
break;
}
}
@@ -159,7 +159,7 @@ void ProcessGenericHIDReport(uint8_t* DataArray)
DataArray is an array holding the last report from the host. This function is called
each time the host has sent a report to the device.
*/
-
+
for (uint8_t i = 0; i < GENERIC_REPORT_SIZE; i++)
LastReceived[i] = DataArray[i];
}
@@ -172,7 +172,7 @@ void CreateGenericHIDReport(uint8_t* DataArray)
{
/*
This is where you need to create reports to be sent to the host from the device. This
- function is called each time the host is ready to accept a new report. DataArray is
+ function is called each time the host is ready to accept a new report. DataArray is
an array to hold the report to the host.
*/
@@ -187,7 +187,7 @@ void HID_Task(void)
return;
Endpoint_SelectEndpoint(GENERIC_OUT_EPNUM);
-
+
/* Check to see if a packet has been sent from the host */
if (Endpoint_IsOUTReceived())
{
@@ -196,26 +196,26 @@ void HID_Task(void)
{
/* Create a temporary buffer to hold the read in report from the host */
uint8_t GenericData[GENERIC_REPORT_SIZE];
-
+
/* Read Generic Report Data */
Endpoint_Read_Stream_LE(&GenericData, sizeof(GenericData));
-
+
/* Process Generic Report Data */
ProcessGenericHIDReport(GenericData);
}
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearOUT();
- }
+ }
Endpoint_SelectEndpoint(GENERIC_IN_EPNUM);
-
+
/* Check to see if the host is ready to accept another packet */
if (Endpoint_IsINReady())
{
/* Create a temporary buffer to hold the report to send to the host */
uint8_t GenericData[GENERIC_REPORT_SIZE];
-
+
/* Create Generic Report Data */
CreateGenericHIDReport(GenericData);
@@ -226,3 +226,4 @@ void HID_Task(void)
Endpoint_ClearIN();
}
}
+
diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.h b/Demos/Device/LowLevel/GenericHID/GenericHID.h
index e6e0666f4..840902e51 100644
--- a/Demos/Device/LowLevel/GenericHID/GenericHID.h
+++ b/Demos/Device/LowLevel/GenericHID/GenericHID.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for GenericHID.c.
*/
-
+
#ifndef _GENERICHID_H_
#define _GENERICHID_H_
@@ -43,13 +43,13 @@
#include <avr/interrupt.h>
#include <stdbool.h>
#include <string.h>
-
+
#include "Descriptors.h"
#include <LUFA/Version.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
/* Macros: */
/** HID Class specific request to get the next HID report from the device. */
#define REQ_GetReport 0x01
@@ -72,7 +72,7 @@
/* Function Prototypes: */
void SetupHardware(void);
void HID_Task(void);
-
+
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
@@ -81,5 +81,6 @@
void ProcessGenericHIDReport(uint8_t* DataArray);
void CreateGenericHIDReport(uint8_t* DataArray);
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.txt b/Demos/Device/LowLevel/GenericHID/GenericHID.txt
index b73a9512d..60920c7fb 100644
--- a/Demos/Device/LowLevel/GenericHID/GenericHID.txt
+++ b/Demos/Device/LowLevel/GenericHID/GenericHID.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Generic HID Device
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -44,19 +44,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Generic HID device demonstration application. This gives a simple reference application
* for implementing a generic HID device, using the basic USB HID drivers in all modern
* OSes (i.e. no special drivers required). By default it accepts and sends up to 8 byte reports
* to and from a USB Host, and transmits the last sent report back to the host.
- *
+ *
* On start-up the system will automatically enumerate and function as a vendor HID device.
* When controlled by a custom HID class application, reports can be sent and received by
* both the standard data endpoint and control request methods defined in the HID specification.
*
* \section SSec_Options Project Options
- *
+ *
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
@@ -73,3 +73,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/GenericHID/makefile b/Demos/Device/LowLevel/GenericHID/makefile
index 8e366900d..bbcc74160 100644
--- a/Demos/Device/LowLevel/GenericHID/makefile
+++ b/Demos/Device/LowLevel/GenericHID/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/Joystick/Descriptors.c b/Demos/Device/LowLevel/Joystick/Descriptors.c
index 19925a9c9..08674c8d6 100644
--- a/Demos/Device/LowLevel/Joystick/Descriptors.c
+++ b/Demos/Device/LowLevel/Joystick/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -81,22 +81,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2043,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -107,41 +107,41 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_JoystickHID =
+ .HID_JoystickHID =
{
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
@@ -149,15 +149,15 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(JoystickReport)
},
- .HID_ReportINEndpoint =
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | JOYSTICK_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = JOYSTICK_EPSIZE,
.PollingIntervalMS = 0x0A
- }
+ }
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
@@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -178,7 +178,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -189,7 +189,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Joystick Demo"
};
@@ -215,38 +215,39 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case DTYPE_HID:
+ case DTYPE_HID:
Address = &ConfigurationDescriptor.HID_JoystickHID;
Size = sizeof(USB_Descriptor_HID_t);
break;
- case DTYPE_Report:
+ case DTYPE_Report:
Address = &JoystickReport;
Size = sizeof(JoystickReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/Joystick/Descriptors.h b/Demos/Device/LowLevel/Joystick/Descriptors.h
index ee828fd4c..76f609715 100644
--- a/Demos/Device/LowLevel/Joystick/Descriptors.h
+++ b/Demos/Device/LowLevel/Joystick/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -48,10 +48,10 @@
typedef struct
{
USB_Descriptor_Header_t Header;
-
+
uint16_t HIDSpec;
uint8_t CountryCode;
-
+
uint8_t TotalReportDescriptors;
uint8_t HIDReportType;
@@ -72,7 +72,7 @@
USB_Descriptor_HID_t HID_JoystickHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the Joystick HID reporting IN endpoint. */
#define JOYSTICK_EPNUM 1
@@ -82,7 +82,7 @@
/** Descriptor header type value, to indicate a HID class HID descriptor. */
#define DTYPE_HID 0x21
-
+
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
#define DTYPE_Report 0x22
@@ -93,3 +93,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/Joystick/Joystick.c b/Demos/Device/LowLevel/Joystick/Joystick.c
index 5aadb599c..24f744fdb 100644
--- a/Demos/Device/LowLevel/Joystick/Joystick.c
+++ b/Demos/Device/LowLevel/Joystick/Joystick.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -90,7 +90,7 @@ void EVENT_USB_Device_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration
* of the USB device after enumeration - the device endpoints are configured and the joystick reporting task started.
- */
+ */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
@@ -116,8 +116,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
USB_JoystickReport_Data_t JoystickReportData;
-
- /* Create the next HID report to send to the host */
+
+ /* Create the next HID report to send to the host */
GetNextReport(&JoystickReportData);
Endpoint_ClearSETUP();
@@ -126,7 +126,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_Write_Control_Stream_LE(&JoystickReportData, sizeof(JoystickReportData));
Endpoint_ClearOUT();
}
-
+
break;
}
}
@@ -160,10 +160,10 @@ bool GetNextReport(USB_JoystickReport_Data_t* const ReportData)
if (JoyStatus_LCL & JOY_PRESS)
ReportData->Button = (1 << 1);
-
+
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
ReportData->Button |= (1 << 0);
-
+
/* Check if the new report is different to the previous report */
InputChanged = (uint8_t)(PrevJoyStatus ^ JoyStatus_LCL) | (uint8_t)(PrevButtonStatus ^ ButtonStatus_LCL);
@@ -181,7 +181,7 @@ void HID_Task(void)
/* Device must be connected and configured for the task to run */
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
-
+
/* Select the Joystick Report Endpoint */
Endpoint_SelectEndpoint(JOYSTICK_EPNUM);
@@ -189,17 +189,18 @@ void HID_Task(void)
if (Endpoint_IsINReady())
{
USB_JoystickReport_Data_t JoystickReportData;
-
+
/* Create the next HID report to send to the host */
GetNextReport(&JoystickReportData);
-
+
/* Write Joystick Report Data */
Endpoint_Write_Stream_LE(&JoystickReportData, sizeof(JoystickReportData));
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
-
+
/* Clear the report data afterwards */
memset(&JoystickReportData, 0, sizeof(JoystickReportData));
}
}
+
diff --git a/Demos/Device/LowLevel/Joystick/Joystick.h b/Demos/Device/LowLevel/Joystick/Joystick.h
index 607f56ec9..e1ae51228 100644
--- a/Demos/Device/LowLevel/Joystick/Joystick.h
+++ b/Demos/Device/LowLevel/Joystick/Joystick.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Joystick.c.
*/
-
+
#ifndef _JOYSTICK_H_
#define _JOYSTICK_H_
@@ -66,7 +66,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Type Defines: */
/** Type define for the joystick HID report structure, for creating and sending HID reports to the host PC.
* This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
@@ -90,3 +90,4 @@
bool GetNextReport(USB_JoystickReport_Data_t* const ReportData);
#endif
+
diff --git a/Demos/Device/LowLevel/Joystick/Joystick.txt b/Demos/Device/LowLevel/Joystick/Joystick.txt
index 5b1495cbc..0a8dff697 100644
--- a/Demos/Device/LowLevel/Joystick/Joystick.txt
+++ b/Demos/Device/LowLevel/Joystick/Joystick.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Joystick Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -44,19 +44,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Joystick demonstration application. This gives a simple reference
* application for implementing a USB Keyboard device, for USB Joysticks
* using the standard Keyboard HID profile.
- *
+ *
* This device will show up as a generic joystick device, with two buttons.
* Pressing the joystick inwards is the first button, and the HWB button
* is the second.
- *
+ *
* Moving the joystick on the selected board moves the joystick location on
* the host computer.
- *
+ *
* Currently only single interface joysticks are supported.
*
* \section SSec_Options Project Options
@@ -71,3 +71,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/Joystick/makefile b/Demos/Device/LowLevel/Joystick/makefile
index 710ec136e..e253c56d7 100644
--- a/Demos/Device/LowLevel/Joystick/makefile
+++ b/Demos/Device/LowLevel/Joystick/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/Keyboard/Descriptors.c b/Demos/Device/LowLevel/Keyboard/Descriptors.c
index 69265cba9..e1a87662f 100644
--- a/Demos/Device/LowLevel/Keyboard/Descriptors.c
+++ b/Demos/Device/LowLevel/Keyboard/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,14 +9,14 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -31,9 +31,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -88,22 +88,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2042,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -114,49 +114,49 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_KeyboardHID =
- {
+ .HID_KeyboardHID =
+ {
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
-
- .HID_ReportINEndpoint =
+
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -166,7 +166,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x0A
},
- .HID_ReportOUTEndpoint =
+ .HID_ReportOUTEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -184,7 +184,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -195,7 +195,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -206,7 +206,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Keyboard Demo"
};
@@ -228,42 +228,43 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case DTYPE_HID:
+ case DTYPE_HID:
Address = &ConfigurationDescriptor.HID_KeyboardHID;
Size = sizeof(USB_Descriptor_HID_t);
break;
- case DTYPE_Report:
+ case DTYPE_Report:
Address = &KeyboardReport;
Size = sizeof(KeyboardReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/Keyboard/Descriptors.h b/Demos/Device/LowLevel/Keyboard/Descriptors.h
index 815381bb7..0ee13a4e4 100644
--- a/Demos/Device/LowLevel/Keyboard/Descriptors.h
+++ b/Demos/Device/LowLevel/Keyboard/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,14 +9,14 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,20 +45,20 @@
/* Type Defines: */
/** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
* specification for details on the structure elements.
- */
+ */
typedef struct
{
USB_Descriptor_Header_t Header;
-
+
uint16_t HIDSpec;
uint8_t CountryCode;
-
+
uint8_t TotalReportDescriptors;
uint8_t HIDReportType;
uint16_t HIDReportLength;
} USB_Descriptor_HID_t;
-
+
/** Type define for the data type used to store HID report descriptor elements. */
typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
@@ -74,20 +74,20 @@
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
USB_Descriptor_Endpoint_t HID_ReportOUTEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_IN_EPNUM 1
/** Endpoint number of the Keyboard HID reporting OUT endpoint. */
#define KEYBOARD_OUT_EPNUM 2
-
- /** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
+
+ /** Size in bytes of the Keyboard HID reporting IN and OUT endpoints. */
#define KEYBOARD_EPSIZE 8
/** Descriptor header type value, to indicate a HID class HID descriptor. */
#define DTYPE_HID 0x21
-
+
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
#define DTYPE_Report 0x22
@@ -98,3 +98,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c
index b4d4c2137..9d187f850 100644
--- a/Demos/Device/LowLevel/Keyboard/Keyboard.c
+++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* Main source file for the Keyboard demo. This file contains the main tasks of the demo and
* is responsible for the initial application hardware configuration.
*/
-
+
#include "Keyboard.h"
/** Indicates what report mode the host has requested, true for normal HID reporting mode, false for special boot
@@ -48,7 +48,7 @@ bool UsingReportProtocol = true;
uint16_t IdleCount = 500;
/** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle
- * milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request
+ * milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request
* the current idle period via a Get Idle HID class request, thus its value must be preserved.
*/
uint16_t IdleMSRemaining = 0;
@@ -60,7 +60,7 @@ uint16_t IdleMSRemaining = 0;
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -113,7 +113,7 @@ void EVENT_USB_Device_Disconnect(void)
* of the USB device after enumeration, and configures the keyboard device endpoints.
*/
void EVENT_USB_Device_ConfigurationChanged(void)
-{
+{
bool ConfigSuccess = true;
/* Setup HID Report Endpoints */
@@ -126,7 +126,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
USB_Device_EnableSOFEvents();
/* Indicate endpoint configuration success or failure */
- LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
@@ -152,13 +152,13 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_Write_Control_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));
Endpoint_ClearOUT();
}
-
+
break;
case REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
-
+
/* Wait until the LED report has been sent by the host */
while (!(Endpoint_IsOUTReceived()))
{
@@ -175,20 +175,20 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process the incoming LED report */
ProcessLEDReport(LEDStatus);
}
-
+
break;
case REQ_GetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
-
+
/* Write the current protocol flag to the host */
Endpoint_Write_Byte(UsingReportProtocol);
Endpoint_ClearIN();
Endpoint_ClearStatusStage();
}
-
+
break;
case REQ_SetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -199,26 +199,26 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
UsingReportProtocol = (USB_ControlRequest.wValue != 0);
}
-
+
break;
case REQ_SetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
- Endpoint_ClearSETUP();
+ Endpoint_ClearSETUP();
Endpoint_ClearStatusStage();
/* Get idle period in MSB, IdleCount must be multiplied by 4 to get number of milliseconds */
IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6);
}
-
+
break;
case REQ_GetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
- {
+ {
Endpoint_ClearSETUP();
-
+
/* Write the current idle duration to the host, must be divided by 4 before sent to host */
- Endpoint_Write_Byte(IdleCount >> 2);
+ Endpoint_Write_Byte(IdleCount >> 2);
Endpoint_ClearIN();
Endpoint_ClearStatusStage();
@@ -249,10 +249,10 @@ void CreateKeyboardReport(USB_KeyboardReport_Data_t* const ReportData)
/* Clear the report contents */
memset(ReportData, 0, sizeof(USB_KeyboardReport_Data_t));
-
+
/* Make sent key uppercase by indicating that the left shift key is pressed */
ReportData->Modifier = KEYBOARD_MODIFER_LEFTSHIFT;
-
+
if (JoyStatus_LCL & JOY_UP)
ReportData->KeyCode[UsedKeyCodes++] = 0x04; // A
else if (JoyStatus_LCL & JOY_DOWN)
@@ -265,7 +265,7 @@ void CreateKeyboardReport(USB_KeyboardReport_Data_t* const ReportData)
if (JoyStatus_LCL & JOY_PRESS)
ReportData->KeyCode[UsedKeyCodes++] = 0x08; // E
-
+
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
ReportData->KeyCode[UsedKeyCodes++] = 0x09; // F
}
@@ -277,10 +277,10 @@ void CreateKeyboardReport(USB_KeyboardReport_Data_t* const ReportData)
void ProcessLEDReport(const uint8_t LEDReport)
{
uint8_t LEDMask = LEDS_LED2;
-
+
if (LEDReport & KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
-
+
if (LEDReport & KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
@@ -297,23 +297,23 @@ void SendNextReport(void)
static USB_KeyboardReport_Data_t PrevKeyboardReportData;
USB_KeyboardReport_Data_t KeyboardReportData;
bool SendReport = true;
-
+
/* Create the next keyboard report for transmission to the host */
CreateKeyboardReport(&KeyboardReportData);
-
+
/* Check to see if the report data has changed - if so a report MUST be sent */
SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0);
-
+
/* Check if the idle period is set and has elapsed */
if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))
{
/* Reset the idle time remaining counter */
IdleMSRemaining = IdleCount;
-
+
/* Idle period is set and has elapsed, must send a report to the host */
SendReport = true;
}
-
+
/* Select the Keyboard Report Endpoint */
Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM);
@@ -322,10 +322,10 @@ void SendNextReport(void)
{
/* Save the current report data for later comparison to check for changes */
PrevKeyboardReportData = KeyboardReportData;
-
+
/* Write Keyboard Report Data */
Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData));
-
+
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
}
@@ -361,10 +361,11 @@ void HID_Task(void)
/* Device must be connected and configured for the task to run */
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
-
+
/* Send the next keypress report to the host */
SendNextReport();
-
+
/* Process the LED report sent from the host */
ReceiveNextReport();
}
+
diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.h b/Demos/Device/LowLevel/Keyboard/Keyboard.h
index e5904b8d6..06526566c 100644
--- a/Demos/Device/LowLevel/Keyboard/Keyboard.h
+++ b/Demos/Device/LowLevel/Keyboard/Keyboard.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -101,7 +101,7 @@
/** Constant for a keyboard output report LED byte, indicating that the host's NUM LOCK mode is currently set. */
#define KEYBOARD_LED_NUMLOCK (1 << 0)
-
+
/** Constant for a keyboard output report LED byte, indicating that the host's CAPS LOCK mode is currently set. */
#define KEYBOARD_LED_CAPSLOCK (1 << 1)
@@ -110,7 +110,7 @@
/** Constant for a keyboard output report LED byte, indicating that the host's KATANA mode is currently set. */
#define KEYBOARD_LED_KATANA (1 << 3)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -133,11 +133,11 @@
uint8_t Reserved; /**< Reserved, always set as 0x00 */
uint8_t KeyCode[6]; /**< Array of up to six simultaneous key codes of pressed keys */
} USB_KeyboardReport_Data_t;
-
+
/* Function Prototypes: */
void SetupHardware(void);
void HID_Task(void);
-
+
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
@@ -150,3 +150,4 @@
void ReceiveNextReport(void);
#endif
+
diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.txt b/Demos/Device/LowLevel/Keyboard/Keyboard.txt
index 49e990f24..54d86d3a7 100644
--- a/Demos/Device/LowLevel/Keyboard/Keyboard.txt
+++ b/Demos/Device/LowLevel/Keyboard/Keyboard.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Keyboard Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -50,8 +50,8 @@
* for implementing a USB Keyboard using the basic USB HID drivers in all modern
* OSes (i.e. no special drivers required). It is boot protocol compatible, and thus
* works under compatible BIOS as if it was a native keyboard (e.g. PS/2).
- *
- * On start-up the system will automatically enumerate and function as a keyboard
+ *
+ * On start-up the system will automatically enumerate and function as a keyboard
* when the USB connection to a host is present. To use the keyboard example,
* manipulate the joystick to send the letters a, b, c, d and e. See the USB HID
* documentation for more information on sending keyboard event and key presses. Unlike
@@ -59,7 +59,7 @@
* inside the same report to the host.
*
* \section SSec_Options Project Options
- *
+ *
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
@@ -70,3 +70,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/Keyboard/makefile b/Demos/Device/LowLevel/Keyboard/makefile
index f46afabc4..c78388099 100644
--- a/Demos/Device/LowLevel/Keyboard/makefile
+++ b/Demos/Device/LowLevel/Keyboard/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c
index 642b8e904..b04dccdf8 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c
+++ b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,14 +9,14 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -31,9 +31,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -121,22 +121,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204D,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -147,49 +147,49 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID1_KeyboardInterface =
+
+ .HID1_KeyboardInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID1_KeyboardHID =
- {
+ .HID1_KeyboardHID =
+ {
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
-
- .HID1_ReportINEndpoint =
+
+ .HID1_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -199,7 +199,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x0A
},
- .HID1_ReportOUTEndpoint =
+ .HID1_ReportOUTEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -209,34 +209,34 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x0A
},
- .HID2_MouseInterface =
+ .HID2_MouseInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x01,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = 0x02,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID2_MouseHID =
- {
+ .HID2_MouseHID =
+ {
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = DTYPE_Report,
.HIDReportLength = sizeof(MouseReport)
},
-
- .HID2_ReportINEndpoint =
+
+ .HID2_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -254,7 +254,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -265,7 +265,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -276,7 +276,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(28), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Mouse and Keyboard Demo"
};
@@ -298,33 +298,33 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case DTYPE_HID:
+ case DTYPE_HID:
if (!(wIndex))
{
Address = &ConfigurationDescriptor.HID1_KeyboardHID;
@@ -333,24 +333,25 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
else
{
Address = &ConfigurationDescriptor.HID2_MouseHID;
- Size = sizeof(USB_Descriptor_HID_t);
+ Size = sizeof(USB_Descriptor_HID_t);
}
break;
- case DTYPE_Report:
+ case DTYPE_Report:
if (!(wIndex))
{
Address = &KeyboardReport;
Size = sizeof(KeyboardReport);
}
else
- {
+ {
Address = &MouseReport;
Size = sizeof(MouseReport);
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h
index 8005d5ad3..908591c26 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h
+++ b/Demos/Device/LowLevel/KeyboardMouse/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,14 +9,14 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -49,10 +49,10 @@
typedef struct
{
USB_Descriptor_Header_t Header;
-
+
uint16_t HIDSpec;
uint8_t CountryCode;
-
+
uint8_t TotalReportDescriptors;
uint8_t HIDReportType;
@@ -77,7 +77,7 @@
USB_Descriptor_HID_t HID2_MouseHID;
USB_Descriptor_Endpoint_t HID2_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the Keyboard HID reporting IN endpoint. */
#define KEYBOARD_IN_EPNUM 1
@@ -93,7 +93,7 @@
/** Descriptor header type value, to indicate a HID class HID descriptor. */
#define DTYPE_HID 0x21
-
+
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
#define DTYPE_Report 0x22
@@ -104,3 +104,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c
index 2f4bd76cf..678957378 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c
+++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,14 +9,14 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* Main source file for the KeyboardMouse demo. This file contains the main tasks of the demo and
* is responsible for the initial application hardware configuration.
*/
-
+
#include "KeyboardMouse.h"
/** Global structure to hold the current keyboard interface HID report, for transmission to the host */
@@ -50,7 +50,7 @@ USB_MouseReport_Data_t MouseReportData;
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -114,7 +114,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
HID_EPSIZE, ENDPOINT_BANK_SINGLE);
/* Indicate endpoint configuration success or failure */
- LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
@@ -133,7 +133,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
-
+
/* Determine if it is the mouse or the keyboard data that is being requested */
if (!(USB_ControlRequest.wIndex))
{
@@ -153,13 +153,13 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Clear the report data afterwards */
memset(ReportData, 0, ReportSize);
}
-
+
break;
case REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
-
+
/* Wait until the LED report has been sent by the host */
while (!(Endpoint_IsOUTReceived()))
{
@@ -176,7 +176,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process the incoming LED report */
Keyboard_ProcessLEDReport(LEDStatus);
}
-
+
break;
}
}
@@ -189,10 +189,10 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
void Keyboard_ProcessLEDReport(const uint8_t LEDStatus)
{
uint8_t LEDMask = LEDS_LED2;
-
+
if (LEDStatus & KEYBOARD_LED_NUMLOCK)
LEDMask |= LEDS_LED1;
-
+
if (LEDStatus & KEYBOARD_LED_CAPSLOCK)
LEDMask |= LEDS_LED3;
@@ -256,7 +256,7 @@ void Keyboard_HID_Task(void)
/* Check if Keyboard LED Endpoint Ready for Read/Write */
if (Endpoint_IsReadWriteAllowed())
- {
+ {
/* Read in and process the LED report from the host */
Keyboard_ProcessLEDReport(Endpoint_Read_Byte());
@@ -309,3 +309,4 @@ void Mouse_HID_Task(void)
memset(&MouseReportData, 0, sizeof(MouseReportData));
}
}
+
diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h
index 565fa57ac..40572992d 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h
+++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,14 +9,14 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
-
+
/* Macros: */
/** HID Class specific request to get the next HID report from the device. */
#define REQ_GetReport 0x01
@@ -87,7 +87,7 @@
/** Constant for a keyboard output report LED byte, indicating that the host's NUM LOCK mode is currently set. */
#define KEYBOARD_LED_NUMLOCK (1 << 0)
-
+
/** Constant for a keyboard output report LED byte, indicating that the host's CAPS LOCK mode is currently set. */
#define KEYBOARD_LED_CAPSLOCK (1 << 1)
@@ -108,7 +108,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Type Defines: */
/** Type define for the keyboard HID report structure, for creating and sending HID reports to the host PC.
* This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
@@ -129,17 +129,18 @@
int8_t X; /**< Current mouse delta X movement, as a signed 8-bit integer */
int8_t Y; /**< Current mouse delta Y movement, as a signed 8-bit integer */
} USB_MouseReport_Data_t;
-
+
/* Function Prototypes: */
void SetupHardware(void);
void Keyboard_ProcessLEDReport(const uint8_t LEDStatus);
void Keyboard_HID_Task(void);
void Mouse_HID_Task(void);
-
+
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
void EVENT_USB_Device_StartOfFrame(void);
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.txt b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.txt
index f13087885..984493056 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.txt
+++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Dual HID Keyboard and Mouse Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -44,7 +44,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Keyboard/Mouse demonstration application. This gives a simple reference
* application for implementing a composite device containing both USB Keyboard
@@ -52,13 +52,13 @@
* (i.e. no special drivers required). This example uses two separate HID
* interfaces for each function. It is boot protocol compatible, and thus works under
* compatible BIOS as if it was a native keyboard and mouse (e.g. PS/2).
- *
+ *
* On start-up the system will automatically enumerate and function
* as a keyboard when the USB connection to a host is present and the HWB is not
* pressed. When enabled, manipulate the joystick to send the letters
* a, b, c, d and e. See the USB HID documentation for more information
* on sending keyboard event and key presses.
- *
+ *
* When the HWB is pressed, the mouse mode is enabled. When enabled, move the
* joystick to move the pointer, and push the joystick inwards to simulate a
* left-button click.
@@ -75,3 +75,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/KeyboardMouse/makefile b/Demos/Device/LowLevel/KeyboardMouse/makefile
index 3898c8209..d3527c790 100644
--- a/Demos/Device/LowLevel/KeyboardMouse/makefile
+++ b/Demos/Device/LowLevel/KeyboardMouse/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/MIDI/Descriptors.c b/Demos/Device/LowLevel/MIDI/Descriptors.c
index 3c2efdbd9..5640c67ca 100644
--- a/Demos/Device/LowLevel/MIDI/Descriptors.c
+++ b/Demos/Device/LowLevel/MIDI/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,11 +30,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
-
+
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2048,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,7 +71,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
@@ -80,122 +80,122 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .Audio_ControlInterface =
+
+ .Audio_ControlInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 0,
-
+
.Class = 0x01,
.SubClass = 0x01,
.Protocol = 0x00,
-
- .InterfaceStrIndex = NO_DESCRIPTOR
+
+ .InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_ControlInterface_SPC =
+
+ .Audio_ControlInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_AC_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_AudioHeader,
-
+
.AudioSpecification = VERSION_BCD(01.00),
.TotalLength = sizeof(USB_Audio_Interface_AC_t),
-
+
.InCollection = 1,
- .InterfaceNumbers = {1},
+ .InterfaceNumbers = {1},
},
- .Audio_StreamInterface =
+ .Audio_StreamInterface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x01,
.SubClass = 0x03,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
-
- .Audio_StreamInterface_SPC =
+
+ .Audio_StreamInterface_SPC =
{
.Header = {.Size = sizeof(USB_Audio_Interface_MIDI_AS_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_General,
.AudioSpecification = VERSION_BCD(01.00),
-
+
.TotalLength = (sizeof(USB_Descriptor_Configuration_t) -
offsetof(USB_Descriptor_Configuration_t, Audio_StreamInterface_SPC))
},
- .MIDI_In_Jack_Emb =
+ .MIDI_In_Jack_Emb =
{
.Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_InputJack,
-
+
.JackType = JACKTYPE_EMBEDDED,
.JackID = 0x01,
-
+
.JackStrIndex = NO_DESCRIPTOR
},
- .MIDI_In_Jack_Ext =
+ .MIDI_In_Jack_Ext =
{
.Header = {.Size = sizeof(USB_MIDI_In_Jack_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_InputJack,
-
+
.JackType = JACKTYPE_EXTERNAL,
.JackID = 0x02,
-
+
.JackStrIndex = NO_DESCRIPTOR
},
-
- .MIDI_Out_Jack_Emb =
+
+ .MIDI_Out_Jack_Emb =
{
.Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_OutputJack,
-
+
.JackType = JACKTYPE_EMBEDDED,
.JackID = 0x03,
.NumberOfPins = 1,
.SourceJackID = {0x02},
.SourcePinID = {0x01},
-
+
.JackStrIndex = NO_DESCRIPTOR
},
- .MIDI_Out_Jack_Ext =
+ .MIDI_Out_Jack_Ext =
{
.Header = {.Size = sizeof(USB_MIDI_Out_Jack_t), .Type = DTYPE_CSInterface},
.Subtype = DSUBTYPE_OutputJack,
-
+
.JackType = JACKTYPE_EXTERNAL,
.JackID = 0x04,
.NumberOfPins = 1,
.SourceJackID = {0x01},
.SourcePinID = {0x01},
-
+
.JackStrIndex = NO_DESCRIPTOR
},
- .MIDI_In_Jack_Endpoint =
+ .MIDI_In_Jack_Endpoint =
{
- .Endpoint =
+ .Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
@@ -204,12 +204,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0
},
-
+
.Refresh = 0,
.SyncEndpointNumber = 0
},
-
- .MIDI_In_Jack_Endpoint_SPC =
+
+ .MIDI_In_Jack_Endpoint_SPC =
{
.Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
.Subtype = DSUBTYPE_General,
@@ -218,9 +218,9 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.AssociatedJackID = {0x01}
},
- .MIDI_Out_Jack_Endpoint =
+ .MIDI_Out_Jack_Endpoint =
{
- .Endpoint =
+ .Endpoint =
{
.Header = {.Size = sizeof(USB_Audio_StreamEndpoint_Std_t), .Type = DTYPE_Endpoint},
@@ -229,12 +229,12 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = MIDI_STREAM_EPSIZE,
.PollingIntervalMS = 0
},
-
+
.Refresh = 0,
.SyncEndpointNumber = 0
},
-
- .MIDI_Out_Jack_Endpoint_SPC =
+
+ .MIDI_Out_Jack_Endpoint_SPC =
{
.Header = {.Size = sizeof(USB_MIDI_Jack_Endpoint_t), .Type = DTYPE_CSEndpoint},
.Subtype = DSUBTYPE_General,
@@ -251,7 +251,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -262,7 +262,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -273,7 +273,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(14), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA MIDI Demo"
};
@@ -295,34 +295,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/MIDI/Descriptors.h b/Demos/Device/LowLevel/MIDI/Descriptors.h
index e110cc2e6..abaabb731 100644
--- a/Demos/Device/LowLevel/MIDI/Descriptors.h
+++ b/Demos/Device/LowLevel/MIDI/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -59,7 +59,7 @@
/** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */
#define JACKTYPE_EXTERNAL 0x02
-
+
/** Endpoint number of the MIDI streaming data IN endpoint, for device-to-host data transfers. */
#define MIDI_STREAM_IN_EPNUM 1
@@ -68,7 +68,7 @@
/** Endpoint size in bytes of the Audio isochronous streaming data IN and OUT endpoints. */
#define MIDI_STREAM_EPSIZE 64
-
+
/* Type Defines: */
/** Type define for an Audio class specific interface descriptor. This follows a regular interface descriptor to
* supply extra information about the audio device's layout to the host. See the USB Audio specification for more
@@ -81,11 +81,11 @@
uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific control descriptors, including this descriptor */
-
+
uint8_t InCollection; /**< Total number of audio class interfaces within this device */
uint8_t InterfaceNumbers[1]; /**< Interface numbers of each audio interface */
} USB_Audio_Interface_AC_t;
-
+
/** Type define for an Audio class specific MIDI streaming interface descriptor. This indicates to the host
* how MIDI the specification compliance of the device and the total length of the Audio class specific descriptors.
* See the USB Audio specification for more details.
@@ -94,12 +94,12 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
-
+
uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
} USB_Audio_Interface_MIDI_AS_t;
-
- /** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
+
+ /** Type define for an Audio class specific endpoint descriptor. This contains a regular endpoint
* descriptor with a few Audio-class specific extensions. See the USB Audio specification for more details.
*/
typedef struct
@@ -120,7 +120,7 @@
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
-
+
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_MIDI_In_Jack_t;
@@ -134,14 +134,14 @@
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
-
+
uint8_t NumberOfPins; /**< Number of output channels within the jack, either physical or logical */
uint8_t SourceJackID[1]; /**< ID of each output pin's source data jack */
uint8_t SourcePinID[1]; /**< Pin number in the input jack of each output pin's source data */
-
+
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_MIDI_Out_Jack_t;
-
+
/** Type define for an Audio class specific extended MIDI jack endpoint descriptor. This contains extra information
* on the usage of MIDI endpoints used to stream MIDI events in and out of the USB Audio device, and follows an Audio
* class specific extended MIDI endpoint descriptor. See the USB Audio specification for more details.
@@ -175,7 +175,7 @@
USB_Audio_StreamEndpoint_Std_t MIDI_Out_Jack_Endpoint;
USB_MIDI_Jack_Endpoint_t MIDI_Out_Jack_Endpoint_SPC;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -183,3 +183,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/MIDI/MIDI.c b/Demos/Device/LowLevel/MIDI/MIDI.c
index 87ecbd4d0..4696d2336 100644
--- a/Demos/Device/LowLevel/MIDI/MIDI.c
+++ b/Demos/Device/LowLevel/MIDI/MIDI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,10 +42,10 @@
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
MIDI_Task();
@@ -62,7 +62,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
Joystick_Init();
LEDs_Init();
@@ -100,7 +100,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
MIDI_STREAM_EPSIZE, ENDPOINT_BANK_SINGLE);
/* Indicate endpoint configuration success or failure */
- LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Task to handle the generation of MIDI note change events in response to presses of the board joystick, and send them
@@ -120,10 +120,10 @@ void MIDI_Task(void)
{
uint8_t MIDICommand = 0;
uint8_t MIDIPitch;
-
+
uint8_t JoystickStatus = Joystick_GetStatus();
uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus);
-
+
/* Get board button status - if pressed use channel 10 (percussion), otherwise use channel 1 */
uint8_t Channel = ((Buttons_GetStatus() & BUTTONS_BUTTON1) ? MIDI_CHANNEL(10) : MIDI_CHANNEL(1));
@@ -144,7 +144,7 @@ void MIDI_Task(void)
MIDICommand = ((JoystickStatus & JOY_RIGHT)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
MIDIPitch = 0x3E;
}
-
+
if (JoystickChanges & JOY_DOWN)
{
MIDICommand = ((JoystickStatus & JOY_DOWN)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
@@ -164,19 +164,19 @@ void MIDI_Task(void)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
-
+
.Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch,
- .Data3 = MIDI_STANDARD_VELOCITY,
+ .Data3 = MIDI_STANDARD_VELOCITY,
};
-
+
/* Write the MIDI event packet to the endpoint */
Endpoint_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
-
+
/* Send the data in the endpoint to the host */
Endpoint_ClearIN();
}
-
+
/* Save previous joystick value for next joystick change detection */
PrevJoystickStatus = JoystickStatus;
}
@@ -188,10 +188,10 @@ void MIDI_Task(void)
if (Endpoint_IsOUTReceived())
{
USB_MIDI_EventPacket_t MIDIEvent;
-
+
/* Read the MIDI event packet from the endpoint */
Endpoint_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
-
+
/* Check to see if the sent command is a note on message with a non-zero velocity */
if ((MIDIEvent.Command == (MIDI_COMMAND_NOTE_ON >> 4)) && (MIDIEvent.Data3 > 0))
{
@@ -203,8 +203,9 @@ void MIDI_Task(void)
/* Turn off all LEDs in response to non Note On messages */
LEDs_SetAllLEDs(LEDS_NO_LEDS);
}
-
+
/* Clear the endpoint ready for new packet */
Endpoint_ClearOUT();
}
}
+
diff --git a/Demos/Device/LowLevel/MIDI/MIDI.h b/Demos/Device/LowLevel/MIDI/MIDI.h
index 75ac8458e..e2f39f3bd 100644
--- a/Demos/Device/LowLevel/MIDI/MIDI.h
+++ b/Demos/Device/LowLevel/MIDI/MIDI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for AudioOutput.c.
*/
-
+
#ifndef _AUDIO_OUTPUT_H_
#define _AUDIO_OUTPUT_H_
@@ -44,7 +44,7 @@
#include <stdbool.h>
#include "Descriptors.h"
-
+
#include <LUFA/Version.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/Joystick.h>
@@ -60,7 +60,7 @@
/** Standard key press velocity value used for all note events, as no pressure sensor is mounted. */
#define MIDI_STANDARD_VELOCITY 64
-
+
/** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
*
@@ -86,18 +86,19 @@
{
unsigned char Command : 4; /**< MIDI command being sent or received in the event packet */
unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface */
-
+
uint8_t Data1; /**< First byte of data in the MIDI event */
uint8_t Data2; /**< Second byte of data in the MIDI event */
- uint8_t Data3; /**< Third byte of data in the MIDI event */
+ uint8_t Data3; /**< Third byte of data in the MIDI event */
} USB_MIDI_EventPacket_t;
-
+
/* Function Prototypes: */
void SetupHardware(void);
void MIDI_Task(void);
-
+
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/MIDI/MIDI.txt b/Demos/Device/LowLevel/MIDI/MIDI.txt
index e9522f2ed..0629832b2 100644
--- a/Demos/Device/LowLevel/MIDI/MIDI.txt
+++ b/Demos/Device/LowLevel/MIDI/MIDI.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage MIDI Input Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Audio Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Standard Audio Device</td>
* </tr>
@@ -44,19 +44,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* MIDI demonstration application. This gives a simple reference
* application for implementing the USB-MIDI class in USB devices.
* It is built upon the USB Audio class.
- *
+ *
* Joystick movements are translated into note on/off messages and
* are sent to the host PC as MIDI streams which can be read by any
* MIDI program supporting MIDI IN devices.
- *
+ *
* If the HWB is not pressed, channel 1 (default piano) is used. If
* the HWB is set, then channel 10 (default percussion) is selected.
- *
+ *
* This device implements MIDI-THRU mode, with the IN MIDI data being
* generated by the device itself. OUT MIDI data is discarded.
*
@@ -72,3 +72,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/MIDI/makefile b/Demos/Device/LowLevel/MIDI/makefile
index 4bdf98462..6cc229ddb 100644
--- a/Demos/Device/LowLevel/MIDI/makefile
+++ b/Demos/Device/LowLevel/MIDI/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/MassStorage/Descriptors.c b/Demos/Device/LowLevel/MassStorage/Descriptors.c
index b6e03a359..d06161049 100644
--- a/Demos/Device/LowLevel/MassStorage/Descriptors.c
+++ b/Demos/Device/LowLevel/MassStorage/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -57,22 +57,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2045,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,38 +83,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .MS_Interface =
+
+ .MS_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x08,
.SubClass = 0x06,
.Protocol = 0x50,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .MS_DataInEndpoint =
+ .MS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -124,7 +124,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .MS_DataOutEndpoint =
+ .MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -142,7 +142,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -153,7 +153,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -164,7 +164,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Mass Storage Demo"
};
@@ -186,34 +186,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/MassStorage/Descriptors.h b/Demos/Device/LowLevel/MassStorage/Descriptors.h
index b2989f1bc..6f3dbd4b4 100644
--- a/Demos/Device/LowLevel/MassStorage/Descriptors.h
+++ b/Demos/Device/LowLevel/MassStorage/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -43,15 +43,15 @@
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
+ #define MASS_STORAGE_IN_EPNUM 3
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
+ #define MASS_STORAGE_OUT_EPNUM 4
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
-
- /* Type Defines: */
+
+ /* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@@ -63,7 +63,7 @@
USB_Descriptor_Endpoint_t MS_DataInEndpoint;
USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -71,3 +71,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
index e32618258..09274e1cd 100644
--- a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
+++ b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -71,11 +71,11 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress,
/* Wait until endpoint is ready before continuing */
if (Endpoint_WaitUntilReady())
return;
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -84,7 +84,7 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress,
{
/* Clear the current endpoint bank */
Endpoint_ClearOUT();
-
+
/* Wait until the host has sent another packet */
if (Endpoint_WaitUntilReady())
return;
@@ -123,7 +123,7 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress,
/* Send the Dataflash buffer write command */
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
+ Dataflash_SendAddressBytes(0, 0);
}
/* Write one 16-byte chunk of data to the Dataflash */
@@ -143,7 +143,7 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress,
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
@@ -152,9 +152,9 @@ void DataflashManager_WriteBlocks(const uint32_t BlockAddress,
/* Check if the current command is being aborted by the host */
if (IsMassStoreReset)
- return;
+ return;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -197,15 +197,15 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress,
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
-
+
/* Wait until endpoint is ready before continuing */
if (Endpoint_WaitUntilReady())
return;
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -214,12 +214,12 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress,
{
/* Clear the endpoint bank to send its contents to the host */
Endpoint_ClearIN();
-
+
/* Wait until the endpoint is ready for more data */
if (Endpoint_WaitUntilReady())
return;
}
-
+
/* Check if end of Dataflash page reached */
if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
{
@@ -229,7 +229,7 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress,
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -237,7 +237,7 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress,
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
Endpoint_Write_Byte(Dataflash_ReceiveByte());
@@ -256,10 +256,10 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress,
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
@@ -267,11 +267,11 @@ void DataflashManager_ReadBlocks(const uint32_t BlockAddress,
if (IsMassStoreReset)
return;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
-
+
/* If the endpoint is full, send its contents to the host */
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearIN();
@@ -315,7 +315,7 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -355,18 +355,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, 0);
}
-
+
/* Write one 16-byte chunk of data to the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
Dataflash_SendByte(*(BufferPtr++));
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
/* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
+ BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -412,7 +412,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -425,7 +425,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -433,19 +433,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
*(BufferPtr++) = Dataflash_ReceiveByte();
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
@@ -460,7 +460,7 @@ void DataflashManager_ResetDataflashProtections(void)
/* Select first Dataflash chip, send the read status register command */
Dataflash_SelectChip(DATAFLASH_CHIP1);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -472,12 +472,12 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
-
+
/* Select second Dataflash chip (if present on selected board), send read status register command */
#if (DATAFLASH_TOTALCHIPS == 2)
Dataflash_SelectChip(DATAFLASH_CHIP2);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -490,7 +490,7 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
#endif
-
+
/* Deselect current Dataflash chip */
Dataflash_DeselectChip();
}
@@ -524,6 +524,7 @@ bool DataflashManager_CheckDataflashOperation(void)
if (ReturnByte != DF_MANUFACTURER_ATMEL)
return false;
#endif
-
+
return true;
}
+
diff --git a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h
index cb613f42c..935f41189 100644
--- a/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h
+++ b/Demos/Device/LowLevel/MassStorage/Lib/DataflashManager.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,13 +32,13 @@
*
* Header file for DataflashManager.c.
*/
-
+
#ifndef _DATAFLASH_MANAGER_H_
#define _DATAFLASH_MANAGER_H_
/* Includes: */
#include <avr/io.h>
-
+
#include "MassStorage.h"
#include "Descriptors.h"
@@ -59,20 +59,20 @@
* storage media (Dataflash) using a different native block size. Do not change this value.
*/
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
-
+
/** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
* change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
*/
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
-
+
/** Total number of Logical Units (drives) in the device. The total device capacity is shared equally between
* each drive - this can be set to any positive non-zero amount.
*/
#define TOTAL_LUNS 1
-
+
/** Blocks in each LUN, calculated from the total capacity divided by the total number of Logical Units in the device. */
- #define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS)
-
+ #define LUN_MEDIA_BLOCKS (VIRTUAL_MEMORY_BLOCKS / TOTAL_LUNS)
+
/* Function Prototypes: */
void DataflashManager_WriteBlocks(const uint32_t BlockAddress,
uint16_t TotalBlocks);
@@ -86,5 +86,6 @@
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
void DataflashManager_ResetDataflashProtections(void);
bool DataflashManager_CheckDataflashOperation(void);
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/MassStorage/Lib/SCSI.c b/Demos/Device/LowLevel/MassStorage/Lib/SCSI.c
index 76005952f..bf961b7ed 100644
--- a/Demos/Device/LowLevel/MassStorage/Lib/SCSI.c
+++ b/Demos/Device/LowLevel/MassStorage/Lib/SCSI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,29 +34,29 @@
* devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
* which wrap around standard SCSI device commands for controlling the actual storage medium.
*/
-
+
#define INCLUDE_FROM_SCSI_C
#include "SCSI.h"
/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
* features and capabilities.
*/
-SCSI_Inquiry_Response_t InquiryData =
+SCSI_Inquiry_Response_t InquiryData =
{
.DeviceType = DEVICE_TYPE_BLOCK,
.PeripheralQualifier = 0,
-
+
.Removable = true,
-
+
.Version = 0,
-
+
.ResponseDataFormat = 2,
.NormACA = false,
.TrmTsk = false,
.AERC = false,
.AdditionalLength = 0x1F,
-
+
.SoftReset = false,
.CmdQue = false,
.Linked = false,
@@ -64,7 +64,7 @@ SCSI_Inquiry_Response_t InquiryData =
.WideBus16Bit = false,
.WideBus32Bit = false,
.RelAddr = false,
-
+
.VendorID = "LUFA",
.ProductID = "Dataflash Disk",
.RevisionID = {'0','.','0','0'},
@@ -94,13 +94,13 @@ bool SCSI_DecodeSCSICommand(void)
switch (CommandBlock.SCSICommandData[0])
{
case SCSI_CMD_INQUIRY:
- CommandSuccess = SCSI_Command_Inquiry();
+ CommandSuccess = SCSI_Command_Inquiry();
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense();
break;
case SCSI_CMD_READ_CAPACITY_10:
- CommandSuccess = SCSI_Command_Read_Capacity_10();
+ CommandSuccess = SCSI_Command_Read_Capacity_10();
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic();
@@ -125,14 +125,14 @@ bool SCSI_DecodeSCSICommand(void)
SCSI_ASENSEQ_NO_QUALIFIER);
break;
}
-
+
/* Check if command was successfully processed */
if (CommandSuccess)
{
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
SCSI_ASENSEQ_NO_QUALIFIER);
-
+
return true;
}
@@ -166,7 +166,7 @@ static bool SCSI_Command_Inquiry(void)
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, StreamCallback_AbortOnMassStoreReset);
uint8_t PadBytes[AllocationLength - BytesTransferred];
-
+
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), StreamCallback_AbortOnMassStoreReset);
@@ -175,7 +175,7 @@ static bool SCSI_Command_Inquiry(void)
/* Succeed the command and update the bytes transferred counter */
CommandBlock.DataTransferLength -= BytesTransferred;
-
+
return true;
}
@@ -188,12 +188,12 @@ static bool SCSI_Command_Request_Sense(void)
{
uint8_t AllocationLength = CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
-
+
/* Send the SENSE data - this indicates to the host the status of the last command */
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, StreamCallback_AbortOnMassStoreReset);
-
+
uint8_t PadBytes[AllocationLength - BytesTransferred];
-
+
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), StreamCallback_AbortOnMassStoreReset);
@@ -228,7 +228,7 @@ static bool SCSI_Command_Read_Capacity_10(void)
/* Succeed the command and update the bytes transferred counter */
CommandBlock.DataTransferLength -= 8;
-
+
return true;
}
@@ -250,21 +250,21 @@ static bool SCSI_Command_Send_Diagnostic(void)
return false;
}
-
+
/* Check to see if all attached Dataflash ICs are functional */
if (!(DataflashManager_CheckDataflashOperation()))
{
/* Update SENSE key with a hardware error condition and return command fail */
SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
return false;
}
-
+
/* Succeed the command and update the bytes transferred counter */
CommandBlock.DataTransferLength = 0;
-
+
return true;
}
@@ -296,7 +296,7 @@ static bool SCSI_Command_ReadWrite_10(const bool IsDataRead)
/* Adjust the given block address to the real media address based on the selected LUN */
BlockAddress += ((uint32_t)CommandBlock.LUN * LUN_MEDIA_BLOCKS);
#endif
-
+
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ)
DataflashManager_ReadBlocks(BlockAddress, TotalBlocks);
@@ -305,6 +305,7 @@ static bool SCSI_Command_ReadWrite_10(const bool IsDataRead)
/* Update the bytes transferred counter and succeed the command */
CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
+
return true;
}
+
diff --git a/Demos/Device/LowLevel/MassStorage/Lib/SCSI.h b/Demos/Device/LowLevel/MassStorage/Lib/SCSI.h
index 0fc99b618..0c4869df4 100644
--- a/Demos/Device/LowLevel/MassStorage/Lib/SCSI.h
+++ b/Demos/Device/LowLevel/MassStorage/Lib/SCSI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for SCSI.c.
*/
-
+
#ifndef _SCSI_H_
#define _SCSI_H_
@@ -48,7 +48,7 @@
#include "Descriptors.h"
#include "DataflashManager.h"
#include "SCSI_Codes.h"
-
+
/* Macros: */
/** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
* is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
@@ -70,7 +70,7 @@
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
#define DEVICE_TYPE_BLOCK 0x00
-
+
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
#define DEVICE_TYPE_CDROM 0x05
@@ -82,12 +82,12 @@
{
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
-
+
unsigned char Reserved : 7;
unsigned char Removable : 1;
-
+
uint8_t Version;
-
+
unsigned char ResponseDataFormat : 4;
unsigned char Reserved2 : 1;
unsigned char NormACA : 1;
@@ -105,27 +105,27 @@
unsigned char WideBus16Bit : 1;
unsigned char WideBus32Bit : 1;
unsigned char RelAddr : 1;
-
+
uint8_t VendorID[8];
uint8_t ProductID[16];
uint8_t RevisionID[4];
} SCSI_Inquiry_Response_t;
-
+
/** Type define for a SCSI sense structure to a SCSI REQUEST SENSE command. For details of the
* structure contents, refer to the SCSI specifications.
*/
typedef struct
{
uint8_t ResponseCode;
-
+
uint8_t SegmentNumber;
-
+
unsigned char SenseKey : 4;
unsigned char Reserved : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
-
+
uint8_t Information[4];
uint8_t AdditionalLength;
uint8_t CmdSpecificInformation[4];
@@ -134,10 +134,10 @@
uint8_t FieldReplaceableUnitCode;
uint8_t SenseKeySpecific[3];
} SCSI_Request_Sense_Response_t;
-
+
/* Function Prototypes: */
bool SCSI_DecodeSCSICommand(void);
-
+
#if defined(INCLUDE_FROM_SCSI_C)
static bool SCSI_Command_Inquiry(void);
static bool SCSI_Command_Request_Sense(void);
@@ -145,5 +145,6 @@
static bool SCSI_Command_Send_Diagnostic(void);
static bool SCSI_Command_ReadWrite_10(const bool IsDataRead);
#endif
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/MassStorage/Lib/SCSI_Codes.h b/Demos/Device/LowLevel/MassStorage/Lib/SCSI_Codes.h
index a69aa56fe..6bcd5780f 100644
--- a/Demos/Device/LowLevel/MassStorage/Lib/SCSI_Codes.h
+++ b/Demos/Device/LowLevel/MassStorage/Lib/SCSI_Codes.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* the SCSI standard documentation for more information on each SCSI command and
* the SENSE data.
*/
-
+
#ifndef _SCSI_CODES_H_
#define _SCSI_CODES_H_
@@ -84,3 +84,4 @@
#define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
#endif
+
diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c
index 3bf2af16c..a168061f5 100644
--- a/Demos/Device/LowLevel/MassStorage/MassStorage.c
+++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -53,7 +53,7 @@ volatile bool IsMassStoreReset = false;
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -89,7 +89,7 @@ void EVENT_USB_Device_Connect(void)
{
/* Indicate USB enumerating */
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
/* Reset the MSReset flag upon connection */
IsMassStoreReset = false;
}
@@ -117,7 +117,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
MASS_STORAGE_IO_EPSIZE, ENDPOINT_BANK_SINGLE);
/* Indicate endpoint configuration success or failure */
- LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the USB_UnhandledControlPacket event. This is used to catch standard and class specific
@@ -147,11 +147,11 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Indicate to the host the number of supported LUNs (virtual disks) on the device */
Endpoint_Write_Byte(TOTAL_LUNS - 1);
-
- Endpoint_ClearIN();
+
+ Endpoint_ClearIN();
Endpoint_ClearStatusStage();
}
-
+
break;
}
}
@@ -176,14 +176,14 @@ void MassStorage_Task(void)
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
/* Decode the received SCSI command, set returned status code */
- CommandStatus.Status = SCSI_DecodeSCSICommand() ? Command_Pass : Command_Fail;
+ CommandStatus.Status = SCSI_DecodeSCSICommand() ? Command_Pass : Command_Fail;
/* Load in the CBW tag into the CSW to link them together */
CommandStatus.Tag = CommandBlock.Tag;
/* Load in the data residue counter into the CSW */
CommandStatus.DataTransferResidue = CommandBlock.DataTransferLength;
-
+
/* Stall the selected data pipe if command failed (if data is still to be transferred) */
if ((CommandStatus.Status == Command_Fail) && (CommandStatus.DataTransferResidue))
Endpoint_StallTransaction();
@@ -201,7 +201,7 @@ void MassStorage_Task(void)
/* Reset the data endpoint banks */
Endpoint_ResetFIFO(MASS_STORAGE_OUT_EPNUM);
Endpoint_ResetFIFO(MASS_STORAGE_IN_EPNUM);
-
+
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
Endpoint_ClearStall();
Endpoint_ResetDataToggle();
@@ -223,7 +223,7 @@ static bool ReadInCommandBlock(void)
{
/* Select the Data Out endpoint */
Endpoint_SelectEndpoint(MASS_STORAGE_OUT_EPNUM);
-
+
/* Abort if no command has been sent from the host */
if (!(Endpoint_IsOUTReceived()))
return false;
@@ -247,7 +247,7 @@ static bool ReadInCommandBlock(void)
Endpoint_StallTransaction();
Endpoint_SelectEndpoint(MASS_STORAGE_IN_EPNUM);
Endpoint_StallTransaction();
-
+
return false;
}
@@ -255,14 +255,14 @@ static bool ReadInCommandBlock(void)
Endpoint_Read_Stream_LE(&CommandBlock.SCSICommandData,
CommandBlock.SCSICommandLength,
StreamCallback_AbortOnMassStoreReset);
-
+
/* Check if the current command is being aborted by the host */
if (IsMassStoreReset)
return false;
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearOUT();
-
+
return true;
}
@@ -292,11 +292,11 @@ static void ReturnCommandStatus(void)
if (IsMassStoreReset)
return;
}
-
+
/* Write the CSW to the endpoint */
Endpoint_Write_Stream_LE(&CommandStatus, sizeof(CommandStatus),
StreamCallback_AbortOnMassStoreReset);
-
+
/* Check if the current command is being aborted by the host */
if (IsMassStoreReset)
return;
@@ -309,11 +309,12 @@ static void ReturnCommandStatus(void)
* if a Mass Storage Reset request has been issued to the control endpoint.
*/
uint8_t StreamCallback_AbortOnMassStoreReset(void)
-{
+{
/* Abort if a Mass Storage reset command was received */
if (IsMassStoreReset)
return STREAMCALLBACK_Abort;
-
+
/* Continue with the current stream operation */
return STREAMCALLBACK_Continue;
}
+
diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.h b/Demos/Device/LowLevel/MassStorage/MassStorage.h
index 5a5c5f800..d993a9a5d 100644
--- a/Demos/Device/LowLevel/MassStorage/MassStorage.h
+++ b/Demos/Device/LowLevel/MassStorage/MassStorage.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -60,14 +60,14 @@
#define REQ_GetMaxLUN 0xFE
/** Maximum length of a SCSI command which can be issued by the device or host in a Mass Storage bulk wrapper. */
- #define MAX_SCSI_COMMAND_LENGTH 16
-
+ #define MAX_SCSI_COMMAND_LENGTH 16
+
/** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define CBW_SIGNATURE 0x43425355UL
/** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define CSW_SIGNATURE 0x53425355UL
-
+
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */
#define COMMAND_DIRECTION_DATA_OUT (0 << 7)
@@ -88,7 +88,7 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* Type Defines: */
/** Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
typedef struct
@@ -101,7 +101,7 @@
uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */
uint8_t SCSICommandData[MAX_SCSI_COMMAND_LENGTH]; /**< Issued SCSI command in the Command Block */
} CommandBlockWrapper_t;
-
+
/** Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
typedef struct
{
@@ -110,7 +110,7 @@
uint32_t DataTransferResidue; /**< Number of bytes of data not processed in the SCSI command */
uint8_t Status; /**< Status code of the issued command - a value from the MassStorage_CommandStatusCodes_t enum */
} CommandStatusWrapper_t;
-
+
/* Enums: */
/** Enum for the possible command status wrapper return status codes. */
enum MassStorage_CommandStatusCodes_t
@@ -119,16 +119,16 @@
Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */
Phase_Error = 2 /**< Command failed due to being invalid in the current phase */
};
-
+
/* Global Variables: */
extern CommandBlockWrapper_t CommandBlock;
extern CommandStatusWrapper_t CommandStatus;
extern volatile bool IsMassStoreReset;
-
+
/* Function Prototypes: */
void SetupHardware(void);
void MassStorage_Task(void);
-
+
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
@@ -142,3 +142,4 @@
uint8_t StreamCallback_AbortOnMassStoreReset(void);
#endif
+
diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.txt b/Demos/Device/LowLevel/MassStorage/MassStorage.txt
index fe4089cb4..d72ad7656 100644
--- a/Demos/Device/LowLevel/MassStorage/MassStorage.txt
+++ b/Demos/Device/LowLevel/MassStorage/MassStorage.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mass Storage Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Mass Storage Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Bulk-Only Transport</td>
* </tr>
@@ -45,23 +45,23 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Dual LUN Mass Storage demonstration application. This gives a simple
* reference application for implementing a multiple LUN USB Mass Storage
* device using the basic USB UFI drivers in all modern OSes (i.e. no
* special drivers required).
- *
+ *
* On start-up the system will automatically enumerate and function as an
* external mass storage device with two LUNs (separate disks) which may
* be formatted and used in the same manner as commercial USB Mass Storage
* devices.
- *
+ *
* You will need to format the mass storage drives upon first run of this
* demonstration - as the device acts only as a data block transport between
* the host and the storage media, it does not matter what file system is used,
* as the data interpretation is performed by the host and not the USB device.
- *
+ *
* This demo is not restricted to only two LUNs; by changing the TOTAL_LUNS
* value in MassStorageDualLUN.h, any number of LUNs can be used (from 1 to
* 255), with each LUN being allocated an equal portion of the available
@@ -90,3 +90,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/MassStorage/makefile b/Demos/Device/LowLevel/MassStorage/makefile
index 457e8b30b..d1c0d8198 100644
--- a/Demos/Device/LowLevel/MassStorage/makefile
+++ b/Demos/Device/LowLevel/MassStorage/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -137,7 +137,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -150,7 +150,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -264,7 +264,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -277,7 +277,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -289,7 +289,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -301,7 +301,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -324,7 +324,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -358,7 +358,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -392,7 +392,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -421,7 +421,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -440,10 +440,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -508,11 +508,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -539,9 +539,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -639,14 +639,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -668,7 +668,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -712,3 +712,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/Mouse/Descriptors.c b/Demos/Device/LowLevel/Mouse/Descriptors.c
index 1d3708f60..d6caf51cd 100644
--- a/Demos/Device/LowLevel/Mouse/Descriptors.c
+++ b/Demos/Device/LowLevel/Mouse/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -81,22 +81,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2041,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -107,41 +107,41 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = 0x02,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_MouseHID =
+ .HID_MouseHID =
{
.Header = {.Size = sizeof(USB_Descriptor_HID_t), .Type = DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
@@ -149,15 +149,15 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(MouseReport)
},
- .HID_ReportINEndpoint =
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | MOUSE_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = MOUSE_EPSIZE,
.PollingIntervalMS = 0x0A
- }
+ }
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
@@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -178,7 +178,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -189,7 +189,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(15), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Mouse Demo"
};
@@ -235,19 +235,19 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case DTYPE_HID:
+ case DTYPE_HID:
Address = &ConfigurationDescriptor.HID_MouseHID;
Size = sizeof(USB_Descriptor_HID_t);
break;
- case DTYPE_Report:
+ case DTYPE_Report:
Address = &MouseReport;
Size = sizeof(MouseReport);
break;
}
-
- *DescriptorAddress = Address;
+
+ *DescriptorAddress = Address;
return Size;
}
diff --git a/Demos/Device/LowLevel/Mouse/Descriptors.h b/Demos/Device/LowLevel/Mouse/Descriptors.h
index a4dc5d5d6..2d9a329d0 100644
--- a/Demos/Device/LowLevel/Mouse/Descriptors.h
+++ b/Demos/Device/LowLevel/Mouse/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -48,10 +48,10 @@
typedef struct
{
USB_Descriptor_Header_t Header;
-
+
uint16_t HIDSpec;
uint8_t CountryCode;
-
+
uint8_t TotalReportDescriptors;
uint8_t HIDReportType;
@@ -72,17 +72,17 @@
USB_Descriptor_HID_t HID_MouseHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPNUM 1
-
+
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
/** Descriptor header type value, to indicate a HID class HID descriptor. */
#define DTYPE_HID 0x21
-
+
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
#define DTYPE_Report 0x22
@@ -93,3 +93,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c
index 6aa258a00..23df2a610 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.c
+++ b/Demos/Device/LowLevel/Mouse/Mouse.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the Mouse demo. This file contains the main tasks of the demo and
* is responsible for the initial application hardware configuration.
*/
-
+
#include "Mouse.h"
/** Indicates what report mode the host has requested, true for normal HID reporting mode, false for special boot
@@ -47,7 +47,7 @@ bool UsingReportProtocol = true;
uint16_t IdleCount = HID_IDLE_CHANGESONLY;
/** Current Idle period remaining. When the IdleCount value is set, this tracks the remaining number of idle
- * milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request
+ * milliseconds. This is separate to the IdleCount timer and is incremented and compared as the host may request
* the current idle period via a Get Idle HID class request, thus its value must be preserved.
*/
uint16_t IdleMSRemaining = 0;
@@ -59,7 +59,7 @@ uint16_t IdleMSRemaining = 0;
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -110,7 +110,7 @@ void EVENT_USB_Device_Disconnect(void)
/** Event handler for the USB_ConfigurationChanged event. This is fired when the host sets the current configuration
* of the USB device after enumeration - the device endpoints are configured and the mouse reporting task started.
- */
+ */
void EVENT_USB_Device_ConfigurationChanged(void)
{
bool ConfigSuccess = true;
@@ -123,7 +123,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
USB_Device_EnableSOFEvents();
/* Indicate endpoint configuration success or failure */
- LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
@@ -152,20 +152,20 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Clear the report data afterwards */
memset(&MouseReportData, 0, sizeof(MouseReportData));
}
-
+
break;
case REQ_GetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
-
+
/* Write the current protocol flag to the host */
Endpoint_Write_Byte(UsingReportProtocol);
-
+
Endpoint_ClearIN();
Endpoint_ClearStatusStage();
}
-
+
break;
case REQ_SetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -176,7 +176,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Set or clear the flag depending on what the host indicates that the current Protocol should be */
UsingReportProtocol = (USB_ControlRequest.wValue != 0);
}
-
+
break;
case REQ_SetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -187,13 +187,13 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Get idle period in MSB, must multiply by 4 to get the duration in milliseconds */
IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6);
}
-
+
break;
case REQ_GetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
- {
+ {
Endpoint_ClearSETUP();
-
+
/* Write the current idle duration to the host, must be divided by 4 before sent to host */
Endpoint_Write_Byte(IdleCount >> 2);
@@ -221,7 +221,7 @@ void CreateMouseReport(USB_MouseReport_Data_t* const ReportData)
{
uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
-
+
/* Clear the report contents */
memset(ReportData, 0, sizeof(USB_MouseReport_Data_t));
@@ -237,7 +237,7 @@ void CreateMouseReport(USB_MouseReport_Data_t* const ReportData)
if (JoyStatus_LCL & JOY_PRESS)
ReportData->Button = (1 << 0);
-
+
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
ReportData->Button |= (1 << 1);
}
@@ -248,40 +248,40 @@ void SendNextReport(void)
static USB_MouseReport_Data_t PrevMouseReportData;
USB_MouseReport_Data_t MouseReportData;
bool SendReport;
-
+
/* Create the next mouse report for transmission to the host */
CreateMouseReport(&MouseReportData);
-
+
/* Check to see if the report data has changed - if so a report MUST be sent */
SendReport = (memcmp(&PrevMouseReportData, &MouseReportData, sizeof(USB_MouseReport_Data_t)) != 0);
-
+
/* Override the check if the Y or X values are non-zero - we want continuous movement while the joystick
* is being held down (via continuous reports), otherwise the cursor will only move once per joystick toggle */
if ((MouseReportData.Y != 0) || (MouseReportData.X != 0))
SendReport = true;
-
+
/* Check if the idle period is set and has elapsed */
if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))
{
/* Reset the idle time remaining counter */
IdleMSRemaining = IdleCount;
-
+
/* Idle period is set and has elapsed, must send a report to the host */
SendReport = true;
}
-
+
/* Select the Mouse Report Endpoint */
Endpoint_SelectEndpoint(MOUSE_EPNUM);
/* Check if Mouse Endpoint Ready for Read/Write and if we should send a new report */
if (Endpoint_IsReadWriteAllowed() && SendReport)
- {
+ {
/* Save the current report data for later comparison to check for changes */
PrevMouseReportData = MouseReportData;
/* Write Mouse Report Data */
Endpoint_Write_Stream_LE(&MouseReportData, sizeof(MouseReportData));
-
+
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
}
@@ -293,7 +293,8 @@ void Mouse_Task(void)
/* Device must be connected and configured for the task to run */
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
-
+
/* Send the next mouse report to the host */
SendNextReport();
}
+
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.h b/Demos/Device/LowLevel/Mouse/Mouse.h
index 56766a6df..f551f5d6e 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.h
+++ b/Demos/Device/LowLevel/Mouse/Mouse.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,7 +43,7 @@
#include <avr/interrupt.h>
#include <stdbool.h>
#include <string.h>
-
+
#include "Descriptors.h"
#include <LUFA/Version.h>
@@ -55,7 +55,7 @@
/* Macros: */
/** Idle period indicating that reports should be sent only when the inputs have changed */
#define HID_IDLE_CHANGESONLY 0
-
+
/** HID Class specific request to get the next HID report from the device. */
#define REQ_GetReport 0x01
@@ -85,7 +85,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Type Defines: */
/** Type define for the mouse HID report structure, for creating and sending HID reports to the host PC.
* This mirrors the layout described to the host in the HID report descriptor, in Descriptors.c.
@@ -96,7 +96,7 @@
int8_t X; /**< Current mouse delta X movement, as a signed 8-bit integer */
int8_t Y; /**< Current mouse delta Y movement, as a signed 8-bit integer */
} USB_MouseReport_Data_t;
-
+
/* Function Prototypes: */
void SetupHardware(void);
void Mouse_Task(void);
@@ -110,3 +110,4 @@
void CreateMouseReport(USB_MouseReport_Data_t* const ReportData);
#endif
+
diff --git a/Demos/Device/LowLevel/Mouse/Mouse.txt b/Demos/Device/LowLevel/Mouse/Mouse.txt
index 5fcdb4d04..f26df7468 100644
--- a/Demos/Device/LowLevel/Mouse/Mouse.txt
+++ b/Demos/Device/LowLevel/Mouse/Mouse.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mouse Device Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -44,14 +44,14 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mouse demonstration application. This gives a simple reference
* application for implementing a USB Mouse using the basic USB HID
* drivers in all modern OSes (i.e. no special drivers required). It is
* boot protocol compatible, and thus works under compatible BIOS as if
* it was a native mouse (e.g. PS/2).
- *
+ *
* On start-up the system will automatically enumerate and function
* as a mouse when the USB connection to a host is present. To use
* the mouse, move the joystick to move the pointer, and push the
@@ -70,3 +70,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/Mouse/makefile b/Demos/Device/LowLevel/Mouse/makefile
index 7e8d65ab5..4c5b510ea 100644
--- a/Demos/Device/LowLevel/Mouse/makefile
+++ b/Demos/Device/LowLevel/Mouse/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c
index 362406887..97da47e69 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,11 +30,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
-
+
#include "Descriptors.h"
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x02,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204C,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,102 +71,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0xFF,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = 0x00,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = 0x02,
-
+
.Capabilities = 0x00,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = 0x06,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0x02
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .RNDIS_DataOutEndpoint =
+ .RNDIS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .RNDIS_DataInEndpoint =
+
+ .RNDIS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -181,7 +181,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -192,7 +192,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -203,7 +203,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(19), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA RNDIS CDC Demo"
};
@@ -229,7 +229,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
@@ -249,10 +249,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h
index 5985d3473..34d64e007 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,10 +43,10 @@
/* Macros: */
/** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 1
+ #define CDC_TX_EPNUM 1
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 2
+ #define CDC_RX_EPNUM 2
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 3
@@ -80,7 +80,7 @@
uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
} USB_Descriptor_CDC_FunctionalACM_t;
-
+
/** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
* CDC control and data interfaces are related. See the CDC class specification for more details.
*/
@@ -116,3 +116,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c
index 853d50542..ca66256e7 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* conversion of physical MAC addresses to protocol IP addresses between the host and the
* device.
*/
-
+
#include "ARP.h"
/** Processes an ARP packet inside an Ethernet frame, and writes the appropriate response
@@ -59,7 +59,7 @@ int16_t ARP_ProcessARPPacket(void* InDataStart,
(SwapEndian_16(ARPHeaderIN->Operation) == ARP_OPERATION_REQUEST))
{
/* If the ARP packet is requesting the MAC or IP of the virtual webserver, return the response */
- if (IP_COMPARE(&ARPHeaderIN->TPA, &ServerIPAddress) ||
+ if (IP_COMPARE(&ARPHeaderIN->TPA, &ServerIPAddress) ||
MAC_COMPARE(&ARPHeaderIN->THA, &ServerMACAddress))
{
/* Fill out the ARP response header */
@@ -81,6 +81,7 @@ int16_t ARP_ProcessARPPacket(void* InDataStart,
return sizeof(ARP_Header_t);
}
}
-
+
return NO_RESPONSE;
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h
index 8de76f3b6..d97761539 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,18 +32,18 @@
*
* Header file for ARP.c.
*/
-
+
#ifndef _ARP_H_
#define _ARP_H_
/* Includes: */
#include <avr/io.h>
#include <string.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
-
+
/* Macros: */
/** ARP header operation constant, indicating a request from a host for an address translation. */
#define ARP_OPERATION_REQUEST 1
@@ -57,19 +57,20 @@
{
uint16_t HardwareType; /**< Hardware type constant, indicating the hardware used */
uint16_t ProtocolType; /**< Protocol being resolved, usually ETHERTYPE_IPV4 */
-
+
uint8_t HLEN; /**< Length in bytes of the source/destination hardware addresses */
uint8_t PLEN; /**< Length in bytes of the source/destination protocol addresses */
uint16_t Operation; /**< Type of operation, either ARP_OPERATION_REQUEST or ARP_OPERATION_REPLY */
-
+
MAC_Address_t SHA; /**< Sender's hardware address */
IP_Address_t SPA; /**< Sender's protocol address */
MAC_Address_t THA; /**< Target's hardware address */
IP_Address_t TPA; /**< Target's protocol address */
} ARP_Header_t;
-
+
/* Function Prototypes: */
int16_t ARP_ProcessARPPacket(void* InDataStart,
void* OutDataStart);
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c
index 41265aa27..118f5e0b5 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* handles the automatic IP negotiation to the host, so that the host will use the provided
* IP address given to it by the device.
*/
-
+
#include "DHCP.h"
/** Processes a DHCP packet inside an Ethernet frame, and writes the appropriate response
@@ -53,7 +53,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
IP_Header_t* IPHeaderIN = (IP_Header_t*)IPHeaderInStart;
DHCP_Header_t* DHCPHeaderIN = (DHCP_Header_t*)DHCPHeaderInStart;
DHCP_Header_t* DHCPHeaderOUT = (DHCP_Header_t*)DHCPHeaderOutStart;
-
+
uint8_t* DHCPOptionsINStart = (uint8_t*)(DHCPHeaderInStart + sizeof(DHCP_Header_t));
uint8_t* DHCPOptionsOUTStart = (uint8_t*)(DHCPHeaderOutStart + sizeof(DHCP_Header_t));
@@ -73,7 +73,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
DHCPHeaderOUT->YourIP = ClientIPAddress;
memmove(&DHCPHeaderOUT->ClientHardwareAddress, &DHCPHeaderIN->ClientHardwareAddress, sizeof(MAC_Address_t));
DHCPHeaderOUT->Cookie = SwapEndian_32(DHCP_MAGIC_COOKIE);
-
+
/* Alter the incoming IP packet header so that the corrected IP source and destinations are used - this means that
when the response IP header is generated, it will use the corrected addresses and not the null/broatcast addresses */
IPHeaderIN->SourceAddress = ClientIPAddress;
@@ -81,7 +81,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
/* Process the incoming DHCP packet options */
while (DHCPOptionsINStart[0] != DHCP_OPTION_END)
- {
+ {
/* Find the Message Type DHCP option, to determine the type of DHCP packet */
if (DHCPOptionsINStart[0] == DHCP_OPTION_MESSAGETYPE)
{
@@ -107,14 +107,15 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
DHCPOptionsOUTStart += sizeof(IP_Address_t);
*(DHCPOptionsOUTStart++) = DHCP_OPTION_END;
-
+
return (sizeof(DHCP_Header_t) + 12 + sizeof(IP_Address_t));
}
}
-
+
/* Go to the next DHCP option - skip one byte if option is a padding byte, else skip the complete option's size */
DHCPOptionsINStart += ((DHCPOptionsINStart[0] == DHCP_OPTION_PAD) ? 1 : (DHCPOptionsINStart[1] + 2));
}
-
+
return NO_RESPONSE;
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h
index 3bfdb29be..a4dc00dbb 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,14 +32,14 @@
*
* Header file for DHCP.c.
*/
-
+
#ifndef _DHCP_H_
#define _DHCP_H_
/* Includes: */
#include <avr/io.h>
#include <string.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
@@ -50,13 +50,13 @@
/** DHCP operation constant, indicating a reply from a DHCP server to a host. */
#define DHCP_OP_BOOTREPLY 0x02
-
+
/** Hardware type constant, indicating Ethernet as a carrier. */
#define DHCP_HTYPE_ETHERNET 0x01
-
+
/** Magic boot protocol "cookie", inserted into all BOOTP packets (BOOTP is the carrier of DHCP). */
#define DHCP_MAGIC_COOKIE 0x63825363
-
+
/** DHCP option list entry header, indicating that a subnet mask will follow. */
#define DHCP_OPTION_SUBNETMASK 1
@@ -71,7 +71,7 @@
/** DHCP option list entry header, indicating the end of option data. */
#define DHCP_OPTION_END 255
-
+
/** Message type constant, used in the DHCP option data field, requesting that a DHCP server offer an IP address. */
#define DHCP_MESSAGETYPE_DISCOVER 1
@@ -106,16 +106,16 @@
uint16_t ElapsedSeconds; /**< Elapsed seconds since the request was made */
uint16_t Flags; /**< BOOTP packet flags */
-
+
IP_Address_t ClientIP; /**< Client IP address, if already leased an IP */
IP_Address_t YourIP; /**< Client IP address */
IP_Address_t NextServerIP; /**< Legacy BOOTP protocol field, unused for DHCP */
IP_Address_t RelayAgentIP; /**< Legacy BOOTP protocol field, unused for DHCP */
-
+
uint8_t ClientHardwareAddress[16]; /**< Hardware (MAC) address of the client making a request to the DHCP server */
uint8_t ServerHostnameString[64]; /**< Legacy BOOTP protocol field, unused for DHCP */
uint8_t BootFileName[128]; /**< Legacy BOOTP protocol field, unused for DHCP */
-
+
uint32_t Cookie; /**< Magic BOOTP protocol cookie to indicate a valid packet */
} DHCP_Header_t;
@@ -125,3 +125,4 @@
void* DHCPHeaderOutStart);
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c
index 0b9563347..0b74d9cbc 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* frames sent and received, deferring the processing of sub-packet protocols to the appropriate
* protocol handlers, such as DHCP or ARP.
*/
-
+
#include "Ethernet.h"
/** Ethernet Frame buffer structure, to hold the incoming Ethernet frame from the host. */
@@ -69,9 +69,9 @@ void Ethernet_ProcessPacket(void)
/* Cast the incoming Ethernet frame to the Ethernet header type */
Ethernet_Frame_Header_t* FrameINHeader = (Ethernet_Frame_Header_t*)&FrameIN.FrameData;
Ethernet_Frame_Header_t* FrameOUTHeader = (Ethernet_Frame_Header_t*)&FrameOUT.FrameData;
-
+
int16_t RetSize = NO_RESPONSE;
-
+
/* Ensure frame is addressed to either all (broadcast) or the virtual webserver, and is a type II frame */
if ((MAC_COMPARE(&FrameINHeader->Destination, &ServerMACAddress) ||
MAC_COMPARE(&FrameINHeader->Destination, &BroadcastMACAddress)) &&
@@ -83,13 +83,13 @@ void Ethernet_ProcessPacket(void)
case ETHERTYPE_ARP:
RetSize = ARP_ProcessARPPacket(&FrameIN.FrameData[sizeof(Ethernet_Frame_Header_t)],
&FrameOUT.FrameData[sizeof(Ethernet_Frame_Header_t)]);
- break;
+ break;
case ETHERTYPE_IPV4:
RetSize = IP_ProcessIPPacket(&FrameIN.FrameData[sizeof(Ethernet_Frame_Header_t)],
&FrameOUT.FrameData[sizeof(Ethernet_Frame_Header_t)]);
break;
}
-
+
/* Protocol processing routine has filled a response, complete the ethernet frame header */
if (RetSize > 0)
{
@@ -97,7 +97,7 @@ void Ethernet_ProcessPacket(void)
FrameOUTHeader->Source = ServerMACAddress;
FrameOUTHeader->Destination = FrameINHeader->Source;
FrameOUTHeader->EtherType = FrameINHeader->EtherType;
-
+
/* Set the response length in the buffer and indicate that a response is ready to be sent */
FrameOUT.FrameLength = (sizeof(Ethernet_Frame_Header_t) + RetSize);
FrameOUT.FrameInBuffer = true;
@@ -128,9 +128,10 @@ uint16_t Ethernet_Checksum16(void* Data,
for (uint16_t CurrWord = 0; CurrWord < (Bytes >> 1); CurrWord++)
Checksum += Words[CurrWord];
-
+
while (Checksum & 0xFFFF0000)
Checksum = ((Checksum & 0xFFFF) + (Checksum >> 16));
-
+
return ~Checksum;
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
index 49c6b1c25..68fffb48f 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Ethernet.c.
*/
-
+
#ifndef _ETHERNET_H_
#define _ETHERNET_H_
@@ -48,19 +48,19 @@
#include "DHCP.h"
#include "ARP.h"
#include "IP.h"
-
+
/* Macros: */
/** Physical MAC address of the USB RNDIS network adapter. */
#define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00}
-
+
/** Physical MAC address of the virtual server on the network. */
- #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01}
+ #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01}
/** Physical MAC address of the network broadcast address. */
#define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
-
+
/** Performs a comparison between two MAC addresses, indicating if they are identical.
- *
+ *
* \param[in] MAC1 First MAC address
* \param[in] MAC2 Second MAC address
*
@@ -70,12 +70,12 @@
/** Maximum size of an incoming or outgoing Ethernet frame in bytes. */
#define ETHERNET_FRAME_SIZE_MAX 1500
-
+
/** Minimum size of an Ethernet packet in bytes, to conform to the Ethernet V2 packet standard. */
#define ETHERNET_VER2_MINSIZE 0x0600
-
+
/** Return value for all sub protocol handling routines, indicating that no response packet has been generated. */
- #define NO_RESPONSE 0
+ #define NO_RESPONSE 0
/** Return value for all sub protocol handling routines, indicating that the packet has not yet been handled. */
#define NO_PROCESS -1
@@ -96,7 +96,7 @@
MAC_Address_t Source; /**< Physics MAC address of the packet source */
uint16_t EtherType; /**< Ethernet packet sub-protocol type, for Ethernet V2 packets */
} Ethernet_Frame_Header_t;
-
+
/* External Variables: */
extern Ethernet_Frame_Info_t FrameIN;
extern Ethernet_Frame_Info_t FrameOUT;
@@ -106,10 +106,11 @@
extern const MAC_Address_t BroadcastMACAddress;
extern const IP_Address_t BroadcastIPAddress;
extern const IP_Address_t ClientIPAddress;
-
+
/* Function Prototypes: */
void Ethernet_ProcessPacket(void);
uint16_t Ethernet_Checksum16(void* Data,
uint16_t Bytes);
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h
index 014a441cf..8f529d6b4 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -63,7 +63,7 @@
#define ETHERTYPE_FIBRECHANNEL 0x8906
#define ETHERTYPE_QINQ 0x9100
#define ETHERTYPE_VLLT 0xCAFE
-
+
#define PROTOCOL_ICMP 1
#define PROTOCOL_IGMP 2
#define PROTOCOL_TCP 6
@@ -77,7 +77,7 @@
{
uint8_t Octets[6]; /**< Individual bytes of a MAC address */
} MAC_Address_t;
-
+
/** Type define for a protocol IP address of a device on a network. */
typedef struct
{
@@ -85,3 +85,4 @@
} IP_Address_t;
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c
index 7e4be9c3d..3bf01cd4b 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* Echo requests from the host, to indicate a successful network connection between the host
* and the virtual server.
*/
-
+
#include "ICMP.h"
/** Processes an ICMP packet inside an Ethernet frame, and writes the appropriate response
@@ -62,9 +62,9 @@ int16_t ICMP_ProcessICMPPacket(void* InDataStart,
ICMPHeaderOUT->Checksum = 0;
ICMPHeaderOUT->Id = ICMPHeaderIN->Id;
ICMPHeaderOUT->Sequence = ICMPHeaderIN->Sequence;
-
+
intptr_t DataSize = FrameIN.FrameLength - ((((intptr_t)InDataStart + sizeof(ICMP_Header_t)) - (intptr_t)FrameIN.FrameData));
-
+
/* Copy the remaining payload to the response - echo requests should echo back any sent data */
memmove(&((uint8_t*)OutDataStart)[sizeof(ICMP_Header_t)],
&((uint8_t*)InDataStart)[sizeof(ICMP_Header_t)],
@@ -75,6 +75,7 @@ int16_t ICMP_ProcessICMPPacket(void* InDataStart,
/* Return the size of the response so far */
return (DataSize + sizeof(ICMP_Header_t));
}
-
+
return NO_RESPONSE;
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h
index dcea1ada4..a0fb6eeee 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,18 +39,18 @@
/* Includes: */
#include <avr/io.h>
#include <string.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
-
+
/* Macros: */
/** ICMP message type constant, indicating an ICMP ECHO Reply message. */
#define ICMP_TYPE_ECHOREPLY 0
/** ICMP message type constant, indicating a packet destination is unreachable. */
#define ICMP_TYPE_DESTINATIONUNREACHABLE 3
-
+
/** ICMP message type constant, indicating an ICMP Source Quench message. */
#define ICMP_TYPE_SOURCEQUENCH 4
@@ -62,7 +62,7 @@
/** ICMP message type constant, indicating an ICMP Time Exceeded message. */
#define ICMP_TYPE_TIMEEXCEEDED 11
-
+
/* Type Defines: */
/** Type define for an ICMP message header. */
typedef struct
@@ -73,9 +73,10 @@
uint16_t Id; /**< Id of the ICMP message */
uint16_t Sequence; /**< Sequence number of the ICMP message, to link together message responses */
} ICMP_Header_t;
-
+
/* Function Prototypes: */
int16_t ICMP_ProcessICMPPacket(void* InDataStart,
void* OutDataStart);
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c
index 85ccf426e..731043f8f 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Internet Protocol (IP) packet handling routines. This protocol handles IP packets from the
* host which typically encapsulate other protocols such as ICMP, UDP and TCP.
*/
-
+
#include "IP.h"
/** Processes an IP packet inside an Ethernet frame, and writes the appropriate response
@@ -65,7 +65,7 @@ int16_t IP_ProcessIPPacket(void* InDataStart,
{
return NO_RESPONSE;
}
-
+
/* Pass off the IP payload to the appropriate protocol processing routine */
switch (IPHeaderIN->Protocol)
{
@@ -76,15 +76,15 @@ int16_t IP_ProcessIPPacket(void* InDataStart,
case PROTOCOL_TCP:
RetSize = TCP_ProcessTCPPacket(InDataStart,
&((uint8_t*)InDataStart)[HeaderLengthBytes],
- &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
+ &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
break;
case PROTOCOL_UDP:
RetSize = UDP_ProcessUDPPacket(InDataStart,
&((uint8_t*)InDataStart)[HeaderLengthBytes],
- &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
+ &((uint8_t*)OutDataStart)[sizeof(IP_Header_t)]);
break;
}
-
+
/* Check to see if the protocol processing routine has filled out a response */
if (RetSize > 0)
{
@@ -101,12 +101,13 @@ int16_t IP_ProcessIPPacket(void* InDataStart,
IPHeaderOUT->TTL = DEFAULT_TTL;
IPHeaderOUT->SourceAddress = IPHeaderIN->DestinationAddress;
IPHeaderOUT->DestinationAddress = IPHeaderIN->SourceAddress;
-
+
IPHeaderOUT->HeaderChecksum = Ethernet_Checksum16(IPHeaderOUT, sizeof(IP_Header_t));
-
+
/* Return the size of the response so far */
return (sizeof(IP_Header_t) + RetSize);
}
-
+
return RetSize;
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h
index 8f45113be..c1b2817ca 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,18 +32,18 @@
*
* Header file for IP.c.
*/
-
+
#ifndef _IP_H_
#define _IP_H_
/* Includes: */
#include <avr/io.h>
#include <string.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
-
+
/* Macros: */
/** Protocol IP address of the host (client) machine, once assigned by DHCP. */
#define CLIENT_IP_ADDRESS { 10, 0, 0, 1}
@@ -58,16 +58,16 @@
* is reached.
*/
#define DEFAULT_TTL 128
-
+
/** Performs a comparison between two IP addresses, indicating if they are identical.
- *
+ *
* \param[in] IP1 First IP address
* \param[in] IP2 Second IP address
*
* \return True if the addresses match, false otherwise
*/
#define IP_COMPARE(IP1, IP2) (memcmp(IP1, IP2, sizeof(IP_Address_t)) == 0)
-
+
/* Type Defines: */
/** Type define of an IP packet header. */
typedef struct
@@ -84,13 +84,14 @@
uint8_t TTL; /**< Maximum allowable number of hops to reach the packet destination */
uint8_t Protocol; /**< Encapsulated protocol type */
uint16_t HeaderChecksum; /**< Ethernet checksum of the IP header */
-
+
IP_Address_t SourceAddress; /**< Source protocol IP address of the packet */
IP_Address_t DestinationAddress; /**< Destination protocol IP address of the packet */
} IP_Header_t;
-
+
/* Function Prototypes: */
int16_t IP_ProcessIPPacket(void* InDataStart,
void* OutDataStart);
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c
index 84e03e0ae..38df7eb64 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -31,7 +31,7 @@
/* Protocol decoders for Ethernet, TCP, IP, ICMP and ARP. Each of these routines
accepts a header to the appropriate protocol and prints out pertinent information
on the packet through the serial port.
-
+
To disable printing of a specific protocol, define the token NO_DECODE_{Protocol}
in the project makefile, and pass it to the compiler using the -D switch.
*/
@@ -46,7 +46,7 @@
* Packet decoding routines can be disabled by defining NO_DECODE_{Protocol Name} in the project makefile
* and passing it to the compiler via the -D switch.
*/
-
+
#include "ProtocolDecoders.h"
/** Decodes an Ethernet frame header and prints its contents to through the USART in a human readable format.
@@ -57,9 +57,9 @@ void DecodeEthernetFrameHeader(void* InDataStart)
{
#if !defined(NO_DECODE_ETHERNET)
Ethernet_Frame_Header_t* FrameHeader = (Ethernet_Frame_Header_t*)InDataStart;
-
+
printf_P(PSTR("\r\n"));
-
+
printf_P(PSTR(" ETHERNET\r\n"));
printf_P(PSTR(" + Frame Size: %u\r\n"), FrameIN.FrameLength);
@@ -98,7 +98,7 @@ void DecodeEthernetFrameHeader(void* InDataStart)
void DecodeARPHeader(void* InDataStart)
{
#if !defined(NO_DECODE_ARP)
- ARP_Header_t* ARPHeader = (ARP_Header_t*)InDataStart;
+ ARP_Header_t* ARPHeader = (ARP_Header_t*)InDataStart;
printf_P(PSTR(" \\\r\n ARP\r\n"));
@@ -106,12 +106,12 @@ void DecodeARPHeader(void* InDataStart)
!(MAC_COMPARE(&ARPHeader->THA, &ServerMACAddress)))
{
printf_P(PSTR(" + NOT ADDRESSED TO DEVICE\r\n"));
- return;
+ return;
}
printf_P(PSTR(" + Protocol: %x\r\n"), SwapEndian_16(ARPHeader->ProtocolType));
printf_P(PSTR(" + Operation: %u\r\n"), SwapEndian_16(ARPHeader->Operation));
-
+
if (SwapEndian_16(ARPHeader->ProtocolType) == ETHERTYPE_IPV4)
{
printf_P(PSTR(" + SHA MAC: %02X:%02X:%02X:%02X:%02X:%02X\r\n"), ARPHeader->SHA.Octets[0],
@@ -163,14 +163,14 @@ void DecodeIPHeader(void* InDataStart)
printf_P(PSTR(" + Header Length: %u Bytes\r\n"), HeaderLengthBytes);
printf_P(PSTR(" + Packet Version: %u\r\n"), IPHeader->Version);
printf_P(PSTR(" + Total Length: %u\r\n"), SwapEndian_16(IPHeader->TotalLength));
-
+
printf_P(PSTR(" + Protocol: %u\r\n"), IPHeader->Protocol);
printf_P(PSTR(" + TTL: %u\r\n"), IPHeader->TTL);
-
+
printf_P(PSTR(" + IP Src: %u.%u.%u.%u\r\n"), IPHeader->SourceAddress.Octets[0],
IPHeader->SourceAddress.Octets[1],
IPHeader->SourceAddress.Octets[2],
- IPHeader->SourceAddress.Octets[3]);
+ IPHeader->SourceAddress.Octets[3]);
printf_P(PSTR(" + IP Dst: %u.%u.%u.%u\r\n"), IPHeader->DestinationAddress.Octets[0],
IPHeader->DestinationAddress.Octets[1],
@@ -215,9 +215,9 @@ void DecodeTCPHeader(void* InDataStart)
printf_P(PSTR(" + Sequence Number: %lu\r\n"), SwapEndian_32(TCPHeader->SequenceNumber));
printf_P(PSTR(" + Acknowledgment Number: %lu\r\n"), SwapEndian_32(TCPHeader->AcknowledgmentNumber));
-
+
printf_P(PSTR(" + Flags: 0x%02X\r\n"), TCPHeader->Flags);
-
+
if (TCP_GetPortState(TCPHeader->DestinationPort) == TCP_Port_Closed)
printf_P(PSTR(" + NOT LISTENING ON DESTINATION PORT\r\n"));
#endif
@@ -272,8 +272,9 @@ void DecodeDHCPHeader(void* InDataStart)
break;
}
}
-
+
DHCPOptions += ((DHCPOptions[0] == DHCP_OPTION_PAD) ? 1 : (DHCPOptions[1] + 2));
}
#endif
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h
index 4723bf472..8c124b427 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,12 +40,12 @@
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <stdio.h>
-
+
#include <LUFA/Drivers/Peripheral/SerialStream.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
-
+
/* Function Prototypes: */
void DecodeEthernetFrameHeader(void* InDataStart);
void DecodeARPHeader(void* InDataStart);
@@ -56,3 +56,4 @@
void DecodeDHCPHeader(void* InDataStart);
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c
index 3875f8801..520557003 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* RNDIS command handler functions. This handles RNDIS commands according to
* the Microsoft RNDIS specification, creating a USB Ethernet network adapter.
*/
-
+
#define INCLUDE_FROM_RNDIS_C
#include "RNDIS.h"
@@ -93,7 +93,7 @@ bool ResponseReady = false;
uint8_t CurrRNDISState = RNDIS_Uninitialized;
/** Current Ethernet packet filter mask. This is non-zero when the adapter is initialized, or zero when disabled. */
-uint32_t CurrPacketFilter = 0;
+uint32_t CurrPacketFilter = 0;
/** Processes the RNDIS message received by the host and stored in the RNDISMessageBuffer global buffer. If a response is
@@ -110,17 +110,17 @@ void ProcessRNDISControlMessage(void)
/* Initialize the adapter - return information about the supported RNDIS version and buffer sizes */
ResponseReady = true;
-
+
RNDIS_Initialize_Message_t* INITIALIZE_Message = (RNDIS_Initialize_Message_t*)&RNDISMessageBuffer;
RNDIS_Initialize_Complete_t* INITIALIZE_Response = (RNDIS_Initialize_Complete_t*)&RNDISMessageBuffer;
-
+
INITIALIZE_Response->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT;
INITIALIZE_Response->MessageLength = sizeof(RNDIS_Initialize_Complete_t);
INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId;
INITIALIZE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
-
+
INITIALIZE_Response->MajorVersion = REMOTE_NDIS_VERSION_MAJOR;
- INITIALIZE_Response->MinorVersion = REMOTE_NDIS_VERSION_MINOR;
+ INITIALIZE_Response->MinorVersion = REMOTE_NDIS_VERSION_MINOR;
INITIALIZE_Response->DeviceFlags = REMOTE_NDIS_DF_CONNECTIONLESS;
INITIALIZE_Response->Medium = REMOTE_NDIS_MEDIUM_802_3;
INITIALIZE_Response->MaxPacketsPerTransfer = 1;
@@ -128,9 +128,9 @@ void ProcessRNDISControlMessage(void)
INITIALIZE_Response->PacketAlignmentFactor = 0;
INITIALIZE_Response->AFListOffset = 0;
INITIALIZE_Response->AFListSize = 0;
-
+
CurrRNDISState = RNDIS_Initialized;
-
+
break;
case REMOTE_NDIS_HALT_MSG:
/* Halt the adapter, reset the adapter state - note that no response should be returned when completed */
@@ -145,42 +145,42 @@ void ProcessRNDISControlMessage(void)
/* Request for information about a parameter about the adapter, specified as an OID token */
ResponseReady = true;
-
+
RNDIS_Query_Message_t* QUERY_Message = (RNDIS_Query_Message_t*)&RNDISMessageBuffer;
RNDIS_Query_Complete_t* QUERY_Response = (RNDIS_Query_Complete_t*)&RNDISMessageBuffer;
uint32_t Query_Oid = QUERY_Message->Oid;
-
+
void* QueryData = &RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
QUERY_Message->InformationBufferOffset];
- void* ResponseData = &RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)];
+ void* ResponseData = &RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)];
uint16_t ResponseSize;
QUERY_Response->MessageType = REMOTE_NDIS_QUERY_CMPLT;
QUERY_Response->MessageLength = sizeof(RNDIS_Query_Complete_t);
-
+
if (ProcessNDISQuery(Query_Oid, QueryData, QUERY_Message->InformationBufferLength,
ResponseData, &ResponseSize))
{
QUERY_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
QUERY_Response->MessageLength += ResponseSize;
-
+
QUERY_Response->InformationBufferLength = ResponseSize;
QUERY_Response->InformationBufferOffset = (sizeof(RNDIS_Query_Complete_t) - sizeof(RNDIS_Message_Header_t));
}
else
- {
+ {
QUERY_Response->Status = REMOTE_NDIS_STATUS_NOT_SUPPORTED;
QUERY_Response->InformationBufferLength = 0;
QUERY_Response->InformationBufferOffset = 0;
}
-
+
break;
case REMOTE_NDIS_SET_MSG:
/* Request to set a parameter of the adapter, specified as an OID token */
-
+
ResponseReady = true;
-
+
RNDIS_Set_Message_t* SET_Message = (RNDIS_Set_Message_t*)&RNDISMessageBuffer;
RNDIS_Set_Complete_t* SET_Response = (RNDIS_Set_Complete_t*)&RNDISMessageBuffer;
uint32_t SET_Oid = SET_Message->Oid;
@@ -191,7 +191,7 @@ void ProcessRNDISControlMessage(void)
void* SetData = &RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
SET_Message->InformationBufferOffset];
-
+
if (ProcessNDISSet(SET_Oid, SetData, SET_Message->InformationBufferLength))
SET_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
else
@@ -200,9 +200,9 @@ void ProcessRNDISControlMessage(void)
break;
case REMOTE_NDIS_RESET_MSG:
/* Soft reset the adapter */
-
+
ResponseReady = true;
-
+
RNDIS_Reset_Complete_t* RESET_Response = (RNDIS_Reset_Complete_t*)&RNDISMessageBuffer;
RESET_Response->MessageType = REMOTE_NDIS_RESET_CMPLT;
@@ -213,9 +213,9 @@ void ProcessRNDISControlMessage(void)
break;
case REMOTE_NDIS_KEEPALIVE_MSG:
/* Keep alive message sent to the adapter every 5 seconds when idle to ensure it is still responding */
-
+
ResponseReady = true;
-
+
RNDIS_KeepAlive_Message_t* KEEPALIVE_Message = (RNDIS_KeepAlive_Message_t*)&RNDISMessageBuffer;
RNDIS_KeepAlive_Complete_t* KEEPALIVE_Response = (RNDIS_KeepAlive_Complete_t*)&RNDISMessageBuffer;
@@ -223,7 +223,7 @@ void ProcessRNDISControlMessage(void)
KEEPALIVE_Response->MessageLength = sizeof(RNDIS_KeepAlive_Complete_t);
KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId;
KEEPALIVE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
-
+
break;
}
}
@@ -248,66 +248,66 @@ static bool ProcessNDISQuery(const uint32_t OId, void* QueryData, uint16_t Query
{
case OID_GEN_SUPPORTED_LIST:
*ResponseSize = sizeof(AdapterSupportedOIDList);
-
+
/* Copy the list of supported NDIS OID tokens to the response buffer */
memcpy_P(ResponseData, AdapterSupportedOIDList, sizeof(AdapterSupportedOIDList));
-
+
return true;
case OID_GEN_PHYSICAL_MEDIUM:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate that the device is a true ethernet link */
*((uint32_t*)ResponseData) = 0;
-
+
return true;
case OID_GEN_HARDWARE_STATUS:
*ResponseSize = sizeof(uint32_t);
-
+
/* Always indicate hardware ready */
*((uint32_t*)ResponseData) = NdisHardwareStatusReady;
-
+
return true;
case OID_GEN_MEDIA_SUPPORTED:
case OID_GEN_MEDIA_IN_USE:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate 802.3 (Ethernet) supported by the adapter */
*((uint32_t*)ResponseData) = REMOTE_NDIS_MEDIUM_802_3;
-
+
return true;
case OID_GEN_VENDOR_ID:
*ResponseSize = sizeof(uint32_t);
-
+
/* Vendor ID 0x0xFFFFFF is reserved for vendors who have not purchased a NDIS VID */
*((uint32_t*)ResponseData) = 0x00FFFFFF;
-
+
return true;
case OID_GEN_MAXIMUM_FRAME_SIZE:
case OID_GEN_TRANSMIT_BLOCK_SIZE:
case OID_GEN_RECEIVE_BLOCK_SIZE:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate that the maximum frame size is the size of the ethernet frame buffer */
*((uint32_t*)ResponseData) = ETHERNET_FRAME_SIZE_MAX;
-
+
return true;
case OID_GEN_VENDOR_DESCRIPTION:
*ResponseSize = sizeof(AdapterVendorDescription);
-
+
/* Copy vendor description string to the response buffer */
memcpy_P(ResponseData, AdapterVendorDescription, sizeof(AdapterVendorDescription));
-
+
return true;
case OID_GEN_MEDIA_CONNECT_STATUS:
*ResponseSize = sizeof(uint32_t);
-
+
/* Always indicate that the adapter is connected to a network */
*((uint32_t*)ResponseData) = REMOTE_NDIS_MEDIA_STATE_CONNECTED;
-
+
return true;
case OID_GEN_LINK_SPEED:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate 10Mb/s link speed */
*((uint32_t*)ResponseData) = 100000;
@@ -315,25 +315,25 @@ static bool ProcessNDISQuery(const uint32_t OId, void* QueryData, uint16_t Query
case OID_802_3_PERMANENT_ADDRESS:
case OID_802_3_CURRENT_ADDRESS:
*ResponseSize = sizeof(MAC_Address_t);
-
+
/* Copy over the fixed adapter MAC to the response buffer */
memcpy_P(ResponseData, &AdapterMACAddress, sizeof(MAC_Address_t));
return true;
case OID_802_3_MAXIMUM_LIST_SIZE:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate only one multicast address supported */
*((uint32_t*)ResponseData) = 1;
-
+
return true;
case OID_GEN_CURRENT_PACKET_FILTER:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate the current packet filter mask */
*((uint32_t*)ResponseData) = CurrPacketFilter;
-
- return true;
+
+ return true;
case OID_GEN_XMIT_OK:
case OID_GEN_RCV_OK:
case OID_GEN_XMIT_ERROR:
@@ -343,24 +343,24 @@ static bool ProcessNDISQuery(const uint32_t OId, void* QueryData, uint16_t Query
case OID_802_3_XMIT_ONE_COLLISION:
case OID_802_3_XMIT_MORE_COLLISIONS:
*ResponseSize = sizeof(uint32_t);
-
+
/* Unused statistic OIDs - always return 0 for each */
*((uint32_t*)ResponseData) = 0;
-
+
return true;
case OID_GEN_MAXIMUM_TOTAL_SIZE:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate maximum overall buffer (Ethernet frame and RNDIS header) the adapter can handle */
*((uint32_t*)ResponseData) = (sizeof(RNDISMessageBuffer) + ETHERNET_FRAME_SIZE_MAX);
-
+
return true;
default:
return false;
}
}
-/** Processes RNDIS set commands, setting adapter parameters to values given by the host. The requested parameter is given
+/** Processes RNDIS set commands, setting adapter parameters to values given by the host. The requested parameter is given
* as an OID value.
*
* \param[in] OId OId value of the parameter being set
@@ -378,16 +378,17 @@ static bool ProcessNDISSet(uint32_t OId, void* SetData, uint16_t SetSize)
case OID_GEN_CURRENT_PACKET_FILTER:
/* Save the packet filter mask in case the host queries it again later */
CurrPacketFilter = *((uint32_t*)SetData);
-
+
/* Set the RNDIS state to initialized if the packet filter is non-zero */
CurrRNDISState = ((CurrPacketFilter) ? RNDIS_Data_Initialized : RNDIS_Data_Initialized);
-
+
return true;
case OID_802_3_MULTICAST_LIST:
/* Do nothing - throw away the value from the host as it is unused */
-
+
return true;
default:
return false;
}
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h
index 17a34ace7..ed35b3546 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
-
+
#include "RNDISEthernet.h"
#include "RNDISConstants.h"
#include "Ethernet.h"
@@ -50,13 +50,13 @@
/** Implemented RNDIS Version Minor. */
#define REMOTE_NDIS_VERSION_MINOR 0x00
-
+
/** RNDIS request to issue a host-to-device NDIS command. */
#define REQ_SendEncapsulatedCommand 0x00
/** RNDIS request to issue a device-to-host NDIS response. */
#define REQ_GetEncapsulatedResponse 0x01
-
+
/* Enums: */
/** Enum for the possible NDIS adapter states. */
enum RNDIS_States_t
@@ -99,19 +99,19 @@
uint32_t VcHandle;
uint32_t Reserved;
} RNDIS_Packet_Message_t;
-
+
/** Type define for a RNDIS Initialize command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t MaxTransferSize;
} RNDIS_Initialize_Message_t;
-
+
/** Type define for a RNDIS Initialize complete response message. */
typedef struct
{
@@ -119,7 +119,7 @@
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
-
+
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t DeviceFlags;
@@ -130,7 +130,7 @@
uint32_t AFListOffset;
uint32_t AFListSize;
} RNDIS_Initialize_Complete_t;
-
+
/** Type define for a RNDIS Keep-alive command message. */
typedef struct
{
@@ -157,14 +157,14 @@
uint32_t AddressingReset;
} RNDIS_Reset_Complete_t;
-
+
/** Type define for a RNDIS Set command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
@@ -179,20 +179,20 @@
uint32_t RequestId;
uint32_t Status;
} RNDIS_Set_Complete_t;
-
+
/** Type define for a RNDIS Query command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle;
} RNDIS_Query_Message_t;
-
+
/** Type define for a RNDIS Query complete response message. */
typedef struct
{
@@ -200,11 +200,11 @@
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
-
+
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
} RNDIS_Query_Complete_t;
-
+
/* External Variables: */
extern uint8_t RNDISMessageBuffer[];
extern RNDIS_Message_Header_t* MessageHeader;
@@ -222,7 +222,8 @@
uint16_t* ResponseSize);
static bool ProcessNDISSet(const uint32_t OId,
void* SetData,
- uint16_t SetSize);
+ uint16_t SetSize);
#endif
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDISConstants.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDISConstants.h
index efe22b699..273fdb81e 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDISConstants.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDISConstants.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* RNDIS specification related constants. For more information on these
* constants, please refer to the Microsoft RNDIS specification.
*/
-
+
#ifndef _RNDIS_CONSTANTS_DEVICE_H_
#define _RNDIS_CONSTANTS_DEVICE_H_
@@ -52,19 +52,19 @@
#define REMOTE_NDIS_SET_CMPLT 0x80000005UL
#define REMOTE_NDIS_RESET_CMPLT 0x80000006UL
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL
-
+
#define REMOTE_NDIS_STATUS_SUCCESS 0x00000000UL
#define REMOTE_NDIS_STATUS_FAILURE 0xC0000001UL
#define REMOTE_NDIS_STATUS_INVALID_DATA 0xC0010015UL
#define REMOTE_NDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL
#define REMOTE_NDIS_STATUS_MEDIA_CONNECT 0x4001000BUL
#define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL
-
+
#define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL
#define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL
-
+
#define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL
-
+
#define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL
#define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL
@@ -79,8 +79,8 @@
#define REMOTE_NDIS_PACKET_GROUP 0x00001000UL
#define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
#define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL
- #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
-
+ #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
+
#define OID_GEN_SUPPORTED_LIST 0x00010101UL
#define OID_GEN_HARDWARE_STATUS 0x00010102UL
#define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
@@ -110,3 +110,4 @@
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c
index a159f35d1..fe8716890 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* and reception of packets to and from devices on a network, to "ports" on the device. It is used in situations where data
* delivery must be reliable and correct, e.g. HTTP, TELNET and most other non-streaming protocols.
*/
-
+
#define INCLUDE_FROM_TCP_C
#include "TCP.h"
@@ -64,7 +64,7 @@ void TCP_Task(void)
for (uint8_t PTableEntry = 0; PTableEntry < MAX_OPEN_TCP_PORTS; PTableEntry++)
{
/* Run the application handler for the port */
- if ((PortStateTable[PTableEntry].Port == ConnectionStateTable[CSTableEntry].Port) &&
+ if ((PortStateTable[PTableEntry].Port == ConnectionStateTable[CSTableEntry].Port) &&
(PortStateTable[PTableEntry].State == TCP_Port_Open))
{
PortStateTable[PTableEntry].ApplicationHandler(&ConnectionStateTable[CSTableEntry],
@@ -72,11 +72,11 @@ void TCP_Task(void)
}
}
}
-
+
/* Bail out early if there is already a frame waiting to be sent in the Ethernet OUT buffer */
if (FrameOUT.FrameInBuffer)
return;
-
+
/* Send response packets from each application as the TCP packet buffers are filled by the applications */
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
{
@@ -108,7 +108,7 @@ void TCP_Task(void)
TCPHeaderOUT->Reserved = 0;
memcpy(TCPDataOUT, ConnectionStateTable[CSTableEntry].Info.Buffer.Data, PacketSize);
-
+
ConnectionStateTable[CSTableEntry].Info.SequenceNumberOut += PacketSize;
TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, ServerIPAddress,
@@ -130,11 +130,11 @@ void TCP_Task(void)
IPHeaderOUT->TTL = DEFAULT_TTL;
IPHeaderOUT->SourceAddress = ServerIPAddress;
IPHeaderOUT->DestinationAddress = ConnectionStateTable[CSTableEntry].RemoteAddress;
-
+
IPHeaderOUT->HeaderChecksum = Ethernet_Checksum16(IPHeaderOUT, sizeof(IP_Header_t));
-
+
PacketSize += sizeof(IP_Header_t);
-
+
/* Fill out the response Ethernet frame header */
FrameOUTHeader->Source = ServerMACAddress;
FrameOUTHeader->Destination = (MAC_Address_t){{0x02, 0x00, 0x02, 0x00, 0x02, 0x00}};
@@ -145,9 +145,9 @@ void TCP_Task(void)
/* Set the response length in the buffer and indicate that a response is ready to be sent */
FrameOUT.FrameLength = PacketSize;
FrameOUT.FrameInBuffer = true;
-
+
ConnectionStateTable[CSTableEntry].Info.Buffer.Ready = false;
-
+
break;
}
}
@@ -207,7 +207,7 @@ bool TCP_SetPortState(const uint16_t Port,
return true;
}
}
-
+
/* Port not in table and no room to add it, return failure */
return false;
}
@@ -234,7 +234,7 @@ uint8_t TCP_GetPortState(const uint16_t Port)
if (PortStateTable[PTableEntry].Port == Port)
return PortStateTable[PTableEntry].State;
}
-
+
/* Port not in table, assume closed */
return TCP_Port_Closed;
}
@@ -267,20 +267,20 @@ bool TCP_SetConnectionState(const uint16_t Port,
return true;
}
}
-
+
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
{
/* Find empty entry in the table */
if (ConnectionStateTable[CSTableEntry].State == TCP_Connection_Closed)
{
ConnectionStateTable[CSTableEntry].Port = Port;
- ConnectionStateTable[CSTableEntry].RemoteAddress = RemoteAddress;
+ ConnectionStateTable[CSTableEntry].RemoteAddress = RemoteAddress;
ConnectionStateTable[CSTableEntry].RemotePort = RemotePort;
ConnectionStateTable[CSTableEntry].State = State;
return true;
}
}
-
+
return false;
}
@@ -304,12 +304,12 @@ uint8_t TCP_GetConnectionState(const uint16_t Port,
if ((ConnectionStateTable[CSTableEntry].Port == Port) &&
IP_COMPARE(&ConnectionStateTable[CSTableEntry].RemoteAddress, &RemoteAddress) &&
ConnectionStateTable[CSTableEntry].RemotePort == RemotePort)
-
+
{
return ConnectionStateTable[CSTableEntry].State;
}
}
-
+
return TCP_Connection_Closed;
}
@@ -337,7 +337,7 @@ TCP_ConnectionInfo_t* TCP_GetConnectionInfo(const uint16_t Port,
return &ConnectionStateTable[CSTableEntry].Info;
}
}
-
+
return NULL;
}
@@ -361,11 +361,11 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCP_Header_t* TCPHeaderOUT = (TCP_Header_t*)TCPHeaderOutStart;
TCP_ConnectionInfo_t* ConnectionInfo;
-
+
DecodeTCPHeader(TCPHeaderInStart);
bool PacketResponse = false;
-
+
/* Check if the destination port is open and allows incoming connections */
if (TCP_GetPortState(TCPHeaderIN->DestinationPort) == TCP_Port_Open)
{
@@ -379,8 +379,8 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_Closed))
{
- TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
- PacketResponse = true;
+ TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
+ PacketResponse = true;
}
}
else
@@ -395,7 +395,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
if (TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_SYNReceived))
{
- TCPHeaderOUT->Flags = (TCP_FLAG_SYN | TCP_FLAG_ACK);
+ TCPHeaderOUT->Flags = (TCP_FLAG_SYN | TCP_FLAG_ACK);
ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress, TCPHeaderIN->SourcePort);
@@ -407,10 +407,10 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
{
TCPHeaderOUT->Flags = TCP_FLAG_RST;
}
-
+
PacketResponse = true;
}
-
+
break;
case TCP_Connection_SYNReceived:
if (TCPHeaderIN->Flags == TCP_FLAG_ACK)
@@ -422,19 +422,19 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort);
-
+
ConnectionInfo->SequenceNumberOut++;
}
-
+
break;
case TCP_Connection_Established:
if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK))
{
/* FIN ACK when connected to a peer starts the finalization process */
-
- TCPHeaderOUT->Flags = (TCP_FLAG_FIN | TCP_FLAG_ACK);
+
+ TCPHeaderOUT->Flags = (TCP_FLAG_FIN | TCP_FLAG_ACK);
PacketResponse = true;
-
+
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_CloseWait);
@@ -449,14 +449,14 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort);
- /* Check if the buffer is currently in use either by a buffered data to send, or receive */
+ /* Check if the buffer is currently in use either by a buffered data to send, or receive */
if ((ConnectionInfo->Buffer.InUse == false) && (ConnectionInfo->Buffer.Ready == false))
- {
+ {
ConnectionInfo->Buffer.Direction = TCP_PACKETDIR_IN;
ConnectionInfo->Buffer.InUse = true;
ConnectionInfo->Buffer.Length = 0;
}
-
+
/* Check if the buffer has been claimed by us to read in data from the peer */
if ((ConnectionInfo->Buffer.Direction == TCP_PACKETDIR_IN) &&
(ConnectionInfo->Buffer.Length != TCP_WINDOW_SIZE))
@@ -472,7 +472,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo->SequenceNumberIn += DataLength;
ConnectionInfo->Buffer.Length += DataLength;
-
+
/* Check if the buffer is full or if the PSH flag is set, if so indicate buffer ready */
if ((!(TCP_WINDOW_SIZE - ConnectionInfo->Buffer.Length)) || (TCPHeaderIN->Flags & TCP_FLAG_PSH))
{
@@ -489,7 +489,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
return NO_PROCESS;
}
}
-
+
break;
case TCP_Connection_Closing:
ConnectionInfo = TCP_GetConnectionInfo(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
@@ -497,9 +497,9 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCPHeaderOUT->Flags = (TCP_FLAG_ACK | TCP_FLAG_FIN);
PacketResponse = true;
-
+
ConnectionInfo->Buffer.InUse = false;
-
+
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_FINWait1);
@@ -515,7 +515,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo->SequenceNumberIn++;
ConnectionInfo->SequenceNumberOut++;
-
+
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_Closed);
}
@@ -524,7 +524,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_FINWait2);
}
-
+
break;
case TCP_Connection_FINWait2:
if (TCPHeaderIN->Flags == (TCP_FLAG_FIN | TCP_FLAG_ACK))
@@ -537,11 +537,11 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
ConnectionInfo->SequenceNumberIn++;
ConnectionInfo->SequenceNumberOut++;
-
+
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_Closed);
}
-
+
break;
case TCP_Connection_CloseWait:
if (TCPHeaderIN->Flags == TCP_FLAG_ACK)
@@ -549,7 +549,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCP_SetConnectionState(TCPHeaderIN->DestinationPort, IPHeaderIN->SourceAddress,
TCPHeaderIN->SourcePort, TCP_Connection_Closed);
}
-
+
break;
}
}
@@ -557,10 +557,10 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
else
{
/* Port is not open, indicate via a RST/ACK response to the sender */
- TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
+ TCPHeaderOUT->Flags = (TCP_FLAG_RST | TCP_FLAG_ACK);
PacketResponse = true;
}
-
+
/* Check if we need to respond to the sent packet */
if (PacketResponse)
{
@@ -572,7 +572,7 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCPHeaderOUT->SequenceNumber = SwapEndian_32(ConnectionInfo->SequenceNumberOut);
TCPHeaderOUT->AcknowledgmentNumber = SwapEndian_32(ConnectionInfo->SequenceNumberIn);
TCPHeaderOUT->DataOffset = (sizeof(TCP_Header_t) / sizeof(uint32_t));
-
+
if (!(ConnectionInfo->Buffer.InUse))
TCPHeaderOUT->WindowSize = SwapEndian_16(TCP_WINDOW_SIZE);
else
@@ -581,11 +581,11 @@ int16_t TCP_ProcessTCPPacket(void* IPHeaderInStart,
TCPHeaderOUT->UrgentPointer = 0;
TCPHeaderOUT->Checksum = 0;
TCPHeaderOUT->Reserved = 0;
-
+
TCPHeaderOUT->Checksum = TCP_Checksum16(TCPHeaderOUT, IPHeaderIN->DestinationAddress,
- IPHeaderIN->SourceAddress, sizeof(TCP_Header_t));
+ IPHeaderIN->SourceAddress, sizeof(TCP_Header_t));
- return sizeof(TCP_Header_t);
+ return sizeof(TCP_Header_t);
}
return NO_RESPONSE;
@@ -607,10 +607,10 @@ static uint16_t TCP_Checksum16(void* TCPHeaderOutStart,
uint16_t TCPOutSize)
{
uint32_t Checksum = 0;
-
+
/* TCP/IP checksums are the addition of the one's compliment of each word including the IP pseudo-header,
complimented */
-
+
Checksum += ((uint16_t*)&SourceAddress)[0];
Checksum += ((uint16_t*)&SourceAddress)[1];
Checksum += ((uint16_t*)&DestinationAddress)[0];
@@ -620,12 +620,13 @@ static uint16_t TCP_Checksum16(void* TCPHeaderOutStart,
for (uint16_t CurrWord = 0; CurrWord < (TCPOutSize >> 1); CurrWord++)
Checksum += ((uint16_t*)TCPHeaderOutStart)[CurrWord];
-
+
if (TCPOutSize & 0x01)
Checksum += (((uint16_t*)TCPHeaderOutStart)[TCPOutSize >> 1] & 0x00FF);
-
+
while (Checksum & 0xFFFF0000)
Checksum = ((Checksum & 0xFFFF) + (Checksum >> 16));
-
+
return ~Checksum;
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h
index 838e0134b..0b1160dee 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,11 +39,11 @@
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
-
+
/* Macros: */
/** Maximum number of TCP ports which can be open at the one time. */
#define MAX_OPEN_TCP_PORTS 1
@@ -53,16 +53,16 @@
/** TCP window size, giving the maximum number of bytes which can be buffered at the one time. */
#define TCP_WINDOW_SIZE 512
-
+
/** Port number for HTTP transmissions. */
#define TCP_PORT_HTTP SwapEndian_16(80)
-
+
/** Data direction indicator for a TCP application buffer, indicating data from host-to-device. */
#define TCP_PACKETDIR_IN false
/** Data direction indicator for a TCP application buffer, indicating data from device-to-host. */
#define TCP_PACKETDIR_OUT true
-
+
/** Congestion Window Reduced TCP flag mask. */
#define TCP_FLAG_CWR (1 << 7)
@@ -86,7 +86,7 @@
/** Connection Finalize TCP flag mask. */
#define TCP_FLAG_FIN (1 << 0)
-
+
/** Application macro: Determines if the given application buffer contains a packet received from the host
*
* \param[in] Buffer Application buffer to check
@@ -139,7 +139,7 @@
* \param[in] Buffer Application buffer to clear
*/
#define TCP_APP_CLEAR_BUFFER(Buffer) MACROS{ Buffer->Ready = false; Buffer->Length = 0; }MACROE
-
+
/** Application macro: Closes an open connection to a host.
*
* \param[in] Connection Open TCP connection to close
@@ -153,7 +153,7 @@
TCP_Port_Closed = 0, /**< TCP port closed, no connections to a host may be made on this port. */
TCP_Port_Open = 1, /**< TCP port open, connections to a host may be made on this port. */
};
-
+
/** Enum for possible TCP connection states. */
enum TCP_ConnectionStates_t
{
@@ -167,9 +167,9 @@
TCP_Connection_Closing = 7, /**< Unused */
TCP_Connection_LastACK = 8, /**< Unused */
TCP_Connection_TimeWait = 9, /**< Unused */
- TCP_Connection_Closed = 10, /**< Connection closed in both directions */
+ TCP_Connection_Closed = 10, /**< Connection closed in both directions */
};
-
+
/* Type Defines: */
/** Type define for a TCP connection buffer structure, including size, data and direction. */
typedef struct
@@ -186,7 +186,7 @@
/** Type define for a TCP connection information structure. */
typedef struct
{
- uint32_t SequenceNumberIn; /**< Current TCP sequence number for host-to-device */
+ uint32_t SequenceNumberIn; /**< Current TCP sequence number for host-to-device */
uint32_t SequenceNumberOut; /**< Current TCP sequence number for device-to-host */
TCP_ConnectionBuffer_t Buffer; /**< Connection application data buffer */
} TCP_ConnectionInfo_t;
@@ -215,15 +215,15 @@
{
uint16_t SourcePort; /**< Source port of the TCP packet */
uint16_t DestinationPort; /**< Destination port of the TCP packet */
-
+
uint32_t SequenceNumber; /**< Data sequence number of the packet */
uint32_t AcknowledgmentNumber; /**< Data acknowledgment number of the packet */
-
+
unsigned char Reserved : 4; /**< Reserved, must be all 0 */
unsigned char DataOffset : 4; /**< Offset of the data from the start of the header, in 4 byte chunks */
uint8_t Flags; /**< TCP packet flags */
uint16_t WindowSize; /**< Current data window size (bytes remaining in reception buffer) */
-
+
uint16_t Checksum; /**< TCP checksum */
uint16_t UrgentPointer; /**< Urgent data pointer */
} TCP_Header_t;
@@ -257,3 +257,4 @@
#endif
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c
index 15b065656..9637bebcb 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* User Datagram Protocol (UDP) packet handling routines. This protocol handles high throughput, low
* reliability packets which are typically used to encapsulate streaming data.
*/
-
+
#define INCLUDE_FROM_UDP_C
#include "UDP.h"
@@ -52,11 +52,11 @@ int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
{
UDP_Header_t* UDPHeaderIN = (UDP_Header_t*)UDPHeaderInStart;
UDP_Header_t* UDPHeaderOUT = (UDP_Header_t*)UDPHeaderOutStart;
-
+
int16_t RetSize = NO_RESPONSE;
-
+
DecodeUDPHeader(UDPHeaderInStart);
-
+
switch (SwapEndian_16(UDPHeaderIN->DestinationPort))
{
case UDP_PORT_DHCP_REQUEST:
@@ -65,7 +65,7 @@ int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
&((uint8_t*)UDPHeaderOutStart)[sizeof(UDP_Header_t)]);
break;
}
-
+
/* Check to see if the protocol processing routine has filled out a response */
if (RetSize > 0)
{
@@ -78,6 +78,7 @@ int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
/* Return the size of the response so far */
return (sizeof(UDP_Header_t) + RetSize);
}
-
+
return NO_RESPONSE;
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h
index 42d7925a3..32861a420 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,12 +38,12 @@
/* Includes: */
#include <avr/io.h>
-
+
#include "EthernetProtocols.h"
#include "Ethernet.h"
#include "ProtocolDecoders.h"
#include "DHCP.h"
-
+
/* Macros: */
/** Source UDP port for a DHCP request. */
#define UDP_PORT_DHCP_REQUEST 67
@@ -63,10 +63,11 @@
uint16_t Length; /**< Total packet length, in bytes */
uint16_t Checksum; /**< Optional UDP packet checksum */
} UDP_Header_t;
-
+
/* Function Prototypes: */
int16_t UDP_ProcessUDPPacket(void* IPHeaderInStart,
void* UDPHeaderInStart,
void* UDPHeaderOutStart);
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c
index bc42ef395..bca8673ca 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,7 +43,7 @@ char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n"
"Server: LUFA RNDIS\r\n"
"Content-type: text/html\r\n"
"Connection: close\r\n\r\n";
-
+
/** HTTP server response header, for transmission before a resource not found error. This indicates to the host that the given
* given URL is invalid, and gives extra error information.
*/
@@ -54,7 +54,7 @@ char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n"
/** HTTP page to serve to the host when a HTTP request is made. This page is too long for a single response, thus it is automatically
* broken up into smaller blocks and sent as a series of packets each time the webserver application callback is run.
*/
-char PROGMEM HTTPPage[] =
+char PROGMEM HTTPPage[] =
"<html>"
" <head>"
" <title>"
@@ -108,7 +108,7 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
char* BufferDataStr = (char*)Buffer->Data;
static uint8_t PageBlock = 0;
-
+
/* Check to see if a packet has been received on the HTTP port from a remote host */
if (TCP_APP_HAS_RECEIVED_PACKET(Buffer))
{
@@ -120,7 +120,7 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
/* Copy the HTTP 200 response header into the packet buffer */
strcpy_P(BufferDataStr, HTTP200Header);
-
+
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
@@ -131,10 +131,10 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
/* Copy the HTTP 404 response header into the packet buffer */
strcpy_P(BufferDataStr, HTTP404Header);
-
+
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
-
+
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
@@ -155,9 +155,9 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
strcpy_P(BufferDataStr, HTTP404Header);
/* Send the buffer contents to the host */
- TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
+ TCP_APP_SEND_BUFFER(Buffer, strlen(BufferDataStr));
}
-
+
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
@@ -165,7 +165,7 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
/* Echo the host's query back to the host */
TCP_APP_SEND_BUFFER(Buffer, Buffer->Length);
-
+
/* All data sent, close the connection */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
@@ -179,13 +179,13 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
uint16_t RemLength = strlen_P(&HTTPPage[PageBlock * HTTP_REPLY_BLOCK_SIZE]);
uint16_t Length;
-
+
/* Determine the length of the loaded block */
Length = ((RemLength > HTTP_REPLY_BLOCK_SIZE) ? HTTP_REPLY_BLOCK_SIZE : RemLength);
/* Copy the next buffer sized block of the page to the packet buffer */
strncpy_P(BufferDataStr, &HTTPPage[PageBlock * HTTP_REPLY_BLOCK_SIZE], Length);
-
+
/* Send the buffer contents to the host */
TCP_APP_SEND_BUFFER(Buffer, Length);
@@ -194,9 +194,10 @@ void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
{
/* Unlock the buffer so that the host can fill it with future packets */
TCP_APP_RELEASE_BUFFER(Buffer);
-
+
/* Close the connection to the host */
TCP_APP_CLOSECONNECTION(ConnectionState);
}
}
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h
index 87fe1c91d..7abd6adc9 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,25 +32,26 @@
*
* Header file for Webserver.c.
*/
-
+
#ifndef _WEBSERVER_H_
#define _WEBSERVER_H_
/* Includes: */
#include <avr/io.h>
#include <avr/pgmspace.h>
-
+
#include <LUFA/Version.h>
-
+
#include "TCP.h"
-
+
/* Macros: */
/** Maximum size of a HTTP response per transmission */
#define HTTP_REPLY_BLOCK_SIZE 128
-
+
/* Function Prototypes: */
void Webserver_Init(void);
void Webserver_ApplicationCallback(TCP_ConnectionState_t* const ConnectionState,
TCP_ConnectionBuffer_t* const Buffer);
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
index 8a8d2142a..e8eda4ccd 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,7 +49,7 @@ int main(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
Ethernet_Task();
@@ -125,7 +125,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
-
+
/* Read in the RNDIS message into the message buffer */
Endpoint_Read_Control_Stream_LE(RNDISMessageBuffer, USB_ControlRequest.wLength);
Endpoint_ClearIN();
@@ -133,7 +133,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Process the RNDIS message */
ProcessRNDISControlMessage();
}
-
+
break;
case REQ_GetEncapsulatedResponse:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -147,7 +147,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
}
Endpoint_ClearSETUP();
-
+
/* Write the message response data to the endpoint */
Endpoint_Write_Control_Stream_LE(RNDISMessageBuffer, MessageHeader->MessageLength);
Endpoint_ClearOUT();
@@ -155,7 +155,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
/* Reset the message header once again after transmission */
MessageHeader->MessageLength = 0;
}
-
+
break;
}
}
@@ -180,7 +180,7 @@ void RNDIS_Task(void)
.wIndex = 0,
.wLength = 0,
};
-
+
/* Indicate that a message response is ready for the host */
Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));
@@ -190,7 +190,7 @@ void RNDIS_Task(void)
/* Indicate a response is no longer ready */
ResponseReady = false;
}
-
+
/* Don't process the data endpoints until the system is in the data initialized state, and the buffer is free */
if ((CurrRNDISState == RNDIS_Data_Initialized) && !(MessageHeader->MessageLength))
{
@@ -199,7 +199,7 @@ void RNDIS_Task(void)
/* Select the data OUT endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
-
+
/* Check if the data OUT endpoint contains data, and that the IN buffer is empty */
if (Endpoint_IsOUTReceived() && !(FrameIN.FrameInBuffer))
{
@@ -212,23 +212,23 @@ void RNDIS_Task(void)
Endpoint_StallTransaction();
return;
}
-
+
/* Read in the Ethernet frame into the buffer */
Endpoint_Read_Stream_LE(FrameIN.FrameData, RNDISPacketHeader.DataLength);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearOUT();
-
+
/* Store the size of the Ethernet frame */
FrameIN.FrameLength = RNDISPacketHeader.DataLength;
/* Indicate Ethernet IN buffer full */
FrameIN.FrameInBuffer = true;
}
-
+
/* Select the data IN endpoint */
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
-
+
/* Check if the data IN endpoint is ready for more data, and that the IN buffer is full */
if (Endpoint_IsINReady() && FrameOUT.FrameInBuffer)
{
@@ -246,10 +246,10 @@ void RNDIS_Task(void)
/* Send the Ethernet frame data to the host */
Endpoint_Write_Stream_LE(FrameOUT.FrameData, RNDISPacketHeader.DataLength);
-
+
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
-
+
/* Indicate Ethernet OUT buffer no longer full */
FrameOUT.FrameInBuffer = false;
}
@@ -282,3 +282,4 @@ void Ethernet_Task(void)
LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
}
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h
index 0caf953d2..fb1a8d314 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for RNDISEthernet.c.
*/
-
+
#ifndef _RNDISETHERNET_H_
#define _RNDISETHERNET_H_
@@ -55,7 +55,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
-
+
/* Macros: */
/** Notification value to indicate that a frame is ready to be read by the host. */
#define NOTIF_RESPONSE_AVAILABLE 0x01
@@ -74,7 +74,7 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* Type Defines: */
/** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification
* Endpoint.
@@ -87,7 +87,7 @@
uint16_t wIndex; /**< Two byte notification index parameter */
uint16_t wLength; /**< Size of data payload following the notification header */
} USB_Notification_t;
-
+
/* Function Prototypes: */
void SetupHardware(void);
void RNDIS_Task(void);
@@ -97,5 +97,6 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
-
+
#endif
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt
index f9cd651d0..906ea0101 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt
+++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage RNDIS Class Ethernet Demo (with Webserver/Telnet)
*
* \section SSec_Compat Demo Compatibility:
@@ -26,7 +26,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard)</td>
* </tr>
@@ -40,7 +40,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Remote Network Driver Interface demonstration application.
* This gives a simple reference application for implementing
@@ -49,7 +49,7 @@
* standard; this demo will only work on Windows 2000 (manually
* patched with the Microsoft RNDIS hotfix) and above (with no
* manual patches), or on the latest Linux kernels.
- *
+ *
* Before running, you will need to install the INF file that
* is located in the RNDISEthernet project directory. This will
* enable Windows to use its inbuilt RNDIS drivers, negating the
@@ -58,7 +58,7 @@
* Windows 2000 is used, the Microsoft INF file in the hotfix
* will need to be altered to use the VID/PID of the demo and
* then chosen instead of the LUFA RNDIS INF file when prompted.
- *
+ *
* When enumerated, this demo will install as a new network
* adapter which ethernet packets can be sent to and received
* from. Running on top of the adapter is a very simple TCP/IP
@@ -66,10 +66,10 @@
* accessed through a web browser at IP address 10.0.0.2:80 or
* through a TELNET client at 10.0.0.2:25. This device also supports
* ping echos via the ICMP protocol.
- *
+ *
* \note The TCP/IP stack in this demo has a number of limitations
* and should serve as an example only - it is not fully featured nor
- * compliant to the TCP/IP specification. For complete projects, it is
+ * compliant to the TCP/IP specification. For complete projects, it is
* recommended that it be replaced with an external open source TCP/IP
* stack that is feature complete, such as the uIP stack.
*
@@ -120,3 +120,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/RNDISEthernet/makefile b/Demos/Device/LowLevel/RNDISEthernet/makefile
index 4f8deac96..9695916c5 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/makefile
+++ b/Demos/Device/LowLevel/RNDISEthernet/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -155,7 +155,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -168,7 +168,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -282,7 +282,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -295,7 +295,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -307,7 +307,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -319,7 +319,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -342,7 +342,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -376,7 +376,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -410,7 +410,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -439,7 +439,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -458,10 +458,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -526,11 +526,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -557,9 +557,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -657,14 +657,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -686,7 +686,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -729,4 +729,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
.PHONY : all begin finish end sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
-debug gdb-config \ No newline at end of file
+debug gdb-config
diff --git a/Demos/Device/LowLevel/VirtualSerial/Descriptors.c b/Demos/Device/LowLevel/VirtualSerial/Descriptors.c
index 5ca446667..9b3aea4b8 100644
--- a/Demos/Device/LowLevel/VirtualSerial/Descriptors.c
+++ b/Demos/Device/LowLevel/VirtualSerial/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -57,22 +57,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x02,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2044,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,102 +83,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = 0x00,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = 0x02,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = 0x06,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_DataOutEndpoint =
+ .CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC_DataInEndpoint =
+
+ .CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -193,7 +193,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -204,7 +204,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -215,7 +215,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA CDC Demo"
};
@@ -241,30 +241,31 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
- *DescriptorAddress = Address;
+
+ *DescriptorAddress = Address;
return Size;
}
+
diff --git a/Demos/Device/LowLevel/VirtualSerial/Descriptors.h b/Demos/Device/LowLevel/VirtualSerial/Descriptors.h
index 44cf084b6..7a8da898e 100644
--- a/Demos/Device/LowLevel/VirtualSerial/Descriptors.h
+++ b/Demos/Device/LowLevel/VirtualSerial/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -40,22 +40,22 @@
#include <LUFA/Drivers/USB/USB.h>
#include <avr/pgmspace.h>
-
+
/* Macros: */
/** Endpoint number of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
+ #define CDC_TX_EPNUM 3
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
+ #define CDC_RX_EPNUM 4
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
- #define CDC_TXRX_EPSIZE 16
+ #define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
@@ -80,7 +80,7 @@
uint8_t Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
} USB_Descriptor_CDC_FunctionalACM_t;
-
+
/** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
* CDC control and data interfaces are related. See the CDC class specification for more details.
*/
@@ -116,3 +116,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c
index 9189ef3e7..22d65ffe7 100644
--- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c
+++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -55,7 +55,7 @@ CDC_Line_Coding_t LineEncoding = { .BaudRateBPS = 0,
int main(void)
{
SetupHardware();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -119,7 +119,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
LineEncoding.BaudRateBPS = 0;
/* Indicate endpoint configuration success or failure */
- LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific
@@ -133,14 +133,14 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
case REQ_GetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
- {
+ {
Endpoint_ClearSETUP();
/* Write the line coding data to the control endpoint */
Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));
Endpoint_ClearOUT();
}
-
+
break;
case REQ_SetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -151,7 +151,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_Line_Coding_t));
Endpoint_ClearIN();
}
-
+
break;
case REQ_SetControlLineState:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -164,7 +164,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
CONTROL_LINE_OUT_* masks to determine the RTS and DTR line states using the following code:
*/
}
-
+
break;
}
}
@@ -175,11 +175,11 @@ void CDC_Task(void)
char* ReportString = NULL;
uint8_t JoyStatus_LCL = Joystick_GetStatus();
static bool ActionSent = false;
-
+
/* Device must be connected and configured for the task to run */
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
-
+
#if 0
/* NOTE: Here you can use the notification endpoint to send back line state changes to the host, for the special RS-232
* handshake signal lines (and some error states), via the CONTROL_LINE_IN_* masks and the following code:
@@ -192,11 +192,11 @@ void CDC_Task(void)
.wIndex = 0,
.wLength = sizeof(uint16_t),
};
-
+
uint16_t LineStateMask;
-
+
// Set LineStateMask here to a mask of CONTROL_LINE_IN_* masks to set the input handshake line states to send to the host
-
+
Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);
Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));
Endpoint_Write_Stream_LE(&LineStateMask, sizeof(LineStateMask));
@@ -227,20 +227,20 @@ void CDC_Task(void)
/* Write the String to the Endpoint */
Endpoint_Write_Stream_LE(ReportString, strlen(ReportString));
-
+
/* Remember if the packet to send completely fills the endpoint */
bool IsFull = (Endpoint_BytesInEndpoint() == CDC_TXRX_EPSIZE);
/* Finalize the stream transfer to send the last packet */
Endpoint_ClearIN();
- /* If the last packet filled the endpoint, send an empty packet to release the buffer on
+ /* If the last packet filled the endpoint, send an empty packet to release the buffer on
* the receiver (otherwise all data will be cached until a non-full packet is received) */
if (IsFull)
{
/* Wait until the endpoint is ready for another packet */
Endpoint_WaitUntilReady();
-
+
/* Send an empty packet to ensure that the host does not buffer data sent to it */
Endpoint_ClearIN();
}
@@ -248,8 +248,9 @@ void CDC_Task(void)
/* Select the Serial Rx Endpoint */
Endpoint_SelectEndpoint(CDC_RX_EPNUM);
-
+
/* Throw away any received data from the host */
if (Endpoint_IsOUTReceived())
Endpoint_ClearOUT();
}
+
diff --git a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h
index 650874c96..b95939b53 100644
--- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h
+++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -59,9 +59,9 @@
/** CDC Class specific request to set the current virtual serial port handshake line states. */
#define REQ_SetControlLineState 0x22
-
+
/** Notification type constant for a change in the virtual serial port handshake line states, for
- * use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
+ * use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
* notification endpoint.
*/
#define NOTIF_SerialState 0x20
@@ -75,7 +75,7 @@
* from the host, to indicate that theRTS line state should be high.
*/
#define CONTROL_LINE_OUT_RTS (1 << 1)
-
+
/** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DCD line state is currently high.
*/
@@ -110,7 +110,7 @@
* to indicate that a data overrun error has occurred on the virtual serial port.
*/
#define CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -138,7 +138,7 @@
*/
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} CDC_Line_Coding_t;
-
+
/** Type define for a CDC notification, sent to the host via the CDC notification endpoint to indicate a
* change in the device state asynchronously.
*/
@@ -152,7 +152,7 @@
uint16_t wIndex; /**< Notification wIndex, notification-specific */
uint16_t wLength; /**< Notification wLength, notification-specific */
} USB_Notification_Header_t;
-
+
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
@@ -161,7 +161,7 @@
OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
TwoStopBits = 2, /**< Each frame contains two stop bits */
};
-
+
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t
{
@@ -171,14 +171,15 @@
Parity_Mark = 3, /**< Mark parity bit mode on each frame */
Parity_Space = 4, /**< Space parity bit mode on each frame */
};
-
+
/* Function Prototypes: */
void SetupHardware(void);
void CDC_Task(void);
-
+
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt
index 571168948..4190c2f7d 100644
--- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt
+++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Communications Device Class (Virtual Serial Port) Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -42,14 +42,14 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Communications Device Class demonstration application.
* This gives a simple reference application for implementing
* a CDC device acting as a virtual serial port. Joystick
* actions are transmitted to the host as strings. The device
* does not respond to serial data sent from the host.
- *
+ *
* After running this demo for the first time on a new computer,
* you will need to supply the .INF file located in this demo
* project's directory as the device's driver when running under
@@ -70,3 +70,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Device/LowLevel/VirtualSerial/makefile b/Demos/Device/LowLevel/VirtualSerial/makefile
index 18a1e61fd..b556a3b78 100644
--- a/Demos/Device/LowLevel/VirtualSerial/makefile
+++ b/Demos/Device/LowLevel/VirtualSerial/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Device/LowLevel/makefile b/Demos/Device/LowLevel/makefile
index ed0dc3f36..11594e9f3 100644
--- a/Demos/Device/LowLevel/makefile
+++ b/Demos/Device/LowLevel/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -63,3 +63,4 @@ all:
$(MAKE) -C Mouse $@
$(MAKE) -C RNDISEthernet $@
$(MAKE) -C VirtualSerial $@
+
diff --git a/Demos/Device/makefile b/Demos/Device/makefile
index ce80f4e96..f389781e5 100644
--- a/Demos/Device/makefile
+++ b/Demos/Device/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -18,3 +18,4 @@ all:
%:
$(MAKE) -C ClassDriver $@
$(MAKE) -C LowLevel $@
+
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c
index 6a699b03d..eec1c9310 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -81,22 +81,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM MouseReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2041,
.ReleaseNumber = 0x0000,
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -107,38 +107,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = HID_BOOTP_MouseBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_MouseHID =
+ .HID_MouseHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
@@ -149,7 +149,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(MouseReport)
},
- .HID_ReportINEndpoint =
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -167,7 +167,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -178,7 +178,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -189,7 +189,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(15), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Mouse Demo"
};
@@ -235,19 +235,19 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case HID_DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_MouseHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case HID_DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &MouseReport;
Size = sizeof(MouseReport);
break;
}
-
- *DescriptorAddress = Address;
+
+ *DescriptorAddress = Address;
return Size;
}
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h
index f482a6946..243c88d35 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -54,11 +54,11 @@
USB_HID_Descriptor_HID_t HID_MouseHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPNUM 1
-
+
/** Size in bytes of the Mouse HID reporting IN endpoint. */
#define MOUSE_EPSIZE 8
@@ -69,3 +69,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c
index be01a2d6b..d9d323e0c 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -57,7 +57,7 @@ USB_ClassInfo_HID_Device_t Mouse_HID_Device_Interface =
.PrevReportINBufferSize = sizeof(PrevMouseHIDReportBuffer),
},
};
-
+
/** Event handler for the library USB WakeUp event. */
void EVENT_USB_Device_Connect(void)
@@ -111,7 +111,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
uint16_t* const ReportSize)
{
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
-
+
uint8_t JoyStatus_LCL = Joystick_GetStatus();
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
@@ -127,10 +127,10 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
if (JoyStatus_LCL & JOY_PRESS)
MouseReport->Button |= (1 << 0);
-
+
if (ButtonStatus_LCL & BUTTONS_BUTTON1)
MouseReport->Button |= (1 << 1);
-
+
*ReportSize = sizeof(USB_MouseReport_Data_t);
return true;
}
@@ -151,3 +151,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
}
+
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h
index 90db85f17..3b3a3797c 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,10 +38,10 @@
/* Includes: */
#include "MouseHostDevice.h"
-
+
/* External Variables: */
extern USB_ClassInfo_HID_Device_t Mouse_HID_Device_Interface;
-
+
/* Function Prototypes: */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
uint8_t* const ReportID,
@@ -49,7 +49,7 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
@@ -59,5 +59,6 @@
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
void EVENT_USB_Device_StartOfFrame(void);
-
+
#endif
+
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c b/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c
index 4e794dcf2..786713ac5 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Host Mode USB Mouse functionality for the MouseHostDevice demo. This file contains the Host mode
* USB Mouse related code of the demo and is responsible for all the Host mode Mouse functionality.
*/
-
+
#include "HostFunctions.h"
/** LUFA HID Class driver interface configuration and state information. This structure is
@@ -46,7 +46,7 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Host_Interface =
{
.DataINPipeNumber = 1,
.DataOUTPipeNumber = 2,
-
+
.HIDInterfaceProtocol = HID_BOOTP_MouseBootProtocol,
},
};
@@ -100,7 +100,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -113,7 +113,7 @@ void MouseHostTask(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -134,7 +134,7 @@ void MouseHostTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
printf("Error Setting Device Configuration.\r\n");
@@ -150,18 +150,18 @@ void MouseHostTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf("Mouse Enumerated.\r\n");
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
if (HID_Host_IsReportReceived(&Mouse_HID_Host_Interface))
- {
+ {
uint8_t LEDMask = LEDS_NO_LEDS;
-
+
USB_MouseReport_Data_t MouseReport;
HID_Host_ReceiveReport(&Mouse_HID_Host_Interface, &MouseReport);
-
+
printf_P(PSTR("dX:%2d dY:%2d Button:%d\r\n"), MouseReport.X,
MouseReport.Y,
MouseReport.Button);
@@ -169,7 +169,7 @@ void MouseHostTask(void)
LEDMask |= LEDS_LED1;
else if (MouseReport.X < 0)
LEDMask |= LEDS_LED2;
-
+
if (MouseReport.Y > 0)
LEDMask |= LEDS_LED3;
else if (MouseReport.Y < 0)
@@ -184,3 +184,4 @@ void MouseHostTask(void)
break;
}
}
+
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.h b/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.h
index fe5214e0a..7aaf0042d 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.h
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/HostFunctions.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,13 +38,13 @@
/* Includes: */
#include "MouseHostDevice.h"
-
+
/* External Variables: */
extern USB_ClassInfo_HID_Host_t Mouse_HID_Host_Interface;
/* Function Prototypes: */
void MouseHostTask(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -53,3 +53,4 @@
void EVENT_USB_Host_DeviceEnumerationComplete(void);
#endif
+
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.c b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.c
index 38acd8562..568791bc5 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.c
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,9 +33,9 @@
* Main source file for the MouseHostDevice demo. This file contains the main tasks of
* the demo and is responsible for the overall control flow of the demo.
*/
-
+
#include "MouseHostDevice.h"
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -88,6 +88,7 @@ void EVENT_USB_UIDChange(void)
{
printf_P(PSTR(ESC_FG_YELLOW "UID Change to %S mode\r\n" ESC_FG_WHITE),
(USB_CurrentMode == USB_MODE_Device) ? PSTR("Device") : PSTR("Host"));
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
+
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.h b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.h
index 1da4936ae..4b4e1ac1f 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.h
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -52,11 +52,11 @@
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
#include "Descriptors.h"
#include "DeviceFunctions.h"
#include "HostFunctions.h"
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -69,8 +69,9 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
-
+
#endif
+
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.txt b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.txt
index de56b55f0..a81a3a075 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.txt
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/MouseHostDevice.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mouse Host/Device Dual Role Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -39,24 +39,24 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mouse host/device dual role demonstration application. This gives a simple
* reference application for implementing a dual role USB Mouse, for USB mice
* using the standard mouse boot protocol HID profile.
- *
+ *
* <b>When in host mode:</b>
* Mouse movement and button presses are displayed on the board LEDs,
* as well as printed out the serial terminal as formatted dY, dY and
* button status information.
- *
+ *
* This uses a naive method where the mouse is set to Boot Protocol mode, so
* that the report structure is fixed and known. A better implementation
* uses the HID report parser for correct report data processing across
* all compatible mice with advanced characteristics, as shown in the
* MouseHostWithParser Host demo application.
- *
- * Currently only single interface mice are supported.
+ *
+ * Currently only single interface mice are supported.
*
* <b>When in device mode:</b>
* Upon enumeration the system will automatically enumerate and function
@@ -77,3 +77,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/makefile b/Demos/DualRole/ClassDriver/MouseHostDevice/makefile
index 703bae5af..0ed12ad21 100644
--- a/Demos/DualRole/ClassDriver/MouseHostDevice/makefile
+++ b/Demos/DualRole/ClassDriver/MouseHostDevice/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -138,7 +138,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -151,7 +151,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -265,7 +265,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -278,7 +278,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -290,7 +290,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -302,7 +302,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -325,7 +325,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -359,7 +359,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -393,7 +393,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -422,7 +422,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -441,10 +441,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -509,11 +509,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -540,9 +540,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -640,14 +640,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -669,7 +669,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -713,3 +713,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/DualRole/ClassDriver/makefile b/Demos/DualRole/ClassDriver/makefile
index 98d7a6807..f50c37f18 100644
--- a/Demos/DualRole/ClassDriver/makefile
+++ b/Demos/DualRole/ClassDriver/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -19,3 +19,4 @@ all:
%:
$(MAKE) -C MouseHostDevice $@
+
diff --git a/Demos/DualRole/makefile b/Demos/DualRole/makefile
index 2e863bbad..7a0008f05 100644
--- a/Demos/DualRole/makefile
+++ b/Demos/DualRole/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -17,3 +17,4 @@ all:
%:
$(MAKE) -C ClassDriver/ $@
+
diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c
index fb48c2b17..8d87e88c2 100644
--- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c
+++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the JoystickHostWithParser demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "JoystickHostWithParser.h"
/** Processed HID report descriptor items structure, containing information on each HID report element */
@@ -52,14 +52,14 @@ USB_ClassInfo_HID_Host_t Joystick_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
-
+
.HIDInterfaceProtocol = HID_BOOTP_NonBootProtocol,
-
+
.HIDParserData = &HIDReportInfo
},
};
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -78,7 +78,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -99,7 +99,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -115,7 +115,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Joystick Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
@@ -131,7 +131,7 @@ int main(void)
for (uint8_t ReportNumber = 0; ReportNumber < HIDReportInfo.TotalReportItems; ReportNumber++)
{
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];
-
+
/* Update the report item value if it is contained within the current report */
if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem)))
continue;
@@ -149,7 +149,7 @@ int main(void)
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);
-
+
if (DeltaMovement)
{
if (ReportItem->Attributes.Usage.Usage == USAGE_X)
@@ -159,13 +159,13 @@ int main(void)
}
}
}
-
+
LEDs_SetAllLEDs(LEDMask);
}
-
+
break;
}
-
+
HID_Host_USBTask(&Joystick_HID_Interface);
USB_USBTask();
}
@@ -235,7 +235,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -277,3 +277,4 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
return ((CurrentItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) ||
(CurrentItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL));
}
+
diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.h b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.h
index 1cebb924c..51f641dd4 100644
--- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.h
+++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -78,17 +78,18 @@
/** HID Report Descriptor Usage value for a Y axis movement. */
#define USAGE_Y 0x31
-
+
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.txt b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.txt
index 055890b70..0fa97f868 100644
--- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.txt
+++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Joystick Host With HID Descriptor Parser Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,19 +41,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Joystick host demonstration application. This gives a simple reference
* application for implementing a USB Joystick host, for USB joysticks using
* the standard joystick HID profile. It uses a HID parser for the HID
* reports, allowing for correct operation across all USB joysticks. This
* demo supports joysticks with a single HID report.
- *
+ *
* Joystick movement and button presses are displayed on the board LEDs.
* On connection to a USB joystick, the report items will be processed and
* printed as a formatted list through the USART before the joystick is
* fully enumerated.
- *
+ *
* Currently only single interface joysticks are supported.
*
* \section SSec_Options Project Options
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/makefile b/Demos/Host/ClassDriver/JoystickHostWithParser/makefile
index a82f4e29c..a585f3f9f 100644
--- a/Demos/Host/ClassDriver/JoystickHostWithParser/makefile
+++ b/Demos/Host/ClassDriver/JoystickHostWithParser/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c
index ddce64c24..9b7941e5f 100644
--- a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c
+++ b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the KeyboardHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "KeyboardHost.h"
/** LUFA HID Class driver interface configuration and state information. This structure is
@@ -49,12 +49,12 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
-
+
.HIDInterfaceProtocol = HID_BOOTP_KeyboardBootProtocol,
},
};
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -66,14 +66,14 @@ int main(void)
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
-
+
for (;;)
{
switch (USB_HostState)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -94,7 +94,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -110,7 +110,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Keyboard Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
@@ -118,11 +118,11 @@ int main(void)
case HOST_STATE_Configured:
if (HID_Host_IsReportReceived(&Keyboard_HID_Interface))
{
- USB_KeyboardReport_Data_t KeyboardReport;
+ USB_KeyboardReport_Data_t KeyboardReport;
HID_Host_ReceiveReport(&Keyboard_HID_Interface, &KeyboardReport);
LEDs_ChangeLEDs(LEDS_LED1, (KeyboardReport.Modifier) ? LEDS_LED1 : 0);
-
+
uint8_t PressedKeyCode = KeyboardReport.KeyCode[0];
if (PressedKeyCode)
@@ -130,25 +130,25 @@ int main(void)
char PressedKey = 0;
LEDs_ToggleLEDs(LEDS_LED2);
-
+
/* Retrieve pressed key character if alphanumeric */
if ((PressedKeyCode >= 0x04) && (PressedKeyCode <= 0x1D))
PressedKey = (PressedKeyCode - 0x04) + 'A';
else if ((PressedKeyCode >= 0x1E) && (PressedKeyCode <= 0x27))
PressedKey = (PressedKeyCode - 0x1E) + '0';
else if (PressedKeyCode == 0x2C)
- PressedKey = ' ';
+ PressedKey = ' ';
else if (PressedKeyCode == 0x28)
PressedKey = '\n';
-
+
if (PressedKey)
putchar(PressedKey);
}
}
-
+
break;
}
-
+
HID_Host_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
@@ -218,6 +218,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h
index fd6b83882..a569162e5 100644
--- a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h
+++ b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -63,15 +63,16 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.txt b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.txt
index 5f2969d28..752807e5a 100644
--- a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.txt
+++ b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Keyboard Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -39,21 +39,21 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Keyboard host demonstration application. This gives a simple reference
* application for implementing a USB keyboard, for USB keyboards using
* the standard keyboard HID profile.
- *
+ *
* Pressed alpha-numeric, enter or space key is transmitted through the serial
* USART at serial settings 9600, 8, N, 1.
- *
+ *
* This uses a naive method where the keyboard is set to Boot Protocol mode, so
* that the report structure is fixed and known. A better implementation
* uses the HID report parser for correct report data processing across
* all compatible mice with advanced characteristics, as shown in the
* KeyboardHostWithParser demo application.
- *
+ *
* Currently only single interface keyboards are supported.
*
* \section SSec_Options Project Options
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/KeyboardHost/makefile b/Demos/Host/ClassDriver/KeyboardHost/makefile
index fa7f60717..8dc1791bc 100644
--- a/Demos/Host/ClassDriver/KeyboardHost/makefile
+++ b/Demos/Host/ClassDriver/KeyboardHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
index 3fd23f051..5f10d8bf7 100644
--- a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
+++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the KeyboardHostWithParser demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "KeyboardHostWithParser.h"
/** Processed HID report descriptor items structure, containing information on each HID report element */
@@ -52,14 +52,14 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
-
+
.HIDInterfaceProtocol = HID_BOOTP_NonBootProtocol,
-
+
.HIDParserData = &HIDReportInfo
},
};
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -78,7 +78,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -99,7 +99,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -115,7 +115,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Keyboard Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
@@ -125,7 +125,7 @@ int main(void)
{
uint8_t KeyboardReport[Keyboard_HID_Interface.State.LargestReportSize];
HID_Host_ReceiveReport(&Keyboard_HID_Interface, &KeyboardReport);
-
+
for (uint8_t ReportNumber = 0; ReportNumber < HIDReportInfo.TotalReportItems; ReportNumber++)
{
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];
@@ -157,24 +157,24 @@ int main(void)
else if ((KeyCode >= 0x1E) && (KeyCode <= 0x27))
PressedKey = (KeyCode - 0x1E) + '0';
else if (KeyCode == 0x2C)
- PressedKey = ' ';
+ PressedKey = ' ';
else if (KeyCode == 0x28)
PressedKey = '\n';
-
+
/* Print the pressed key character out through the serial port if valid */
if (PressedKey)
putchar(PressedKey);
}
-
+
/* Once a scan-code is found, stop scanning through the report items */
break;
}
}
}
-
+
break;
}
-
+
HID_Host_USBTask(&Keyboard_HID_Interface);
USB_USBTask();
}
@@ -244,7 +244,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -265,3 +265,4 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
*/
return (CurrentItem->Attributes.Usage.Page == USAGE_PAGE_KEYBOARD);
}
+
diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h
index 5ecfdf458..b31d5cb66 100644
--- a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h
+++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -63,20 +63,21 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** HID Report Descriptor Usage Page value for a desktop keyboard. */
#define USAGE_PAGE_KEYBOARD 0x07
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.txt b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.txt
index 5e122a38f..50f6c861d 100644
--- a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.txt
+++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Keyboard Host With HID Descriptor Parser Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,20 +41,20 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Keyboard host demonstration application. This gives a simple reference
* application for implementing a USB Keyboard host, for USB keyboards using
* the standard Keyboard HID profile. It uses a HID parser for the HID reports,
* allowing for correct operation across all USB keyboards. This demo supports
* keyboards with a single HID report.
- *
+ *
* Pressed alpha-numeric, enter or space key is transmitted through the serial
* USART at serial settings 9600, 8, N, 1. On connection to a USB keyboard, the
* report items will be processed and printed as a formatted list through the
* USART before the keyboard is fully enumerated.
- *
- * Currently only single interface keyboards are supported.
+ *
+ * Currently only single interface keyboards are supported.
*
* \section SSec_Options Project Options
*
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile b/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile
index a3c1aab0c..90ec16242 100644
--- a/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile
+++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c
index faaebdd7c..a4d00cef7 100644
--- a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c
+++ b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the MIDIHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MIDIHost.h"
/** LUFA MIDI Class driver interface configuration and state information. This structure is
@@ -46,13 +46,13 @@ USB_ClassInfo_MIDI_Host_t Keyboard_MIDI_Interface =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
-
+
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
},
};
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -71,7 +71,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -92,7 +92,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -100,20 +100,20 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("MIDI Device Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
CheckJoystickMovement();
-
+
MIDI_EventPacket_t MIDIEvent;
if (MIDI_Host_ReceiveEventPacket(&Keyboard_MIDI_Interface, &MIDIEvent))
{
bool NoteOnEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_ON >> 4));
bool NoteOffEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_OFF >> 4));
-
+
if (NoteOnEvent || NoteOffEvent)
{
printf_P(PSTR("MIDI Note %s - Channel %d, Pitch %d, Velocity %d\r\n"), NoteOnEvent ? "On" : "Off",
@@ -121,10 +121,10 @@ int main(void)
MIDIEvent.Data2, MIDIEvent.Data3);
}
}
-
+
break;
}
-
+
MIDI_Host_USBTask(&Keyboard_MIDI_Interface);
USB_USBTask();
}
@@ -154,11 +154,11 @@ void CheckJoystickMovement(void)
uint8_t MIDICommand = 0;
uint8_t MIDIPitch;
-
+
/* Get current joystick mask, XOR with previous to detect joystick changes */
uint8_t JoystickStatus = Joystick_GetStatus();
uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus);
-
+
/* Get board button status - if pressed use channel 10 (percussion), otherwise use channel 1 */
uint8_t Channel = ((Buttons_GetStatus() & BUTTONS_BUTTON1) ? MIDI_CHANNEL(10) : MIDI_CHANNEL(1));
@@ -179,7 +179,7 @@ void CheckJoystickMovement(void)
MIDICommand = ((JoystickStatus & JOY_RIGHT)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
MIDIPitch = 0x3E;
}
-
+
if (JoystickChanges & JOY_DOWN)
{
MIDICommand = ((JoystickStatus & JOY_DOWN)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
@@ -191,19 +191,19 @@ void CheckJoystickMovement(void)
MIDICommand = ((JoystickStatus & JOY_PRESS)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
MIDIPitch = 0x3B;
}
-
+
if (MIDICommand)
{
MIDI_EventPacket_t MIDIEvent = (MIDI_EventPacket_t)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
-
+
.Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch,
- .Data3 = MIDI_STANDARD_VELOCITY,
+ .Data3 = MIDI_STANDARD_VELOCITY,
};
-
+
MIDI_Host_SendEventPacket(&Keyboard_MIDI_Interface, &MIDIEvent);
MIDI_Host_Flush(&Keyboard_MIDI_Interface);
}
@@ -259,6 +259,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.h b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.h
index 84e7680f3..977eabbd3 100644
--- a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.h
+++ b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -52,7 +52,7 @@
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MIDI.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -65,16 +65,17 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void CheckJoystickMovement(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.txt b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.txt
index a90ae04d3..337dba72e 100644
--- a/Demos/Host/ClassDriver/MIDIHost/MIDIHost.txt
+++ b/Demos/Host/ClassDriver/MIDIHost/MIDIHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage MIDI Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Audio Class Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>MIDI Subclass</td>
* </tr>
@@ -39,7 +39,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* MIDI host demonstration application. This demo will enumerate an attached USB-MIDI device, and print incoming MIDI note
* on and off messages on any channel to the serial port. Pressing the board joystick will send note on and off messages to
@@ -57,3 +57,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/MIDIHost/makefile b/Demos/Host/ClassDriver/MIDIHost/makefile
index 6de81be84..64a05e1e6 100644
--- a/Demos/Host/ClassDriver/MIDIHost/makefile
+++ b/Demos/Host/ClassDriver/MIDIHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
index 40cf2a48d..7f8ba9544 100644
--- a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
+++ b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the MassStorageHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MassStorageHost.h"
/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
@@ -46,13 +46,13 @@ USB_ClassInfo_MS_Host_t FlashDisk_MS_Interface =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
-
+
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
},
};
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -71,7 +71,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -92,7 +92,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -100,14 +100,14 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Mass Storage Device Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
uint8_t MaxLUNIndex;
if (MS_Host_GetMaxLUN(&FlashDisk_MS_Interface, &MaxLUNIndex))
{
@@ -116,9 +116,9 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Total LUNs: %d - Using first LUN in device.\r\n"), (MaxLUNIndex + 1));
-
+
if (MS_Host_ResetMSInterface(&FlashDisk_MS_Interface))
{
puts_P(PSTR("Error resetting Mass Storage interface.\r\n"));
@@ -126,7 +126,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
SCSI_Request_Sense_Response_t SenseData;
if (MS_Host_RequestSense(&FlashDisk_MS_Interface, 0, &SenseData) != 0)
{
@@ -135,7 +135,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (MS_Host_PreventAllowMediumRemoval(&FlashDisk_MS_Interface, 0, true))
{
puts_P(PSTR("Error setting Prevent Device Removal bit.\r\n"));
@@ -150,17 +150,17 @@ int main(void)
puts_P(PSTR("Error retrieving device Inquiry data.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
printf_P(PSTR("Vendor \"%.8s\", Product \"%.16s\"\r\n"), InquiryData.VendorID, InquiryData.ProductID);
-
+
puts_P(PSTR("Waiting until ready...\r\n"));
for (;;)
{
uint8_t ErrorCode = MS_Host_TestUnitReady(&FlashDisk_MS_Interface, 0);
-
+
if (!(ErrorCode))
break;
@@ -184,7 +184,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("%lu blocks of %lu bytes.\r\n"), DiskCapacity.Blocks, DiskCapacity.BlockSize);
uint8_t BlockBuffer[DiskCapacity.BlockSize];
@@ -196,20 +196,20 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("\r\nContents of first block:\r\n"));
for (uint16_t Chunk = 0; Chunk < (DiskCapacity.BlockSize >> 4); Chunk++)
{
uint8_t* ChunkPtr = &BlockBuffer[Chunk << 4];
-
+
/* Print out the 16 bytes of the chunk in HEX format */
for (uint8_t ByteOffset = 0; ByteOffset < (1 << 4); ByteOffset++)
{
char CurrByte = *(ChunkPtr + ByteOffset);
printf_P(PSTR("%.2X "), CurrByte);
}
-
+
printf_P(PSTR(" "));
/* Print out the 16 bytes of the chunk in ASCII format */
@@ -218,7 +218,7 @@ int main(void)
char CurrByte = *(ChunkPtr + ByteOffset);
putchar(isprint(CurrByte) ? CurrByte : '.');
}
-
+
printf_P(PSTR("\r\n"));
}
@@ -226,7 +226,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
MS_Host_USBTask(&FlashDisk_MS_Interface);
USB_USBTask();
}
@@ -296,6 +296,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.h b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.h
index b99471205..af8470cf0 100644
--- a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.h
+++ b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -51,7 +51,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -64,18 +64,19 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.txt b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.txt
index 23f083dea..45d78c43b 100644
--- a/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.txt
+++ b/Demos/Host/ClassDriver/MassStorageHost/MassStorageHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mass Storage Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Mass Storage Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Bulk Only</td>
* </tr>
@@ -42,12 +42,12 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mass Storage host demonstration application. This gives a simple reference
* application for implementing a USB Mass Storage host, for USB storage devices
* using the standard Mass Storage USB profile.
- *
+ *
* The first 512 bytes (boot sector) of an attached disk's memory will be dumped
* out of the serial port in HEX and ASCII form when it is attached to the AT90USB1287
* AVR. The device will then wait for HWB to be pressed, whereupon the entire ASCII contents
@@ -65,3 +65,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/MassStorageHost/makefile b/Demos/Host/ClassDriver/MassStorageHost/makefile
index 3e947f2c0..a3b7ff178 100644
--- a/Demos/Host/ClassDriver/MassStorageHost/makefile
+++ b/Demos/Host/ClassDriver/MassStorageHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -261,7 +261,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -274,7 +274,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -286,7 +286,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -298,7 +298,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -321,7 +321,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -355,7 +355,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -389,7 +389,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -418,7 +418,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -437,10 +437,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -505,11 +505,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -536,9 +536,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -636,14 +636,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -665,7 +665,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -709,3 +709,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.c b/Demos/Host/ClassDriver/MouseHost/MouseHost.c
index d76f048d9..c34a2fcb6 100644
--- a/Demos/Host/ClassDriver/MouseHost/MouseHost.c
+++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the MouseHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MouseHost.h"
/** LUFA HID Class driver interface configuration and state information. This structure is
@@ -46,15 +46,15 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
-
+
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
-
+
.HIDInterfaceProtocol = HID_BOOTP_MouseBootProtocol,
},
};
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -73,7 +73,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -94,7 +94,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -110,7 +110,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Mouse Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
@@ -119,10 +119,10 @@ int main(void)
if (HID_Host_IsReportReceived(&Mouse_HID_Interface))
{
uint8_t LEDMask = LEDS_NO_LEDS;
-
+
USB_MouseReport_Data_t MouseReport;
HID_Host_ReceiveReport(&Mouse_HID_Interface, &MouseReport);
-
+
printf_P(PSTR("dX:%2d dY:%2d Button:%d\r\n"), MouseReport.X,
MouseReport.Y,
MouseReport.Button);
@@ -130,7 +130,7 @@ int main(void)
LEDMask |= LEDS_LED1;
else if (MouseReport.X < 0)
LEDMask |= LEDS_LED2;
-
+
if (MouseReport.Y > 0)
LEDMask |= LEDS_LED3;
else if (MouseReport.Y < 0)
@@ -141,10 +141,10 @@ int main(void)
LEDs_SetAllLEDs(LEDMask);
}
-
+
break;
}
-
+
HID_Host_USBTask(&Mouse_HID_Interface);
USB_USBTask();
}
@@ -214,6 +214,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.h b/Demos/Host/ClassDriver/MouseHost/MouseHost.h
index 7664580cb..c5567ed38 100644
--- a/Demos/Host/ClassDriver/MouseHost/MouseHost.h
+++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -63,15 +63,16 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.txt b/Demos/Host/ClassDriver/MouseHost/MouseHost.txt
index be608db2f..b659abada 100644
--- a/Demos/Host/ClassDriver/MouseHost/MouseHost.txt
+++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mouse Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,23 +41,23 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mouse host demonstration application. This gives a simple reference
* application for implementing a USB Mouse host, for USB mice using
* the standard mouse HID profile.
- *
+ *
* Mouse movement and button presses are displayed on the board LEDs,
* as well as printed out the serial terminal as formatted dY, dY and
* button status information.
- *
+ *
* This uses a naive method where the mouse is set to Boot Protocol mode, so
* that the report structure is fixed and known. A better implementation
* uses the HID report parser for correct report data processing across
* all compatible mice with advanced characteristics, as shown in the
* MouseHostWithParser demo application.
- *
- * Currently only single interface mice are supported.
+ *
+ * Currently only single interface mice are supported.
*
* \section SSec_Options Project Options
*
@@ -71,3 +71,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/MouseHost/makefile b/Demos/Host/ClassDriver/MouseHost/makefile
index 6d8ea3a8d..0812c5cb1 100644
--- a/Demos/Host/ClassDriver/MouseHost/makefile
+++ b/Demos/Host/ClassDriver/MouseHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
index d02424c7b..7948e2c49 100644
--- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
+++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the MouseHostWithParser demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MouseHostWithParser.h"
/** Processed HID report descriptor items structure, containing information on each HID report element */
@@ -52,14 +52,14 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
-
+
.HIDInterfaceProtocol = HID_BOOTP_NonBootProtocol,
-
+
.HIDParserData = &HIDReportInfo
},
};
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -78,7 +78,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -99,7 +99,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -115,7 +115,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Mouse Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
@@ -131,11 +131,11 @@ int main(void)
for (uint8_t ReportNumber = 0; ReportNumber < HIDReportInfo.TotalReportItems; ReportNumber++)
{
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];
-
+
/* Update the report item value if it is contained within the current report */
if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem)))
continue;
-
+
/* Determine what report item is being tested, process updated value as needed */
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&
(ReportItem->ItemType == HID_REPORT_ITEM_In))
@@ -148,7 +148,7 @@ int main(void)
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
int16_t WheelDelta = HID_ALIGN_DATA(ReportItem, int16_t);
-
+
if (WheelDelta)
LEDMask = (LEDS_LED1 | LEDS_LED2 | ((WheelDelta > 0) ? LEDS_LED3 : LEDS_LED4));
}
@@ -158,7 +158,7 @@ int main(void)
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);
-
+
if (DeltaMovement)
{
if (ReportItem->Attributes.Usage.Usage == USAGE_X)
@@ -168,13 +168,13 @@ int main(void)
}
}
}
-
+
LEDs_SetAllLEDs(LEDMask);
}
-
+
break;
}
-
+
HID_Host_USBTask(&Mouse_HID_Interface);
USB_USBTask();
}
@@ -244,7 +244,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -286,3 +286,4 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
return ((CurrentItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) ||
(CurrentItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL));
}
+
diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.h b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.h
index 3b26cead5..e4958b7c5 100644
--- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.h
+++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -78,20 +78,21 @@
/** HID Report Descriptor Usage value for a Y axis movement. */
#define USAGE_Y 0x31
-
+
/** HID Report Descriptor Usage value for a Scroll Wheel movement. */
#define USAGE_SCROLL_WHEEL 0x38
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.txt b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.txt
index febd4a939..fdcdb6153 100644
--- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.txt
+++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mouse Host With HID Descriptor Parser Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,19 +41,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mouse host demonstration application. This gives a simple reference
* application for implementing a USB Mouse host, for USB mice using
* the standard mouse HID profile. It uses a HID parser for the HID
* reports, allowing for correct operation across all USB mice. This
* demo supports mice with a single HID report.
- *
+ *
* Mouse and scroll wheel movement and button presses are displayed
* on the board LEDs. On connection to a USB mouse, the report items
* will be processed and printed as a formatted list through the USART
* before the mouse is fully enumerated.
- *
+ *
* Currently only single interface mice are supported.
*
* \section SSec_Options Project Options
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/makefile b/Demos/Host/ClassDriver/MouseHostWithParser/makefile
index aacce7a04..48923b2de 100644
--- a/Demos/Host/ClassDriver/MouseHostWithParser/makefile
+++ b/Demos/Host/ClassDriver/MouseHostWithParser/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c
index 66c4f1302..2d776fd5d 100644
--- a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c
+++ b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the PrinterHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "PrinterHost.h"
/** LUFA Printer Class driver interface configuration and state information. This structure is
@@ -46,7 +46,7 @@ USB_ClassInfo_PRNT_Host_t Printer_PRNT_Interface =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
-
+
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
},
@@ -70,7 +70,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -91,7 +91,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -99,7 +99,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (PRNT_Host_SetBidirectionalMode(&Printer_PRNT_Interface) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Bidirectional Mode.\r\n"));
@@ -107,16 +107,16 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Printer Device Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
puts_P(PSTR("Retrieving Device ID...\r\n"));
-
+
char DeviceIDString[300];
if (PRNT_Host_GetDeviceID(&Printer_PRNT_Interface, DeviceIDString,
sizeof(DeviceIDString)) != HOST_SENDCONTROL_Successful)
@@ -126,12 +126,12 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Device ID: %s.\r\n"), DeviceIDString);
-
+
char TestPageData[] = "\033%-12345X\033E" "LUFA PCL Test Page" "\033E\033%-12345X";
uint16_t TestPageLength = strlen(TestPageData);
-
+
printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"), TestPageLength);
if (PRNT_Host_SendString(&Printer_PRNT_Interface, &TestPageData, TestPageLength) != PIPE_RWSTREAM_NoError)
@@ -148,7 +148,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
PRNT_Host_USBTask(&Printer_PRNT_Interface);
USB_USBTask();
}
@@ -218,6 +218,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.h b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.h
index a2b90a69d..120dec40f 100644
--- a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.h
+++ b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Printer.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -63,18 +63,19 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.txt b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.txt
index fab6a5b84..21780998e 100644
--- a/Demos/Host/ClassDriver/PrinterHost/PrinterHost.txt
+++ b/Demos/Host/ClassDriver/PrinterHost/PrinterHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Printer Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Printer Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Bidirectional Protocol</td>
* </tr>
@@ -41,16 +41,16 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Printer host demonstration application. This gives a simple reference
* application for implementing a USB Printer host, for USB printers using
* the bidirectional data encapsulation protocol and PCL language.
- *
+ *
* Upon connection of a compatible printer, the printer's device ID is sent
* to the AVR's serial port, and a simple test page is printed using the PCL
* printer language.
- *
+ *
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
@@ -63,3 +63,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/PrinterHost/makefile b/Demos/Host/ClassDriver/PrinterHost/makefile
index b98ec7796..15c267882 100644
--- a/Demos/Host/ClassDriver/PrinterHost/makefile
+++ b/Demos/Host/ClassDriver/PrinterHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c
index b793db928..69fa25cd7 100644
--- a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c
+++ b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the RNDISEthernetHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "RNDISEthernetHost.h"
/** Buffer to hold incoming and outgoing Ethernet packets. */
@@ -55,11 +55,11 @@ USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface =
.NotificationPipeNumber = 3,
.NotificationPipeDoubleBank = false,
-
+
.HostMaxPacketSize = sizeof(PacketBuffer),
},
};
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -78,7 +78,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -99,7 +99,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -107,18 +107,18 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Initializing Device.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
-
+
printf_P(PSTR("Device Max Transfer Size: %lu bytes.\r\n"), Ethernet_RNDIS_Interface.State.DeviceMaxPacketSize);
-
+
uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST | REMOTE_NDIS_PACKET_ALL_MULTICAST);
if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_CURRENT_PACKET_FILTER,
&PacketFilter, sizeof(PacketFilter)) != HOST_SENDCONTROL_Successful)
@@ -129,7 +129,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
uint32_t VendorID;
if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_VENDOR_ID,
&VendorID, sizeof(VendorID)) != HOST_SENDCONTROL_Successful)
@@ -140,7 +140,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Device Vendor ID: 0x%08lX\r\n"), VendorID);
puts_P(PSTR("RNDIS Device Enumerated.\r\n"));
@@ -149,10 +149,10 @@ int main(void)
break;
case HOST_STATE_Configured:
PrintIncomingPackets();
-
+
break;
}
-
+
RNDIS_Host_USBTask(&Ethernet_RNDIS_Interface);
USB_USBTask();
}
@@ -167,14 +167,14 @@ void PrintIncomingPackets(void)
uint16_t PacketLength;
RNDIS_Host_ReadPacket(&Ethernet_RNDIS_Interface, &PacketBuffer, &PacketLength);
-
+
printf_P(PSTR("***PACKET (Size %d)***\r\n"), PacketLength);
-
+
for (uint16_t i = 0; i < PacketLength; i++)
printf("0x%02x ", PacketBuffer[i]);
printf_P(PSTR("\r\n\r\n"));
-
+
LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
}
@@ -243,6 +243,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h
index f3c04f593..56a6fe94e 100644
--- a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h
+++ b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/RNDIS.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -63,19 +63,20 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
/* Function Prototypes: */
void SetupHardware(void);
void PrintIncomingPackets(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.txt b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.txt
index 9fec00bec..a989bc51a 100644
--- a/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.txt
+++ b/Demos/Host/ClassDriver/RNDISEthernetHost/RNDISEthernetHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage RNDIS Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard)</td>
* </tr>
@@ -39,12 +39,12 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* RNDIS host demonstration application. This gives a simple reference
* application for implementing a RNDIS Ethernet host, for USB devices such as
* modems.
- *
+ *
* This demo will enumerate an attached USB RNDIS device, print out its vendor ID
* and any received packets in raw form through the serial USART.
*
@@ -60,3 +60,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/RNDISEthernetHost/makefile b/Demos/Host/ClassDriver/RNDISEthernetHost/makefile
index ff783f0b7..8453a491d 100644
--- a/Demos/Host/ClassDriver/RNDISEthernetHost/makefile
+++ b/Demos/Host/ClassDriver/RNDISEthernetHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c
index f5d1b23fd..35d41d4c4 100644
--- a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c
+++ b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the StillImageHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "StillImageHost.h"
/** LUFA Still Image Class driver interface configuration and state information. This structure is
@@ -46,10 +46,10 @@ USB_ClassInfo_SI_Host_t DigitalCamera_SI_Interface =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
-
+
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
-
+
.EventsPipeNumber = 3,
.EventsPipeDoubleBank = false,
},
@@ -73,7 +73,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -94,7 +94,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -102,14 +102,14 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Still Image Device Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
puts_P(PSTR("Opening Session...\r\n"));
-
+
if (SI_Host_OpenSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)
{
puts_P(PSTR("Could not open PIMA session.\r\n"));
@@ -124,7 +124,7 @@ int main(void)
{
puts_P(PSTR("Could not turn off device.\r\n"));
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
puts_P(PSTR("Device Off.\r\n"));
@@ -137,12 +137,12 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
SI_Host_USBTask(&DigitalCamera_SI_Interface);
USB_USBTask();
}
@@ -212,6 +212,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.h b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.h
index 1b776596b..3f4375dc7 100644
--- a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.h
+++ b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/StillImage.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -63,15 +63,16 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.txt b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.txt
index 95a2e14b5..2dc3b662b 100644
--- a/Demos/Host/ClassDriver/StillImageHost/StillImageHost.txt
+++ b/Demos/Host/ClassDriver/StillImageHost/StillImageHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Still Image Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Still Image Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -40,12 +40,12 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Still Image host demonstration application. This gives a simple reference
* application for implementing a Still Image host, for USB devices such as
* digital cameras.
- *
+ *
* This demo will enumerate an attached USB Still Image device, print out its
* information structure, open a session with the device and finally close the
* session.
@@ -62,3 +62,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/StillImageHost/makefile b/Demos/Host/ClassDriver/StillImageHost/makefile
index 6c36513b2..8c6cdb53e 100644
--- a/Demos/Host/ClassDriver/StillImageHost/makefile
+++ b/Demos/Host/ClassDriver/StillImageHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c
index c48694274..bca146e35 100644
--- a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c
+++ b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the VirtualSerialHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "VirtualSerialHost.h"
/** LUFA CDC Class driver interface configuration and state information. This structure is
@@ -54,7 +54,7 @@ USB_ClassInfo_CDC_Host_t VirtualSerial_CDC_Interface =
.NotificationPipeDoubleBank = false,
},
};
-
+
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
@@ -73,7 +73,7 @@ int main(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -94,7 +94,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
@@ -102,7 +102,7 @@ int main(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("CDC Device Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
@@ -115,10 +115,10 @@ int main(void)
if (!(ReceivedByte < 0))
putchar(ReceivedByte);
}
-
+
break;
}
-
+
CDC_Host_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
@@ -188,6 +188,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.h b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.h
index ed4ffcef7..e873f539f 100644
--- a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.h
+++ b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -63,15 +63,16 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.txt b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.txt
index d771b7976..80a470818 100644
--- a/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.txt
+++ b/Demos/Host/ClassDriver/VirtualSerialHost/VirtualSerialHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage CDC Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -39,13 +39,13 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* CDC host demonstration application. This gives a simple reference application
* for implementing a USB CDC host, for CDC devices using the standard ACM profile.
- *
+ *
* This demo prints out received CDC data through the serial port.
- *
+ *
* Not that this demo is only compatible with devices which report the correct CDC
* and ACM class, subclass and protocol values. Most USB-Serial cables have vendor
* specific features, thus use vendor-specific class/subclass/protocol codes to force
@@ -63,3 +63,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/ClassDriver/VirtualSerialHost/makefile b/Demos/Host/ClassDriver/VirtualSerialHost/makefile
index 8bd6949db..38ac416b8 100644
--- a/Demos/Host/ClassDriver/VirtualSerialHost/makefile
+++ b/Demos/Host/ClassDriver/VirtualSerialHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,7 +133,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -146,7 +146,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -260,7 +260,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -273,7 +273,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -285,7 +285,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -297,7 +297,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -320,7 +320,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -354,7 +354,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -388,7 +388,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -417,7 +417,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -436,10 +436,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -504,11 +504,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -535,9 +535,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -635,14 +635,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -664,7 +664,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -708,3 +708,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/ClassDriver/makefile b/Demos/Host/ClassDriver/makefile
index e1c22d35e..95f8634dc 100644
--- a/Demos/Host/ClassDriver/makefile
+++ b/Demos/Host/ClassDriver/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -15,7 +15,7 @@
all:
$(MAKE) -C JoystickHostWithParser clean
- $(MAKE) -C JoystickHostWithParser all
+ $(MAKE) -C JoystickHostWithParser all
$(MAKE) -C KeyboardHost clean
$(MAKE) -C KeyboardHost all
@@ -45,8 +45,8 @@ all:
$(MAKE) -C StillImageHost all
$(MAKE) -C VirtualSerialHost clean
- $(MAKE) -C VirtualSerialHost all
-
+ $(MAKE) -C VirtualSerialHost all
+
%:
$(MAKE) -C JoystickHostWithParser $@
$(MAKE) -C KeyboardHost $@
@@ -59,3 +59,4 @@ all:
$(MAKE) -C RNDISEthernetHost $@
$(MAKE) -C StillImageHost $@
$(MAKE) -C VirtualSerialHost $@
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
index 543e1b879..de4db0c50 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.c
@@ -191,3 +191,4 @@ void RFCOMM_ChannelSignalsReceived(RFCOMM_Channel_t* const RFCOMMChannel)
{
// Currently do nothing in response to the remote device sending new terminal control signals
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h
index 336f61d5e..3e1b70457 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothEvents.h
@@ -69,3 +69,4 @@
extern RFCOMM_Channel_t* SerialChannel_RFCOMM;
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
index 8301e85bd..c2139154c 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -52,14 +52,14 @@ int main(void)
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "Bluetooth Host Demo running.\r\n" ESC_FG_WHITE));
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
RFCOMM_ServiceChannels(SerialChannel_ACL);
-
+
Bluetooth_Host_Task();
Bluetooth_Stack_USBTask();
USB_USBTask();
@@ -130,7 +130,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -143,7 +143,7 @@ void Bluetooth_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Device Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessDeviceDescriptor()) != SuccessfulDeviceRead)
{
@@ -153,7 +153,7 @@ void Bluetooth_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDS_LED1);
@@ -177,9 +177,9 @@ void Bluetooth_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -189,7 +189,7 @@ void Bluetooth_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDS_LED1);
@@ -199,7 +199,7 @@ void Bluetooth_Host_Task(void)
}
puts_P(PSTR("Bluetooth Dongle Enumerated.\r\n"));
-
+
/* Initialize the Bluetooth stack */
Bluetooth_Stack_Init();
@@ -207,3 +207,4 @@ void Bluetooth_Host_Task(void)
break;
}
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
index 0814845a0..a5148900f 100644
--- a/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
+++ b/Demos/Host/Incomplete/BluetoothHost/BluetoothHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,7 +54,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -73,7 +73,7 @@
/* Task Definitions: */
void Bluetooth_Host_Task(void);
-
+
/* Event Handlers: */
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -84,5 +84,6 @@
/* Function Prototypes: */
void SetupHardware(void);
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c
index cc7570387..447bf00a4 100644
--- a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c
+++ b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
USB_Descriptor_Endpoint_t* EventsEndpoint = NULL;
@@ -67,11 +67,11 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return DevControlError;
}
-
+
/* The Bluetooth USB transport addendum mandates that the data (not streaming voice) endpoints
be in the first interface descriptor (interface 0) */
USB_GetNextDescriptorOfType(&CurrConfigBytesRem, &CurrConfigLocation, DTYPE_Interface);
-
+
/* Ensure that an interface was found, and the end of the descriptor was not reached */
if (!(CurrConfigBytesRem))
return NoCompatibleInterfaceFound;
@@ -103,7 +103,7 @@ uint8_t ProcessConfigurationDescriptor(void)
DataOUTEndpoint = EndpointData;
}
}
-
+
/* Configure the Bluetooth data IN pipe */
Pipe_ConfigurePipe(BLUETOOTH_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -125,7 +125,7 @@ uint8_t ProcessConfigurationDescriptor(void)
* configuration descriptor, to search for a specific sub descriptor. It can also be used to abort the configuration
* descriptor processing if an incompatible descriptor configuration is found.
*
- * This comparator searches for the next Endpoint descriptor inside the current interface descriptor, aborting the
+ * This comparator searches for the next Endpoint descriptor inside the current interface descriptor, aborting the
* search if another interface descriptor is found before the required endpoint.
*
* \return A value from the DSEARCH_Return_ErrorCodes_t enum
diff --git a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h
index 25442b87b..6d1ec2d49 100644
--- a/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h
+++ b/Demos/Host/Incomplete/BluetoothHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,7 +38,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
/* Macros: */
#define BLUETOOTH_DATA_IN_PIPE 1
#define BLUETOOTH_DATA_OUT_PIPE 2
@@ -54,10 +54,11 @@
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
};
-
+
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
-
+
uint8_t DComp_NextInterfaceBluetoothDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c b/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c
index 22a9c3506..707180023 100644
--- a/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c
+++ b/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,7 +30,7 @@
/** \file
*
- * USB Device Descriptor processing routines, to determine the overall device parameters. Descriptors are special
+ * USB Device Descriptor processing routines, to determine the overall device parameters. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine information about
* the attached device.
*/
@@ -50,11 +50,11 @@ uint8_t ProcessDeviceDescriptor(void)
/* Send the request to retrieve the device descriptor */
if (USB_Host_GetDeviceDescriptor(&DeviceDescriptor) != HOST_SENDCONTROL_Successful)
return DevControlError;
-
+
/* Validate returned data - ensure the returned data is a device descriptor */
if (DeviceDescriptor.Header.Type != DTYPE_Device)
return InvalidDeviceDataReturned;
-
+
/* Validate returned device Class, SubClass and Protocol values against the Bluetooth spec values */
if ((DeviceDescriptor.Class != BLUETOOTH_DEVICE_CLASS) ||
(DeviceDescriptor.SubClass != BLUETOOTH_DEVICE_SUBCLASS) ||
@@ -62,6 +62,7 @@ uint8_t ProcessDeviceDescriptor(void)
{
return IncorrectBTDevice;
}
-
+
return SuccessfulDeviceRead;
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h b/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h
index 06bbc8526..1c017d386 100644
--- a/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h
+++ b/Demos/Host/Incomplete/BluetoothHost/DeviceDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "BluetoothHost.h"
-
+
/* Macros: */
/** Device Class value for the Bluetooth Device class. */
#define BLUETOOTH_DEVICE_CLASS 0xE0
@@ -62,6 +62,7 @@
};
/* Function Prototypes: */
- uint8_t ProcessDeviceDescriptor(void);
+ uint8_t ProcessDeviceDescriptor(void);
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
index 939b2ae5f..35b1e920d 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,14 +50,14 @@ void Bluetooth_ACLTask(void)
{
/* Process incoming ACL packets, if any */
Bluetooth_ProcessIncomingACLPackets();
-
+
/* Check for any half-open channels, send configuration details to the remote device if found */
for (uint8_t i = 0; i < BLUETOOTH_MAX_OPEN_CHANNELS; i++)
{
Bluetooth_Channel_t* ChannelData = &Bluetooth_Connection.Channels[i];
-
+
bool MustSendConfigReq = true;
-
+
/* Check if we are in a channel state which requires a configuration request to be sent */
switch (ChannelData->State)
{
@@ -71,7 +71,7 @@ void Bluetooth_ACLTask(void)
MustSendConfigReq = false;
break;
}
-
+
/* Only send a configuration request if it the channel was in a state which required it */
if (MustSendConfigReq)
{
@@ -79,14 +79,14 @@ void Bluetooth_ACLTask(void)
{
BT_Signal_Header_t SignalCommandHeader;
BT_Signal_ConfigurationReq_t ConfigurationRequest;
-
+
struct
{
BT_Config_Option_Header_t Header;
uint16_t Value;
} Option_LocalMTU;
} PacketData;
-
+
/* Fill out the Signal Command header in the response packet */
PacketData.SignalCommandHeader.Code = BT_SIGNAL_CONFIGURATION_REQUEST;
PacketData.SignalCommandHeader.Identifier = ++Bluetooth_Connection.SignalingIdentifier;
@@ -101,7 +101,7 @@ void Bluetooth_ACLTask(void)
PacketData.Option_LocalMTU.Value = ChannelData->LocalMTU;
Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);
-
+
BT_ACL_DEBUG(1, ">> L2CAP Configuration Request");
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", PacketData.ConfigurationRequest.DestinationChannel);
}
@@ -119,13 +119,13 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
Pipe_SelectPipe(BLUETOOTH_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
if (!(Pipe_IsReadWriteAllowed()))
{
Pipe_Freeze();
return;
}
-
+
/* Read in the received ACL packet headers when it has been discovered that a packet has been received */
Pipe_Read_Stream_LE(&ACLPacketHeader, sizeof(ACLPacketHeader));
Pipe_Read_Stream_LE(&DataHeader, sizeof(DataHeader));
@@ -143,7 +143,7 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
/* Read in the Signal Command header of the incoming packet */
BT_Signal_Header_t SignalCommandHeader;
Pipe_Read_Stream_LE(&SignalCommandHeader, sizeof(SignalCommandHeader));
-
+
/* Dispatch to the appropriate handler function based on the Signal message code */
switch (SignalCommandHeader.Code)
{
@@ -173,20 +173,20 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
break;
case BT_SIGNAL_COMMAND_REJECT:
BT_ACL_DEBUG(1, "<< Command Reject");
-
+
uint16_t RejectReason;
Pipe_Read_Stream_LE(&RejectReason, sizeof(RejectReason));
Pipe_Discard_Stream(ACLPacketHeader.DataLength - sizeof(RejectReason));
Pipe_ClearIN();
- Pipe_Freeze();
-
+ Pipe_Freeze();
+
BT_ACL_DEBUG(2, "-- Reason: %d", RejectReason);
break;
default:
BT_ACL_DEBUG(1, "<< Unknown Signaling Command 0x%02X", SignalCommandHeader.Code);
-
+
Pipe_Discard_Stream(ACLPacketHeader.DataLength);
- Pipe_ClearIN();
+ Pipe_ClearIN();
Pipe_Freeze();
break;
}
@@ -198,7 +198,7 @@ static void Bluetooth_ProcessIncomingACLPackets(void)
Pipe_Read_Stream_LE(PacketData, DataHeader.PayloadLength);
Pipe_ClearIN();
Pipe_Freeze();
-
+
Bluetooth_PacketReceived(PacketData, DataHeader.PayloadLength,
Bluetooth_GetChannelData(DataHeader.DestinationChannel, CHANNEL_SEARCH_LOCALNUMBER));
}
@@ -221,9 +221,9 @@ Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue,
/* Closed channels should be ignored as they are not considered valid data */
if (ChannelData->State == BT_Channel_Closed)
continue;
-
+
bool FoundMatch = false;
-
+
/* Search the current channel for the search key to see if it matches */
switch (SearchKey)
{
@@ -237,7 +237,7 @@ Bluetooth_Channel_t* Bluetooth_GetChannelData(const uint16_t SearchValue,
FoundMatch = (SearchValue == ChannelData->PSM);
break;
}
-
+
if (FoundMatch)
return ChannelData;
}
@@ -285,9 +285,9 @@ uint8_t Bluetooth_SendPacket(void* Data,
Pipe_Write_Stream_LE(&DataHeader, sizeof(DataHeader));
Pipe_Write_Stream_LE(Data, DataLen);
Pipe_ClearOUT();
-
+
Pipe_Freeze();
-
+
BT_ACL_DEBUG(2, "");
BT_ACL_DEBUG(2, "Packet Sent");
BT_ACL_DEBUG(2, "-- Connection Handle: 0x%04X", (ACLPacketHeader.ConnectionHandle & 0x0FFF));
@@ -319,7 +319,7 @@ Bluetooth_Channel_t* Bluetooth_OpenChannel(const uint16_t PSM)
if (Bluetooth_Connection.Channels[i].State == BT_Channel_Closed)
{
ChannelData = &Bluetooth_Connection.Channels[i];
-
+
/* Set the new channel structure's local channel number to a unique value within the connection orientated
channel address space */
ChannelData->LocalNumber = (BT_CHANNELNUMBER_BASEOFFSET + i);
@@ -336,7 +336,7 @@ Bluetooth_Channel_t* Bluetooth_OpenChannel(const uint16_t PSM)
ChannelData->PSM = PSM;
ChannelData->LocalMTU = MAXIMUM_CHANNEL_MTU;
ChannelData->State = BT_Channel_WaitConnectRsp;
-
+
struct
{
BT_Signal_Header_t SignalCommandHeader;
@@ -347,11 +347,11 @@ Bluetooth_Channel_t* Bluetooth_OpenChannel(const uint16_t PSM)
PacketData.SignalCommandHeader.Code = BT_SIGNAL_CONNECTION_REQUEST;
PacketData.SignalCommandHeader.Identifier = ++Bluetooth_Connection.SignalingIdentifier;
PacketData.SignalCommandHeader.Length = sizeof(PacketData.ConnectionRequest);
-
+
/* Fill out the Connection Request in the response packet */
PacketData.ConnectionRequest.PSM = PSM;
PacketData.ConnectionRequest.SourceChannel = ChannelData->LocalNumber;
-
+
Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);
BT_ACL_DEBUG(1, ">> L2CAP Connection Request");
@@ -385,7 +385,7 @@ void Bluetooth_CloseChannel(Bluetooth_Channel_t* const ACLChannel)
BT_Signal_Header_t SignalCommandHeader;
BT_Signal_DisconnectionReq_t DisconnectionRequest;
} PacketData;
-
+
/* Fill out the Signal Command header in the response packet */
PacketData.SignalCommandHeader.Code = BT_SIGNAL_DISCONNECTION_REQUEST;
PacketData.SignalCommandHeader.Identifier = ++Bluetooth_Connection.SignalingIdentifier;
@@ -396,10 +396,10 @@ void Bluetooth_CloseChannel(Bluetooth_Channel_t* const ACLChannel)
PacketData.DisconnectionRequest.SourceChannel = ACLChannel->LocalNumber;
Bluetooth_SendPacket(&PacketData, sizeof(PacketData), NULL);
-
+
BT_ACL_DEBUG(1, ">> L2CAP Disconnection Request");
- BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", PacketData.DisconnectionRequest.DestinationChannel);
- BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", PacketData.DisconnectionRequest.SourceChannel);
+ BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", PacketData.DisconnectionRequest.DestinationChannel);
+ BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", PacketData.DisconnectionRequest.SourceChannel);
}
/** Internal Bluetooth stack Signal Command processing routine for a Connection Request command.
@@ -409,12 +409,12 @@ void Bluetooth_CloseChannel(Bluetooth_Channel_t* const ACLChannel)
static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_ConnectionReq_t ConnectionRequest;
-
+
Pipe_Read_Stream_LE(&ConnectionRequest, sizeof(ConnectionRequest));
Pipe_ClearIN();
Pipe_Freeze();
-
+
BT_ACL_DEBUG(1, "<< L2CAP Connection Request");
BT_ACL_DEBUG(2, "-- PSM: 0x%04X", ConnectionRequest.PSM);
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionRequest.SourceChannel);
@@ -439,7 +439,7 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
}
}
}
-
+
uint8_t ChannelStatus = BT_CONNECTION_REFUSED_RESOURCES;
/* Reset the channel item contents only if a channel entry was found for it */
@@ -452,15 +452,15 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
ChannelData->PSM = ConnectionRequest.PSM;
ChannelData->LocalMTU = MAXIMUM_CHANNEL_MTU;
ChannelData->State = BT_Channel_Config_WaitConfig;
-
+
ChannelStatus = BT_CONNECTION_SUCCESSFUL;
}
else
{
- ChannelStatus = BT_CONNECTION_REFUSED_PSM;
+ ChannelStatus = BT_CONNECTION_REFUSED_PSM;
}
}
-
+
struct
{
BT_Signal_Header_t SignalCommandHeader;
@@ -477,7 +477,7 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
ResponsePacket.ConnectionResponse.SourceChannel = ChannelData->RemoteNumber;
ResponsePacket.ConnectionResponse.Result = ChannelStatus;
ResponsePacket.ConnectionResponse.Status = 0x00;
-
+
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
BT_ACL_DEBUG(1, ">> L2CAP Connection Response");
@@ -493,16 +493,16 @@ static inline void Bluetooth_Signal_ConnectionReq(const BT_Signal_Header_t* cons
static inline void Bluetooth_Signal_ConnectionResp(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_ConnectionResp_t ConnectionResponse;
-
+
Pipe_Read_Stream_LE(&ConnectionResponse, sizeof(ConnectionResponse));
Pipe_ClearIN();
Pipe_Freeze();
BT_ACL_DEBUG(1, "<< L2CAP Connection Response");
- BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConnectionResponse.Result);
- BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionResponse.SourceChannel);
- BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);
+ BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConnectionResponse.Result);
+ BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConnectionResponse.SourceChannel);
+ BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", ConnectionResponse.DestinationChannel);
/* Search for the referenced channel in the channel information list */
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConnectionResponse.SourceChannel, CHANNEL_SEARCH_LOCALNUMBER);
@@ -524,12 +524,12 @@ static inline void Bluetooth_Signal_ConnectionResp(const BT_Signal_Header_t* con
static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_ConfigurationReq_t ConfigurationRequest;
-
+
/* Allocate a buffer large enough to hold the variable number of configuration options in the request */
uint8_t OptionsLen = (SignalCommandHeader->Length - sizeof(ConfigurationRequest));
uint8_t Options[OptionsLen];
- Pipe_Read_Stream_LE(&ConfigurationRequest, sizeof(ConfigurationRequest));
+ Pipe_Read_Stream_LE(&ConfigurationRequest, sizeof(ConfigurationRequest));
Pipe_Read_Stream_LE(&Options, sizeof(Options));
Pipe_ClearIN();
@@ -554,7 +554,7 @@ static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* c
BT_ACL_DEBUG(2, "-- Option Type: 0x%04X", OptionHeader->Type);
BT_ACL_DEBUG(2, "-- Option Length: 0x%04X", (sizeof(BT_Config_Option_Header_t) + OptionHeader->Length));
-
+
/* Store the remote MTU option's value if present */
if (OptionHeader->Type == BT_CONFIG_OPTION_MTU)
ChannelData->RemoteMTU = *((uint16_t*)OptionData);
@@ -563,7 +563,7 @@ static inline void Bluetooth_Signal_ConfigurationReq(const BT_Signal_Header_t* c
OptionPos += (sizeof(BT_Config_Option_Header_t) + OptionHeader->Length);
}
}
-
+
struct
{
BT_Signal_Header_t SignalCommandHeader;
@@ -616,14 +616,14 @@ static inline void Bluetooth_Signal_ConfigurationResp(const BT_Signal_Header_t*
Pipe_ClearIN();
Pipe_Freeze();
-
+
BT_ACL_DEBUG(1, "<< L2CAP Configuration Response");
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", ConfigurationResponse.SourceChannel);
BT_ACL_DEBUG(2, "-- Result: 0x%02X", ConfigurationResponse.Result);
/* Search for the referenced channel in the channel information list */
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(ConfigurationResponse.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);
-
+
/* Only update the channel's state if it was found in the channel list */
if (ChannelData != NULL)
{
@@ -639,7 +639,7 @@ static inline void Bluetooth_Signal_ConfigurationResp(const BT_Signal_Header_t*
ChannelData->State = BT_Channel_Open;
Bluetooth_ChannelOpened(ChannelData);
break;
- }
+ }
}
else
{
@@ -656,16 +656,16 @@ static inline void Bluetooth_Signal_ConfigurationResp(const BT_Signal_Header_t*
static inline void Bluetooth_Signal_DisconnectionReq(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_DisconnectionReq_t DisconnectionRequest;
-
+
Pipe_Read_Stream_LE(&DisconnectionRequest, sizeof(DisconnectionRequest));
BT_ACL_DEBUG(1, "<< L2CAP Disconnection Request");
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DisconnectionRequest.DestinationChannel);
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", DisconnectionRequest.SourceChannel);
-
+
Pipe_ClearIN();
Pipe_Freeze();
-
+
/* Search for the referenced channel in the channel information list */
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionRequest.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);
@@ -702,20 +702,20 @@ static inline void Bluetooth_Signal_DisconnectionReq(const BT_Signal_Header_t* c
static inline void Bluetooth_Signal_DisconnectionResp(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_Signal_DisconnectionResp_t DisconnectionResponse;
-
+
Pipe_Read_Stream_LE(&DisconnectionResponse, sizeof(DisconnectionResponse));
BT_ACL_DEBUG(1, "<< L2CAP Disconnection Response");
BT_ACL_DEBUG(2, "-- Destination Channel: 0x%04X", DisconnectionResponse.DestinationChannel);
BT_ACL_DEBUG(2, "-- Source Channel: 0x%04X", DisconnectionResponse.SourceChannel);
-
+
Pipe_ClearIN();
Pipe_Freeze();
-
+
/* Search for the referenced channel in the channel information list */
Bluetooth_Channel_t* ChannelData = Bluetooth_GetChannelData(DisconnectionResponse.SourceChannel, CHANNEL_SEARCH_REMOTENUMBER);
-
- /* If the channel was found in the channel list, close it */
+
+ /* If the channel was found in the channel list, close it */
if (ChannelData != NULL)
ChannelData->State = BT_Channel_Closed;
}
@@ -727,10 +727,10 @@ static inline void Bluetooth_Signal_DisconnectionResp(const BT_Signal_Header_t*
static inline void Bluetooth_Signal_EchoReq(const BT_Signal_Header_t* const SignalCommandHeader)
{
BT_ACL_DEBUG(1, "<< L2CAP Echo Request");
-
+
Pipe_ClearIN();
Pipe_Freeze();
-
+
struct
{
BT_Signal_Header_t SignalCommandHeader;
@@ -740,7 +740,7 @@ static inline void Bluetooth_Signal_EchoReq(const BT_Signal_Header_t* const Sign
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_ECHO_RESPONSE;
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
ResponsePacket.SignalCommandHeader.Length = 0;
-
+
Bluetooth_SendPacket(&ResponsePacket, sizeof(ResponsePacket), NULL);
BT_ACL_DEBUG(1, ">> L2CAP Echo Response");
@@ -758,7 +758,7 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
BT_ACL_DEBUG(1, "<< L2CAP Information Request");
BT_ACL_DEBUG(2, "-- Info Type: 0x%04X", InformationRequest.InfoType);
-
+
Pipe_ClearIN();
Pipe_Freeze();
@@ -766,25 +766,25 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
{
BT_Signal_Header_t SignalCommandHeader;
BT_Signal_InformationResp_t InformationResponse;
-
+
uint8_t Data[4];
} ResponsePacket;
-
+
uint8_t DataLen = 0;
-
+
/* Retrieve the requested information and store it in the outgoing packet, if found */
switch (InformationRequest.InfoType)
{
- case BT_INFOREQ_MTU:
+ case BT_INFOREQ_MTU:
ResponsePacket.InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
DataLen = 2;
-
+
*((uint16_t*)&ResponsePacket.Data) = MAXIMUM_CHANNEL_MTU;
break;
case BT_INFOREQ_EXTENDEDFEATURES:
ResponsePacket.InformationResponse.Result = BT_INFORMATION_SUCCESSFUL;
DataLen = 4;
-
+
*((uint32_t*)&ResponsePacket.Data) = 0;
break;
default:
@@ -792,7 +792,7 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
DataLen = 0;
break;
}
-
+
/* Fill out the Signal Command header in the response packet */
ResponsePacket.SignalCommandHeader.Code = BT_SIGNAL_INFORMATION_RESPONSE;
ResponsePacket.SignalCommandHeader.Identifier = SignalCommandHeader->Identifier;
@@ -800,9 +800,10 @@ static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* con
/* Fill out the Information Response in the response packet */
ResponsePacket.InformationResponse.InfoType = InformationRequest.InfoType;
-
+
Bluetooth_SendPacket(&ResponsePacket, (sizeof(ResponsePacket) - sizeof(ResponsePacket.Data) + DataLen), NULL);
- BT_ACL_DEBUG(1, ">> L2CAP Information Response");
+ BT_ACL_DEBUG(1, ">> L2CAP Information Response");
BT_ACL_DEBUG(2, "-- Result: 0x%02X", ResponsePacket.InformationResponse.Result);
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
index efe9d39f6..4c587d597 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothACLPackets.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -44,13 +44,13 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
-
+
#include "BluetoothStack.h"
-
+
/* Macros: */
#define BT_ACL_DEBUG(l, s, ...) do { if (ACL_DEBUG_LEVEL >= l) printf_P(PSTR("(ACL) " s "\r\n"), ##__VA_ARGS__); } while (0)
#define ACL_DEBUG_LEVEL 0
-
+
/** Lowest possible channel number for L2CAP data channels. */
#define BT_CHANNELNUMBER_BASEOFFSET 0x0040
@@ -59,7 +59,7 @@
/** Bluetooth specification defined channel number for connectionless data. */
#define BT_CHANNEL_CONNECTIONLESS 0x0002
-
+
#define BT_ACL_FIRST_AUTOFLUSH (1 << 13)
#define BT_SIGNAL_COMMAND_REJECT 0x01
@@ -73,23 +73,23 @@
#define BT_SIGNAL_ECHO_RESPONSE 0x09
#define BT_SIGNAL_INFORMATION_REQUEST 0x0A
#define BT_SIGNAL_INFORMATION_RESPONSE 0x0B
-
+
#define BT_INFOREQ_MTU 0x0001
#define BT_INFOREQ_EXTENDEDFEATURES 0x0002
-
+
#define BT_INFORMATION_SUCCESSFUL 0x0000
#define BT_INFORMATION_NOTSUPPORTED 0x0001
-
+
#define BT_CONNECTION_SUCCESSFUL 0x0000
#define BT_CONNECTION_REFUSED_PSM 0x0002
#define BT_CONNECTION_REFUSED_RESOURCES 0x0004
-
+
#define BT_CONFIGURATION_SUCCESSFUL 0x0000
#define BT_CONFIGURATION_REJECTED 0x0002
#define BT_CONFIGURATION_UNKNOWNOPTIONS 0x0003
-
+
#define BT_CONFIG_OPTION_MTU 1
-
+
/* Type Defines: */
/** Bluetooth ACL header structure, common to all ACL data packets. */
typedef struct
@@ -104,7 +104,7 @@
uint16_t PayloadLength; /**< Size of the data payload, in bytes */
uint16_t DestinationChannel; /**< Destination channel in the device the data is directed to */
} BT_DataPacket_Header_t;
-
+
/** Bluetooth signaling command header structure, for all ACL packets containing a signaling command. */
typedef struct
{
@@ -112,7 +112,7 @@
uint8_t Identifier; /**< Unique signal command identifier to link requests and responses */
uint16_t Length; /**< Length of the signaling command data, in bytes */
} BT_Signal_Header_t;
-
+
/** Connection Request signaling command structure, for channel connection requests. */
typedef struct
{
@@ -135,13 +135,13 @@
uint16_t DestinationChannel; /**< Destination channel address which is to be disconnected */
uint16_t SourceChannel; /**< Source channel address which is to be disconnected */
} BT_Signal_DisconnectionReq_t;
-
+
/** Disconnection response signaling command structure, for responses to channel disconnection requests. */
typedef struct
{
uint16_t DestinationChannel; /**< Destination channel address which was disconnected */
uint16_t SourceChannel; /**< Source channel address which was disconnected */
- } BT_Signal_DisconnectionResp_t;
+ } BT_Signal_DisconnectionResp_t;
/** Configuration Request signaling command structure, for channel configuration requests. */
typedef struct
@@ -163,14 +163,14 @@
{
uint16_t InfoType; /**< Data type that is being requested, a BT_INFOREQ_* mask value */
} BT_Signal_InformationReq_t;
-
+
/** Information Response signaling command structure, for responses to information requests. */
typedef struct
{
uint16_t InfoType; /**< Data type that was requested, a BT_INFOREQ_* mask value */
uint16_t Result; /**< Result of the request, a BT_INFORMATION_* mask value */
} BT_Signal_InformationResp_t;
-
+
/** Configuration Option header structure, placed at the start of each option in a Channel Configuration
* request's options list.
*/
@@ -182,7 +182,7 @@
/* Function Prototypes: */
void Bluetooth_ACLTask(void);
-
+
#if defined(INCLUDE_FROM_BLUETOOTH_ACLPACKETS_C)
static void Bluetooth_ProcessIncomingACLPackets(void);
@@ -195,5 +195,6 @@
static inline void Bluetooth_Signal_EchoReq(const BT_Signal_Header_t* const SignalCommandHeader);
static inline void Bluetooth_Signal_InformationReq(const BT_Signal_Header_t* const SignalCommandHeader);
#endif
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h
index c4690f4a8..f0699373d 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothClassCodes.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@
#define DEVICE_CLASS_SERVICE_AUDIO (1UL << 21)
#define DEVICE_CLASS_SERVICE_TELEPHONY (1UL << 22)
#define DEVICE_CLASS_SERVICE_INFORMATION (1UL << 23)
-
+
#define DEVICE_CLASS_MAJOR_MISC (0x00 << 8)
#define DEVICE_CLASS_MAJOR_COMPUTER (0x01 << 8)
#define DEVICE_CLASS_MAJOR_PHONE (0x02 << 8)
@@ -63,7 +63,7 @@
#define DEVICE_CLASS_MINOR_COMPUTER_HANDHELD (0x04 << 2)
#define DEVICE_CLASS_MINOR_COMPUTER_PALM (0x05 << 2)
#define DEVICE_CLASS_MINOR_COMPUTER_WEARABLE (0x06 << 2)
-
+
#define DEVICE_CLASS_MINOR_PHONE_UNCATEGORIZED (0x00 << 2)
#define DEVICE_CLASS_MINOR_PHONE_CELLULAR (0x01 << 2)
#define DEVICE_CLASS_MINOR_PHONE_CORDLESS (0x02 << 2)
@@ -79,7 +79,7 @@
#define DEVICE_CLASS_MINOR_LAN_67_TO_83_PC_UTILIZED (0x05 << 5)
#define DEVICE_CLASS_MINOR_LAN_83_TO_99_PC_UTILIZED (0x06 << 5)
#define DEVICE_CLASS_MINOR_LAN_NO_SERVICE_AVAILABLE (0x07 << 5)
-
+
#define DEVICE_CLASS_MINOR_AV_UNCATEGORIZED (0x00 << 2)
#define DEVICE_CLASS_MINOR_AV_HEADSET (0x01 << 2)
#define DEVICE_CLASS_MINOR_AV_HANDSFREE (0x02 << 2)
@@ -97,7 +97,7 @@
#define DEVICE_CLASS_MINOR_AV_DISPLAY_AND_LOUDSPEAKER (0x0F << 2)
#define DEVICE_CLASS_MINOR_AV_VIDEO_CONFERENCING (0x10 << 2)
#define DEVICE_CLASS_MINOR_AV_GAMING_TOY (0x12 << 2)
-
+
#define DEVICE_CLASS_MINOR_PERIPHERAL_KEYBOARD (0x01 << 6)
#define DEVICE_CLASS_MINOR_PERIPHERAL_POINTING (0x02 << 6)
#define DEVICE_CLASS_MINOR_PERIPHERAL_COMBO (0x03 << 6)
@@ -115,3 +115,4 @@
#define DEVICE_CLASS_MINOR_IMAGING_PRINTER (1 << 7)
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
index 7f6f8b78d..0cf18f21c 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -59,28 +59,28 @@ void Bluetooth_HCITask(void)
case Bluetooth_ProcessEvents:
Pipe_SelectPipe(BLUETOOTH_EVENTS_PIPE);
Pipe_Unfreeze();
-
+
if (Pipe_IsReadWriteAllowed())
{
BT_HCIEvent_Header_t HCIEventHeader;
/* Read in the event header to fetch the event code and payload length */
Pipe_Read_Stream_LE(&HCIEventHeader, sizeof(HCIEventHeader));
-
+
/* Create a temporary buffer for the event parameters */
uint8_t EventParams[HCIEventHeader.ParameterLength];
/* Read in the event parameters into the temporary buffer */
Pipe_Read_Stream_LE(&EventParams, HCIEventHeader.ParameterLength);
Pipe_ClearIN();
-
+
BT_HCI_DEBUG(1, "Event Received (0x%02X)", HCIEventHeader.EventCode);
switch (HCIEventHeader.EventCode)
{
case EVENT_COMMAND_COMPLETE:
BT_HCI_DEBUG(1, "<< Command Complete");
-
+
/* Check which operation was completed in case we need to process the even parameters */
switch (((BT_HCIEvent_CommandComplete_t*)&EventParams)->Opcode)
{
@@ -91,7 +91,7 @@ void Bluetooth_HCITask(void)
sizeof(Bluetooth_State.LocalBDADDR));
break;
}
-
+
Bluetooth_State.CurrentHCIState = Bluetooth_State.NextHCIState;
break;
case EVENT_COMMAND_STATUS:
@@ -110,7 +110,7 @@ void Bluetooth_HCITask(void)
memcpy(Bluetooth_TempDeviceAddress,
&((BT_HCIEvent_ConnectionRequest_t*)&EventParams)->RemoteAddress,
sizeof(Bluetooth_TempDeviceAddress));
-
+
bool IsACLConnection = (((BT_HCIEvent_ConnectionRequest_t*)&EventParams)->LinkType == 0x01);
/* Only accept the connection if it is a ACL (data) connection, a device is not already connected
@@ -135,12 +135,12 @@ void Bluetooth_HCITask(void)
break;
case EVENT_LINK_KEY_REQUEST:
BT_HCI_DEBUG(1, "<< Link Key Request");
-
+
/* Need to store the remote device's BT address in a temporary buffer for later use */
memcpy(Bluetooth_TempDeviceAddress,
&((BT_HCIEvent_LinkKeyReq_t*)&EventParams)->RemoteAddress,
- sizeof(Bluetooth_TempDeviceAddress));
-
+ sizeof(Bluetooth_TempDeviceAddress));
+
Bluetooth_State.CurrentHCIState = Bluetooth_Conn_SendLinkKeyNAK;
break;
case EVENT_CONNECTION_COMPLETE:
@@ -155,22 +155,22 @@ void Bluetooth_HCITask(void)
/* Store the created connection handle and indicate that the connection has been established */
Bluetooth_Connection.ConnectionHandle = ((BT_HCIEvent_ConnectionComplete_t*)&EventParams)->ConnectionHandle;
Bluetooth_Connection.IsConnected = true;
-
- Bluetooth_ConnectionComplete();
+
+ Bluetooth_ConnectionComplete();
break;
case EVENT_DISCONNECTION_COMPLETE:
BT_HCI_DEBUG(1, "<< Disconnection Complete");
/* Device disconnected, indicate connection information no longer valid */
Bluetooth_Connection.IsConnected = false;
-
+
Bluetooth_DisconnectionComplete();
break;
}
}
-
+
Pipe_Freeze();
-
+
break;
case Bluetooth_Init:
BT_HCI_DEBUG(1, "# Init");
@@ -180,7 +180,7 @@ void Bluetooth_HCITask(void)
/* Reset the connection information structure to destroy any previous connection state */
memset(&Bluetooth_Connection, 0x00, sizeof(Bluetooth_Connection));
- Bluetooth_State.CurrentHCIState = Bluetooth_Init_Reset;
+ Bluetooth_State.CurrentHCIState = Bluetooth_Init_Reset;
break;
case Bluetooth_Init_Reset:
BT_HCI_DEBUG(1, "# Reset");
@@ -193,13 +193,13 @@ void Bluetooth_HCITask(void)
/* Send the command to reset the Bluetooth dongle controller */
Bluetooth_SendHCICommand(&HCICommandHeader, NULL, 0);
-
+
Bluetooth_State.NextHCIState = Bluetooth_Init_ReadBufferSize;
Bluetooth_State.CurrentHCIState = Bluetooth_ProcessEvents;
break;
case Bluetooth_Init_ReadBufferSize:
BT_HCI_DEBUG(1, "# Read Buffer Size");
-
+
HCICommandHeader = (BT_HCICommand_Header_t)
{
OpCode: (OGF_CTRLR_INFORMATIONAL | OCF_CTRLR_INFORMATIONAL_READBUFFERSIZE),
@@ -214,7 +214,7 @@ void Bluetooth_HCITask(void)
break;
case Bluetooth_Init_GetBDADDR:
BT_HCI_DEBUG(1, "# Get BDADDR");
-
+
HCICommandHeader = (BT_HCICommand_Header_t)
{
OpCode: (OGF_CTRLR_INFORMATIONAL | OCF_CTRLR_INFORMATIONAL_READBDADDR),
@@ -267,10 +267,10 @@ void Bluetooth_HCITask(void)
};
uint8_t Interval = BT_SCANMODE_InquiryAndPageScans;
-
+
/* Send the command to set the remote device scanning mode */
Bluetooth_SendHCICommand(&HCICommandHeader, &Interval, 1);
-
+
Bluetooth_State.NextHCIState = Bluetooth_Init_FinalizeInit;
Bluetooth_State.CurrentHCIState = Bluetooth_ProcessEvents;
break;
@@ -301,7 +301,7 @@ void Bluetooth_HCITask(void)
/* Send the command to accept the remote connection request */
Bluetooth_SendHCICommand(&HCICommandHeader, &AcceptConnectionParams, sizeof(BT_HCICommand_AcceptConnectionReq_t));
-
+
Bluetooth_State.CurrentHCIState = Bluetooth_ProcessEvents;
break;
case Bluetooth_Conn_RejectConnection:
@@ -321,7 +321,7 @@ void Bluetooth_HCITask(void)
/* Send the command to reject the remote connection request */
Bluetooth_SendHCICommand(&HCICommandHeader, &RejectConnectionParams, sizeof(BT_HCICommand_RejectConnectionReq_t));
-
+
Bluetooth_State.CurrentHCIState = Bluetooth_ProcessEvents;
break;
case Bluetooth_Conn_SendPINCode:
@@ -339,7 +339,7 @@ void Bluetooth_HCITask(void)
memcpy(PINCodeRequestParams.RemoteAddress, Bluetooth_TempDeviceAddress, sizeof(PINCodeRequestParams.RemoteAddress));
PINCodeRequestParams.PINCodeLength = strlen(Bluetooth_DeviceConfiguration.PINCode);
memcpy(PINCodeRequestParams.PINCode, Bluetooth_DeviceConfiguration.PINCode, sizeof(PINCodeRequestParams.PINCode));
-
+
/* Send the command to transmit the device's local PIN number for authentication */
Bluetooth_SendHCICommand(&HCICommandHeader, &PINCodeRequestParams, sizeof(BT_HCICommand_PinCodeResp_t));
@@ -392,14 +392,15 @@ static uint8_t Bluetooth_SendHCICommand(const BT_HCICommand_Header_t* const HCIC
/* Copy over the HCI command header to the allocated buffer */
memcpy(CommandBuffer, HCICommandHeader, sizeof(BT_HCICommand_Header_t));
-
+
/* Zero out the parameter section of the response so that all padding bytes are known to be zero */
memset(&CommandBuffer[sizeof(BT_HCICommand_Header_t)], 0x00, HCICommandHeader->ParameterLength);
/* Copy over the command parameters (if any) to the command buffer - note, the number of actual source parameter bytes
may differ to those in the header; any difference in length is filled with 0x00 padding bytes */
memcpy(&CommandBuffer[sizeof(BT_HCICommand_Header_t)], Parameters, ParameterLength);
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
return USB_Host_SendControlRequest(CommandBuffer);
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h
index 9476446f6..90074e841 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothHCICommands.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -82,7 +82,7 @@
#define OCF_CTRLR_BASEBAND_WRITE_AUTHENTICATION_ENABLE 0x0020
#define OCF_CTRLR_INFORMATIONAL_READBUFFERSIZE 0x0005
#define OCF_CTRLR_INFORMATIONAL_READBDADDR 0x0009
-
+
#define EVENT_COMMAND_STATUS 0x0F
#define EVENT_COMMAND_COMPLETE 0x0E
#define EVENT_CONNECTION_COMPLETE 0x03
@@ -91,10 +91,10 @@
#define EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07
#define EVENT_PIN_CODE_REQUEST 0x16
#define EVENT_LINK_KEY_REQUEST 0x17
-
+
#define ERROR_LIMITED_RESOURCES 0x0D
#define ERROR_UNACCEPTABLE_BDADDR 0x0F
-
+
/* Type Defines: */
typedef struct
{
@@ -115,7 +115,7 @@
uint8_t Packets;
uint16_t OpCode;
} BT_HCIEvent_CommandStatus_t;
-
+
typedef struct
{
uint8_t HCIPacketsAllowable;
@@ -139,7 +139,7 @@
uint8_t LinkType;
uint8_t EncryptionEnabled;
} BT_HCIEvent_ConnectionComplete_t;
-
+
typedef struct
{
uint8_t RemoteAddress[6];
@@ -149,7 +149,7 @@
{
uint8_t RemoteAddress[6];
} BT_HCIEvent_LinkKeyReq_t;
-
+
typedef struct
{
uint8_t RemoteAddress[6];
@@ -161,18 +161,18 @@
uint8_t PINCodeLength;
char PINCode[16];
} BT_HCICommand_PinCodeResp_t;
-
+
typedef struct
{
uint8_t RemoteAddress[6];
uint8_t SlaveRole;
} BT_HCICommand_AcceptConnectionReq_t;
-
+
typedef struct
{
uint8_t RemoteAddress[6];
uint8_t Reason;
- } BT_HCICommand_RejectConnectionReq_t;
+ } BT_HCICommand_RejectConnectionReq_t;
/* Enums: */
enum BT_ScanEnable_Modes_t
@@ -199,14 +199,15 @@
Bluetooth_Conn_SendPINCode = 11,
Bluetooth_Conn_SendLinkKeyNAK = 12,
};
-
+
/* Function Prototypes: */
void Bluetooth_HCITask(void);
-
+
#if defined(INCLUDE_FROM_BLUETOOTHHCICOMMANDS_C)
static uint8_t Bluetooth_SendHCICommand(const BT_HCICommand_Header_t* const HCICommandHeader,
const void* Parameters,
const uint16_t ParameterLength);
#endif
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
index 1fa8079f3..d85b1f983 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -71,3 +71,4 @@ void Bluetooth_Stack_USBTask(void)
Bluetooth_HCITask();
Bluetooth_ACLTask();
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
index e434e6c4f..9483198c7 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/BluetoothStack.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,12 +38,12 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "../ConfigDescriptor.h"
-
+
/* Macros: */
#define BLUETOOTH_MAX_OPEN_CHANNELS 6
-
+
#define CHANNEL_PSM_SDP 0x0001
#define CHANNEL_PSM_UDP 0x0002
#define CHANNEL_PSM_RFCOMM 0x0003
@@ -53,13 +53,13 @@
#define CHANNEL_PSM_HTTP 0x000C
#define CHANNEL_PSM_UPNP 0x0010
#define CHANNEL_PSM_HIDP 0x0011
-
+
#define CHANNEL_SEARCH_LOCALNUMBER 0
#define CHANNEL_SEARCH_REMOTENUMBER 1
#define CHANNEL_SEARCH_PSM 2
-
+
#define MAXIMUM_CHANNEL_MTU 255
-
+
/* Enums: */
/** Enum for the possible states for a Bluetooth ACL channel. */
enum BT_ChannelStates_t
@@ -117,7 +117,7 @@
Bluetooth_Channel_t Channels[BLUETOOTH_MAX_OPEN_CHANNELS]; /**< Channel information structures for the connection. */
uint8_t SignalingIdentifier; /**< Next Signaling Channel unique command sequence identifier. */
} Bluetooth_Connection_t;
-
+
/** Local Bluetooth device information structure, for the defining of local device characteristics for the Bluetooth stack. */
typedef struct
{
@@ -125,7 +125,7 @@
char PINCode[16]; /**< Pin code required to send or receive in order to authenticate with a remote device. */
char Name[]; /**< Name of the local Bluetooth device, up to 248 characters. */
} Bluetooth_Device_t;
-
+
/** Bluetooth stack state information structure, for the containment of the Bluetooth stack state. The values in
* this structure are set by the Bluetooth stack internally, and should all be treated as read only by the user
* application.
@@ -139,12 +139,12 @@
*/
uint8_t LocalBDADDR[6]; /**< Local Bluetooth adapter's BDADDR, valid when the stack is fully initialized. */
} Bluetooth_Stack_State_t;
-
+
/* Includes: */
#include "BluetoothHCICommands.h"
- #include "BluetoothACLPackets.h"
-
- /* Function Prototypes: */
+ #include "BluetoothACLPackets.h"
+
+ /* Function Prototypes: */
void Bluetooth_Stack_Init(void);
void Bluetooth_Stack_USBTask(void);
@@ -171,3 +171,4 @@
extern Bluetooth_Stack_State_t Bluetooth_State;
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
index 2638dee35..636b5a454 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -124,7 +124,7 @@ void RFCOMM_ProcessPacket(void* Data,
const RFCOMM_Header_t* FrameHeader = (const RFCOMM_Header_t*)Data;
const uint8_t* FrameData = (const uint8_t*)Data + sizeof(RFCOMM_Header_t);
uint16_t FrameDataLen = RFCOMM_GetVariableFieldValue(&FrameData);
-
+
/* Decode the RFCOMM frame type from the header */
switch (FrameHeader->Control & ~FRAME_POLL_FINAL)
{
@@ -167,7 +167,7 @@ void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel,
uint8_t Length;
RFCOMM_MSC_Parameters_t Params;
} MSCommand;
-
+
MSCommand.CommandHeader = (RFCOMM_Command_t){.Command = RFCOMM_Control_ModemStatus, .EA = true, .CR = true};
MSCommand.Length = (sizeof(MSCommand.Params) << 1) | 0x01;
MSCommand.Params.Channel = (RFCOMM_Address_t){.DLCI = RFCOMMChannel->DLCI, .EA = true, .CR = true};
@@ -175,7 +175,7 @@ void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel,
MSCommand.Params.BreakSignal = RFCOMMChannel->Local.BreakSignal;
/* Send the MSC command to the remote device */
- RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, true, RFCOMM_Frame_UIH, sizeof(MSCommand), &MSCommand, ACLChannel);
+ RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, true, RFCOMM_Frame_UIH, sizeof(MSCommand), &MSCommand, ACLChannel);
}
/** Sends new data through an open logical RFCOMM channel. This should be used to transmit data through a
@@ -193,12 +193,12 @@ void RFCOMM_SendData(const uint16_t DataLen,
{
if (RFCOMMChannel->State != RFCOMM_Channel_Open)
return;
-
+
BT_RFCOMM_DEBUG(1, ">> UIH Frame");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", RFCOMMChannel->DLCI);
/* Send the MSC command to the remote device */
- RFCOMM_SendFrame(RFCOMMChannel->DLCI, false, RFCOMM_Frame_UIH, DataLen, Data, ACLChannel);
+ RFCOMM_SendFrame(RFCOMMChannel->DLCI, false, RFCOMM_Frame_UIH, DataLen, Data, ACLChannel);
}
RFCOMM_Channel_t* RFCOMM_GetFreeChannelEntry(const uint8_t DLCI)
@@ -220,11 +220,11 @@ RFCOMM_Channel_t* RFCOMM_GetFreeChannelEntry(const uint8_t DLCI)
RFCOMMChannel->Local.Signals = RFCOMM_SIGNAL_RTC | RFCOMM_SIGNAL_RTR | RFCOMM_SIGNAL_DV | (1 << 0);
RFCOMMChannel->Local.BreakSignal = 0 | (1 << 0);
RFCOMMChannel->ConfigFlags = 0;
-
+
return RFCOMMChannel;
}
}
-
+
return NULL;
}
@@ -234,7 +234,7 @@ RFCOMM_Channel_t* RFCOMM_GetChannelData(const uint8_t DLCI)
for (uint8_t i = 0; i < RFCOMM_MAX_OPEN_CHANNELS; i++)
{
RFCOMM_Channel_t* CurrRFCOMMChannel = &RFCOMM_Channels[i];
-
+
/* If the current non-closed channel's DLCI matches the search DLCI, return it to the caller */
if ((CurrRFCOMMChannel->State != RFCOMM_Channel_Closed) && (CurrRFCOMMChannel->DLCI == DLCI))
return CurrRFCOMMChannel;
@@ -248,10 +248,10 @@ uint16_t RFCOMM_GetVariableFieldValue(const uint8_t** BufferPos)
{
uint8_t FirstOctet;
uint8_t SecondOctet = 0;
-
+
FirstOctet = **BufferPos;
(*BufferPos)++;
-
+
/* If the field size is more than a single byte, fetch the next byte in the variable length field */
if (!(FirstOctet & 0x01))
{
@@ -281,30 +281,30 @@ void RFCOMM_SendFrame(const uint8_t DLCI,
uint8_t Data[DataLen];
uint8_t FCS;
} ResponsePacket;
-
+
/* Set the frame header values to the specified address and frame type */
ResponsePacket.FrameHeader.Control = Control;
ResponsePacket.FrameHeader.Address = (RFCOMM_Address_t){.DLCI = DLCI, .EA = true, .CR = CommandResponse};
-
+
/* Set the lower 7 bits of the packet length */
ResponsePacket.Size[0] = (DataLen << 1);
-
+
/* Terminate the size field if size is 7 bits or lower, otherwise set the upper 8 bits of the length */
if (DataLen < 128)
ResponsePacket.Size[0] |= 0x01;
else
ResponsePacket.Size[1] = (DataLen >> 7);
-
+
/* Copy over the packet data from the source buffer to the response packet buffer */
memcpy(ResponsePacket.Data, Data, DataLen);
-
+
/* Determine the length of the frame which is to be used to calculate the CRC value */
uint8_t CRCLength = sizeof(ResponsePacket.FrameHeader);
/* UIH frames do not have the CRC calculated on the Size field in the response, all other frames do */
if ((Control & ~FRAME_POLL_FINAL) != RFCOMM_Frame_UIH)
CRCLength += sizeof(ResponsePacket.Size);
-
+
/* Calculate the frame checksum from the appropriate fields */
ResponsePacket.FCS = RFCOMM_GetFCSValue(&ResponsePacket, CRCLength);
@@ -316,7 +316,7 @@ static uint8_t RFCOMM_GetFCSValue(const void* FrameStart,
uint8_t Length)
{
uint8_t FCS = 0xFF;
-
+
/* Calculate new Frame CRC value via the given data bytes and the CRC table */
for (uint8_t i = 0; i < Length; i++)
FCS = pgm_read_byte(&CRC8_Table[FCS ^ ((const uint8_t*)FrameStart)[i]]);
@@ -338,7 +338,7 @@ static void RFCOMM_ProcessDISC(const RFCOMM_Address_t* const FrameAddress,
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", FrameAddress->DLCI);
RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(FrameAddress->DLCI);
-
+
/* If the requested channel is currently open, destroy it */
if (RFCOMMChannel != NULL)
RFCOMMChannel->State = RFCOMM_Channel_Closed;
@@ -356,7 +356,7 @@ static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress,
if (FrameAddress->DLCI == RFCOMM_CONTROL_DLCI)
{
BT_RFCOMM_DEBUG(1, ">> UA Sent");
-
+
/* Free channel found, or request was to the control channel - accept SABM by sending a UA frame */
RFCOMM_SendFrame(FrameAddress->DLCI, true, (RFCOMM_Frame_UA | FRAME_POLL_FINAL), 0, NULL, ACLChannel);
@@ -365,7 +365,7 @@ static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress,
/* Find the existing channel's entry in the channel table */
RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(FrameAddress->DLCI);
-
+
/* Existing entry not found, create a new entry for the channel */
if (RFCOMMChannel == NULL)
RFCOMMChannel = RFCOMM_GetFreeChannelEntry(FrameAddress->DLCI);
@@ -374,7 +374,7 @@ static void RFCOMM_ProcessSABM(const RFCOMM_Address_t* const FrameAddress,
if (RFCOMMChannel != NULL)
{
BT_RFCOMM_DEBUG(1, ">> UA Sent");
-
+
/* Free channel found, or request was to the control channel - accept SABM by sending a UA frame */
RFCOMM_SendFrame(FrameAddress->DLCI, true, (RFCOMM_Frame_UA | FRAME_POLL_FINAL), 0, NULL, ACLChannel);
}
@@ -395,7 +395,7 @@ static void RFCOMM_ProcessUA(const RFCOMM_Address_t* const FrameAddress,
}
static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress,
- const uint16_t FrameLength,
+ const uint16_t FrameLength,
const uint8_t* FrameData,
Bluetooth_Channel_t* const ACLChannel)
{
@@ -408,9 +408,10 @@ static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress,
BT_RFCOMM_DEBUG(1, "<< UIH Received");
BT_RFCOMM_DEBUG(2, "-- DLCI 0x%02X", FrameAddress->DLCI);
BT_RFCOMM_DEBUG(2, "-- Length 0x%02X", FrameLength);
-
+
RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(FrameAddress->DLCI);
-
+
if (RFCOMMChannel != NULL)
RFCOMM_DataReceived(RFCOMMChannel, FrameLength, FrameData);
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h
index 7b74f4fab..be862a2b3 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMM.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,13 +48,13 @@
#include "BluetoothStack.h"
#include "RFCOMMControl.h"
-
+
/* Macros: */
#define BT_RFCOMM_DEBUG(l, s, ...) do { if (RFCOMM_DEBUG_LEVEL >= l) printf_P(PSTR("(RFCOMM) " s "\r\n"), ##__VA_ARGS__); } while (0)
#define RFCOMM_DEBUG_LEVEL 0
-
+
#define FRAME_POLL_FINAL (1 << 4)
-
+
#define RFCOMM_CONTROL_DLCI 0
#define RFCOMM_MAX_OPEN_CHANNELS 5
@@ -68,14 +68,14 @@
RFCOMM_Frame_UA = 0x63, /**< Unnumbered Acknowledgement Field */
RFCOMM_Frame_UIH = 0xEF, /**< Unnumbered Information with Header check Field */
};
-
+
enum RFCOMM_Channel_States_t
{
RFCOMM_Channel_Closed = 0,
RFCOMM_Channel_Configure = 1,
RFCOMM_Channel_Open = 2,
};
-
+
/* Type Defines: */
typedef struct
{
@@ -95,7 +95,7 @@
uint8_t BreakSignal;
} Local;
} RFCOMM_Channel_t;
-
+
/* External Variables: */
extern RFCOMM_Channel_t RFCOMM_Channels[RFCOMM_MAX_OPEN_CHANNELS];
@@ -104,7 +104,7 @@
void RFCOMM_ServiceChannels(Bluetooth_Channel_t* const ACLChannel);
void RFCOMM_ProcessPacket(void* Data,
Bluetooth_Channel_t* const ACLChannel);
-
+
void RFCOMM_SendChannelSignals(const RFCOMM_Channel_t* const RFCOMMChannel,
Bluetooth_Channel_t* const ACLChannel);
void RFCOMM_SendData(const uint16_t DataLen,
@@ -141,9 +141,10 @@
static void RFCOMM_ProcessUA(const RFCOMM_Address_t* const FrameAddress,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessUIH(const RFCOMM_Address_t* const FrameAddress,
- const uint16_t FrameLength,
+ const uint16_t FrameLength,
const uint8_t* FrameData,
Bluetooth_Channel_t* const ACLChannel);
#endif
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
index 5bd884572..871d3627f 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -69,7 +69,7 @@ void RFCOMM_ProcessControlCommand(const uint8_t* Command,
RFCOMM_ProcessDPNCommand(CommandHeader, CommandData, ACLChannel);
break;
default:
- BT_RFCOMM_DEBUG(1, "<< Unknown Command");
+ BT_RFCOMM_DEBUG(1, "<< Unknown Command");
break;
}
}
@@ -82,7 +82,7 @@ static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeade
const uint8_t* Params = (const uint8_t*)CommandData;
BT_RFCOMM_DEBUG(1, "<< TEST Command");
-
+
struct
{
RFCOMM_Command_t CommandHeader;
@@ -94,7 +94,7 @@ static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeade
TestResponse.CommandHeader = (RFCOMM_Command_t){.Command = RFCOMM_Control_Test, .EA = true, .CR = false};
TestResponse.Length = (CommandDataLen << 1) | 0x01;
memcpy(TestResponse.TestData, Params, CommandDataLen);
-
+
BT_RFCOMM_DEBUG(1, ">> TEST Response");
/* Send the PDN response to acknowledge the command */
@@ -124,14 +124,14 @@ static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader
BT_RFCOMM_DEBUG(1, "<< MSC %s", (CommandHeader->CR) ? "Command" : "Response");
BT_RFCOMM_DEBUG(2, "-- DLCI: 0x%02X", Params->Channel.DLCI);
-
+
/* Ignore status flags sent to the control channel */
if (Params->Channel.DLCI == RFCOMM_CONTROL_DLCI)
return;
-
+
/* Retrieve existing channel configuration data, if already opened */
- RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(Params->Channel.DLCI);
-
+ RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(Params->Channel.DLCI);
+
/* If the channel does not exist, abort */
if (RFCOMMChannel == NULL)
return;
@@ -140,16 +140,16 @@ static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader
if (CommandHeader->CR)
{
/* Save the new channel signals to the channel state structure */
- RFCOMMChannel->Remote.Signals = Params->Signals;
+ RFCOMMChannel->Remote.Signals = Params->Signals;
RFCOMMChannel->ConfigFlags |= RFCOMM_CONFIG_REMOTESIGNALS;
-
+
/* If the command contains the optional break signals field, store the value */
if (CommandDataLen == sizeof(RFCOMM_MSC_Parameters_t))
RFCOMMChannel->Remote.BreakSignal = Params->BreakSignal;
/* Notify the user application that the signals have been received */
RFCOMM_ChannelSignalsReceived(RFCOMMChannel);
-
+
struct
{
RFCOMM_Command_t CommandHeader;
@@ -172,7 +172,7 @@ static void RFCOMM_ProcessMSCCommand(const RFCOMM_Command_t* const CommandHeader
{
/* Indicate that the remote device has acknowledged the sent signals */
RFCOMMChannel->ConfigFlags |= RFCOMM_CONFIG_LOCALSIGNALS;
- }
+ }
}
static void RFCOMM_ProcessRPNCommand(const RFCOMM_Command_t* const CommandHeader,
@@ -197,20 +197,20 @@ static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader
BT_RFCOMM_DEBUG(1, "<< DPN Command");
BT_RFCOMM_DEBUG(2, "-- DLCI: 0x%02X", Params->DLCI);
-
+
/* Ignore parameter negotiations to the control channel */
if (Params->DLCI == RFCOMM_CONTROL_DLCI)
return;
-
+
/* Retrieve existing channel configuration data, if already opened */
RFCOMM_Channel_t* RFCOMMChannel = RFCOMM_GetChannelData(Params->DLCI);
-
+
/* Check if the channel has no corresponding entry - remote did not open it first */
if (RFCOMMChannel == NULL)
{
/* Create a new entry in the channel table for the new channel */
RFCOMMChannel = RFCOMM_GetFreeChannelEntry(Params->DLCI);
-
+
/* No free entry was found, discard the request */
if (RFCOMMChannel == NULL)
{
@@ -218,27 +218,28 @@ static void RFCOMM_ProcessDPNCommand(const RFCOMM_Command_t* const CommandHeader
return;
}
}
-
+
/* Save the new channel configuration */
RFCOMMChannel->State = RFCOMM_Channel_Configure;
RFCOMMChannel->Priority = Params->Priority;
RFCOMMChannel->MTU = Params->MaximumFrameSize;
-
+
struct
{
RFCOMM_Command_t CommandHeader;
uint8_t Length;
RFCOMM_DPN_Parameters_t Params;
} DPNResponse;
-
+
/* Fill out the DPN response data */
DPNResponse.CommandHeader = (RFCOMM_Command_t){.Command = RFCOMM_Control_DLCParameterNegotiation, .EA = true, .CR = false};
DPNResponse.Length = (sizeof(DPNResponse.Params) << 1) | 0x01;
memcpy(&DPNResponse.Params, Params, sizeof(RFCOMM_DPN_Parameters_t));
DPNResponse.Params.ConvergenceLayer = 0x00; // TODO: Enable credit based transaction support
-
+
BT_RFCOMM_DEBUG(1, ">> DPN Response");
/* Send the DPN response to acknowledge the command */
RFCOMM_SendFrame(RFCOMM_CONTROL_DLCI, false, RFCOMM_Frame_UIH, sizeof(DPNResponse), &DPNResponse, ACLChannel);
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h
index b527bfa7c..b65e0d5a0 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/RFCOMMControl.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,14 +48,14 @@
#include "BluetoothStack.h"
#include "RFCOMM.h"
-
+
/* Macros: */
#define RFCOMM_SIGNAL_FC (1 << 1)
#define RFCOMM_SIGNAL_RTC (1 << 2)
#define RFCOMM_SIGNAL_RTR (1 << 3)
#define RFCOMM_SIGNAL_IC (1 << 6)
#define RFCOMM_SIGNAL_DV (1 << 7)
-
+
#define RFCOMM_CONFIG_REMOTESIGNALS (1 << 0)
#define RFCOMM_CONFIG_LOCALSIGNALS (1 << 1)
#define RFCOMM_CONFIG_LOCALSIGNALSSENT (1 << 2)
@@ -73,7 +73,7 @@
RFCOMM_Control_DLCParameterNegotiation = (0x80 >> 2),
RFCOMM_Control_NonSupportedCommand = (0x10 >> 2),
};
-
+
/* Type Defines: */
typedef struct
{
@@ -94,7 +94,7 @@
unsigned char CR : 1;
unsigned char Command : 6;
} RFCOMM_Command_t;
-
+
typedef struct
{
uint8_t DLCI;
@@ -104,9 +104,9 @@
uint8_t ACKTimerTicks;
uint16_t MaximumFrameSize;
uint8_t MaxRetransmissions;
- uint8_t RecoveryWindowSize;
+ uint8_t RecoveryWindowSize;
} RFCOMM_DPN_Parameters_t;
-
+
typedef struct
{
RFCOMM_Address_t Channel;
@@ -120,7 +120,7 @@
#if defined(INCLUDE_FROM_RFCOMM_CONTROL_C)
static void RFCOMM_ProcessTestCommand(const RFCOMM_Command_t* const CommandHeader,
- const uint8_t CommandDataLen,
+ const uint8_t CommandDataLen,
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
static void RFCOMM_ProcessFCECommand(const RFCOMM_Command_t* const CommandHeader,
@@ -143,5 +143,6 @@
const uint8_t* CommandData,
Bluetooth_Channel_t* const ACLChannel);
#endif
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c
index 19d42e264..3c1acfe28 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -73,7 +73,7 @@ void SDP_ProcessPacket(void* Data, Bluetooth_Channel_t* const Channel)
{
case SDP_PDU_SERVICESEARCHREQUEST:
SDP_ProcessServiceSearch(SDPHeader, Channel);
- break;
+ break;
case SDP_PDU_SERVICEATTRIBUTEREQUEST:
SDP_ProcessServiceAttribute(SDPHeader, Channel);
break;
@@ -99,11 +99,11 @@ static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader,
uint8_t UUIDList[12][UUID_SIZE_BYTES];
uint8_t TotalUUIDs = SDP_GetUUIDList(UUIDList, &CurrentParameter);
BT_SDP_DEBUG(2, "-- Total UUIDs: %d", TotalUUIDs);
-
+
/* Retrieve the maximum service record response count from the request */
uint16_t MaxServiceRecordCount = SDP_ReadData16(&CurrentParameter);
BT_SDP_DEBUG(2, "-- Max Return Service Count: 0x%04X", MaxServiceRecordCount);
-
+
struct
{
SDP_PDUHeader_t SDPHeader;
@@ -111,7 +111,7 @@ static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader,
uint16_t CurrentServiceRecordCount;
uint8_t ResponseData[100];
} ResponsePacket;
-
+
uint8_t AddedServiceHandles = 0;
/* Create a pointer to the buffer to indicate the current location for response data to be added */
@@ -136,7 +136,7 @@ static void SDP_ProcessServiceSearch(const SDP_PDUHeader_t* const SDPHeader,
uint8_t AttrSize = SDP_GetLocalAttributeContainerSize(AttributeValue, &AttrHeaderSize);
memcpy_P(CurrResponsePos, AttributeValue + AttrHeaderSize, AttrSize);
CurrResponsePos += AttrHeaderSize + AttrSize;
-
+
AddedServiceHandles++;
}
@@ -180,11 +180,11 @@ static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader,
/* Retrieve the service handle whose attributes are to be examined */
uint32_t ServiceHandle = SDP_ReadData32(&CurrentParameter);
BT_SDP_DEBUG(2, "-- Service Handle: 0x%08lX", ServiceHandle);
-
+
/* Retrieve the maximum Attribute response size from the request */
uint16_t MaxAttributeSize = SDP_ReadData16(&CurrentParameter);
BT_SDP_DEBUG(2, "-- Max Return Attribute Bytes: 0x%04X", MaxAttributeSize);
-
+
/* Retrieve the list of Attributes from the request */
uint16_t AttributeList[8][2];
uint8_t TotalAttributes = SDP_GetAttributeList(AttributeList, &CurrentParameter);
@@ -211,24 +211,24 @@ static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader,
{
/* Read in a pointer to the current UUID table entry's Attribute table */
ServiceAttributeTable_t* CurrAttributeTable = pgm_read_ptr(&SDP_Services_Table[CurrTableItem]);
-
+
/* Retrieve a PROGMEM pointer to the value of the Service Record Handle */
const void* ServiceRecord = SDP_GetAttributeValue(CurrAttributeTable, SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE);
-
+
/* Get the size of the header for the Service Record Handle */
uint8_t AttrHeaderSize;
SDP_GetLocalAttributeContainerSize(ServiceRecord, &AttrHeaderSize);
-
+
/* Retrieve the endian-swapped service handle of the current service being examined */
uint32_t CurrServiceHandle = SwapEndian_32(pgm_read_dword(ServiceRecord + AttrHeaderSize));
-
+
/* Check if the current service in the service table has the requested service handle */
if (ServiceHandle == CurrServiceHandle)
{
/* Add the listed attributes for the found UUID to the response */
TotalResponseSize = SDP_AddListedAttributesToResponse(CurrAttributeTable, AttributeList, TotalAttributes,
&CurrResponsePos);
-
+
/* Requested service found, abort the search through the service table */
break;
}
@@ -243,7 +243,7 @@ static void SDP_ProcessServiceAttribute(const SDP_PDUHeader_t* const SDPHeader,
/* Calculate the total parameter length that is to be sent, including the fixed return parameters, the created attribute
value list and the SDP continuation state */
uint16_t ParamLength = (sizeof(ResponsePacket.AttributeListByteCount) + TotalResponseSize + sizeof(uint8_t));
-
+
/* Fill in the response packet's header */
ResponsePacket.SDPHeader.PDU = SDP_PDU_SERVICEATTRIBUTERESPONSE;
ResponsePacket.SDPHeader.TransactionID = SDPHeader->TransactionID;
@@ -265,30 +265,30 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe
Bluetooth_Channel_t* const Channel)
{
const void* CurrentParameter = ((const void*)SDPHeader + sizeof(SDP_PDUHeader_t));
-
+
BT_SDP_DEBUG(1, "<< Service Search Attribute");
/* Retrieve the list of search UUIDs from the request */
uint8_t UUIDList[12][UUID_SIZE_BYTES];
uint8_t TotalUUIDs = SDP_GetUUIDList(UUIDList, &CurrentParameter);
BT_SDP_DEBUG(2, "-- Total UUIDs: %d", TotalUUIDs);
-
+
/* Retrieve the maximum Attribute response size from the request */
uint16_t MaxAttributeSize = SDP_ReadData16(&CurrentParameter);
BT_SDP_DEBUG(2, "-- Max Return Attribute Bytes: 0x%04X", MaxAttributeSize);
-
+
/* Retrieve the list of Attributes from the request */
uint16_t AttributeList[8][2];
uint8_t TotalAttributes = SDP_GetAttributeList(AttributeList, &CurrentParameter);
BT_SDP_DEBUG(2, "-- Total Attributes: %d", TotalAttributes);
-
+
struct
{
SDP_PDUHeader_t SDPHeader;
uint16_t AttributeListByteCount;
uint8_t ResponseData[100];
} ResponsePacket;
-
+
/* Create a pointer to the buffer to indicate the current location for response data to be added */
void* CurrResponsePos = ResponsePacket.ResponseData;
@@ -298,7 +298,7 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe
/* Add the outer Data Element Sequence header for all of the retrieved Attributes */
uint16_t* TotalResponseSize = SDP_AddSequence16(&CurrResponsePos);
-
+
/* Search through the global service list an item at a time */
for (uint8_t CurrTableItem = 0; CurrTableItem < (sizeof(SDP_Services_Table) / sizeof(void*)); CurrTableItem++)
{
@@ -307,14 +307,14 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe
if (!(SDP_SearchServiceTable(UUIDList, TotalUUIDs, CurrAttributeTable)))
continue;
-
+
BT_SDP_DEBUG(2, " -- Found search match in table");
/* Add the listed attributes for the found UUID to the response */
- *TotalResponseSize += SDP_AddListedAttributesToResponse(CurrAttributeTable, AttributeList, TotalAttributes,
+ *TotalResponseSize += SDP_AddListedAttributesToResponse(CurrAttributeTable, AttributeList, TotalAttributes,
&CurrResponsePos);
}
-
+
/* Continuation state - always zero */
SDP_WriteData8(&CurrResponsePos, 0);
@@ -323,7 +323,7 @@ static void SDP_ProcessServiceSearchAttribute(const SDP_PDUHeader_t* const SDPHe
/* Calculate the total parameter length that is to be sent, including the fixed return parameters, the created attribute
value list and the SDP continuation state */
- uint16_t ParamLength = (sizeof(ResponsePacket.AttributeListByteCount) +
+ uint16_t ParamLength = (sizeof(ResponsePacket.AttributeListByteCount) +
(3 + *TotalResponseSize) +
sizeof(uint8_t));
@@ -366,7 +366,7 @@ static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t*
{
uint16_t* AttributeIDRange = AttributeList[CurrAttribute];
void* AttributeValue;
-
+
/* Look through the current service's attribute list, examining all the attributes */
while ((AttributeValue = pgm_read_ptr(&AttributeTable->Data)) != NULL)
{
@@ -377,9 +377,9 @@ static uint16_t SDP_AddListedAttributesToResponse(const ServiceAttributeTable_t*
if ((CurrAttributeID >= AttributeIDRange[0]) && (CurrAttributeID <= AttributeIDRange[1]))
{
/* Increment the current UUID's returned Attribute container size by the number of added bytes */
- *AttributeListSize += SDP_AddAttributeToResponse(CurrAttributeID, AttributeValue, BufferPos);
+ *AttributeListSize += SDP_AddAttributeToResponse(CurrAttributeID, AttributeValue, BufferPos);
}
-
+
AttributeTable++;
}
}
@@ -408,19 +408,19 @@ static uint16_t SDP_AddAttributeToResponse(const uint16_t AttributeID,
/* Retrieve the size of the attribute value from its container header */
uint8_t AttributeHeaderLength;
uint16_t AttributeValueLength = SDP_GetLocalAttributeContainerSize(AttributeValue, &AttributeHeaderLength);
-
+
BT_SDP_DEBUG(2, " -- Add Attribute (0x%04X) 0x%04X", (AttributeHeaderLength + AttributeValueLength), AttributeID);
/* Add a Data Element header to the response for the Attribute ID */
SDP_WriteData8(ResponseBuffer, (SDP_DATATYPE_UnsignedInt | SDP_DATASIZE_16Bit));
-
+
/* Add the Attribute ID to the created Data Element */
SDP_WriteData16(ResponseBuffer, AttributeID);
-
+
/* Copy over the Attribute value Data Element container to the response */
memcpy_P(*ResponseBuffer, AttributeValue, AttributeHeaderLength + AttributeValueLength);
*ResponseBuffer += AttributeHeaderLength + AttributeValueLength;
-
+
return (sizeof(uint8_t) + sizeof(uint16_t) + AttributeHeaderLength + AttributeValueLength);
}
@@ -435,17 +435,17 @@ static void* SDP_GetAttributeValue(const ServiceAttributeTable_t* AttributeTable
const uint16_t AttributeID)
{
void* CurrTableItemData;
-
+
/* Search through the current Attribute table, abort when the terminator item has been reached */
while ((CurrTableItemData = pgm_read_ptr(&AttributeTable->Data)) != NULL)
{
/* Check if the current Attribute ID matches the search ID - if so return a pointer to it */
if (pgm_read_word(&AttributeTable->AttributeID) == AttributeID)
return CurrTableItemData;
-
+
AttributeTable++;
}
-
+
return NULL;
}
@@ -463,7 +463,7 @@ static bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES],
{
const void* CurrAttribute;
uint16_t UUIDMatchFlags = 0;
-
+
/* Search through the current attribute table, checking each attribute value for UUID matches */
while ((CurrAttribute = pgm_read_ptr(&CurrAttributeTable->Data)) != NULL)
{
@@ -475,7 +475,7 @@ static bool SDP_SearchServiceTable(uint8_t UUIDList[][UUID_SIZE_BYTES],
uint8_t UUIDMatches;
for (UUIDMatches = 0; UUIDMatchFlags; UUIDMatches++)
UUIDMatchFlags &= (UUIDMatchFlags - 1);
-
+
/* If all UUIDs have been matched to the current service, return true */
return (UUIDMatches == TotalUUIDs);
}
@@ -501,7 +501,7 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
if (CurrAttributeType == SDP_DATATYPE_UUID)
{
uint16_t CurrUUIDMatchMask = (1 << 0);
-
+
/* Look for matches in the UUID list against the current attribute UUID value */
for (uint8_t i = 0; i < TotalUUIDs; i++)
{
@@ -512,7 +512,7 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
*UUIDMatchFlags |= CurrUUIDMatchMask;
break;
}
-
+
CurrUUIDMatchMask <<= 1;
}
}
@@ -520,15 +520,15 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
{
uint8_t SequenceHeaderSize;
uint16_t SequenceSize = SDP_GetLocalAttributeContainerSize(CurrAttribute, &SequenceHeaderSize);
-
+
CurrAttribute += SequenceHeaderSize;
-
+
/* Recursively unwrap the sequence container, and re-search its contents for UUIDs */
while (SequenceSize)
{
uint8_t InnerHeaderSize;
uint16_t InnerSize = SDP_GetLocalAttributeContainerSize(CurrAttribute, &InnerHeaderSize);
-
+
/* Recursively search of the next element in the sequence, trying to match UUIDs with the UUID list */
SDP_CheckUUIDMatch(UUIDList, TotalUUIDs, UUIDMatchFlags, CurrAttribute);
@@ -536,10 +536,10 @@ static void SDP_CheckUUIDMatch(uint8_t UUIDList[][UUID_SIZE_BYTES],
SequenceSize -= InnerHeaderSize + InnerSize;
CurrAttribute += InnerHeaderSize + InnerSize;
}
- }
+ }
}
-/** Reads in the collection of Attribute ranges from the input buffer's Data Element Sequence container, into the given
+/** Reads in the collection of Attribute ranges from the input buffer's Data Element Sequence container, into the given
* Attribute list for later use. Once complete, the input buffer pointer is advanced to the end of the Attribute container.
*
* \param[out] AttributeList Pointer to a buffer where the list of Attribute ranges are to be stored
@@ -561,10 +561,10 @@ static uint8_t SDP_GetAttributeList(uint16_t AttributeList[][2],
/* Retrieve the size of the next Attribute in the container and get a pointer to the next free Attribute element in the list */
uint16_t* CurrentAttributeRange = AttributeList[TotalAttributes++];
uint8_t AttributeLength = SDP_GetDataElementSize(CurrentParameter, &ElementHeaderSize);
-
+
/* Copy over the starting Attribute ID and (if it the current element is a range) the ending Attribute ID */
memcpy(&CurrentAttributeRange[0], *CurrentParameter, AttributeLength);
-
+
/* If the element is not an Attribute Range, copy over the starting ID to the ending ID to make a range of 1 */
if (AttributeLength == 2)
CurrentAttributeRange[1] = CurrentAttributeRange[0];
@@ -574,15 +574,15 @@ static uint8_t SDP_GetAttributeList(uint16_t AttributeList[][2],
CurrentAttributeRange[1] = SwapEndian_16(CurrentAttributeRange[1]);
BT_SDP_DEBUG(2, "-- Attribute: 0x%04X-0x%04X", CurrentAttributeRange[0], CurrentAttributeRange[1]);
-
+
AttributeIDListLength -= (AttributeLength + ElementHeaderSize);
*CurrentParameter += AttributeLength;
}
-
+
return TotalAttributes;
}
-/** Reads in the collection of UUIDs from the input buffer's Data Element Sequence container, into the given
+/** Reads in the collection of UUIDs from the input buffer's Data Element Sequence container, into the given
* UUID list for later use. Once complete, the input buffer pointer is advanced to the end of the UUID container.
*
* \param[out] UUIDList Pointer to a buffer where the list of UUIDs are to be stored
@@ -604,7 +604,7 @@ static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES],
/* Retrieve the size of the next UUID in the container and get a pointer to the next free UUID element in the list */
uint8_t* CurrentUUID = UUIDList[TotalUUIDs++];
uint8_t UUIDLength = SDP_GetDataElementSize(CurrentParameter, &ElementHeaderSize);
-
+
/* Copy over UUID from the container to the free slot */
if (UUIDLength <= 4)
{
@@ -617,9 +617,9 @@ static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES],
else
{
/* Copy over full UUID */
- memcpy(CurrentUUID, *CurrentParameter, UUIDLength);
+ memcpy(CurrentUUID, *CurrentParameter, UUIDLength);
}
-
+
BT_SDP_DEBUG(2, "-- UUID (%d): %02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
UUIDLength,
CurrentUUID[0], CurrentUUID[1], CurrentUUID[2], CurrentUUID[3],
@@ -631,7 +631,7 @@ static uint8_t SDP_GetUUIDList(uint8_t UUIDList[][UUID_SIZE_BYTES],
ServicePatternLength -= (UUIDLength + ElementHeaderSize);
*CurrentParameter += UUIDLength;
}
-
+
return TotalUUIDs;
}
@@ -647,7 +647,7 @@ static uint32_t SDP_GetLocalAttributeContainerSize(const void* const AttributeDa
{
/* Fetch the size of the Data Element structure from the header */
uint8_t SizeIndex = (pgm_read_byte(AttributeData) & 0x07);
-
+
uint32_t ElementValueSize;
/* Convert the Data Element size index into a size in bytes */
@@ -686,7 +686,7 @@ static uint32_t SDP_GetDataElementSize(const void** const DataElementHeader,
uint8_t* const ElementHeaderSize)
{
/* Fetch the size of the Data Element structure from the header, increment the current buffer pos */
- uint8_t SizeIndex = (SDP_ReadData8(DataElementHeader) & 0x07);
+ uint8_t SizeIndex = (SDP_ReadData8(DataElementHeader) & 0x07);
uint32_t ElementValueSize;
@@ -710,6 +710,7 @@ static uint32_t SDP_GetDataElementSize(const void** const DataElementHeader,
ElementValueSize = (1 << SizeIndex);
break;
}
-
+
return ElementValueSize;
}
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h
index 2df8c225d..733889a4d 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDP.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,11 +48,11 @@
#include "BluetoothStack.h"
#include "SDPServices.h"
-
+
/* Macros: */
#define BT_SDP_DEBUG(l, s, ...) do { if (SDP_DEBUG_LEVEL >= l) printf_P(PSTR("(SDP) " s "\r\n"), ##__VA_ARGS__); } while (0)
#define SDP_DEBUG_LEVEL 0
-
+
#define SDP_PDU_ERRORRESPONSE 0x01
#define SDP_PDU_SERVICESEARCHREQUEST 0x02
#define SDP_PDU_SERVICESEARCHRESPONSE 0x03
@@ -103,7 +103,7 @@
uint16_t TransactionID; /**< Unique transaction ID number to associate requests and responses */
uint16_t ParameterLength; /**< Length of the data following the SDP header */
} SDP_PDUHeader_t;
-
+
/* Inline Functions: */
/** Writes 8 bits of raw data to the given buffer, incrementing the buffer position afterwards.
*
@@ -116,7 +116,7 @@
*((uint8_t*)*BufferPos) = Data;
*BufferPos += sizeof(uint8_t);
}
-
+
/** Writes 16 bits of raw data to the given buffer, incrementing the buffer position afterwards.
*
* \param[in, out] BufferPos Current position in the buffer where the data is to be written to
@@ -127,7 +127,7 @@
{
*((uint16_t*)*BufferPos) = SwapEndian_16(Data);
*BufferPos += sizeof(uint16_t);
- }
+ }
/** Writes 32 bits of raw data to the given buffer, incrementing the buffer position afterwards.
*
@@ -151,7 +151,7 @@
{
uint8_t Data = *((const uint8_t*)*BufferPos);
*BufferPos += sizeof(uint8_t);
-
+
return Data;
}
@@ -165,7 +165,7 @@
{
uint16_t Data = SwapEndian_16(*((const uint16_t*)*BufferPos));
*BufferPos += sizeof(uint16_t);
-
+
return Data;
}
@@ -179,13 +179,13 @@
{
uint32_t Data = SwapEndian_32(*((const uint32_t*)*BufferPos));
*BufferPos += sizeof(uint32_t);
-
+
return Data;
}
- /** Adds a new Data Element Sequence container with a 16-bit size header to the buffer. The buffer
+ /** Adds a new Data Element Sequence container with a 16-bit size header to the buffer. The buffer
* pointer's position is advanced past the added header once the element has been added. The returned
- * size header value is pre-zeroed out so that it can be incremented as data is placed into the Data
+ * size header value is pre-zeroed out so that it can be incremented as data is placed into the Data
* Element Sequence container.
*
* The total added size of the container header is three bytes, regardless of the size of its contents
@@ -199,12 +199,12 @@
{
SDP_WriteData8(BufferPos, (SDP_DATASIZE_Variable16Bit | SDP_DATATYPE_Sequence));
- uint16_t* SizePos = *BufferPos;
+ uint16_t* SizePos = *BufferPos;
SDP_WriteData16(BufferPos, 0);
return SizePos;
}
-
+
/* Function Prototypes: */
void SDP_ProcessPacket(void* Data,
Bluetooth_Channel_t* const Channel);
@@ -247,3 +247,4 @@
#endif
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c
index 93f5519fe..9f7855e63 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -181,3 +181,4 @@ const ServiceAttributeTable_t PROGMEM SerialPort_Attribute_Table[] =
SERVICE_ATTRIBUTE_TABLE_TERMINATOR
};
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h
index afa8e0024..3ec95c4d1 100644
--- a/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h
+++ b/Demos/Host/Incomplete/BluetoothHost/Lib/SDPServices.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,22 +35,22 @@
#ifndef _SDPSERVICES_H_
#define _SDPSERVICES_H_
-
+
/* Includes: */
#include "SDP.h"
/* Macros: */
/** Size of a full 128 bit UUID, in bytes. */
#define UUID_SIZE_BYTES 16
-
+
/** First 80 bits common to all standardized Bluetooth services. */
#define BASE_80BIT_UUID 0x0000, 0x0010, 0x0080, {0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}
-
+
#define RFCOMM_UUID {SWAPENDIAN_32(0x00000003), BASE_80BIT_UUID}
#define L2CAP_UUID {SWAPENDIAN_32(0x00000100), BASE_80BIT_UUID}
#define SP_CLASS_UUID {SWAPENDIAN_32(0x00001101), BASE_80BIT_UUID}
#define PUBLICBROWSEGROUP_CLASS_UUID {SWAPENDIAN_32(0x00001002), BASE_80BIT_UUID}
-
+
#define SDP_ATTRIBUTE_ID_SERVICERECORDHANDLE 0x0000
#define SDP_ATTRIBUTE_ID_SERVICECLASSIDS 0x0001
#define SDP_ATTRIBUTE_ID_PROTOCOLDESCRIPTORLIST 0x0004
@@ -58,10 +58,10 @@
#define SDP_ATTRIBUTE_ID_LANGUAGEBASEATTROFFSET 0x0006
#define SDP_ATTRIBUTE_ID_SERVICENAME 0x0100
#define SDP_ATTRIBUTE_ID_SERVICEDESCRIPTION 0x0101
-
+
/** Terminator for a service attribute table of type \ref ServiceAttributeTable_t. */
#define SERVICE_ATTRIBUTE_TABLE_TERMINATOR {.Data = NULL}
-
+
/* Type Defines: */
/** Type define for a UUID value structure. This struct can be used to hold full 128-bit UUIDs. */
typedef struct
@@ -72,7 +72,7 @@
uint16_t D; /**< Bits 64-79 of the UUID. */
uint8_t E[6]; /**< Bits 80-128 of the UUID. */
} UUID_t;
-
+
/** Structure for the association of attribute ID values to an attribute value in FLASH. A table of these
* structures can then be built up for each supported UUID service within the device.
*
@@ -111,7 +111,7 @@
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_UUID | SDP_DATASIZE_128Bit) */
UUID_t UUID; /**< UUID to store in the list Data Element */
} ItemUUID_t;
-
+
/** Structure for a list of Data Elements Sequences containing UUID Data Elements, for service attributes requiring
* protocol lists.
*/
@@ -119,7 +119,7 @@
{
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
uint8_t Size; /**< Size of the inner Data Element sequence */
-
+
struct
{
ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
@@ -133,14 +133,14 @@
{
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
uint8_t Size; /**< Size of the inner Data Element sequence */
-
+
struct
{
ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
Item8Bit_t Param; /**< 8-Bit Parameter associated with the service */
} Protocol;
} ItemProtocol_8BitParam_t;
-
+
/** Structure for a list of Data Elements Sequences containing UUID Data Elements and an 16-bit param value, for service
* attributes requiring extended protocol lists containing an 16-bit value.
*/
@@ -148,7 +148,7 @@
{
uint8_t Header; /**< Data Element header, should be (SDP_DATATYPE_Sequence | SDP_DATASIZE_Variable8Bit) */
uint8_t Size; /**< Size of the inner Data Element sequence */
-
+
struct
{
ItemUUID_t UUID; /**< UUID to store in the protocol list Data Element sequence */
@@ -165,9 +165,10 @@
Item16Bit_t EncodingID; /**< Encoding used for the current language */
Item16Bit_t OffsetID; /**< Attribute offset added to all strings using this language within the service */
} ItemLangEncoding_t;
-
+
/* External Variables: */
extern const ServiceAttributeTable_t SerialPort_Attribute_Table[];
extern const ServiceAttributeTable_t PnP_Attribute_Table[];
-
+
#endif
+
diff --git a/Demos/Host/Incomplete/BluetoothHost/makefile b/Demos/Host/Incomplete/BluetoothHost/makefile
index 21f7d5a57..c8fd05907 100644
--- a/Demos/Host/Incomplete/BluetoothHost/makefile
+++ b/Demos/Host/Incomplete/BluetoothHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -143,7 +143,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -156,7 +156,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -270,7 +270,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -283,7 +283,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -295,7 +295,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -307,7 +307,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -330,7 +330,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -364,7 +364,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -398,7 +398,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -427,7 +427,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -446,10 +446,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -514,11 +514,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -545,9 +545,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -645,14 +645,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -674,7 +674,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -718,3 +718,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c
index 093c7db65..83eb30101 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -79,7 +79,7 @@ uint8_t ProcessConfigurationDescriptor(void)
* but only found the mandatory IN endpoint, it's safe to continue with the device enumeration */
if (DataINEndpoint)
break;
-
+
/* Get the next HID interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
DComp_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)
@@ -87,17 +87,17 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the interface in case we need to refer back to it later */
HIDInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
/* Clear any found endpoints */
DataOUTEndpoint = NULL;
-
+
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -107,20 +107,20 @@ uint8_t ProcessConfigurationDescriptor(void)
else
DataOUTEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(HID_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
-
+
/* Check if the HID interface contained an optional OUT data endpoint */
if (DataOUTEndpoint)
{
/* Configure the HID data OUT pipe */
Pipe_ConfigurePipe(HID_DATA_OUT_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
- }
-
+ }
+
/* Valid data found, return success */
return SuccessfulConfigRead;
}
@@ -145,7 +145,7 @@ uint8_t DComp_NextHIDInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
/* Current descriptor does not match what this comparator is looking for */
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -176,3 +176,4 @@ uint8_t DComp_NextHIDInterfaceDataEndpoint(void* CurrentDescriptor)
/* Current descriptor does not match what this comparator is looking for */
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h
index e5a39479d..bde951439 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,19 +38,19 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "GenericHIDHost.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define HID_CLASS 0x03
/** Pipe number for the HID data IN pipe. */
#define HID_DATA_IN_PIPE 1
-
+
/** Pipe number for the HID data OUT pipe. */
#define HID_DATA_OUT_PIPE 2
-
+
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */
enum GenericHIDHost_GetConfigDescriptorDataCodes_t
@@ -60,7 +60,7 @@
DescriptorTooLarge = 2, /**< The device's Configuration Descriptor is too large to process */
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
- };
+ };
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
@@ -69,3 +69,4 @@
uint8_t DComp_NextHIDInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c
index 66a5b8e7e..ba182607b 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c
+++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the GenericHIDHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "GenericHIDHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -137,10 +137,10 @@ void ReadNextReport(void)
{
/* Refreeze HID data IN pipe */
Pipe_Freeze();
-
+
return;
}
-
+
/* Ensure pipe contains data before trying to read from it */
if (Pipe_IsReadWriteAllowed())
{
@@ -148,17 +148,17 @@ void ReadNextReport(void)
/* Read in HID report data */
Pipe_Read_Stream_LE(&ReportINData, sizeof(ReportINData));
-
+
/* Print report data through the serial port */
for (uint16_t CurrByte = 0; CurrByte < sizeof(ReportINData); CurrByte++)
printf_P(PSTR("0x%02X "), ReportINData[CurrByte]);
-
+
puts_P(PSTR("\r\n"));
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
-
+
/* Refreeze HID data IN pipe */
Pipe_Freeze();
}
@@ -177,7 +177,7 @@ void WriteNextReport(uint8_t* ReportOUTData,
{
/* Select the HID data OUT pipe */
Pipe_SelectPipe(HID_DATA_OUT_PIPE);
-
+
/* Not all HID devices have an OUT endpoint (some require OUT reports to be sent over the
* control endpoint instead) - check to see if the OUT endpoint has been initialized */
if (Pipe_IsConfigured() && (ReportType == REPORT_TYPE_OUT))
@@ -189,17 +189,17 @@ void WriteNextReport(uint8_t* ReportOUTData,
{
/* Refreeze the data OUT pipe */
Pipe_Freeze();
-
+
return;
}
-
+
/* If the report index is used, send it before the report data */
if (ReportIndex)
Pipe_Write_Byte(ReportIndex);
/* Write out HID report data */
- Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
-
+ Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
+
/* Clear the OUT endpoint, send last data packet */
Pipe_ClearOUT();
@@ -238,7 +238,7 @@ void HID_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -248,7 +248,7 @@ void HID_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -265,12 +265,12 @@ void HID_Host_Task(void)
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("HID Device Enumerated.\r\n"));
USB_HostState = HOST_STATE_Configured;
@@ -281,3 +281,4 @@ void HID_Host_Task(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h
index 489fba896..e3fc32135 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h
+++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,9 +49,9 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** HID Class specific request to send a HID report to the device. */
#define REQ_SetReport 0x09
@@ -67,7 +67,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** HID Report Type to indicate an IN report. */
#define REPORT_TYPE_IN 1
@@ -76,11 +76,11 @@
/** HID Report Type to indicate a FEATURE report. */
#define REPORT_TYPE_FEATURE 3
-
+
/* Function Prototypes: */
void SetupHardware(void);
void HID_Host_Task(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -93,5 +93,6 @@
const uint8_t ReportIndex,
const uint8_t ReportType,
uint16_t ReportLength);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt
index e176507de..a82a77830 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt
+++ b/Demos/Host/LowLevel/GenericHIDHost/GenericHIDHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Generic HID Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,14 +41,14 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Generic HID host demonstration application. This gives a simple reference
* application for implementing a Generic HID USB host, for any device implementing
* the HID profile.
*
* Received reports from the attached device are printed to the serial port.
- *
+ *
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
@@ -61,3 +61,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/GenericHIDHost/makefile b/Demos/Host/LowLevel/GenericHIDHost/makefile
index b7342e007..d39f7e6d4 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/makefile
+++ b/Demos/Host/LowLevel/GenericHIDHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -261,7 +261,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -274,7 +274,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -286,7 +286,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -298,7 +298,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -321,7 +321,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -355,7 +355,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -389,7 +389,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -418,7 +418,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -437,10 +437,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -505,11 +505,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -536,9 +536,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -636,14 +636,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -665,7 +665,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -709,3 +709,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c
index 3eaf7d960..20eaec7c9 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
@@ -95,12 +95,12 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Save the HID descriptor for later use */
- HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
+ HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -108,7 +108,7 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(JOYSTICK_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -140,7 +140,7 @@ uint8_t DComp_NextJoystickInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -181,5 +181,6 @@ uint8_t DComp_NextHID(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else
- return DESCRIPTOR_SEARCH_NotFound;
+ return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h
index 58c63f9e5..5aafe7d39 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "HIDReport.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define JOYSTICK_CLASS 0x03
@@ -53,7 +53,7 @@
/** Descriptor header type constant for a HID report descriptor. */
#define DTYPE_Report 0x22
-
+
/** Pipe number for the joystick report data pipe. */
#define JOYSTICK_DATA_IN_PIPE 1
@@ -78,3 +78,4 @@
uint8_t DComp_NextHID(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c b/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c
index bda99bdd0..76e26a0d5 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@ uint8_t GetHIDReportData(void)
{
/* Create a buffer big enough to hold the entire returned HID report */
uint8_t HIDReportData[HIDReportSize];
-
+
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
@@ -66,7 +66,7 @@ uint8_t GetHIDReportData(void)
/* Send the HID report to the parser for processing */
if (USB_ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful)
return ParseError;
-
+
return ParseSuccessful;
}
@@ -100,7 +100,7 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
/* If a collection with the joystick usage was not found, indicate that we are not interested in this item */
if (!IsJoystick)
return false;
-
+
/* Check the attributes of the current joystick item - see if we are interested in it or not;
* only store BUTTON and GENERIC_DESKTOP_CONTROL items into the Processed HID Report
* structure to save RAM and ignore the rest
@@ -108,3 +108,4 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
return ((CurrentItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) ||
(CurrentItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL));
}
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h b/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h
index da73ff823..0808806f7 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/HIDReport.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Host/HIDParser.h>
-
+
#include "JoystickHostWithParser.h"
/* Macros: */
@@ -66,16 +66,16 @@
ParseError = 1, /**< Failed to fully process the HID report descriptor */
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
-
+
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
-
+
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
-
+
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
@@ -88,7 +88,8 @@
/* Function Prototypes: */
uint8_t GetHIDReportData(void);
-
+
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c
index c7739e97f..3bd27da11 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the JoystickHostWithParser demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "JoystickHostWithParser.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -64,7 +64,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
SerialStream_Init(9600, false);
LEDs_Init();
@@ -118,7 +118,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -134,7 +134,7 @@ void Joystick_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -144,7 +144,7 @@ void Joystick_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -152,7 +152,7 @@ void Joystick_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -161,12 +161,12 @@ void Joystick_HID_Task(void)
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Processing HID Report (Size %d Bytes).\r\n"), HIDReportSize);
/* Get and process the device's first HID report descriptor */
@@ -178,21 +178,21 @@ void Joystick_HID_Task(void)
puts_P(PSTR("Not a valid Joystick." ESC_FG_WHITE));
else
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);
for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)
{
HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
-
+
uint8_t ReportSizeInBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_In];
uint8_t ReportSizeOutBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Out];
uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Feature];
@@ -211,9 +211,9 @@ void Joystick_HID_Task(void)
break;
case HOST_STATE_Configured:
/* Select and unfreeze joystick data pipe */
- Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE);
+ Pipe_SelectPipe(JOYSTICK_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Check to see if a packet has been received */
if (Pipe_IsINReceived())
{
@@ -225,11 +225,11 @@ void Joystick_HID_Task(void)
/* Load in the joystick report */
Pipe_Read_Stream_LE(JoystickReport, Pipe_BytesInPipe());
-
+
/* Process the read in joystick report from the device */
ProcessJoystickReport(JoystickReport);
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
}
@@ -254,7 +254,7 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
{
/* Create a temporary item pointer to the next report item */
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];
-
+
bool FoundData;
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&
@@ -262,7 +262,7 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
{
/* Get the joystick button value */
FoundData = USB_GetHIDReportItemInfo(JoystickReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
@@ -278,13 +278,13 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
{
/* Get the joystick relative position value */
FoundData = USB_GetHIDReportItemInfo(JoystickReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
-
+
int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);
-
+
/* Check to see if a (non-zero) delta movement has been indicated */
if (DeltaMovement)
{
@@ -296,7 +296,7 @@ void ProcessJoystickReport(uint8_t* JoystickReport)
}
}
}
-
+
/* Display the button information on the board LEDs */
LEDs_SetAllLEDs(LEDMask);
-} \ No newline at end of file
+}
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h
index 5f34dba03..403465fbe 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,7 +49,7 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "ConfigDescriptor.h"
#include "HIDReport.h"
@@ -69,7 +69,7 @@
/* Function Prototypes: */
void Joystick_HID_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -80,3 +80,4 @@
void ProcessJoystickReport(uint8_t* JoystickReport);
#endif
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt
index 055890b70..0fa97f868 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/JoystickHostWithParser.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Joystick Host With HID Descriptor Parser Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,19 +41,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Joystick host demonstration application. This gives a simple reference
* application for implementing a USB Joystick host, for USB joysticks using
* the standard joystick HID profile. It uses a HID parser for the HID
* reports, allowing for correct operation across all USB joysticks. This
* demo supports joysticks with a single HID report.
- *
+ *
* Joystick movement and button presses are displayed on the board LEDs.
* On connection to a USB joystick, the report items will be processed and
* printed as a formatted list through the USART before the joystick is
* fully enumerated.
- *
+ *
* Currently only single interface joysticks are supported.
*
* \section SSec_Options Project Options
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/makefile b/Demos/Host/LowLevel/JoystickHostWithParser/makefile
index 39b13ed36..ec35eeb38 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/makefile
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c
index e1e32ed7c..ea42a28ab 100644
--- a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
@@ -66,7 +66,7 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return ControlError;
}
-
+
while (!(DataINEndpoint))
{
/* See if we've found a likely compatible interface, and if there is an endpoint within that interface */
@@ -88,7 +88,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -96,7 +96,7 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(KEYBOARD_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -125,7 +125,7 @@ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -152,3 +152,4 @@ uint8_t DComp_NextKeyboardInterfaceDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h
index f8fed3e58..14f691b68 100644
--- a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,16 +38,16 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "KeyboardHost.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define KEYBOARD_CLASS 0x03
/** Interface Protocol value for a Boot Protocol Keyboard compliant device. */
#define KEYBOARD_PROTOCOL 0x01
-
+
/** Pipe number for the keyboard data IN pipe. */
#define KEYBOARD_DATA_IN_PIPE 1
@@ -64,8 +64,9 @@
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
-
+
uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor);
uint8_t DComp_NextKeyboardInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
index 0c24bc9e2..269fe2779 100644
--- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
+++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the KeyboardHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "KeyboardHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -129,9 +129,9 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
void ReadNextReport(void)
{
USB_KeyboardReport_Data_t KeyboardReport;
-
+
/* Select keyboard data pipe */
- Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE);
+ Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE);
/* Unfreeze keyboard data pipe */
Pipe_Unfreeze();
@@ -141,10 +141,10 @@ void ReadNextReport(void)
{
/* Refreeze HID data IN pipe */
Pipe_Freeze();
-
+
return;
}
-
+
/* Ensure pipe contains data before trying to read from it */
if (Pipe_IsReadWriteAllowed())
{
@@ -153,13 +153,13 @@ void ReadNextReport(void)
/* Indicate if the modifier byte is non-zero (special key such as shift is being pressed) */
LEDs_ChangeLEDs(LEDS_LED1, (KeyboardReport.Modifier) ? LEDS_LED1 : 0);
-
+
/* Check if a key has been pressed */
if (KeyboardReport.KeyCode)
{
/* Toggle status LED to indicate keypress */
LEDs_ToggleLEDs(LEDS_LED2);
-
+
char PressedKey = 0;
/* Retrieve pressed key character if alphanumeric */
@@ -168,16 +168,16 @@ void ReadNextReport(void)
else if ((KeyboardReport.KeyCode[0] >= 0x1E) && (KeyboardReport.KeyCode[0] <= 0x27))
PressedKey = (KeyboardReport.KeyCode[0] - 0x1E) + '0';
else if (KeyboardReport.KeyCode[0] == 0x2C)
- PressedKey = ' ';
+ PressedKey = ' ';
else if (KeyboardReport.KeyCode[0] == 0x28)
PressedKey = '\n';
-
+
/* Print the pressed key character out through the serial port if valid */
if (PressedKey)
putchar(PressedKey);
}
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
@@ -196,7 +196,7 @@ void Keyboard_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -206,7 +206,7 @@ void Keyboard_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -214,7 +214,7 @@ void Keyboard_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -228,7 +228,7 @@ void Keyboard_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* HID class request to set the keyboard protocol to the Boot Protocol */
USB_ControlRequest = (USB_Request_Header_t)
{
@@ -250,7 +250,7 @@ void Keyboard_HID_Task(void)
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
@@ -267,3 +267,4 @@ void Keyboard_HID_Task(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h
index 0c6075330..63d6c06b5 100644
--- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h
+++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,9 +49,9 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** HID Class Specific request to set the report protocol mode. */
#define REQ_SetProtocol 0x0B
@@ -76,11 +76,11 @@
uint8_t Reserved; /**< Reserved for OEM use, always set to 0 */
uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys */
} USB_KeyboardReport_Data_t;
-
+
/* Function Prototypes: */
void Keyboard_HID_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -89,5 +89,6 @@
void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ReadNextReport(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt
index 397150175..810634dcd 100644
--- a/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt
+++ b/Demos/Host/LowLevel/KeyboardHost/KeyboardHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Keyboard Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,21 +41,21 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Keyboard host demonstration application. This gives a simple reference
* application for implementing a USB keyboard, for USB keyboards using
* the standard keyboard HID profile.
- *
+ *
* Pressed alpha-numeric, enter or space key is transmitted through the serial
* USART at serial settings 9600, 8, N, 1.
- *
+ *
* This uses a naive method where the keyboard is set to Boot Protocol mode, so
* that the report structure is fixed and known. A better implementation
* uses the HID report parser for correct report data processing across
* all compatible mice with advanced characteristics, as shown in the
* KeyboardHostWithParser demo application.
- *
+ *
* Currently only single interface keyboards are supported.
*
* \section SSec_Options Project Options
@@ -70,3 +70,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/KeyboardHost/makefile b/Demos/Host/LowLevel/KeyboardHost/makefile
index 6d8634ce1..13bf64d63 100644
--- a/Demos/Host/LowLevel/KeyboardHost/makefile
+++ b/Demos/Host/LowLevel/KeyboardHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -261,7 +261,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -274,7 +274,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -286,7 +286,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -298,7 +298,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -321,7 +321,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -355,7 +355,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -389,7 +389,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -418,7 +418,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -437,10 +437,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -505,11 +505,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -536,9 +536,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -636,14 +636,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -665,7 +665,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -709,3 +709,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c
index 74817a2f1..fe35d95b7 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
@@ -82,7 +82,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the interface in case we need to refer back to it later */
HIDInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
@@ -93,14 +93,14 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the HID descriptor for later use */
- HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
-
+ HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
+
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -108,7 +108,7 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(KEYBOARD_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -140,7 +140,7 @@ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -183,5 +183,6 @@ uint8_t DComp_NextHID(void* CurrentDescriptor)
else if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
return DESCRIPTOR_SEARCH_Fail;
else
- return DESCRIPTOR_SEARCH_NotFound;
+ return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h
index a7bc1d34c..d23c89dd0 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "HIDReport.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define KEYBOARD_CLASS 0x03
@@ -53,7 +53,7 @@
/** Descriptor header type constant for a HID report descriptor. */
#define DTYPE_Report 0x22
-
+
/** Pipe number for the keyboard report data pipe. */
#define KEYBOARD_DATA_IN_PIPE 1
@@ -74,5 +74,6 @@
uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor);
uint8_t DComp_NextKeyboardInterfaceDataEndpoint(void* CurrentDescriptor);
uint8_t DComp_NextHID(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c
index 6b4df377d..d2dde64bd 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@ uint8_t GetHIDReportData(void)
{
/* Create a buffer big enough to hold the entire returned HID report */
uint8_t HIDReportData[HIDReportSize];
-
+
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
@@ -66,7 +66,7 @@ uint8_t GetHIDReportData(void)
/* Send the HID report to the parser for processing */
if (USB_ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful)
return ParseError;
-
+
return ParseSuccessful;
}
@@ -87,3 +87,4 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
*/
return (CurrentItem->Attributes.Usage.Page == USAGE_PAGE_KEYBOARD);
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h
index 09cace965..e18ad3aae 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Host/HIDParser.h>
-
+
#include "KeyboardHostWithParser.h"
/* Macros: */
@@ -54,16 +54,16 @@
ParseError = 1, /**< Failed to fully process the HID report descriptor */
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
-
+
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
-
+
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
-
+
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
@@ -78,5 +78,6 @@
uint8_t GetHIDReportData(void);
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
index 15bc94061..bdf4a2830 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the KeyboardHostWithParser demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "KeyboardHostWithParser.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -119,7 +119,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -134,7 +134,7 @@ void Keyboard_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -144,7 +144,7 @@ void Keyboard_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -167,9 +167,9 @@ void Keyboard_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Processing HID Report (Size %d Bytes).\r\n"), HIDReportSize);
-
+
/* Get and process the device's first HID report descriptor */
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)
{
@@ -179,13 +179,13 @@ void Keyboard_HID_Task(void)
puts_P(PSTR("Not a valid Keyboard." ESC_FG_WHITE));
else
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);
@@ -193,7 +193,7 @@ void Keyboard_HID_Task(void)
for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)
{
HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
-
+
uint8_t ReportSizeInBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_In];
uint8_t ReportSizeOutBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Out];
uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Feature];
@@ -212,7 +212,7 @@ void Keyboard_HID_Task(void)
break;
case HOST_STATE_Configured:
/* Select and unfreeze keyboard data pipe */
- Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE);
+ Pipe_SelectPipe(KEYBOARD_DATA_IN_PIPE);
Pipe_Unfreeze();
/* Check to see if a packet has been received */
@@ -226,11 +226,11 @@ void Keyboard_HID_Task(void)
/* Load in the keyboard report */
Pipe_Read_Stream_LE(KeyboardReport, Pipe_BytesInPipe());
-
+
/* Process the read in keyboard report from the device */
ProcessKeyboardReport(KeyboardReport);
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
}
@@ -262,11 +262,11 @@ void ProcessKeyboardReport(uint8_t* KeyboardReport)
{
/* Retrieve the keyboard scan-code from the report data retrieved from the device */
bool FoundData = USB_GetHIDReportItemInfo(KeyboardReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
-
+
/* Key code is an unsigned char in length, cast to the appropriate type */
uint8_t KeyCode = (uint8_t)ReportItem->Value;
@@ -284,17 +284,18 @@ void ProcessKeyboardReport(uint8_t* KeyboardReport)
else if ((KeyCode >= 0x1E) && (KeyCode <= 0x27))
PressedKey = (KeyCode - 0x1E) + '0';
else if (KeyCode == 0x2C)
- PressedKey = ' ';
+ PressedKey = ' ';
else if (KeyCode == 0x28)
PressedKey = '\n';
-
+
/* Print the pressed key character out through the serial port if valid */
if (PressedKey)
putchar(PressedKey);
}
-
+
/* Once a scan-code is found, stop scanning through the report items */
break;
}
}
}
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h
index 4aaea382f..3a5f138a1 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -44,7 +44,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
#include "HIDReport.h"
@@ -60,7 +60,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void Keyboard_HID_Task(void);
void SetupHardware(void);
@@ -73,5 +73,6 @@
void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ProcessKeyboardReport(uint8_t* KeyboardReport);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt
index 5e122a38f..50f6c861d 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Keyboard Host With HID Descriptor Parser Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,20 +41,20 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Keyboard host demonstration application. This gives a simple reference
* application for implementing a USB Keyboard host, for USB keyboards using
* the standard Keyboard HID profile. It uses a HID parser for the HID reports,
* allowing for correct operation across all USB keyboards. This demo supports
* keyboards with a single HID report.
- *
+ *
* Pressed alpha-numeric, enter or space key is transmitted through the serial
* USART at serial settings 9600, 8, N, 1. On connection to a USB keyboard, the
* report items will be processed and printed as a formatted list through the
* USART before the keyboard is fully enumerated.
- *
- * Currently only single interface keyboards are supported.
+ *
+ * Currently only single interface keyboards are supported.
*
* \section SSec_Options Project Options
*
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/makefile b/Demos/Host/LowLevel/KeyboardHostWithParser/makefile
index db8f91911..04bb9ab79 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/makefile
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c
index 7feb31251..874fa7a3a 100644
--- a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* needed to communication with an attached USB device. Descriptors are special computer-readable structures
* which the host requests upon device enumeration, to determine the device's capabilities and functions.
*/
-
+
#include "ConfigDescriptor.h"
/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* MIDIInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -67,7 +67,7 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return ControlError;
}
-
+
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
/* See if we've found a likely compatible interface, and if there is an endpoint within that interface */
@@ -93,7 +93,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -103,7 +103,7 @@ uint8_t ProcessConfigurationDescriptor(void)
else
DataOUTEndpoint = EndpointData;
}
-
+
/* Configure the MIDI data IN pipe */
Pipe_ConfigurePipe(MIDI_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -136,7 +136,7 @@ uint8_t DComp_NextMIDIStreamingInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -155,7 +155,7 @@ uint8_t DComp_NextMIDIStreamingDataEndpoint(void* CurrentDescriptor)
{
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
-
+
/* Check the endpoint type, break out if correct BULK type endpoint found */
if (EndpointType == EP_TYPE_BULK)
return DESCRIPTOR_SEARCH_Found;
@@ -167,3 +167,4 @@ uint8_t DComp_NextMIDIStreamingDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h
index 80a05667d..57a36d924 100644
--- a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,19 +38,19 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "MIDIHost.h"
-
+
/* Macros: */
/** Interface Class value for the MIDI Audio class. */
#define MIDI_STREAMING_CLASS 0x01
-
+
/** Interface Class value for the MIDI Audio Streaming subclass. */
#define MIDI_STREAMING_SUBCLASS 0x03
/** Interface Class value for the MIDI Audio Streaming protocol. */
#define MIDI_STREAMING_PROTOCOL 0x00
-
+
/** Pipe number for the MIDI data IN pipe. */
#define MIDI_DATA_IN_PIPE 1
@@ -69,9 +69,10 @@
};
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
-
+ uint8_t ProcessConfigurationDescriptor(void);
+
uint8_t DComp_NextMIDIStreamingInterface(void* CurrentDescriptor);
uint8_t DComp_NextMIDIStreamingDataEndpoint(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MIDIHost/MIDIHost.c b/Demos/Host/LowLevel/MIDIHost/MIDIHost.c
index 7725f5d8a..63ed6da25 100644
--- a/Demos/Host/LowLevel/MIDIHost/MIDIHost.c
+++ b/Demos/Host/LowLevel/MIDIHost/MIDIHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the MIDIHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MIDIHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -121,7 +121,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -137,7 +137,7 @@ void MIDI_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -147,7 +147,7 @@ void MIDI_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -155,7 +155,7 @@ void MIDI_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -176,16 +176,16 @@ void MIDI_Host_Task(void)
break;
case HOST_STATE_Configured:
Pipe_SelectPipe(MIDI_DATA_IN_PIPE);
-
+
if (Pipe_IsINReceived())
{
USB_MIDI_EventPacket_t MIDIEvent;
-
+
Pipe_Read_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
-
+
bool NoteOnEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_ON >> 4));
bool NoteOffEvent = ((MIDIEvent.Command & 0x0F) == (MIDI_COMMAND_NOTE_OFF >> 4));
-
+
if (NoteOnEvent || NoteOffEvent)
{
printf_P(PSTR("MIDI Note %s - Channel %d, Pitch %d, Velocity %d\r\n"), NoteOnEvent ? "On" : "Off",
@@ -195,19 +195,19 @@ void MIDI_Host_Task(void)
Pipe_ClearIN();
}
-
+
Pipe_SelectPipe(MIDI_DATA_OUT_PIPE);
-
+
static uint8_t PrevJoystickStatus;
if (Pipe_IsOUTReady())
{
uint8_t MIDICommand = 0;
uint8_t MIDIPitch;
-
+
uint8_t JoystickStatus = Joystick_GetStatus();
uint8_t JoystickChanges = (JoystickStatus ^ PrevJoystickStatus);
-
+
/* Get board button status - if pressed use channel 10 (percussion), otherwise use channel 1 */
uint8_t Channel = ((Buttons_GetStatus() & BUTTONS_BUTTON1) ? MIDI_CHANNEL(10) : MIDI_CHANNEL(1));
@@ -228,7 +228,7 @@ void MIDI_Host_Task(void)
MIDICommand = ((JoystickStatus & JOY_RIGHT)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
MIDIPitch = 0x3E;
}
-
+
if (JoystickChanges & JOY_DOWN)
{
MIDICommand = ((JoystickStatus & JOY_DOWN)? MIDI_COMMAND_NOTE_ON : MIDI_COMMAND_NOTE_OFF);
@@ -248,19 +248,19 @@ void MIDI_Host_Task(void)
{
.CableNumber = 0,
.Command = (MIDICommand >> 4),
-
+
.Data1 = MIDICommand | Channel,
.Data2 = MIDIPitch,
- .Data3 = MIDI_STANDARD_VELOCITY,
+ .Data3 = MIDI_STANDARD_VELOCITY,
};
-
+
/* Write the MIDI event packet to the pipe */
Pipe_Write_Stream_LE(&MIDIEvent, sizeof(MIDIEvent));
-
+
/* Send the data in the pipe to the device */
Pipe_ClearOUT();
}
-
+
/* Save previous joystick value for next joystick change detection */
PrevJoystickStatus = JoystickStatus;
}
@@ -268,3 +268,4 @@ void MIDI_Host_Task(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/MIDIHost/MIDIHost.h b/Demos/Host/LowLevel/MIDIHost/MIDIHost.h
index 507f0787c..f7fb57a91 100644
--- a/Demos/Host/LowLevel/MIDIHost/MIDIHost.h
+++ b/Demos/Host/LowLevel/MIDIHost/MIDIHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -51,19 +51,19 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Board/Joystick.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** MIDI command for a note on (activation) event. */
#define MIDI_COMMAND_NOTE_ON 0x90
/** MIDI command for a note off (deactivation) event. */
#define MIDI_COMMAND_NOTE_OFF 0x80
-
+
/** Standard key press velocity value used for all note events, as no pressure sensor is mounted. */
#define MIDI_STANDARD_VELOCITY 64
-
+
/** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
*
@@ -89,21 +89,22 @@
{
unsigned char Command : 4; /**< MIDI command being sent or received in the event packet */
unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface */
-
+
uint8_t Data1; /**< First byte of data in the MIDI event */
uint8_t Data2; /**< Second byte of data in the MIDI event */
- uint8_t Data3; /**< Third byte of data in the MIDI event */
+ uint8_t Data3; /**< Third byte of data in the MIDI event */
} USB_MIDI_EventPacket_t;
/* Function Prototypes: */
void SetupHardware(void);
void MIDI_Host_Task(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MIDIHost/MIDIHost.txt b/Demos/Host/LowLevel/MIDIHost/MIDIHost.txt
index a90ae04d3..337dba72e 100644
--- a/Demos/Host/LowLevel/MIDIHost/MIDIHost.txt
+++ b/Demos/Host/LowLevel/MIDIHost/MIDIHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage MIDI Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Audio Class Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>MIDI Subclass</td>
* </tr>
@@ -39,7 +39,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* MIDI host demonstration application. This demo will enumerate an attached USB-MIDI device, and print incoming MIDI note
* on and off messages on any channel to the serial port. Pressing the board joystick will send note on and off messages to
@@ -57,3 +57,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/MIDIHost/makefile b/Demos/Host/LowLevel/MIDIHost/makefile
index 36b231598..2940c5468 100644
--- a/Demos/Host/LowLevel/MIDIHost/makefile
+++ b/Demos/Host/LowLevel/MIDIHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -261,7 +261,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -274,7 +274,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -286,7 +286,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -298,7 +298,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -321,7 +321,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -355,7 +355,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -389,7 +389,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -418,7 +418,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -437,10 +437,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -505,11 +505,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -536,9 +536,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -636,14 +636,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -665,7 +665,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -709,3 +709,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c
index 3468e0db9..f336d62bf 100644
--- a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* needed to communication with an attached USB device. Descriptors are special computer-readable structures
* which the host requests upon device enumeration, to determine the device's capabilities and functions.
*/
-
+
#include "ConfigDescriptor.h"
/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* MSInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -93,7 +93,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -103,7 +103,7 @@ uint8_t ProcessConfigurationDescriptor(void)
else
DataOUTEndpoint = EndpointData;
}
-
+
/* Configure the Mass Storage data IN pipe */
Pipe_ConfigurePipe(MASS_STORE_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -136,7 +136,7 @@ uint8_t DComp_NextMSInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -167,3 +167,4 @@ uint8_t DComp_NextMSInterfaceBulkDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h
index d75789192..92c984068 100644
--- a/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MassStorageHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "MassStorageHost.h"
-
+
/* Macros: */
/** Interface Class value for the Mass Storage Device class. */
#define MASS_STORE_CLASS 0x08
@@ -67,11 +67,12 @@
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
};
-
+
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
uint8_t DComp_NextMSInterface(void* CurrentDescriptor);
uint8_t DComp_NextMSInterfaceBulkDataEndpoint(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c
index c86e51b0c..712589660 100644
--- a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c
+++ b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@
* larger value in the project makefile and passing it to the compiler
* via the -D switch.
*/
-
+
#define INCLUDE_FROM_MASSSTORE_COMMANDS_C
#include "MassStoreCommands.h"
@@ -85,13 +85,13 @@ static uint8_t MassStore_SendCommand(CommandBlockWrapper_t* const SCSICommandBlo
/* Send the data in the OUT pipe to the attached device */
Pipe_ClearOUT();
-
+
/* Wait until command has been sent */
Pipe_WaitUntilReady();
/* Freeze pipe after use */
Pipe_Freeze();
-
+
/* Send data if any */
if ((BufferPtr != NULL) &&
((ErrorCode = MassStore_SendReceiveData(SCSICommandBlock, BufferPtr)) != PIPE_READYWAIT_NoError))
@@ -99,7 +99,7 @@ static uint8_t MassStore_SendCommand(CommandBlockWrapper_t* const SCSICommandBlo
Pipe_Freeze();
return ErrorCode;
}
-
+
return ErrorCode;
}
@@ -116,12 +116,12 @@ static uint8_t MassStore_WaitForDataReceived(void)
/* Select the IN data pipe for data reception */
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Wait until data received in the IN pipe */
while (!(Pipe_IsINReceived()))
{
uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber();
-
+
/* Check to see if a new frame has been issued (1ms elapsed) */
if (CurrentFrameNumber != PreviousFrameNumber)
{
@@ -133,7 +133,7 @@ static uint8_t MassStore_WaitForDataReceived(void)
if (!(TimeoutMSRem))
return PIPE_RWSTREAM_Timeout;
}
-
+
Pipe_Freeze();
Pipe_SelectPipe(MASS_STORE_DATA_OUT_PIPE);
Pipe_Unfreeze();
@@ -146,7 +146,7 @@ static uint8_t MassStore_WaitForDataReceived(void)
return PIPE_RWSTREAM_PipeStalled;
}
-
+
Pipe_Freeze();
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
@@ -159,15 +159,15 @@ static uint8_t MassStore_WaitForDataReceived(void)
return PIPE_RWSTREAM_PipeStalled;
}
-
+
/* Check to see if the device was disconnected, if so exit function */
if (USB_HostState == HOST_STATE_Unattached)
return PIPE_RWSTREAM_DeviceDisconnected;
};
-
+
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Freeze();
-
+
Pipe_SelectPipe(MASS_STORE_DATA_OUT_PIPE);
Pipe_Freeze();
@@ -194,11 +194,11 @@ static uint8_t MassStore_SendReceiveData(CommandBlockWrapper_t* const SCSIComman
/* Wait until the device has replied with some data */
if ((ErrorCode = MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
/* Select the IN data pipe for data reception */
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Read in the block data from the pipe */
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -218,14 +218,14 @@ static uint8_t MassStore_SendReceiveData(CommandBlockWrapper_t* const SCSIComman
/* Acknowledge the packet */
Pipe_ClearOUT();
-
+
while (!(Pipe_IsOUTReady()))
{
if (USB_HostState == HOST_STATE_Unattached)
return PIPE_RWSTREAM_DeviceDisconnected;
}
}
-
+
/* Freeze used pipe after use */
Pipe_Freeze();
@@ -249,21 +249,21 @@ static uint8_t MassStore_GetReturnedStatus(CommandStatusWrapper_t* const SCSICom
/* Select the IN data pipe for data reception */
Pipe_SelectPipe(MASS_STORE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Load in the CSW from the attached device */
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(CommandStatusWrapper_t))) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
/* Clear the data ready for next reception */
Pipe_ClearIN();
-
+
/* Freeze the IN pipe after use */
Pipe_Freeze();
-
+
/* Check to see if command failed */
if (SCSICommandStatus->Status != Command_Pass)
ErrorCode = MASS_STORE_SCSI_COMMAND_FAILED;
-
+
return ErrorCode;
}
@@ -282,7 +282,7 @@ uint8_t MassStore_MassStorageReset(void)
.wIndex = 0,
.wLength = 0,
};
-
+
/* Select the control pipe for the request transfer */
Pipe_SelectPipe(PIPE_CONTROLPIPE);
@@ -312,7 +312,7 @@ uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex)
.wIndex = 0,
.wLength = 1,
};
-
+
/* Select the control pipe for the request transfer */
Pipe_SelectPipe(PIPE_CONTROLPIPE);
@@ -320,14 +320,14 @@ uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex)
{
/* Clear the pipe stall */
Pipe_ClearStall();
-
+
/* Some faulty Mass Storage devices don't implement the GET_MAX_LUN request, so assume a single LUN */
*MaxLUNIndex = 0;
-
+
/* Clear the error, and pretend the request executed correctly if the device STALLed it */
ErrorCode = HOST_SENDCONTROL_Successful;
}
-
+
return ErrorCode;
}
@@ -362,7 +362,7 @@ uint8_t MassStore_Inquiry(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -371,7 +371,7 @@ uint8_t MassStore_Inquiry(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -413,7 +413,7 @@ uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -422,7 +422,7 @@ uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -474,7 +474,7 @@ uint8_t MassStore_ReadDeviceBlock(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -483,7 +483,7 @@ uint8_t MassStore_ReadDeviceBlock(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -535,7 +535,7 @@ uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -544,7 +544,7 @@ uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -564,7 +564,7 @@ uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
*/
uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex)
{
- uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
+ uint8_t ErrorCode = PIPE_RWSTREAM_NoError;
/* Create a CBW with a SCSI command to issue TEST UNIT READY command */
CommandBlockWrapper_t SCSICommandBlock = (CommandBlockWrapper_t)
@@ -584,7 +584,7 @@ uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex)
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -593,7 +593,7 @@ uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex)
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -639,7 +639,7 @@ uint8_t MassStore_ReadCapacity(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -648,11 +648,11 @@ uint8_t MassStore_ReadCapacity(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Endian-correct the read data */
CapacityPtr->Blocks = SwapEndian_32(CapacityPtr->Blocks);
CapacityPtr->BlockSize = SwapEndian_32(CapacityPtr->BlockSize);
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -695,7 +695,7 @@ uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
0x00 // Unused (control)
}
};
-
+
CommandStatusWrapper_t SCSICommandStatus;
/* Send the command and any data to the attached device */
@@ -704,7 +704,7 @@ uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
Pipe_Freeze();
return ErrorCode;
}
-
+
/* Retrieve status information from the attached device */
if ((ErrorCode = MassStore_GetReturnedStatus(&SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
{
@@ -714,3 +714,4 @@ uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
return ErrorCode;
}
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h
index 628066363..8fcffe424 100644
--- a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h
+++ b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for MassStoreCommands.c.
*/
-
+
#ifndef _MASS_STORE_COMMANDS_H_
#define _MASS_STORE_COMMANDS_H_
@@ -56,16 +56,16 @@
/** Command Static Wrapper signature byte, for verification of valid CSW blocks. */
#define CSW_SIGNATURE 0x53425355UL
-
+
/** Data direction mask for the Flags field of a CBW, indicating Host-to-Device transfer direction. */
#define COMMAND_DIRECTION_DATA_OUT (0 << 7)
/** Data direction mask for the Flags field of a CBW, indicating Device-to-Host transfer direction. */
#define COMMAND_DIRECTION_DATA_IN (1 << 7)
-
+
/** Timeout period between the issuing of a CBW to a device, and the reception of the first packet. */
#define COMMAND_DATA_TIMEOUT_MS 10000
-
+
/** Additional error code for Mass Storage functions when a device returns a logical command failure. */
#define MASS_STORE_SCSI_COMMAND_FAILED 0xC0
@@ -83,7 +83,7 @@
uint8_t SCSICommandLength; /**< Length of the SCSI command in the CBW */
uint8_t SCSICommandData[16]; /**< SCSI command to issue to the device */
} CommandBlockWrapper_t;
-
+
/** Type define for a Mass Storage class Command Status Wrapper, used to wrap SCSI
* responses for transport over the USB bulk endpoints from the device.
*/
@@ -94,7 +94,7 @@
uint32_t DataTransferResidue; /**< Length of data not transferred */
uint8_t Status; /**< Command status, a value from the MassStorageHost_CommandStatusCodes_t enum */
} CommandStatusWrapper_t;
-
+
/** Type define for a SCSI Sense structure. Structures of this type are filled out by the
* device via the \ref MassStore_RequestSense() function, indicating the current sense data of the
* device (giving explicit error codes for the last issued command). For details of the
@@ -105,13 +105,13 @@
uint8_t ResponseCode;
uint8_t SegmentNumber;
-
+
unsigned char SenseKey : 4;
unsigned char Reserved : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
-
+
uint8_t Information[4];
uint8_t AdditionalLength;
uint8_t CmdSpecificInformation[4];
@@ -129,12 +129,12 @@
{
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
-
+
unsigned char Reserved : 7;
unsigned char Removable : 1;
-
+
uint8_t Version;
-
+
unsigned char ResponseDataFormat : 4;
unsigned char Reserved2 : 1;
unsigned char NormACA : 1;
@@ -152,12 +152,12 @@
unsigned char WideBus16Bit : 1;
unsigned char WideBus32Bit : 1;
unsigned char RelAddr : 1;
-
+
uint8_t VendorID[8];
uint8_t ProductID[16];
uint8_t RevisionID[4];
} SCSI_Inquiry_Response_t;
-
+
/** SCSI capacity structure, to hold the total capacity of the device in both the number
* of blocks in the current LUN, and the size of each block. This structure is filled by
* the device when the \ref MassStore_ReadCapacity() function is called.
@@ -176,7 +176,7 @@
Command_Fail = 1, /**< Command failed to complete successfully */
Phase_Error = 2 /**< Phase error while processing the issued command */
};
-
+
/* Function Prototypes: */
#if defined(INCLUDE_FROM_MASSSTORE_COMMANDS_C)
static uint8_t MassStore_SendCommand(CommandBlockWrapper_t* const SCSICommandBlock,
@@ -186,7 +186,7 @@
void* BufferPtr) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t MassStore_GetReturnedStatus(CommandStatusWrapper_t* const SCSICommandStatus) ATTR_NON_NULL_PTR_ARG(1);
#endif
-
+
uint8_t MassStore_MassStorageReset(void);
uint8_t MassStore_GetMaxLUN(uint8_t* const MaxLUNIndex);
uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
@@ -210,3 +210,4 @@
const bool PreventRemoval);
#endif
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.h b/Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.h
index a69aa56fe..6bcd5780f 100644
--- a/Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.h
+++ b/Demos/Host/LowLevel/MassStorageHost/Lib/SCSI_Codes.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* the SCSI standard documentation for more information on each SCSI command and
* the SENSE data.
*/
-
+
#ifndef _SCSI_CODES_H_
#define _SCSI_CODES_H_
@@ -84,3 +84,4 @@
#define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
#endif
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c
index 985aeeb08..93c62e74f 100644
--- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c
+++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -124,7 +124,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -139,7 +139,7 @@ void MassStorage_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -149,7 +149,7 @@ void MassStorage_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -171,7 +171,7 @@ void MassStorage_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Mass Storage Disk Enumerated.\r\n"));
USB_HostState = HOST_STATE_Configured;
@@ -179,28 +179,28 @@ void MassStorage_Task(void)
case HOST_STATE_Configured:
/* Indicate device busy via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
/* Send the request, display error and wait for device detach if request fails */
if ((ErrorCode = MassStore_GetMaxLUN(&MassStore_MaxLUNIndex)) != HOST_SENDCONTROL_Successful)
- {
+ {
ShowDiskReadError(PSTR("Get Max LUN"), ErrorCode);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Print number of LUNs detected in the attached device */
printf_P(PSTR("Total LUNs: %d - Using first LUN in device.\r\n"), (MassStore_MaxLUNIndex + 1));
-
+
/* Reset the Mass Storage device interface, ready for use */
if ((ErrorCode = MassStore_MassStorageReset()) != HOST_SENDCONTROL_Successful)
{
ShowDiskReadError(PSTR("Mass Storage Reset"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Get sense data from the device - many devices will not accept any other commands until the sense data
* is read - both on start-up and after a failed command */
SCSI_Request_Sense_Response_t SenseData;
@@ -210,12 +210,12 @@ void MassStorage_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the prevent removal flag for the device, allowing it to be accessed */
if ((ErrorCode = MassStore_PreventAllowMediumRemoval(0, true)) != 0)
{
ShowDiskReadError(PSTR("Prevent/Allow Medium Removal"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -225,14 +225,14 @@ void MassStorage_Task(void)
if ((ErrorCode = MassStore_Inquiry(0, &InquiryData)) != 0)
{
ShowDiskReadError(PSTR("Inquiry"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
/* Print vendor and product names of attached device */
printf_P(PSTR("Vendor \"%.8s\", Product \"%.16s\"\r\n"), InquiryData.VendorID, InquiryData.ProductID);
-
+
/* Wait until disk ready */
puts_P(PSTR("Waiting until ready.."));
@@ -246,7 +246,7 @@ void MassStorage_Task(void)
/* Check to see if the attached device is ready for new commands */
ErrorCode = MassStore_TestUnitReady(0);
-
+
/* If attached device is ready, abort the loop */
if (!(ErrorCode))
break;
@@ -270,11 +270,11 @@ void MassStorage_Task(void)
if ((ErrorCode = MassStore_ReadCapacity(0, &DiskCapacity)) != 0)
{
ShowDiskReadError(PSTR("Read Capacity"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Display the disk capacity in blocks * block size bytes */
printf_P(PSTR("%lu blocks of %lu bytes.\r\n"), DiskCapacity.Blocks, DiskCapacity.BlockSize);
@@ -285,11 +285,11 @@ void MassStorage_Task(void)
if ((ErrorCode = MassStore_ReadDeviceBlock(0, 0x00000000, 1, DiskCapacity.BlockSize, BlockBuffer)) != 0)
{
ShowDiskReadError(PSTR("Read Device Block"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("\r\nContents of first block:\r\n"));
/* Print out the first block in both HEX and ASCII, 16 bytes per line */
@@ -297,30 +297,30 @@ void MassStorage_Task(void)
{
/* Pointer to the start of the current 16-byte chunk in the read block of data */
uint8_t* ChunkPtr = &BlockBuffer[Chunk << 4];
-
+
/* Print out the 16 bytes of the chunk in HEX format */
for (uint8_t ByteOffset = 0; ByteOffset < (1 << 4); ByteOffset++)
{
char CurrByte = *(ChunkPtr + ByteOffset);
-
+
printf_P(PSTR("%.2X "), CurrByte);
}
-
+
puts_P(PSTR(" "));
/* Print out the 16 bytes of the chunk in ASCII format */
for (uint8_t ByteOffset = 0; ByteOffset < (1 << 4); ByteOffset++)
{
char CurrByte = *(ChunkPtr + ByteOffset);
-
+
putchar(isprint(CurrByte) ? CurrByte : '.');
}
-
+
puts_P(PSTR("\r\n"));
}
-
+
puts_P(PSTR("\r\n\r\nPress board button to read entire ASCII contents of disk...\r\n\r\n"));
-
+
/* Wait for the board button to be pressed */
while (!(Buttons_GetStatus() & BUTTONS_BUTTON1))
{
@@ -332,7 +332,7 @@ void MassStorage_Task(void)
/* Abort if device removed */
if (USB_HostState == HOST_STATE_Unattached)
break;
-
+
/* Print out the entire disk contents in ASCII format */
for (uint32_t CurrBlockAddress = 0; CurrBlockAddress < DiskCapacity.Blocks; CurrBlockAddress++)
{
@@ -340,7 +340,7 @@ void MassStorage_Task(void)
if ((ErrorCode = MassStore_ReadDeviceBlock(0, CurrBlockAddress, 1, DiskCapacity.BlockSize, BlockBuffer)) != 0)
{
ShowDiskReadError(PSTR("Read Device Block"), ErrorCode);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -349,7 +349,7 @@ void MassStorage_Task(void)
for (uint16_t Byte = 0; Byte < DiskCapacity.BlockSize; Byte++)
{
char CurrByte = BlockBuffer[Byte];
-
+
putchar(isprint(CurrByte) ? CurrByte : '.');
}
@@ -357,10 +357,10 @@ void MassStorage_Task(void)
if (USB_HostState == HOST_STATE_Unattached)
break;
}
-
+
/* Indicate device no longer busy */
LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
@@ -386,7 +386,7 @@ void ShowDiskReadError(char* CommandString,
{
/* Display the error code */
printf_P(PSTR(ESC_FG_RED "Command error (%S).\r\n"), CommandString);
- printf_P(PSTR(" -- Error Code: %d" ESC_FG_WHITE), ErrorCode);
+ printf_P(PSTR(" -- Error Code: %d" ESC_FG_WHITE), ErrorCode);
}
Pipe_Freeze();
@@ -394,3 +394,4 @@ void ShowDiskReadError(char* CommandString,
/* Indicate device error via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h
index 7aabe9f7d..ef937b7be 100644
--- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h
+++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for MassStoreHost.c.
*/
-
+
#ifndef _MASS_STORE_HOST_H_
#define _MASS_STORE_HOST_H_
@@ -72,11 +72,11 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* Function Prototypes: */
void MassStorage_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -88,3 +88,4 @@
const uint8_t ErrorCode);
#endif
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt
index 23f083dea..45d78c43b 100644
--- a/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt
+++ b/Demos/Host/LowLevel/MassStorageHost/MassStorageHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mass Storage Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Mass Storage Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Bulk Only</td>
* </tr>
@@ -42,12 +42,12 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mass Storage host demonstration application. This gives a simple reference
* application for implementing a USB Mass Storage host, for USB storage devices
* using the standard Mass Storage USB profile.
- *
+ *
* The first 512 bytes (boot sector) of an attached disk's memory will be dumped
* out of the serial port in HEX and ASCII form when it is attached to the AT90USB1287
* AVR. The device will then wait for HWB to be pressed, whereupon the entire ASCII contents
@@ -65,3 +65,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/MassStorageHost/makefile b/Demos/Host/LowLevel/MassStorageHost/makefile
index 15db4bd67..7d8352351 100644
--- a/Demos/Host/LowLevel/MassStorageHost/makefile
+++ b/Demos/Host/LowLevel/MassStorageHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -136,7 +136,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -149,7 +149,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -263,7 +263,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -276,7 +276,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -288,7 +288,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -300,7 +300,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -323,7 +323,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -357,7 +357,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -391,7 +391,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -420,7 +420,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -439,10 +439,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -507,11 +507,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -538,9 +538,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -638,14 +638,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -667,7 +667,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -711,3 +711,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c
index b5d62236e..83e0c5338 100644
--- a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
@@ -88,7 +88,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -96,12 +96,12 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(MOUSE_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
-
+
/* Valid data found, return success */
return SuccessfulConfigRead;
}
@@ -127,7 +127,7 @@ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
/* Current descriptor does not match what this comparator is looking for */
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -162,3 +162,4 @@ uint8_t DComp_NextMouseInterfaceDataEndpoint(void* CurrentDescriptor)
/* Current descriptor does not match what this comparator is looking for */
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h
index 71fbadedd..57d71e692 100644
--- a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,19 +38,19 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "MouseHost.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define MOUSE_CLASS 0x03
/** Interface Protocol value for a Boot Protocol Mouse compliant device. */
#define MOUSE_PROTOCOL 0x02
-
+
/** Pipe number for the mouse data IN pipe. */
#define MOUSE_DATA_IN_PIPE 1
-
+
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */
enum MouseHost_GetConfigDescriptorDataCodes_t
@@ -69,3 +69,4 @@
uint8_t DComp_NextMouseInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.c b/Demos/Host/LowLevel/MouseHost/MouseHost.c
index 05efa25c5..a7bda5ae5 100644
--- a/Demos/Host/LowLevel/MouseHost/MouseHost.c
+++ b/Demos/Host/LowLevel/MouseHost/MouseHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the MouseHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MouseHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -64,7 +64,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
SerialStream_Init(9600, false);
LEDs_Init();
@@ -132,7 +132,7 @@ void ReadNextReport(void)
uint8_t LEDMask = LEDS_NO_LEDS;
/* Select mouse data pipe */
- Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
+ Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
/* Unfreeze keyboard data pipe */
Pipe_Unfreeze();
@@ -142,10 +142,10 @@ void ReadNextReport(void)
{
/* No packet received (no movement), turn off LEDs */
LEDs_SetAllLEDs(LEDS_NO_LEDS);
-
+
/* Refreeze HID data IN pipe */
Pipe_Freeze();
-
+
return;
}
@@ -153,14 +153,14 @@ void ReadNextReport(void)
if (Pipe_IsReadWriteAllowed())
{
/* Read in mouse report data */
- Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
+ Pipe_Read_Stream_LE(&MouseReport, sizeof(MouseReport));
/* Alter status LEDs according to mouse X movement */
if (MouseReport.X > 0)
LEDMask |= LEDS_LED1;
else if (MouseReport.X < 0)
LEDMask |= LEDS_LED2;
-
+
/* Alter status LEDs according to mouse Y movement */
if (MouseReport.Y > 0)
LEDMask |= LEDS_LED3;
@@ -170,9 +170,9 @@ void ReadNextReport(void)
/* Alter status LEDs according to mouse button position */
if (MouseReport.Button)
LEDMask = LEDS_ALL_LEDS;
-
+
LEDs_SetAllLEDs(LEDMask);
-
+
/* Print mouse report data through the serial port */
printf_P(PSTR("dX:%2d dY:%2d Button:%d\r\n"), MouseReport.X,
MouseReport.Y,
@@ -198,7 +198,7 @@ void Mouse_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -208,7 +208,7 @@ void Mouse_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -225,12 +225,12 @@ void Mouse_HID_Task(void)
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* HID class request to set the mouse protocol to the Boot Protocol */
USB_ControlRequest = (USB_Request_Header_t)
{
@@ -252,7 +252,7 @@ void Mouse_HID_Task(void)
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
@@ -269,3 +269,4 @@ void Mouse_HID_Task(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.h b/Demos/Host/LowLevel/MouseHost/MouseHost.h
index 8947436e6..dc75013f8 100644
--- a/Demos/Host/LowLevel/MouseHost/MouseHost.h
+++ b/Demos/Host/LowLevel/MouseHost/MouseHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,9 +49,9 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** HID Class Specific request to set the report protocol mode. */
#define REQ_SetProtocol 0x0B
@@ -76,11 +76,11 @@
int8_t X; /**< Current delta X movement of the mouse */
int8_t Y; /**< Current delta Y movement on the mouse */
} USB_MouseReport_Data_t;
-
+
/* Function Prototypes: */
void Mouse_HID_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -89,5 +89,6 @@
void EVENT_USB_Host_DeviceEnumerationComplete(void);
void ReadNextReport(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHost/MouseHost.txt b/Demos/Host/LowLevel/MouseHost/MouseHost.txt
index be608db2f..b659abada 100644
--- a/Demos/Host/LowLevel/MouseHost/MouseHost.txt
+++ b/Demos/Host/LowLevel/MouseHost/MouseHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mouse Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,23 +41,23 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mouse host demonstration application. This gives a simple reference
* application for implementing a USB Mouse host, for USB mice using
* the standard mouse HID profile.
- *
+ *
* Mouse movement and button presses are displayed on the board LEDs,
* as well as printed out the serial terminal as formatted dY, dY and
* button status information.
- *
+ *
* This uses a naive method where the mouse is set to Boot Protocol mode, so
* that the report structure is fixed and known. A better implementation
* uses the HID report parser for correct report data processing across
* all compatible mice with advanced characteristics, as shown in the
* MouseHostWithParser demo application.
- *
- * Currently only single interface mice are supported.
+ *
+ * Currently only single interface mice are supported.
*
* \section SSec_Options Project Options
*
@@ -71,3 +71,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/MouseHost/makefile b/Demos/Host/LowLevel/MouseHost/makefile
index 1369db77d..d35b1da5c 100644
--- a/Demos/Host/LowLevel/MouseHost/makefile
+++ b/Demos/Host/LowLevel/MouseHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -261,7 +261,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -274,7 +274,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -286,7 +286,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -298,7 +298,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -321,7 +321,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -355,7 +355,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -389,7 +389,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -418,7 +418,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -437,10 +437,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -505,11 +505,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -536,9 +536,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -636,14 +636,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -665,7 +665,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -709,3 +709,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c
index dc8ada879..7a1a6faaa 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
@@ -67,7 +67,7 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return ControlError;
}
-
+
while (!(DataINEndpoint))
{
/* See if we've found a likely compatible interface, and if there is an endpoint within that interface */
@@ -82,7 +82,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the interface in case we need to refer back to it later */
HIDInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
@@ -93,14 +93,14 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the HID descriptor for later use */
- HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
-
+ HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
+
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -108,7 +108,7 @@ uint8_t ProcessConfigurationDescriptor(void)
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(MOUSE_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -140,7 +140,7 @@ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -181,5 +181,6 @@ uint8_t DComp_NextHID(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else
- return DESCRIPTOR_SEARCH_NotFound;
+ return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h
index b2a2e3890..504bc0b76 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,16 +38,16 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "HIDReport.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define MOUSE_CLASS 0x03
/** Interface Protocol value for a Boot Protocol Mouse compliant device. */
#define MOUSE_PROTOCOL 0x02
-
+
/** Descriptor header type constant for a HID descriptor. */
#define DTYPE_HID 0x21
@@ -56,7 +56,7 @@
/** Pipe number for the mouse report data pipe. */
#define MOUSE_DATA_IN_PIPE 1
-
+
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */
enum MouseHostWithParser_GetConfigDescriptorDataCodes_t
@@ -76,3 +76,4 @@
uint8_t DComp_NextHID(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c
index 327ae45ec..18799c27f 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c
+++ b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@ uint8_t GetHIDReportData(void)
{
/* Create a buffer big enough to hold the entire returned HID report */
uint8_t HIDReportData[HIDReportSize];
-
+
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
@@ -66,7 +66,7 @@ uint8_t GetHIDReportData(void)
/* Send the HID report to the parser for processing */
if (USB_ProcessHIDReport(HIDReportData, HIDReportSize, &HIDReportInfo) != HID_PARSE_Successful)
return ParseError;
-
+
return ParseSuccessful;
}
@@ -100,7 +100,7 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
/* If a collection with the mouse usage was not found, indicate that we are not interested in this item */
if (!IsMouse)
return false;
-
+
/* Check the attributes of the current mouse item - see if we are interested in it or not;
* only store BUTTON and GENERIC_DESKTOP_CONTROL items into the Processed HID Report
* structure to save RAM and ignore the rest
@@ -108,3 +108,4 @@ bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
return ((CurrentItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) ||
(CurrentItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL));
}
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h
index bd12a39c1..19cfd753c 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h
+++ b/Demos/Host/LowLevel/MouseHostWithParser/HIDReport.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/Host/HIDParser.h>
-
+
#include "MouseHostWithParser.h"
/* Macros: */
@@ -60,7 +60,7 @@
/** HID Report Descriptor Usage value for a Scroll Wheel movement. */
#define USAGE_SCROLL_WHEEL 0x38
-
+
/* Enums: */
/** Enum for the possible return codes of the \ref GetHIDReportData() function. */
enum MouseHostWithParser_GetHIDReportDataCodes_t
@@ -69,16 +69,16 @@
ParseError = 1, /**< Failed to fully process the HID report descriptor */
ParseControlError = 2, /**< Control error occurred while trying to read the device HID descriptor */
};
-
+
/* Type Defines: */
/** Type define for a HID descriptor. */
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
-
+
uint16_t HIDSpec; /**< Implemented HID class specification, in BCD encoded format */
uint8_t CountryCode; /**< Country code value for localized hardware */
-
+
uint8_t TotalHIDDescriptors; /**< Total number of HID report descriptors in the current interface */
uint8_t HIDReportType; /**< HID report type of the first HID report descriptor */
@@ -91,7 +91,8 @@
/* Function Prototypes: */
uint8_t GetHIDReportData(void);
-
+
bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
index a0240b04a..185871d4a 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
+++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the MouseHostWithParser demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "MouseHostWithParser.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -64,7 +64,7 @@ void SetupHardware(void)
/* Disable clock division */
clock_prescale_set(clock_div_1);
-
+
/* Hardware Initialization */
SerialStream_Init(9600, false);
LEDs_Init();
@@ -119,7 +119,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -135,7 +135,7 @@ void Mouse_HID_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -145,7 +145,7 @@ void Mouse_HID_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -153,7 +153,7 @@ void Mouse_HID_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -162,12 +162,12 @@ void Mouse_HID_Task(void)
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Processing HID Report (Size %d Bytes).\r\n"), HIDReportSize);
/* Get and process the device's first HID report descriptor */
@@ -179,21 +179,21 @@ void Mouse_HID_Task(void)
puts_P(PSTR("Not a valid Mouse." ESC_FG_WHITE));
else
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);
for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)
{
HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];
-
+
uint8_t ReportSizeInBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_In];
uint8_t ReportSizeOutBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Out];
uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[HID_REPORT_ITEM_Feature];
@@ -212,9 +212,9 @@ void Mouse_HID_Task(void)
break;
case HOST_STATE_Configured:
/* Select and unfreeze mouse data pipe */
- Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
+ Pipe_SelectPipe(MOUSE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Check to see if a packet has been received */
if (Pipe_IsINReceived())
{
@@ -226,11 +226,11 @@ void Mouse_HID_Task(void)
/* Load in the mouse report */
Pipe_Read_Stream_LE(MouseReport, Pipe_BytesInPipe());
-
+
/* Process the read in mouse report from the device */
ProcessMouseReport(MouseReport);
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
}
@@ -255,7 +255,7 @@ void ProcessMouseReport(uint8_t* MouseReport)
{
/* Create a temporary item pointer to the next report item */
HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber];
-
+
bool FoundData;
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&
@@ -263,7 +263,7 @@ void ProcessMouseReport(uint8_t* MouseReport)
{
/* Get the mouse button value */
FoundData = USB_GetHIDReportItemInfo(MouseReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
@@ -276,14 +276,14 @@ void ProcessMouseReport(uint8_t* MouseReport)
(ReportItem->Attributes.Usage.Usage == USAGE_SCROLL_WHEEL) &&
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
- /* Get the mouse wheel value if it is contained within the current
+ /* Get the mouse wheel value if it is contained within the current
* report, if not, skip to the next item in the parser list
*/
if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem)))
- continue;
+ continue;
int16_t WheelDelta = HID_ALIGN_DATA(ReportItem, int16_t);
-
+
if (WheelDelta)
LEDMask = (LEDS_LED1 | LEDS_LED2 | ((WheelDelta > 0) ? LEDS_LED3 : LEDS_LED4));
}
@@ -294,13 +294,13 @@ void ProcessMouseReport(uint8_t* MouseReport)
{
/* Get the mouse relative position value */
FoundData = USB_GetHIDReportItemInfo(MouseReport, ReportItem);
-
+
/* For multi-report devices - if the requested data was not in the issued report, continue */
if (!(FoundData))
continue;
-
+
int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);
-
+
/* Check to see if a (non-zero) delta movement has been indicated */
if (DeltaMovement)
{
@@ -312,7 +312,7 @@ void ProcessMouseReport(uint8_t* MouseReport)
}
}
}
-
+
/* Display the button information on the board LEDs */
LEDs_SetAllLEDs(LEDMask);
-} \ No newline at end of file
+}
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h
index a51b7a25d..4e492f61c 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h
+++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,7 +49,7 @@
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "ConfigDescriptor.h"
#include "HIDReport.h"
@@ -69,7 +69,7 @@
/* Function Prototypes: */
void Mouse_HID_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -80,3 +80,4 @@
void ProcessMouseReport(uint8_t* MouseReport);
#endif
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt
index febd4a939..fdcdb6153 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt
+++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Mouse Host With HID Descriptor Parser Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -41,19 +41,19 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Mouse host demonstration application. This gives a simple reference
* application for implementing a USB Mouse host, for USB mice using
* the standard mouse HID profile. It uses a HID parser for the HID
* reports, allowing for correct operation across all USB mice. This
* demo supports mice with a single HID report.
- *
+ *
* Mouse and scroll wheel movement and button presses are displayed
* on the board LEDs. On connection to a USB mouse, the report items
* will be processed and printed as a formatted list through the USART
* before the mouse is fully enumerated.
- *
+ *
* Currently only single interface mice are supported.
*
* \section SSec_Options Project Options
@@ -68,3 +68,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/makefile b/Demos/Host/LowLevel/MouseHostWithParser/makefile
index cd1907272..9ea09fa0c 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/makefile
+++ b/Demos/Host/LowLevel/MouseHostWithParser/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c
index 89bf488be..b269820e4 100644
--- a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,7 +49,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* PrinterInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -66,7 +66,7 @@ uint8_t ProcessConfigurationDescriptor(void)
default:
return ControlError;
}
-
+
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
/* See if we've found a likely compatible interface, and if there is an endpoint within that interface */
@@ -81,7 +81,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the interface in case we need to refer back to it later */
PrinterInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
@@ -92,7 +92,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -102,10 +102,10 @@ uint8_t ProcessConfigurationDescriptor(void)
else
DataOUTEndpoint = EndpointData;
}
-
+
/* Save Printer interface details for later use */
PrinterInterfaceNumber = PrinterInterface->InterfaceNumber;
- PrinterAltSetting = PrinterInterface->AlternateSetting;
+ PrinterAltSetting = PrinterInterface->AlternateSetting;
/* Configure the Printer data IN pipe */
Pipe_ConfigurePipe(PRINTER_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
@@ -140,7 +140,7 @@ uint8_t DComp_NextBidirectionalPrinterInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -171,3 +171,4 @@ uint8_t DComp_NextPrinterInterfaceBulkDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h
index b0cd56b19..b25f3bdc7 100644
--- a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,10 +33,10 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "PrinterHost.h"
#include "Lib/PrinterCommands.h"
-
+
/* Macros: */
/** Interface Class value for the Printer Device class. */
#define PRINTER_CLASS 0x07
@@ -63,22 +63,23 @@
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
};
-
+
/* External Variables: */
/** Interface index of the Bidirectional Printer interface within the device, once the Configuration
* Descriptor has been processed.
*/
uint8_t PrinterInterfaceNumber;
-
+
/** Interface Alternate Setting index of the Bidirectional Printer interface within the device, once
* the Configuration Descriptor has been processed.
*/
uint8_t PrinterAltSetting;
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
+ uint8_t ProcessConfigurationDescriptor(void);
uint8_t DComp_NextBidirectionalPrinterInterface(void* CurrentDescriptor);
uint8_t DComp_NextPrinterInterfaceBulkDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
index 0b75d7507..da79e03cc 100644
--- a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
+++ b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -51,14 +51,14 @@ uint8_t Printer_SendData(const void* const PrinterCommands,
Pipe_SelectPipe(PRINTER_DATA_OUT_PIPE);
Pipe_Unfreeze();
-
+
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands, CommandSize)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearOUT();
-
+
Pipe_WaitUntilReady();
-
+
Pipe_Freeze();
return PIPE_RWSTREAM_NoError;
@@ -86,33 +86,33 @@ uint8_t Printer_GetDeviceID(char* DeviceIDString,
.wIndex = PrinterInterfaceNumber,
.wLength = sizeof(DeviceIDStringLength),
};
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
if ((ErrorCode = USB_Host_SendControlRequest(&DeviceIDStringLength)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
-
+
if (!(DeviceIDStringLength))
{
DeviceIDString[0] = 0x00;
return HOST_SENDCONTROL_Successful;
}
-
+
DeviceIDStringLength = SwapEndian_16(DeviceIDStringLength);
if (DeviceIDStringLength > BufferSize)
DeviceIDStringLength = BufferSize;
USB_ControlRequest.wLength = DeviceIDStringLength;
-
+
if ((ErrorCode = USB_Host_SendControlRequest(DeviceIDString)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
-
+
/* Move string back two characters to remove the string length value from the start of the array */
memmove(&DeviceIDString[0], &DeviceIDString[2], DeviceIDStringLength - 2);
DeviceIDString[DeviceIDStringLength - 2] = 0x00;
-
+
return HOST_SENDCONTROL_Successful;
}
diff --git a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h
index 9cd768efa..812ff7e5a 100644
--- a/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h
+++ b/Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for PrinterCommands.c.
*/
-
+
#ifndef _PRINTER_COMMANDS_H_
#define _PRINTER_COMMANDS_H_
@@ -41,7 +41,7 @@
#include <string.h>
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "../PrinterHost.h"
/* Macros: */
@@ -53,7 +53,7 @@
/** Printer class-specific request to soft-reset the device. */
#define REQ_SoftReset 2
-
+
/* Function Prototypes: */
uint8_t Printer_SendData(const void* const PrinterCommands,
const uint16_t CommandSize);
@@ -61,5 +61,6 @@
const uint16_t BufferSize);
uint8_t Printer_GetPortStatus(uint8_t* const PortStatus);
uint8_t Printer_SoftReset(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c
index f12c95ef9..88a1a8c43 100644
--- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c
+++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@ int main(void)
puts_P(PSTR(ESC_FG_CYAN "Printer Host Demo running.\r\n" ESC_FG_WHITE));
sei();
-
+
for (;;)
{
USB_Printer_Host();
@@ -134,10 +134,10 @@ void USB_Printer_Host(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Select the control pipe for the request transfer */
- Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -147,7 +147,7 @@ void USB_Printer_Host(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n"), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -155,7 +155,7 @@ void USB_Printer_Host(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -169,7 +169,7 @@ void USB_Printer_Host(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Some printers use alternate settings to determine the communication protocol used - if so, send a SetInterface
* request to switch to the interface alternate setting with the Bidirectional protocol */
if (PrinterAltSetting)
@@ -182,7 +182,7 @@ void USB_Printer_Host(void)
.wIndex = PrinterInterfaceNumber,
.wLength = 0,
};
-
+
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
{
printf_P(PSTR(ESC_FG_RED "Control Error (Set Interface).\r\n"
@@ -193,12 +193,12 @@ void USB_Printer_Host(void)
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
}
-
+
puts_P(PSTR("Retrieving Device ID...\r\n"));
-
+
char DeviceIDString[300];
if ((ErrorCode = Printer_GetDeviceID(DeviceIDString, sizeof(DeviceIDString))) != HOST_SENDCONTROL_Successful)
{
@@ -222,10 +222,10 @@ void USB_Printer_Host(void)
case HOST_STATE_Configured:
/* Indicate device busy via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
char TestPageData[] = "\033%-12345X\033E" "LUFA PCL Test Page" "\033E\033%-12345X";
uint16_t TestPageLength = strlen(TestPageData);
-
+
printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"), TestPageLength);
if ((ErrorCode = Printer_SendData(&TestPageData, TestPageLength)) != PIPE_RWSTREAM_NoError)
@@ -242,7 +242,7 @@ void USB_Printer_Host(void)
}
puts_P(PSTR("Test Page Sent.\r\n"));
-
+
/* Indicate device no longer busy */
LEDs_SetAllLEDs(LEDMASK_USB_READY);
@@ -250,3 +250,4 @@ void USB_Printer_Host(void)
break;
}
}
+
diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h b/Demos/Host/LowLevel/PrinterHost/PrinterHost.h
index 2ba270f7d..1825d9f17 100644
--- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.h
+++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for PrinterHost.c.
*/
-
+
#ifndef _MASS_STORE_HOST_H_
#define _MASS_STORE_HOST_H_
@@ -66,13 +66,13 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* External Variables: */
extern uint8_t PrinterInterfaceNumber;
-
+
/* Function Prototypes: */
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -86,3 +86,4 @@
void USB_Printer_Host(void);
#endif
+
diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt b/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt
index 92d43310b..e6b810dbc 100644
--- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt
+++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Printer Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Printer Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Bidirectional Protocol</td>
* </tr>
@@ -38,16 +38,16 @@
* Full Speed Mode</td>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Printer host demonstration application. This gives a simple reference
* application for implementing a USB Printer host, for USB printers using
* the bidirectional data encapsulation protocol and PCL language.
- *
+ *
* Upon connection of a compatible printer, the printer's device ID is sent
* to the AVR's serial port, and a simple test page is printed using the PCL
* printer language.
- *
+ *
* \section SSec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
@@ -60,3 +60,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/PrinterHost/makefile b/Demos/Host/LowLevel/PrinterHost/makefile
index b8c162522..f64184ba0 100644
--- a/Demos/Host/LowLevel/PrinterHost/makefile
+++ b/Demos/Host/LowLevel/PrinterHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c
index 58e1408c1..1190d28b7 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* needed to communication with an attached USB device. Descriptors are special computer-readable structures
* which the host requests upon device enumeration, to determine the device's capabilities and functions.
*/
-
+
#include "ConfigDescriptor.h"
/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* RNDISControlInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -85,7 +85,7 @@ uint8_t ProcessConfigurationDescriptor(void)
{
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
- }
+ }
/* Clear any found endpoints */
DataINEndpoint = NULL;
@@ -111,7 +111,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -129,7 +129,7 @@ uint8_t ProcessConfigurationDescriptor(void)
DataOUTEndpoint = EndpointData;
}
}
-
+
/* Configure the RNDIS data IN pipe */
Pipe_ConfigurePipe(RNDIS_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -167,7 +167,7 @@ uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -191,7 +191,7 @@ uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -211,7 +211,7 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor)
{
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
-
+
if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT))
return DESCRIPTOR_SEARCH_Found;
}
@@ -222,3 +222,4 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h
index 834493742..b4a056f85 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "RNDISEthernetHost.h"
-
+
/* Macros: */
/** Interface Class value for the CDC class. */
#define CDC_CONTROL_CLASS 0x02
@@ -50,7 +50,7 @@
/** Interface Class value for the CDC RNDIS vendor specific protocol. */
#define CDC_CONTROL_PROTOCOL 0xFF
-
+
/** Interface Class value for the CDC data class. */
#define CDC_DATA_CLASS 0x0A
@@ -59,7 +59,7 @@
/** Interface Class value for the CDC data protocol. */
#define CDC_DATA_PROTOCOL 0x00
-
+
/** Pipe number for the RNDIS data IN pipe. */
#define RNDIS_DATA_IN_PIPE 1
@@ -81,10 +81,11 @@
};
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
-
+ uint8_t ProcessConfigurationDescriptor(void);
+
uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor);
uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor);
uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c
index 64cfc3ce6..661762b8b 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -83,7 +83,7 @@ uint8_t RNDIS_GetEncapsulatedResponse(void* const Buffer,
.wIndex = 0,
.wLength = Length,
};
-
+
/* Select the control pipe for the request transfer */
Pipe_SelectPipe(PIPE_CONTROLPIPE);
@@ -102,7 +102,7 @@ uint8_t RNDIS_SendKeepAlive(void)
RNDIS_KeepAlive_Message_t KeepAliveMessage;
RNDIS_KeepAlive_Complete_t KeepAliveMessageResponse;
-
+
KeepAliveMessage.MessageType = REMOTE_NDIS_KEEPALIVE_MSG;
KeepAliveMessage.MessageLength = sizeof(RNDIS_KeepAlive_Message_t);
KeepAliveMessage.RequestId = RequestID++;
@@ -112,13 +112,13 @@ uint8_t RNDIS_SendKeepAlive(void)
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(&KeepAliveMessageResponse,
sizeof(RNDIS_KeepAlive_Complete_t))) != HOST_SENDCONTROL_Successful)
{
return ErrorCode;
}
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -145,13 +145,13 @@ uint8_t RNDIS_InitializeDevice(const uint16_t HostMaxPacketSize,
InitMessage.MajorVersion = REMOTE_NDIS_VERSION_MAJOR;
InitMessage.MinorVersion = REMOTE_NDIS_VERSION_MINOR;
InitMessage.MaxTransferSize = HostMaxPacketSize;
-
+
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(&InitMessage,
sizeof(RNDIS_Initialize_Message_t))) != HOST_SENDCONTROL_Successful)
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(&InitMessageResponse,
sizeof(RNDIS_Initialize_Complete_t))) != HOST_SENDCONTROL_Successful)
{
@@ -160,9 +160,9 @@ uint8_t RNDIS_InitializeDevice(const uint16_t HostMaxPacketSize,
if (InitMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
return RNDIS_COMMAND_FAILED;
-
+
*DeviceMaxPacketSize = InitMessageResponse.MaxTransferSize;
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -186,18 +186,18 @@ uint8_t RNDIS_SetRNDISProperty(const uint32_t Oid,
RNDIS_Set_Message_t SetMessage;
uint8_t ContiguousBuffer[Length];
} SetMessageData;
-
+
RNDIS_Set_Complete_t SetMessageResponse;
-
+
SetMessageData.SetMessage.MessageType = REMOTE_NDIS_SET_MSG;
SetMessageData.SetMessage.MessageLength = sizeof(RNDIS_Set_Message_t) + Length;
SetMessageData.SetMessage.RequestId = RequestID++;
-
+
SetMessageData.SetMessage.Oid = Oid;
SetMessageData.SetMessage.InformationBufferLength = Length;
SetMessageData.SetMessage.InformationBufferOffset = (sizeof(RNDIS_Set_Message_t) - sizeof(RNDIS_Message_Header_t));
SetMessageData.SetMessage.DeviceVcHandle = 0;
-
+
memcpy(&SetMessageData.ContiguousBuffer, Buffer, Length);
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(&SetMessageData,
@@ -205,7 +205,7 @@ uint8_t RNDIS_SetRNDISProperty(const uint32_t Oid,
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(&SetMessageResponse,
sizeof(RNDIS_Set_Complete_t))) != HOST_SENDCONTROL_Successful)
{
@@ -214,7 +214,7 @@ uint8_t RNDIS_SetRNDISProperty(const uint32_t Oid,
if (SetMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
return RNDIS_COMMAND_FAILED;
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -244,7 +244,7 @@ uint8_t RNDIS_QueryRNDISProperty(const uint32_t Oid,
QueryMessage.MessageType = REMOTE_NDIS_QUERY_MSG;
QueryMessage.MessageLength = sizeof(RNDIS_Query_Message_t);
QueryMessage.RequestId = RequestID++;
-
+
QueryMessage.Oid = Oid;
QueryMessage.InformationBufferLength = 0;
QueryMessage.InformationBufferOffset = 0;
@@ -255,7 +255,7 @@ uint8_t RNDIS_QueryRNDISProperty(const uint32_t Oid,
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(&QueryMessageResponseData,
sizeof(QueryMessageResponseData))) != HOST_SENDCONTROL_Successful)
{
@@ -284,7 +284,7 @@ uint8_t RNDIS_GetPacketLength(uint16_t* const PacketLength)
Pipe_SelectPipe(RNDIS_DATA_IN_PIPE);
Pipe_SetPipeToken(PIPE_TOKEN_IN);
Pipe_Unfreeze();
-
+
if (!(Pipe_IsReadWriteAllowed()))
{
*PacketLength = 0;
@@ -293,17 +293,18 @@ uint8_t RNDIS_GetPacketLength(uint16_t* const PacketLength)
}
RNDIS_Packet_Message_t DeviceMessage;
-
+
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t))) != PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}
*PacketLength = (uint16_t)DeviceMessage.DataLength;
-
+
Pipe_Discard_Stream(DeviceMessage.DataOffset - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)));
-
+
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h
index 56b4946e6..f474c9bd8 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISCommands.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,9 +40,9 @@
#include <avr/io.h>
#include <stdio.h>
#include <string.h>
-
+
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "RNDISConstants.h"
#include "../RNDISEthernetHost.h"
@@ -69,19 +69,19 @@
uint32_t VcHandle;
uint32_t Reserved;
} RNDIS_Packet_Message_t;
-
+
/** Type define for a RNDIS Initialize command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t MaxTransferSize;
} RNDIS_Initialize_Message_t;
-
+
/** Type define for a RNDIS Initialize complete response message. */
typedef struct
{
@@ -89,7 +89,7 @@
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
-
+
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t DeviceFlags;
@@ -100,7 +100,7 @@
uint32_t AFListOffset;
uint32_t AFListSize;
} RNDIS_Initialize_Complete_t;
-
+
/** Type define for a RNDIS Keep-alive command message. */
typedef struct
{
@@ -127,14 +127,14 @@
uint32_t AddressingReset;
} RNDIS_Reset_Complete_t;
-
+
/** Type define for a RNDIS Set command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
@@ -149,20 +149,20 @@
uint32_t RequestId;
uint32_t Status;
} RNDIS_Set_Complete_t;
-
+
/** Type define for a RNDIS Query command message. */
typedef struct
{
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle;
} RNDIS_Query_Message_t;
-
+
/** Type define for a RNDIS Query complete response message. */
typedef struct
{
@@ -170,7 +170,7 @@
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
-
+
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
} RNDIS_Query_Complete_t;
@@ -187,7 +187,7 @@
/** Implemented RNDIS Version Minor. */
#define REMOTE_NDIS_VERSION_MINOR 0x00
-
+
/** Additional error code for RNDIS functions when a device returns a logical command failure. */
#define RNDIS_COMMAND_FAILED 0xC0
@@ -209,3 +209,4 @@
uint8_t RNDIS_GetPacketLength(uint16_t* const PacketLength);
#endif
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h
index efe22b699..273fdb81e 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/Lib/RNDISConstants.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* RNDIS specification related constants. For more information on these
* constants, please refer to the Microsoft RNDIS specification.
*/
-
+
#ifndef _RNDIS_CONSTANTS_DEVICE_H_
#define _RNDIS_CONSTANTS_DEVICE_H_
@@ -52,19 +52,19 @@
#define REMOTE_NDIS_SET_CMPLT 0x80000005UL
#define REMOTE_NDIS_RESET_CMPLT 0x80000006UL
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL
-
+
#define REMOTE_NDIS_STATUS_SUCCESS 0x00000000UL
#define REMOTE_NDIS_STATUS_FAILURE 0xC0000001UL
#define REMOTE_NDIS_STATUS_INVALID_DATA 0xC0010015UL
#define REMOTE_NDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL
#define REMOTE_NDIS_STATUS_MEDIA_CONNECT 0x4001000BUL
#define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL
-
+
#define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL
#define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL
-
+
#define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL
-
+
#define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL
#define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL
@@ -79,8 +79,8 @@
#define REMOTE_NDIS_PACKET_GROUP 0x00001000UL
#define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
#define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL
- #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
-
+ #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
+
#define OID_GEN_SUPPORTED_LIST 0x00010101UL
#define OID_GEN_HARDWARE_STATUS 0x00010102UL
#define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
@@ -110,3 +110,4 @@
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
#endif
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c
index 1da5b4dbf..302eddb66 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the RNDISEthernetHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "RNDISEthernetHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -119,7 +119,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -133,13 +133,13 @@ void PrintIncomingPackets(void)
if ((ErrorCode = RNDIS_GetPacketLength(&PacketLength)) != HOST_SENDCONTROL_Successful)
{
printf_P(PSTR(ESC_FG_RED "Packet Reception Error.\r\n"
- " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
+ " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
return;
}
-
+
if (!(PacketLength))
return;
-
+
Pipe_Unfreeze();
printf_P(PSTR("***PACKET (Size %d)***\r\n"), PacketLength);
@@ -152,13 +152,13 @@ void PrintIncomingPackets(void)
else
{
uint8_t PacketBuffer[PacketLength];
-
+
Pipe_Read_Stream_LE(&PacketBuffer, PacketLength);
-
+
for (uint16_t i = 0; i < PacketLength; i++)
printf("0x%02x ", PacketBuffer[i]);
}
-
+
Pipe_ClearIN();
Pipe_Freeze();
@@ -178,7 +178,7 @@ void RNDIS_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -188,7 +188,7 @@ void RNDIS_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -196,7 +196,7 @@ void RNDIS_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -210,7 +210,7 @@ void RNDIS_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
uint16_t DeviceMaxPacketSize;
if ((ErrorCode = RNDIS_InitializeDevice(1024, &DeviceMaxPacketSize)) != HOST_SENDCONTROL_Successful)
{
@@ -222,11 +222,11 @@ void RNDIS_Host_Task(void)
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
-
+
printf_P(PSTR("Device Max Transfer Size: %lu bytes.\r\n"), DeviceMaxPacketSize);
-
+
/* We set the default filter to only receive packets we would be interested in */
uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST | REMOTE_NDIS_PACKET_ALL_MULTICAST);
if ((ErrorCode = RNDIS_SetRNDISProperty(OID_GEN_CURRENT_PACKET_FILTER,
@@ -242,7 +242,7 @@ void RNDIS_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
uint32_t VendorID;
if ((ErrorCode = RNDIS_QueryRNDISProperty(OID_GEN_VENDOR_ID,
&VendorID, sizeof(VendorID))) != HOST_SENDCONTROL_Successful)
@@ -257,16 +257,16 @@ void RNDIS_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
printf_P(PSTR("Device Vendor ID: 0x%08lX\r\n"), VendorID);
-
+
puts_P(PSTR("RNDIS Device Enumerated.\r\n"));
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
PrintIncomingPackets();
-
+
break;
}
}
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h
index 08187f9fa..c52fe6b9c 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISEthernetHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,11 +49,11 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "Lib/RNDISCommands.h"
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -66,7 +66,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
@@ -87,12 +87,13 @@
void SetupHardware(void);
void PrintIncomingPackets(void);
void RNDIS_Host_Task(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt
index 9fec00bec..a989bc51a 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/RNDISHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage RNDIS Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard)</td>
* </tr>
@@ -39,12 +39,12 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* RNDIS host demonstration application. This gives a simple reference
* application for implementing a RNDIS Ethernet host, for USB devices such as
* modems.
- *
+ *
* This demo will enumerate an attached USB RNDIS device, print out its vendor ID
* and any received packets in raw form through the serial USART.
*
@@ -60,3 +60,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/makefile b/Demos/Host/LowLevel/RNDISEthernetHost/makefile
index b2faa5be5..d9821c6db 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/makefile
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c
index d11dee038..2a00a7361 100644
--- a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* StillImageInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -113,7 +113,7 @@ uint8_t ProcessConfigurationDescriptor(void)
DataOUTEndpoint = EndpointData;
}
}
-
+
/* Configure the Still Image data IN pipe */
Pipe_ConfigurePipe(SIMAGE_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -151,7 +151,7 @@ uint8_t DComp_NextStillImageInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -170,7 +170,7 @@ uint8_t DComp_NextStillImageInterfaceDataEndpoint(void* CurrentDescriptor)
{
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
-
+
if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT))
return DESCRIPTOR_SEARCH_Found;
}
@@ -181,3 +181,4 @@ uint8_t DComp_NextStillImageInterfaceDataEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h
index 929d658cd..bd31c6bf2 100644
--- a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "StillImageHost.h"
-
+
/* Macros: */
/** Interface Class value for the Still Image Device class. */
#define SIMAGE_CLASS 0x06
@@ -50,7 +50,7 @@
/** Interface Class value for the Still Image Device protocol. */
#define SIMAGE_PROTOCOL 0x01
-
+
/** Pipe number of the Still Image data IN pipe. */
#define SIMAGE_DATA_IN_PIPE 1
@@ -70,7 +70,7 @@
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
};
-
+
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
@@ -78,3 +78,4 @@
uint8_t DComp_NextStillImageInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h b/Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h
index 7bd8d4fe8..692b1fae8 100644
--- a/Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h
+++ b/Demos/Host/LowLevel/StillImageHost/Lib/PIMACodes.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,7 +40,7 @@
#define PIMA_OPERATION_GETDEVICEINFO 0x1001
#define PIMA_OPERATION_OPENSESSION 0x1002
#define PIMA_OPERATION_CLOSESESSION 0x1003
-
+
#define PIMA_RESPONSE_OK 0x2001
#define PIMA_RESPONSE_GENERALERROR 0x2002
#define PIMA_RESPONSE_SESSIONNOTOPEN 0x2003
@@ -49,3 +49,4 @@
#define PIMA_RESPONSE_PARAMETERNOTSUPPORTED 0x2006
#endif
+
diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
index 861f55b5d..9d6828e32 100644
--- a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
+++ b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,7 +56,7 @@ void SImage_SendBlockHeader(void)
/* Write the PIMA block to the data OUT pipe */
Pipe_Write_Stream_LE(&PIMA_SendBlock, PIMA_COMMAND_SIZE(0));
-
+
/* If the block type is a command, send its parameters (if any) */
if (PIMA_SendBlock.Type == CType_CommandBlock)
{
@@ -69,11 +69,11 @@ void SImage_SendBlockHeader(void)
/* Write the PIMA parameters to the data OUT pipe */
Pipe_Write_Stream_LE(&PIMA_SendBlock.Params, ParamBytes);
}
-
+
/* Send the PIMA command block to the attached device */
Pipe_ClearOUT();
}
-
+
/* Freeze pipe after use */
Pipe_Freeze();
}
@@ -89,16 +89,16 @@ uint8_t SImage_ReceiveEventHeader(void)
/* Unfreeze the events pipe */
Pipe_SelectPipe(SIMAGE_EVENTS_PIPE);
Pipe_Unfreeze();
-
+
/* Read in the event data into the global structure */
ErrorCode = Pipe_Read_Stream_LE(&PIMA_EventBlock, sizeof(PIMA_EventBlock));
-
+
/* Clear the pipe after read complete to prepare for next event */
Pipe_ClearIN();
-
+
/* Freeze the event pipe again after use */
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -114,7 +114,7 @@ uint8_t SImage_ReceiveBlockHeader(void)
/* Unfreeze the data IN pipe */
Pipe_SelectPipe(SIMAGE_DATA_IN_PIPE);
Pipe_Unfreeze();
-
+
/* Wait until data received on the IN pipe */
while (!(Pipe_IsINReceived()))
{
@@ -131,7 +131,7 @@ uint8_t SImage_ReceiveBlockHeader(void)
if (!(TimeoutMSRem))
return PIPE_RWSTREAM_Timeout;
}
-
+
Pipe_Freeze();
Pipe_SelectPipe(SIMAGE_DATA_OUT_PIPE);
Pipe_Unfreeze();
@@ -159,15 +159,15 @@ uint8_t SImage_ReceiveBlockHeader(void)
/* Return error code */
return PIPE_RWSTREAM_PipeStalled;
}
-
+
/* Check to see if the device was disconnected, if so exit function */
if (USB_HostState == HOST_STATE_Unattached)
return PIPE_RWSTREAM_DeviceDisconnected;
}
-
+
/* Load in the response from the attached device */
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock, PIMA_COMMAND_SIZE(0));
-
+
/* Check if the returned block type is a response block */
if (PIMA_ReceivedBlock.Type == CType_ResponseBlock)
{
@@ -180,14 +180,14 @@ uint8_t SImage_ReceiveBlockHeader(void)
/* Read the PIMA parameters from the data IN pipe */
Pipe_Read_Stream_LE(&PIMA_ReceivedBlock.Params, ParamBytes);
}
-
+
/* Clear pipe bank after use */
Pipe_ClearIN();
}
-
+
/* Freeze the IN pipe after use */
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
@@ -206,7 +206,7 @@ uint8_t SImage_SendData(void* const Buffer,
/* Unfreeze the data OUT pipe */
Pipe_SelectPipe(SIMAGE_DATA_OUT_PIPE);
Pipe_Unfreeze();
-
+
/* Write the data contents to the pipe */
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes);
@@ -215,7 +215,7 @@ uint8_t SImage_SendData(void* const Buffer,
/* Freeze the pipe again after use */
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -240,7 +240,7 @@ uint8_t SImage_ReadData(void* const Buffer,
/* Freeze the pipe again after use */
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -255,13 +255,14 @@ bool SImage_IsEventReceived(void)
/* Unfreeze the Event pipe */
Pipe_SelectPipe(SIMAGE_EVENTS_PIPE);
Pipe_Unfreeze();
-
+
/* If the pipe contains data, an event has been received */
if (Pipe_BytesInPipe())
IsEventReceived = true;
-
+
/* Freeze the pipe after use */
Pipe_Freeze();
-
+
return IsEventReceived;
}
+
diff --git a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h
index f2bb18953..2ab36c2ba 100644
--- a/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h
+++ b/Demos/Host/LowLevel/StillImageHost/Lib/StillImageCommands.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,17 +32,17 @@
*
* Header file for StillImageCommands.c.
*/
-
+
#ifndef _STILL_IMAGE_COMMANDS_H_
#define _STILL_IMAGE_COMMANDS_H_
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "PIMACodes.h"
#include "../StillImageHost.h"
- /* Macros: */
+ /* Macros: */
/** Length in bytes of a given Unicode string's character length.
*
* \param[in] chars Total number of Unicode characters in the string
@@ -51,7 +51,7 @@
/** Timeout period between the issuing of a command to a device, and the reception of the first packet. */
#define COMMAND_DATA_TIMEOUT_MS 10000
-
+
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a command container.
*
@@ -79,7 +79,7 @@
uint32_t TransactionID; /**< Unique container ID to link blocks together */
uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only) */
} PIMA_Container_t;
-
+
/* Enums: */
/** Enum for the possible PIMA contains types. */
enum PIMA_Container_Types_t
@@ -90,12 +90,12 @@
CType_ResponseBlock = 3, /**< Response container type */
CType_EventBlock = 4, /**< Event Block container type */
};
-
+
/* External Variables: */
extern PIMA_Container_t PIMA_SendBlock;
extern PIMA_Container_t PIMA_ReceivedBlock;
extern PIMA_Container_t PIMA_EventBlock;
-
+
/* Function Prototypes: */
void SImage_SendBlockHeader(void);
uint8_t SImage_ReceiveBlockHeader(void);
@@ -107,3 +107,4 @@
bool SImage_IsEventReceived(void);
#endif
+
diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
index 73f0c2c76..aa139e225 100644
--- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
+++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -120,7 +120,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -135,7 +135,7 @@ void StillImage_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -145,7 +145,7 @@ void StillImage_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -167,16 +167,16 @@ void StillImage_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Still Image Device Enumerated.\r\n"));
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
/* Indicate device busy via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
puts_P(PSTR("Retrieving Device Info...\r\n"));
-
+
PIMA_SendBlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(0),
@@ -185,34 +185,34 @@ void StillImage_Task(void)
.TransactionID = 0x00000000,
.Params = {},
};
-
+
/* Send the GETDEVICEINFO block */
SImage_SendBlockHeader();
-
+
/* Receive the response data block */
if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Calculate the size of the returned device info data structure */
uint16_t DeviceInfoSize = (PIMA_ReceivedBlock.DataLength - PIMA_COMMAND_SIZE(0));
-
+
/* Create a buffer large enough to hold the entire device info */
uint8_t DeviceInfo[DeviceInfoSize];
/* Read in the data block data (containing device info) */
SImage_ReadData(DeviceInfo, DeviceInfoSize);
-
+
/* Once all the data has been read, the pipe must be cleared before the response can be sent */
Pipe_ClearIN();
-
+
/* Create a pointer for walking through the info dataset */
uint8_t* DeviceInfoPos = DeviceInfo;
-
+
/* Skip over the data before the unicode device information strings */
DeviceInfoPos += 8; // Skip to VendorExtensionDesc String
DeviceInfoPos += (1 + UNICODE_STRING_LENGTH(*DeviceInfoPos)); // Skip over VendorExtensionDesc String
@@ -222,7 +222,7 @@ void StillImage_Task(void)
DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over Supported Device Properties Array
DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over Capture Formats Array
DeviceInfoPos += (4 + (*(uint32_t*)DeviceInfoPos << 1)); // Skip over Image Formats Array
-
+
/* Extract and convert the Manufacturer Unicode string to ASCII and print it through the USART */
char Manufacturer[*DeviceInfoPos];
UnicodeToASCII(DeviceInfoPos, Manufacturer);
@@ -246,22 +246,22 @@ void StillImage_Task(void)
if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Verify that the command completed successfully */
if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
{
ShowCommandError(PIMA_ReceivedBlock.Code, true);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
puts_P(PSTR("Opening Session...\r\n"));
-
+
PIMA_SendBlock = (PIMA_Container_t)
{
.DataLength = PIMA_COMMAND_SIZE(1),
@@ -270,24 +270,24 @@ void StillImage_Task(void)
.TransactionID = 0x00000000,
.Params = {0x00000001},
};
-
+
/* Send the OPENSESSION block, open a session with an ID of 0x0001 */
SImage_SendBlockHeader();
-
+
/* Receive the response block from the device */
if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Verify that the command completed successfully */
if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
{
ShowCommandError(PIMA_ReceivedBlock.Code, true);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -302,15 +302,15 @@ void StillImage_Task(void)
.TransactionID = 0x00000001,
.Params = {0x00000001},
};
-
+
/* Send the CLOSESESSION block, close the session with an ID of 0x0001 */
SImage_SendBlockHeader();
-
+
/* Receive the response block from the device */
if ((ErrorCode = SImage_ReceiveBlockHeader()) != PIPE_RWSTREAM_NoError)
{
ShowCommandError(ErrorCode, false);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -319,7 +319,7 @@ void StillImage_Task(void)
if ((PIMA_ReceivedBlock.Type != CType_ResponseBlock) || (PIMA_ReceivedBlock.Code != PIMA_RESPONSE_OK))
{
ShowCommandError(PIMA_ReceivedBlock.Code, true);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -328,7 +328,7 @@ void StillImage_Task(void)
/* Indicate device no longer busy */
LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
+
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
@@ -345,17 +345,17 @@ void UnicodeToASCII(uint8_t* UnicodeString,
{
/* Get the number of characters in the string, skip to the start of the string data */
uint8_t CharactersRemaining = *(UnicodeString++);
-
+
/* Loop through the entire unicode string */
while (CharactersRemaining--)
{
/* Load in the next unicode character (only the lower byte, as only Unicode coded ASCII is supported) */
*(Buffer++) = *UnicodeString;
-
+
/* Jump to the next unicode character */
UnicodeString += 2;
}
-
+
/* Null terminate the string */
*Buffer = 0;
}
@@ -372,7 +372,8 @@ void ShowCommandError(uint8_t ErrorCode,
printf_P(PSTR(ESC_FG_RED "Command Error (%S).\r\n"
" -- Error Code %d\r\n" ESC_FG_WHITE), FailureType, ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.h b/Demos/Host/LowLevel/StillImageHost/StillImageHost.h
index 61e5eb5b5..9c88f71f0 100644
--- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.h
+++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
#include <avr/power.h>
#include <avr/interrupt.h>
#include <stdio.h>
-
+
#include "ConfigDescriptor.h"
#include "Lib/PIMACodes.h"
@@ -52,7 +52,7 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -68,11 +68,11 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* Function Prototypes: */
void StillImage_Task(void);
void SetupHardware(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
@@ -84,5 +84,6 @@
char* Buffer);
void ShowCommandError(uint8_t ErrorCode,
bool ResponseCodeError);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/StillImageHost/StillImageHost.txt b/Demos/Host/LowLevel/StillImageHost/StillImageHost.txt
index 95a2e14b5..2dc3b662b 100644
--- a/Demos/Host/LowLevel/StillImageHost/StillImageHost.txt
+++ b/Demos/Host/LowLevel/StillImageHost/StillImageHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Still Image Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Still Image Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -40,12 +40,12 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Still Image host demonstration application. This gives a simple reference
* application for implementing a Still Image host, for USB devices such as
* digital cameras.
- *
+ *
* This demo will enumerate an attached USB Still Image device, print out its
* information structure, open a session with the device and finally close the
* session.
@@ -62,3 +62,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/StillImageHost/makefile b/Demos/Host/LowLevel/StillImageHost/makefile
index 087802248..2947de859 100644
--- a/Demos/Host/LowLevel/StillImageHost/makefile
+++ b/Demos/Host/LowLevel/StillImageHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c
index 7d9fb38c0..54eb99c84 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* needed to communication with an attached USB device. Descriptors are special computer-readable structures
* which the host requests upon device enumeration, to determine the device's capabilities and functions.
*/
-
+
#include "ConfigDescriptor.h"
/** Reads and processes an attached device's descriptors, to determine compatibility and pipe configurations. This
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* CDCControlInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -85,7 +85,7 @@ uint8_t ProcessConfigurationDescriptor(void)
{
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
- }
+ }
/* Clear any found endpoints */
DataINEndpoint = NULL;
@@ -111,7 +111,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -129,7 +129,7 @@ uint8_t ProcessConfigurationDescriptor(void)
DataOUTEndpoint = EndpointData;
}
}
-
+
/* Configure the CDC data IN pipe */
Pipe_ConfigurePipe(CDC_DATA_IN_PIPE, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
@@ -167,7 +167,7 @@ uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -191,7 +191,7 @@ uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -211,7 +211,7 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor)
{
uint8_t EndpointType = (DESCRIPTOR_CAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t).Attributes & EP_TYPE_MASK);
-
+
if ((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT))
return DESCRIPTOR_SEARCH_Found;
}
@@ -222,3 +222,4 @@ uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h
index 2e4730c55..270e130ae 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,9 +38,9 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "VirtualSerialHost.h"
-
+
/* Macros: */
/** Interface Class value for the CDC class. */
#define CDC_CONTROL_CLASS 0x02
@@ -50,7 +50,7 @@
/** Interface Class value for the CDC protocol. */
#define CDC_CONTROL_PROTOCOL 0x01
-
+
/** Interface Class value for the CDC data class. */
#define CDC_DATA_CLASS 0x0A
@@ -59,7 +59,7 @@
/** Interface Class value for the CDC data protocol. */
#define CDC_DATA_PROTOCOL 0x00
-
+
/** Pipe number for the CDC data IN pipe. */
#define CDC_DATA_IN_PIPE 1
@@ -81,10 +81,11 @@
};
/* Function Prototypes: */
- uint8_t ProcessConfigurationDescriptor(void);
-
+ uint8_t ProcessConfigurationDescriptor(void);
+
uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor);
uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor);
uint8_t DComp_NextCDCDataInterfaceEndpoint(void* CurrentDescriptor);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c
index 91775b7a4..f5fcdb10b 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c
+++ b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the VirtualSerialHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "VirtualSerialHost.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -119,7 +119,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
@@ -134,7 +134,7 @@ void CDC_Host_Task(void)
{
case HOST_STATE_Addressed:
puts_P(PSTR("Getting Config Data.\r\n"));
-
+
/* Get and process the configuration descriptor data */
if ((ErrorCode = ProcessConfigurationDescriptor()) != SuccessfulConfigRead)
{
@@ -144,7 +144,7 @@ void CDC_Host_Task(void)
puts_P(PSTR(ESC_FG_RED "Invalid Device.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
-
+
/* Indicate error via status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@@ -152,7 +152,7 @@ void CDC_Host_Task(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
{
@@ -188,10 +188,10 @@ void CDC_Host_Task(void)
/* Get the length of the pipe data, and create a new buffer to hold it */
uint16_t BufferLength = Pipe_BytesInPipe();
uint8_t Buffer[BufferLength];
-
+
/* Read in the pipe data to the temporary buffer */
Pipe_Read_Stream_LE(Buffer, BufferLength);
-
+
/* Print out the buffer contents to the USART */
for (uint16_t BufferByte = 0; BufferByte < BufferLength; BufferByte++)
putchar(Buffer[BufferByte]);
@@ -207,17 +207,18 @@ void CDC_Host_Task(void)
/* Select and unfreeze the notification pipe */
Pipe_SelectPipe(CDC_NOTIFICATION_PIPE);
Pipe_Unfreeze();
-
+
/* Check if a packet has been received */
if (Pipe_IsINReceived())
{
/* Discard the unused event notification */
Pipe_ClearIN();
}
-
+
/* Freeze notification IN pipe after use */
Pipe_Freeze();
-
+
break;
}
}
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h
index d55fa68af..fb3b3f187 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h
+++ b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,9 +49,9 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -64,16 +64,17 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
void CDC_Host_Task(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt
index d771b7976..80a470818 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt
+++ b/Demos/Host/LowLevel/VirtualSerialHost/VirtualSerialHost.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage CDC Host Demo
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -39,13 +39,13 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* CDC host demonstration application. This gives a simple reference application
* for implementing a USB CDC host, for CDC devices using the standard ACM profile.
- *
+ *
* This demo prints out received CDC data through the serial port.
- *
+ *
* Not that this demo is only compatible with devices which report the correct CDC
* and ACM class, subclass and protocol values. Most USB-Serial cables have vendor
* specific features, thus use vendor-specific class/subclass/protocol codes to force
@@ -63,3 +63,4 @@
* </tr>
* </table>
*/
+
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/makefile b/Demos/Host/LowLevel/VirtualSerialHost/makefile
index 43677949d..09a245808 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/makefile
+++ b/Demos/Host/LowLevel/VirtualSerialHost/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -134,7 +134,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -147,7 +147,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -261,7 +261,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -274,7 +274,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -286,7 +286,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -298,7 +298,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -321,7 +321,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -355,7 +355,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -389,7 +389,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -418,7 +418,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -437,10 +437,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -505,11 +505,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -536,9 +536,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -636,14 +636,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -665,7 +665,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -709,3 +709,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Demos/Host/LowLevel/makefile b/Demos/Host/LowLevel/makefile
index 2dec7c85b..9a7c46578 100644
--- a/Demos/Host/LowLevel/makefile
+++ b/Demos/Host/LowLevel/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -60,3 +60,4 @@ all:
$(MAKE) -C RNDISEthernetHost $@
$(MAKE) -C StillImageHost $@
$(MAKE) -C VirtualSerialHost $@
+
diff --git a/Demos/Host/makefile b/Demos/Host/makefile
index ce80f4e96..f389781e5 100644
--- a/Demos/Host/makefile
+++ b/Demos/Host/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -18,3 +18,4 @@ all:
%:
$(MAKE) -C ClassDriver $@
$(MAKE) -C LowLevel $@
+
diff --git a/Demos/makefile b/Demos/makefile
index 30434b7ea..0dbfc1da0 100644
--- a/Demos/makefile
+++ b/Demos/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -19,3 +19,4 @@ all:
$(MAKE) -C Device $@
$(MAKE) -C Host $@
$(MAKE) -C DualRole $@
+
diff --git a/LUFA/CodeTemplates/DriverStubs/Buttons.h b/LUFA/CodeTemplates/DriverStubs/Buttons.h
index c92577a44..d03352240 100644
--- a/LUFA/CodeTemplates/DriverStubs/Buttons.h
+++ b/LUFA/CodeTemplates/DriverStubs/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,7 +38,7 @@
This stub is for the board-specific component of the LUFA Buttons driver,
for the control of physical board-mounted GPIO pushbuttons.
*/
-
+
#ifndef __BUTTONS_USER_H__
#define __BUTTONS_USER_H__
@@ -57,12 +57,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 // TODO: Add mask for first board button here
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -81,5 +81,6 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
+
diff --git a/LUFA/CodeTemplates/DriverStubs/Dataflash.h b/LUFA/CodeTemplates/DriverStubs/Dataflash.h
index 31b5fed32..4efa54279 100644
--- a/LUFA/CodeTemplates/DriverStubs/Dataflash.h
+++ b/LUFA/CodeTemplates/DriverStubs/Dataflash.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,7 +49,7 @@
#if !defined(__INCLUDE_FROM_DATAFLASH_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead.
#endif
-
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
@@ -57,7 +57,7 @@
#define DATAFLASH_CHIPCS_DDR // TODO: Replace with the DDR register name for the board's Dataflash ICs
#define DATAFLASH_CHIPCS_PORT // TODO: Replace with the PORT register name for the board's Dataflash ICs
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Constant indicating the total number of dataflash ICs mounted on the selected board. */
@@ -71,7 +71,7 @@
/** Mask for the second dataflash chip selected. */
#define DATAFLASH_CHIP2 // TODO: Replace with mask to hold /CS of second Dataflash low, and all others high
-
+
/** Internal main memory page size for the board's dataflash ICs. */
#define DATAFLASH_PAGE_SIZE // TODO: Replace with the page size for the Dataflash ICs
@@ -87,7 +87,7 @@
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
}
-
+
/** Determines the currently selected dataflash chip.
*
* \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected
@@ -129,7 +129,7 @@
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress)
{
Dataflash_DeselectChip();
-
+
if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS))
return;
@@ -149,11 +149,11 @@
static inline void Dataflash_ToggleSelectedChipCS(void)
{
uint8_t SelectedChipMask = Dataflash_GetSelectedChip();
-
+
Dataflash_DeselectChip();
Dataflash_SelectChip(SelectedChipMask);
}
-
+
/** Spin-loops while the currently selected dataflash is busy executing a command, such as a main
* memory page program or main memory to buffer transfer.
*/
@@ -162,7 +162,7 @@
Dataflash_ToggleSelectedChipCS();
Dataflash_SendByte(DF_CMD_GETSTATUS);
while (!(Dataflash_ReceiveByte() & DF_STATUS_READY));
- Dataflash_ToggleSelectedChipCS();
+ Dataflash_ToggleSelectedChipCS();
}
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
@@ -176,10 +176,11 @@
#if (DATAFLASH_TOTALCHIPS == 2)
PageAddress >>= 1;
#endif
-
+
Dataflash_SendByte(PageAddress >> 5);
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
Dataflash_SendByte(BufferByte);
}
-
+
#endif
+
diff --git a/LUFA/CodeTemplates/DriverStubs/Joystick.h b/LUFA/CodeTemplates/DriverStubs/Joystick.h
index 4e7040a42..994b4bb5e 100644
--- a/LUFA/CodeTemplates/DriverStubs/Joystick.h
+++ b/LUFA/CodeTemplates/DriverStubs/Joystick.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@
driver, a small surface mount four-way (plus button) digital joystick
on most USB AVR boards.
*/
-
+
#ifndef __JOYSTICK_USER_H__
#define __JOYSTICK_USER_H__
@@ -57,7 +57,7 @@
#if !defined(__INCLUDE_FROM_JOYSTICK_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Joystick.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the joystick being pushed in the left direction. */
@@ -74,14 +74,14 @@
/** Mask for the joystick being pushed inward. */
#define JOY_PRESS // TODO: Add mask to indicate joystick pressed position here
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Joystick_Init(void)
{
// TODO: Initialize joystick port pins as inputs with pull-ups
}
-
+
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void)
{
@@ -95,3 +95,4 @@
#endif
#endif
+
diff --git a/LUFA/CodeTemplates/DriverStubs/LEDs.h b/LUFA/CodeTemplates/DriverStubs/LEDs.h
index 8081be854..d959c8287 100644
--- a/LUFA/CodeTemplates/DriverStubs/LEDs.h
+++ b/LUFA/CodeTemplates/DriverStubs/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -83,7 +83,7 @@
{
// TODO: Add code to initialize LED port pins as outputs here
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
// TODO: Add code to turn on LEDs given in the LEDMask mask here, leave others as-is
@@ -98,7 +98,7 @@
{
// TODO: Add code to turn on only LEDs given in the LEDMask mask here, all others off
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask)
{
// TODO: Add code to set the Leds in the given LEDMask to the status given in ActiveMask here
@@ -108,7 +108,7 @@
{
// TODO: Add code to toggle the Leds in the given LEDMask, ignoring all others
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -120,5 +120,6 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
+
diff --git a/LUFA/Common/Attributes.h b/LUFA/Common/Attributes.h
index bcac84c7b..ac0b11f03 100644
--- a/LUFA/Common/Attributes.h
+++ b/LUFA/Common/Attributes.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
* \brief AVR-GCC special function/variable attribute macros.
*
* This file contains macros for applying GCC specific attributes to functions and variables to control various
- * optimiser and code generation features of the compiler. Attributes may be placed in the function prototype
+ * optimiser and code generation features of the compiler. Attributes may be placed in the function prototype
* or variable declaration in any order, and multiple attributes can be specified for a single item via a space
* separated list.
*
@@ -42,7 +42,7 @@
* \note Do not include this file directly, rather include the Common.h header file instead to gain this file's
* functionality.
*/
-
+
/** \ingroup Group_Common
* @defgroup Group_GCCAttr Function/Variable Attributes
*
@@ -67,7 +67,7 @@
* return code may be omitted by the compiler in the resulting binary.
*/
#define ATTR_NO_RETURN __attribute__ ((noreturn))
-
+
/** Indicates that the function returns a value which should not be ignored by the user code. When
* applied, any ignored return value from calling the function will produce a compiler warning.
*/
@@ -84,7 +84,7 @@
* is responsible for maintaining stack and register integrity.
*/
#define ATTR_NAKED __attribute__ ((naked))
-
+
/** Prevents the compiler from considering a specified function for inlining. When applied, the given
* function will not be inlined under any circumstances.
*/
@@ -94,25 +94,25 @@
* inlined under all circumstances.
*/
#define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
-
+
/** Indicates that the specified function is pure, in that it has no side-effects other than global
* or parameter variable access.
*/
#define ATTR_PURE __attribute__ ((pure))
-
+
/** Indicates that the specified function is constant, in that it has no side effects other than
* parameter access.
*/
#define ATTR_CONST __attribute__ ((const))
-
+
/** Marks a given function as deprecated, which produces a warning if the function is called. */
#define ATTR_DEPRECATED __attribute__ ((deprecated))
-
+
/** Marks a function as a weak reference, which can be overridden by other functions with an
* identical name (in which case the weak reference is discarded at link time).
*/
#define ATTR_WEAK __attribute__ ((weak))
-
+
/** Forces the compiler to not automatically zero the given global variable on startup, so that the
* current RAM contents is retained. Under most conditions this value will be random due to the
* behaviour of volatile memory once power is removed, but may be used in some specific circumstances,
@@ -127,7 +127,7 @@
* \param[in] SectionIndex Initialization section number where the function should be placed.
*/
#define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((naked, section (".init" #SectionIndex )))
-
+
/** Marks a function as an alias for another function.
*
* \param[in] Func Name of the function which the given function name should alias.
@@ -136,3 +136,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Common/BoardTypes.h b/LUFA/Common/BoardTypes.h
index 8f3394e5e..faef82caa 100644
--- a/LUFA/Common/BoardTypes.h
+++ b/LUFA/Common/BoardTypes.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@
*
* @{
*/
-
+
#ifndef __BOARDTYPES_H__
#define __BOARDTYPES_H__
@@ -68,7 +68,7 @@
/** Selects the RZUSBSTICK specific board drivers, including the driver for the boards LEDs. */
#define BOARD_RZUSBSTICK 3
-
+
/** Selects the ATAVRUSBRF01 specific board drivers, including the driver for the board LEDs. */
#define BOARD_ATAVRUSBRF01 4
@@ -81,7 +81,7 @@
/** Selects the BUMBLEB specific board drivers, using the officially recommended peripheral layout. */
#define BOARD_BUMBLEB 6
-
+
/** Selects the XPLAIN (Revision 2 or newer) specific board drivers, including LED and Dataflash driver. */
#define BOARD_XPLAIN 7
@@ -90,20 +90,20 @@
/** Selects the EVK527 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */
#define BOARD_EVK527 9
-
+
/** Disables board drivers when operation will not be adversely affected (e.g. LEDs) - use of board drivers
* such as the Joystick driver, where the removal would adversely affect the code's operation is still disallowed. */
#define BOARD_NONE 10
-
+
/** Selects the Teensy (all versions) specific board drivers, including the driver for the board LEDs. */
#define BOARD_TEENSY 11
-
+
/** Selects the USBTINY MKII specific board drivers, including the Button and LEDs drivers. */
#define BOARD_USBTINYMKII 12
-
+
/** Selects the Benito specific board drivers, including the Button and LEDs drivers. */
#define BOARD_BENITO 13
-
+
/** Selects the JM-DB-U2 specific board drivers, including the Button and LEDs drivers. */
#define BOARD_JMDBU2 14
@@ -118,13 +118,13 @@
/** Selects the Arduino Uno specific board drivers, including the driver for the board LEDs. */
#define BOARD_UNO 18
-
+
/** Selects the CUL V3 specific board drivers, including the Button and LEDs drivers. */
#define BOARD_CULV3 19
#if !defined(__DOXYGEN__)
#define BOARD_ BOARD_NONE
-
+
#if !defined(BOARD)
#define BOARD BOARD_NONE
#endif
@@ -133,3 +133,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Common/Common.h b/LUFA/Common/Common.h
index c750e4015..61dfe2952 100644
--- a/LUFA/Common/Common.h
+++ b/LUFA/Common/Common.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* This file contains macros which are common to all library elements, and which may be useful in user code. It
* also includes other common headers, such as Atomic.h, Attributes.h and BoardTypes.h.
*/
-
+
/** @defgroup Group_Common Common Utility Headers - LUFA/Drivers/Common/Common.h
*
* Common utility headers containing macros, functions, enums and types which are common to all
@@ -47,7 +47,7 @@
*
* Macros for debugging use.
*/
-
+
/** @defgroup Group_BitManip Endian and Bit Macros
*
* Functions for swapping endianness and reversing bit orders.
@@ -59,7 +59,7 @@
/* Includes: */
#include <stdint.h>
#include <stdbool.h>
-
+
#include "Attributes.h"
#include "BoardTypes.h"
@@ -78,7 +78,7 @@
* a block (such as inline IF statements).
*/
#define MACROE while (0)
-
+
/** Defines a volatile NOP statement which cannot be optimized out by the compiler, and thus can always
* be set as a breakpoint in the resulting code. Useful for debugging purposes, where the optimiser
* removes/reorders code to the point where break points cannot reliably be set.
@@ -93,7 +93,7 @@
* \ingroup Group_Debugging
*/
#define JTAG_DEBUG_BREAK() __asm__ volatile ("BREAK" ::)
-
+
/** Macro for testing condition "x" and breaking via JTAG_DEBUG_BREAK() if the condition is false.
*
* \ingroup Group_Debugging
@@ -165,7 +165,7 @@
return Byte;
}
-
+
/** Function to reverse the byte ordering of the individual bytes in a 16 bit number.
*
* \ingroup Group_BitManip
@@ -182,13 +182,13 @@
uint16_t Word;
uint8_t Bytes[2];
} Data;
-
+
Data.Word = Word;
-
+
Temp = Data.Bytes[0];
Data.Bytes[0] = Data.Bytes[1];
Data.Bytes[1] = Temp;
-
+
return Data.Word;
}
@@ -208,17 +208,17 @@
uint32_t DWord;
uint8_t Bytes[4];
} Data;
-
+
Data.DWord = DWord;
-
+
Temp = Data.Bytes[0];
Data.Bytes[0] = Data.Bytes[3];
Data.Bytes[3] = Temp;
-
+
Temp = Data.Bytes[1];
Data.Bytes[1] = Data.Bytes[2];
Data.Bytes[2] = Temp;
-
+
return Data.DWord;
}
@@ -235,7 +235,7 @@
uint8_t Bytes)
{
uint8_t* CurrDataPos = (uint8_t*)Data;
-
+
while (Bytes > 1)
{
uint8_t Temp = *CurrDataPos;
@@ -250,3 +250,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/ATAVRUSBRF01/Buttons.h b/LUFA/Drivers/Board/ATAVRUSBRF01/Buttons.h
index dd5ce8122..da685d692 100644
--- a/LUFA/Drivers/Board/ATAVRUSBRF01/Buttons.h
+++ b/LUFA/Drivers/Board/ATAVRUSBRF01/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-
+
/** \ingroup Group_Buttons
* @defgroup Group_Buttons_ATAVRUSBRF01 ATAVRUSBRF01
*
@@ -66,12 +66,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 7)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -91,7 +91,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h b/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
index 0ff47f418..550317c2a 100644
--- a/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
+++ b/LUFA/Drivers/Board/ATAVRUSBRF01/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the LEDs driver
* dispatch header located in LUFA/Drivers/Board/LEDs.h.
*/
-
+
/** \ingroup Group_LEDs
* @defgroup Group_LEDs_ATAVRUSBRF01 ATAVRUSBRF01
*
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __LEDS_ATAVRUSBRF01_H__
#define __LEDS_ATAVRUSBRF01_H__
@@ -71,7 +71,7 @@
/* Macros: */
#define LEDS_PORTD_LEDS (LEDS_LED1 | LEDS_LED2)
#define LEDS_PORTE_LEDS (LEDS_LED3 | LEDS_LED4)
-
+
#define LEDS_PORTE_MASK_SHIFT 4
#endif
@@ -88,7 +88,7 @@
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
@@ -111,7 +111,7 @@
{
PORTD = (PORTD & ~LEDS_ALL_LEDS) | (LEDMask & LEDS_ALL_LEDS);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
@@ -122,7 +122,7 @@
{
PORTD ^= LEDMask;
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -134,7 +134,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/BENITO/Buttons.h b/LUFA/Drivers/Board/BENITO/Buttons.h
index a61ac7187..bd3dc78d5 100644
--- a/LUFA/Drivers/Board/BENITO/Buttons.h
+++ b/LUFA/Drivers/Board/BENITO/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-
+
/** \ingroup Group_Buttons
* @defgroup Group_Buttons_BENITO BENITO
*
@@ -66,12 +66,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 7)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -91,7 +91,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/BENITO/LEDs.h b/LUFA/Drivers/Board/BENITO/LEDs.h
index ff701985b..9c2446e9c 100644
--- a/LUFA/Drivers/Board/BENITO/LEDs.h
+++ b/LUFA/Drivers/Board/BENITO/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -85,7 +85,7 @@
DDRC |= LEDS_ALL_LEDS;
PORTC |= LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTC &= ~LEDMask;
@@ -100,7 +100,7 @@
{
PORTC = ((PORTC | LEDS_ALL_LEDS) & ~LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
@@ -111,7 +111,7 @@
{
PORTC ^= LEDMask;
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -123,7 +123,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/BUI/LEDs.h b/LUFA/Drivers/Board/BUI/LEDs.h
index 9fe73aed4..168b5cb7e 100644
--- a/LUFA/Drivers/Board/BUI/LEDs.h
+++ b/LUFA/Drivers/Board/BUI/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -87,7 +87,7 @@
{
DDRC |= LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTC |= LEDMask;
@@ -102,7 +102,7 @@
{
PORTC = (PORTC & ~LEDS_ALL_LEDS) | LEDMask;
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
@@ -113,7 +113,7 @@
{
PORTC ^= LEDMask;
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -125,7 +125,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/BUMBLEB/Buttons.h b/LUFA/Drivers/Board/BUMBLEB/Buttons.h
index 28a948b5d..e6029d936 100644
--- a/LUFA/Drivers/Board/BUMBLEB/Buttons.h
+++ b/LUFA/Drivers/Board/BUMBLEB/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -71,12 +71,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 7)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -96,7 +96,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/BUMBLEB/Joystick.h b/LUFA/Drivers/Board/BUMBLEB/Joystick.h
index 68866bf02..2f69133b6 100644
--- a/LUFA/Drivers/Board/BUMBLEB/Joystick.h
+++ b/LUFA/Drivers/Board/BUMBLEB/Joystick.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -93,7 +93,7 @@
/** Mask for the joystick being pushed inward. */
#define JOY_PRESS (1 << 4)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Joystick_Init(void)
@@ -101,7 +101,7 @@
DDRD &= ~JOY_MASK;
PORTD |= JOY_MASK;
}
-
+
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void)
{
@@ -117,3 +117,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/BUMBLEB/LEDs.h b/LUFA/Drivers/Board/BUMBLEB/LEDs.h
index e9816a88b..3b2b3e28a 100644
--- a/LUFA/Drivers/Board/BUMBLEB/LEDs.h
+++ b/LUFA/Drivers/Board/BUMBLEB/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -98,7 +98,7 @@
DDRB |= LEDS_ALL_LEDS;
PORTB &= ~LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)
{
PORTB |= LedMask;
@@ -113,13 +113,13 @@
{
PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LedMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LedMask,
const uint8_t ActiveMask)
{
PORTB = ((PORTB & ~LedMask) | ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= LEDMask;
@@ -136,7 +136,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/Buttons.h b/LUFA/Drivers/Board/Buttons.h
index 44e3ef6b2..6a53ed95d 100644
--- a/LUFA/Drivers/Board/Buttons.h
+++ b/LUFA/Drivers/Board/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -74,7 +74,7 @@
/* Includes: */
#include "../../Common/Common.h"
-
+
#if (BOARD == BOARD_NONE)
#error The Board Buttons driver cannot be used if the makefile BOARD option is not set.
#elif (BOARD == BOARD_USBKEY)
@@ -90,7 +90,7 @@
#elif (BOARD == BOARD_EVK527)
#include "EVK527/Buttons.h"
#elif (BOARD == BOARD_USBTINYMKII)
- #include "USBTINYMKII/Buttons.h"
+ #include "USBTINYMKII/Buttons.h"
#elif (BOARD == BOARD_BENITO)
#include "BENITO/Buttons.h"
#elif (BOARD == BOARD_JMDBU2)
@@ -108,7 +108,7 @@
#else
#error The selected board does not contain any GPIO buttons.
#endif
-
+
/* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__)
/** Initialises the BUTTONS driver, so that the current button position can be read. This sets the appropriate
@@ -117,7 +117,7 @@
* This must be called before any Button driver functions are used.
*/
static inline void Buttons_Init(void);
-
+
/** Returns a mask indicating which board buttons are currently pressed.
*
* \return Mask indicating which board buttons are currently pressed.
@@ -128,3 +128,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/CULV3/Buttons.h b/LUFA/Drivers/Board/CULV3/Buttons.h
index 770ba54fc..0a9407336 100644
--- a/LUFA/Drivers/Board/CULV3/Buttons.h
+++ b/LUFA/Drivers/Board/CULV3/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -66,12 +66,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 2)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -91,7 +91,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/CULV3/LEDs.h b/LUFA/Drivers/Board/CULV3/LEDs.h
index cb5f93490..6705b4d7d 100644
--- a/LUFA/Drivers/Board/CULV3/LEDs.h
+++ b/LUFA/Drivers/Board/CULV3/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -84,7 +84,7 @@
DDRE |= LEDS_ALL_LEDS;
PORTE &= ~LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTE |= LEDMask;
@@ -99,18 +99,18 @@
{
PORTE = ((PORTE & ~LEDS_ALL_LEDS) | LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTE = ((PORTE & ~LEDMask) | ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTE = (PORTE ^ (LEDMask & LEDS_ALL_LEDS));
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -122,7 +122,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/Dataflash.h b/LUFA/Drivers/Board/Dataflash.h
index b4bd39da0..150dca1c2 100644
--- a/LUFA/Drivers/Board/Dataflash.h
+++ b/LUFA/Drivers/Board/Dataflash.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
*
* For possible BOARD makefile values, see \ref Group_BoardTypes.
*/
-
+
/** \ingroup Group_BoardDrivers
* @defgroup Group_Dataflash Dataflash Driver - LUFA/Drivers/Board/Dataflash.h
*
@@ -61,7 +61,7 @@
*
* @{
*/
-
+
#ifndef __DATAFLASH_H__
#define __DATAFLASH_H__
@@ -86,7 +86,7 @@
#define __GET_DATAFLASH_MASK2(x, y) x ## y
#define __GET_DATAFLASH_MASK(x) __GET_DATAFLASH_MASK2(DATAFLASH_CHIP,x)
#endif
-
+
/** Retrieves the Dataflash chip select mask for the given Dataflash chip index.
*
* \param[in] index Index of the dataflash chip mask to retrieve
@@ -94,7 +94,7 @@
* \return Mask for the given Dataflash chip's /CS pin
*/
#define DATAFLASH_CHIP_MASK(index) __GET_DATAFLASH_MASK(index)
-
+
/* Inline Functions: */
/** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC.
* The AVR's SPI driver MUST be initialized before any of the dataflash commands are used.
@@ -128,7 +128,7 @@
* ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1).
*/
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress);
-
+
/** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive
* a new command.
*/
@@ -169,7 +169,7 @@
{
SPI_SendByte(Byte);
}
-
+
/** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash.
*
* \return Last response byte from the dataflash
@@ -205,7 +205,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/EVK527/AT45DB321C.h b/LUFA/Drivers/Board/EVK527/AT45DB321C.h
index 6b056b53c..ee4f1f690 100644
--- a/LUFA/Drivers/Board/EVK527/AT45DB321C.h
+++ b/LUFA/Drivers/Board/EVK527/AT45DB321C.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __DATAFLASH_CMDS_H__
#define __DATAFLASH_CMDS_H__
@@ -56,9 +56,9 @@
#define DF_STATUS_READY (1 << 7)
#define DF_STATUS_COMPMISMATCH (1 << 6)
#define DF_STATUS_SECTORPROTECTION_ON (1 << 1)
-
+
#define DF_MANUFACTURER_ATMEL 0x1F
-
+
#define DF_CMD_GETSTATUS 0xD7
#define DF_CMD_MAINMEMTOBUFF1 0x53
@@ -67,12 +67,12 @@
#define DF_CMD_MAINMEMTOBUFF2COMP 0x61
#define DF_CMD_AUTOREWRITEBUFF1 0x58
#define DF_CMD_AUTOREWRITEBUFF2 0x59
-
+
#define DF_CMD_MAINMEMPAGEREAD 0xD2
#define DF_CMD_CONTARRAYREAD_LF 0xE8
#define DF_CMD_BUFF1READ_LF 0xD4
#define DF_CMD_BUFF2READ_LF 0xD6
-
+
#define DF_CMD_BUFF1WRITE 0x84
#define DF_CMD_BUFF2WRITE 0x87
#define DF_CMD_BUFF1TOMAINMEMWITHERASE 0x83
@@ -81,7 +81,7 @@
#define DF_CMD_BUFF2TOMAINMEM 0x89
#define DF_CMD_MAINMEMPAGETHROUGHBUFF1 0x82
#define DF_CMD_MAINMEMPAGETHROUGHBUFF2 0x85
-
+
#define DF_CMD_PAGEERASE 0x81
#define DF_CMD_BLOCKERASE 0x50
@@ -90,9 +90,10 @@
#define DF_CMD_SECTORPROTECTIONOFF_BYTE2 0x2A
#define DF_CMD_SECTORPROTECTIONOFF_BYTE3 0x7F
#define DF_CMD_SECTORPROTECTIONOFF_BYTE4 0xCF
-
+
#define DF_CMD_READMANUFACTURERDEVICEINFO 0x9F
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/EVK527/Buttons.h b/LUFA/Drivers/Board/EVK527/Buttons.h
index 624e1c20c..f15550e3e 100644
--- a/LUFA/Drivers/Board/EVK527/Buttons.h
+++ b/LUFA/Drivers/Board/EVK527/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -72,12 +72,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 2)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -97,7 +97,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/EVK527/Dataflash.h b/LUFA/Drivers/Board/EVK527/Dataflash.h
index 3bf492438..50de932ba 100644
--- a/LUFA/Drivers/Board/EVK527/Dataflash.h
+++ b/LUFA/Drivers/Board/EVK527/Dataflash.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -52,7 +52,7 @@
#define __DATAFLASH_EVK527_H__
/* Includes: */
- #include "AT45DB321C.h"
+ #include "AT45DB321C.h"
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_DATAFLASH_H)
@@ -77,7 +77,7 @@
/** Mask for the first dataflash chip selected. */
#define DATAFLASH_CHIP1 0
-
+
/** Internal main memory page size for the board's dataflash IC. */
#define DATAFLASH_PAGE_SIZE 512
@@ -93,7 +93,7 @@
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
}
-
+
/** Determines the currently selected dataflash chip.
*
* \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected
@@ -135,7 +135,7 @@
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress)
{
Dataflash_DeselectChip();
-
+
if (PageAddress >= DATAFLASH_PAGES)
return;
@@ -148,7 +148,7 @@
static inline void Dataflash_ToggleSelectedChipCS(void)
{
uint8_t SelectedChipMask = Dataflash_GetSelectedChip();
-
+
Dataflash_DeselectChip();
Dataflash_SelectChip(SelectedChipMask);
}
@@ -161,7 +161,7 @@
Dataflash_ToggleSelectedChipCS();
Dataflash_SendByte(DF_CMD_GETSTATUS);
while (!(Dataflash_ReceiveByte() & DF_STATUS_READY));
- Dataflash_ToggleSelectedChipCS();
+ Dataflash_ToggleSelectedChipCS();
}
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
@@ -172,12 +172,13 @@
*/
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress,
const uint16_t BufferByte)
- {
+ {
Dataflash_SendByte(PageAddress >> 5);
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
Dataflash_SendByte(BufferByte);
}
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/EVK527/Joystick.h b/LUFA/Drivers/Board/EVK527/Joystick.h
index af3b54fdc..02af59adf 100644
--- a/LUFA/Drivers/Board/EVK527/Joystick.h
+++ b/LUFA/Drivers/Board/EVK527/Joystick.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -72,7 +72,7 @@
#define JOY_FMASK ((1 << 4) | (1 << 5) | (1 << 6) | (1 << 7))
#define JOY_CMASK (1 << 6))
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the joystick being pushed in the left direction. */
@@ -89,7 +89,7 @@
/** Mask for the joystick being pushed inward. */
#define JOY_PRESS (1 << 6)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Joystick_Init(void)
@@ -98,9 +98,9 @@
DDRC &= ~(JOY_CMASK);
PORTF |= JOY_FMASK;
- PORTC |= JOY_CMASK;
+ PORTC |= JOY_CMASK;
}
-
+
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void)
{
@@ -116,3 +116,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/EVK527/LEDs.h b/LUFA/Drivers/Board/EVK527/LEDs.h
index b24f6eb76..a74d39d5b 100644
--- a/LUFA/Drivers/Board/EVK527/LEDs.h
+++ b/LUFA/Drivers/Board/EVK527/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -90,7 +90,7 @@
DDRD |= LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD |= LEDMask;
@@ -105,18 +105,18 @@
{
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTD = ((PORTD & ~LEDMask) | ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -128,7 +128,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/JMDBU2/Buttons.h b/LUFA/Drivers/Board/JMDBU2/Buttons.h
index e00bcd15c..70494fdee 100644
--- a/LUFA/Drivers/Board/JMDBU2/Buttons.h
+++ b/LUFA/Drivers/Board/JMDBU2/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-
+
/** \ingroup Group_Buttons
* @defgroup Group_Buttons_JMDBU2 JMDBU2
*
@@ -66,12 +66,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 7)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -91,7 +91,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/JMDBU2/LEDs.h b/LUFA/Drivers/Board/JMDBU2/LEDs.h
index 22efbc63e..f048dcfc9 100644
--- a/LUFA/Drivers/Board/JMDBU2/LEDs.h
+++ b/LUFA/Drivers/Board/JMDBU2/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -84,7 +84,7 @@
DDRD |= LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD |= LEDMask;
@@ -99,18 +99,18 @@
{
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTD = ((PORTD & ~LEDMask) | ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -122,7 +122,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/Joystick.h b/LUFA/Drivers/Board/Joystick.h
index f4423fb23..5f5026bcb 100644
--- a/LUFA/Drivers/Board/Joystick.h
+++ b/LUFA/Drivers/Board/Joystick.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,9 +40,9 @@
* If the BOARD value is set to BOARD_USER, this will include the /Board/Joystick.h file in the user project
* directory.
*
- * For possible BOARD makefile values, see \ref Group_BoardTypes.
+ * For possible BOARD makefile values, see \ref Group_BoardTypes.
*/
-
+
/** \ingroup Group_BoardDrivers
* @defgroup Group_Joystick Joystick Driver - LUFA/Drivers/Board/Joystick.h
*
@@ -73,7 +73,7 @@
/* Includes: */
#include "../../Common/Common.h"
-
+
#if (BOARD == BOARD_NONE)
#error The Board Joystick driver cannot be used if the makefile BOARD option is not set.
#elif (BOARD == BOARD_USBKEY)
@@ -111,3 +111,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/LEDs.h b/LUFA/Drivers/Board/LEDs.h
index 67efbeaee..7122e7ae5 100644
--- a/LUFA/Drivers/Board/LEDs.h
+++ b/LUFA/Drivers/Board/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -62,7 +62,7 @@
*
* \note To make code as compatible as possible, it is assumed that all boards carry a minimum of four LEDs. If
* a board contains less than four LEDs, the remaining LED masks are defined to 0 so as to have no effect.
- * If other behaviour is desired, either alias the remaining LED masks to existing LED masks via the -D
+ * If other behaviour is desired, either alias the remaining LED masks to existing LED masks via the -D
* switch in the project makefile, or alias them to nothing in the makefile to cause compilation errors when
* a non-existing LED is referenced in application code. Note that this means that it is possible to make
* compatible code for a board with no LEDs by making a board LED driver (see \ref Page_WritingBoardDrivers)
@@ -79,7 +79,7 @@
#define __INCLUDE_FROM_LEDS_H
#define INCLUDE_FROM_LEDS_H
#endif
-
+
/* Includes: */
#include "../../Common/Common.h"
@@ -130,7 +130,7 @@
#elif (BOARD == BOARD_USER)
#include "Board/LEDs.h"
#endif
-
+
#if !defined(LEDS_LED1)
#define LEDS_LED1 0
#endif
@@ -146,7 +146,7 @@
#if !defined(LEDS_LED4)
#define LEDS_LED4 0
#endif
-
+
/* Pseudo-Functions for Doxygen: */
#if defined(__DOXYGEN__)
/** Initialises the board LED driver so that the LEDs can be controlled. This sets the appropriate port
@@ -181,7 +181,7 @@
*/
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask);
-
+
/** Toggles all LEDs in the LED mask, leaving all others in their current states.
*
* \param[in] LEDMask Mask of the board LEDs to manipulate (see board-specific LEDs.h driver file).
@@ -199,3 +199,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/OLIMEX162/Buttons.h b/LUFA/Drivers/Board/OLIMEX162/Buttons.h
index c30b4d369..48b75aa6b 100644
--- a/LUFA/Drivers/Board/OLIMEX162/Buttons.h
+++ b/LUFA/Drivers/Board/OLIMEX162/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-
+
/** \ingroup Group_Buttons
* @defgroup Group_Buttons_OLIMEX162 OLIMEX162
*
@@ -66,12 +66,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 7)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -91,7 +91,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/OLIMEX162/LEDs.h b/LUFA/Drivers/Board/OLIMEX162/LEDs.h
index 205836fb5..3bf3a40ac 100644
--- a/LUFA/Drivers/Board/OLIMEX162/LEDs.h
+++ b/LUFA/Drivers/Board/OLIMEX162/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __LEDS_OLIMEX162_H__
#define __LEDS_OLIMEX162_H__
@@ -76,7 +76,7 @@
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
@@ -84,7 +84,7 @@
DDRD |= LEDS_ALL_LEDS;
PORTD |= LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD &= ~LEDMask;
@@ -99,13 +99,13 @@
{
PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTD = ((PORTD | LEDMask) & ~ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
@@ -122,7 +122,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h b/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
index 673bc25f8..4f4d3cc44 100644
--- a/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
+++ b/LUFA/Drivers/Board/RZUSBSTICK/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __LEDS_RZUSBSTICK_H__
#define __LEDS_RZUSBSTICK_H__
@@ -71,7 +71,7 @@
/* Macros: */
#define LEDS_PORTD_LEDS (LEDS_LED1 | LEDS_LED2)
#define LEDS_PORTE_LEDS (LEDS_LED3 | LEDS_LED4)
-
+
#define LEDS_PORTE_MASK_SHIFT 4
#endif
@@ -94,7 +94,7 @@
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
@@ -106,11 +106,11 @@
DDRE |= (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT);
PORTE |= (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT);
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD |= (LEDMask & LEDS_LED1);
- PORTD &= ~(LEDMask & LEDS_LED2);
+ PORTD &= ~(LEDMask & LEDS_LED2);
PORTE &= ~((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT);
}
@@ -128,7 +128,7 @@
PORTE = ((PORTE | (LEDS_PORTE_LEDS << LEDS_PORTE_MASK_SHIFT)) &
~((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT));
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
@@ -137,7 +137,7 @@
PORTE = ((PORTE | ((LEDMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT)) &
~((ActiveMask & LEDS_PORTE_LEDS) << LEDS_PORTE_MASK_SHIFT));
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD = (PORTD ^ (LEDMask & LEDS_PORTD_LEDS));
@@ -156,7 +156,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK525/AT45DB321C.h b/LUFA/Drivers/Board/STK525/AT45DB321C.h
index 7b95a62d9..ac6985508 100644
--- a/LUFA/Drivers/Board/STK525/AT45DB321C.h
+++ b/LUFA/Drivers/Board/STK525/AT45DB321C.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __DATAFLASH_CMDS_H__
#define __DATAFLASH_CMDS_H__
@@ -56,9 +56,9 @@
#define DF_STATUS_READY (1 << 7)
#define DF_STATUS_COMPMISMATCH (1 << 6)
#define DF_STATUS_SECTORPROTECTION_ON (1 << 1)
-
+
#define DF_MANUFACTURER_ATMEL 0x1F
-
+
#define DF_CMD_GETSTATUS 0xD7
#define DF_CMD_MAINMEMTOBUFF1 0x53
@@ -67,12 +67,12 @@
#define DF_CMD_MAINMEMTOBUFF2COMP 0x61
#define DF_CMD_AUTOREWRITEBUFF1 0x58
#define DF_CMD_AUTOREWRITEBUFF2 0x59
-
+
#define DF_CMD_MAINMEMPAGEREAD 0xD2
#define DF_CMD_CONTARRAYREAD_LF 0xE8
#define DF_CMD_BUFF1READ_LF 0xD4
#define DF_CMD_BUFF2READ_LF 0xD6
-
+
#define DF_CMD_BUFF1WRITE 0x84
#define DF_CMD_BUFF2WRITE 0x87
#define DF_CMD_BUFF1TOMAINMEMWITHERASE 0x83
@@ -81,7 +81,7 @@
#define DF_CMD_BUFF2TOMAINMEM 0x89
#define DF_CMD_MAINMEMPAGETHROUGHBUFF1 0x82
#define DF_CMD_MAINMEMPAGETHROUGHBUFF2 0x85
-
+
#define DF_CMD_PAGEERASE 0x81
#define DF_CMD_BLOCKERASE 0x50
@@ -90,9 +90,10 @@
#define DF_CMD_SECTORPROTECTIONOFF_BYTE2 0x2A
#define DF_CMD_SECTORPROTECTIONOFF_BYTE3 0x7F
#define DF_CMD_SECTORPROTECTIONOFF_BYTE4 0xCF
-
+
#define DF_CMD_READMANUFACTURERDEVICEINFO 0x9F
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK525/Buttons.h b/LUFA/Drivers/Board/STK525/Buttons.h
index 0dfac0fd4..91b856d49 100644
--- a/LUFA/Drivers/Board/STK525/Buttons.h
+++ b/LUFA/Drivers/Board/STK525/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -72,12 +72,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 2)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -97,7 +97,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK525/Dataflash.h b/LUFA/Drivers/Board/STK525/Dataflash.h
index 67b896ecb..d416221eb 100644
--- a/LUFA/Drivers/Board/STK525/Dataflash.h
+++ b/LUFA/Drivers/Board/STK525/Dataflash.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -52,7 +52,7 @@
#define __DATAFLASH_STK525_H__
/* Includes: */
- #include "AT45DB321C.h"
+ #include "AT45DB321C.h"
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_DATAFLASH_H)
@@ -77,7 +77,7 @@
/** Mask for the first dataflash chip selected. */
#define DATAFLASH_CHIP1 0
-
+
/** Internal main memory page size for the board's dataflash IC. */
#define DATAFLASH_PAGE_SIZE 512
@@ -135,20 +135,20 @@
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress)
{
Dataflash_DeselectChip();
-
+
if (PageAddress >= DATAFLASH_PAGES)
return;
Dataflash_SelectChip(DATAFLASH_CHIP1);
}
-
+
/** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive
* a new command.
*/
static inline void Dataflash_ToggleSelectedChipCS(void)
{
uint8_t SelectedChipMask = Dataflash_GetSelectedChip();
-
+
Dataflash_DeselectChip();
Dataflash_SelectChip(SelectedChipMask);
}
@@ -161,7 +161,7 @@
Dataflash_ToggleSelectedChipCS();
Dataflash_SendByte(DF_CMD_GETSTATUS);
while (!(Dataflash_ReceiveByte() & DF_STATUS_READY));
- Dataflash_ToggleSelectedChipCS();
+ Dataflash_ToggleSelectedChipCS();
}
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
@@ -172,12 +172,13 @@
*/
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress,
const uint16_t BufferByte)
- {
+ {
Dataflash_SendByte(PageAddress >> 6);
Dataflash_SendByte((PageAddress << 2) | (BufferByte >> 8));
Dataflash_SendByte(BufferByte);
}
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK525/Joystick.h b/LUFA/Drivers/Board/STK525/Joystick.h
index 5f5e58490..93122237c 100644
--- a/LUFA/Drivers/Board/STK525/Joystick.h
+++ b/LUFA/Drivers/Board/STK525/Joystick.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the joystick driver
* dispatch header located in LUFA/Drivers/Board/Joystick.h.
*/
-
+
/** \ingroup Group_Joystick
* @defgroup Group_Joystick_STK525 STK525
*
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __JOYSTICK_STK525_H__
#define __JOYSTICK_STK525_H__
@@ -72,7 +72,7 @@
#define JOY_BMASK ((1 << 5) | (1 << 6) | (1 << 7))
#define JOY_EMASK ((1 << 4) | (1 << 5))
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the joystick being pushed in the left direction. */
@@ -89,7 +89,7 @@
/** Mask for the joystick being pushed inward. */
#define JOY_PRESS (1 << 5)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Joystick_Init(void)
@@ -98,9 +98,9 @@
DDRE &= ~(JOY_EMASK);
PORTB |= JOY_BMASK;
- PORTE |= JOY_EMASK;
+ PORTE |= JOY_EMASK;
}
-
+
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void)
{
@@ -112,7 +112,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK525/LEDs.h b/LUFA/Drivers/Board/STK525/LEDs.h
index 7f3e2934a..99c89d675 100644
--- a/LUFA/Drivers/Board/STK525/LEDs.h
+++ b/LUFA/Drivers/Board/STK525/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __LEDS_STK525_H__
#define __LEDS_STK525_H__
@@ -60,7 +60,7 @@
#if defined(__cplusplus)
extern "C" {
#endif
-
+
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_LEDS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead.
@@ -93,7 +93,7 @@
DDRD |= LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD |= LEDMask;
@@ -108,13 +108,13 @@
{
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTD = ((PORTD & ~LEDMask) | ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
@@ -131,7 +131,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK526/AT45DB642D.h b/LUFA/Drivers/Board/STK526/AT45DB642D.h
index aa7346797..54b907750 100644
--- a/LUFA/Drivers/Board/STK526/AT45DB642D.h
+++ b/LUFA/Drivers/Board/STK526/AT45DB642D.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -57,9 +57,9 @@
#define DF_STATUS_COMPMISMATCH (1 << 6)
#define DF_STATUS_SECTORPROTECTION_ON (1 << 1)
#define DF_STATUS_BINARYPAGESIZE_ON (1 << 0)
-
+
#define DF_MANUFACTURER_ATMEL 0x1F
-
+
#define DF_CMD_GETSTATUS 0xD7
#define DF_CMD_POWERDOWN 0xB9
#define DF_CMD_WAKEUP 0xAB
@@ -70,12 +70,12 @@
#define DF_CMD_MAINMEMTOBUFF2COMP 0x61
#define DF_CMD_AUTOREWRITEBUFF1 0x58
#define DF_CMD_AUTOREWRITEBUFF2 0x59
-
+
#define DF_CMD_MAINMEMPAGEREAD 0xD2
#define DF_CMD_CONTARRAYREAD_LF 0x03
#define DF_CMD_BUFF1READ_LF 0xD1
#define DF_CMD_BUFF2READ_LF 0xD3
-
+
#define DF_CMD_BUFF1WRITE 0x84
#define DF_CMD_BUFF2WRITE 0x87
#define DF_CMD_BUFF1TOMAINMEMWITHERASE 0x83
@@ -84,7 +84,7 @@
#define DF_CMD_BUFF2TOMAINMEM 0x89
#define DF_CMD_MAINMEMPAGETHROUGHBUFF1 0x82
#define DF_CMD_MAINMEMPAGETHROUGHBUFF2 0x85
-
+
#define DF_CMD_PAGEERASE 0x81
#define DF_CMD_BLOCKERASE 0x50
#define DF_CMD_SECTORERASE 0x7C
@@ -94,15 +94,16 @@
#define DF_CMD_CHIPERASE_BYTE2 0x94
#define DF_CMD_CHIPERASE_BYTE3 0x80
#define DF_CMD_CHIPERASE_BYTE4 0x9A
-
+
#define DF_CMD_SECTORPROTECTIONOFF ((char[]){0x3D, 0x2A, 0x7F, 0x9A})
#define DF_CMD_SECTORPROTECTIONOFF_BYTE1 0x3D
#define DF_CMD_SECTORPROTECTIONOFF_BYTE2 0x2A
#define DF_CMD_SECTORPROTECTIONOFF_BYTE3 0x7F
#define DF_CMD_SECTORPROTECTIONOFF_BYTE4 0x9A
-
+
#define DF_CMD_READMANUFACTURERDEVICEINFO 0x9F
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK526/Buttons.h b/LUFA/Drivers/Board/STK526/Buttons.h
index da51919c2..a63fe2da1 100644
--- a/LUFA/Drivers/Board/STK526/Buttons.h
+++ b/LUFA/Drivers/Board/STK526/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -72,12 +72,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 7)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -97,7 +97,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK526/Dataflash.h b/LUFA/Drivers/Board/STK526/Dataflash.h
index 40d42c96f..e86435db6 100644
--- a/LUFA/Drivers/Board/STK526/Dataflash.h
+++ b/LUFA/Drivers/Board/STK526/Dataflash.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -77,7 +77,7 @@
/** Mask for the first dataflash chip selected. */
#define DATAFLASH_CHIP1 0
-
+
/** Internal main memory page size for the board's dataflash IC. */
#define DATAFLASH_PAGE_SIZE 1024
@@ -93,7 +93,7 @@
DATAFLASH_CHIPCS_DDR |= DATAFLASH_CHIPCS_MASK;
DATAFLASH_CHIPCS_PORT |= DATAFLASH_CHIPCS_MASK;
}
-
+
/** Determines the currently selected dataflash chip.
*
* \return Mask of the currently selected Dataflash chip, either \ref DATAFLASH_NO_CHIP if no chip is selected
@@ -135,7 +135,7 @@
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress)
{
Dataflash_DeselectChip();
-
+
if (PageAddress >= DATAFLASH_PAGES)
return;
@@ -148,7 +148,7 @@
static inline void Dataflash_ToggleSelectedChipCS(void)
{
uint8_t SelectedChipMask = Dataflash_GetSelectedChip();
-
+
Dataflash_DeselectChip();
Dataflash_SelectChip(SelectedChipMask);
}
@@ -161,7 +161,7 @@
Dataflash_ToggleSelectedChipCS();
Dataflash_SendByte(DF_CMD_GETSTATUS);
while (!(Dataflash_ReceiveByte() & DF_STATUS_READY));
- Dataflash_ToggleSelectedChipCS();
+ Dataflash_ToggleSelectedChipCS();
}
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
@@ -172,12 +172,13 @@
*/
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress,
const uint16_t BufferByte)
- {
+ {
Dataflash_SendByte(PageAddress >> 5);
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
Dataflash_SendByte(BufferByte);
}
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK526/Joystick.h b/LUFA/Drivers/Board/STK526/Joystick.h
index 0bf9c7937..1c3669248 100644
--- a/LUFA/Drivers/Board/STK526/Joystick.h
+++ b/LUFA/Drivers/Board/STK526/Joystick.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __JOYSTICK_STK526_H__
#define __JOYSTICK_STK526_H__
@@ -71,7 +71,7 @@
/* Macros: */
#define JOY_BMASK ((1 << 0) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7))
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the joystick being pushed in the left direction. */
@@ -88,7 +88,7 @@
/** Mask for the joystick being pushed inward. */
#define JOY_PRESS (1 << 0)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Joystick_Init(void)
@@ -97,7 +97,7 @@
PORTB |= JOY_BMASK;
}
-
+
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void)
{
@@ -109,7 +109,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/STK526/LEDs.h b/LUFA/Drivers/Board/STK526/LEDs.h
index d01adf8eb..6095218bc 100644
--- a/LUFA/Drivers/Board/STK526/LEDs.h
+++ b/LUFA/Drivers/Board/STK526/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __LEDS_STK526_H__
#define __LEDS_STK526_H__
@@ -93,7 +93,7 @@
DDRD |= LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD |= LEDMask;
@@ -108,30 +108,31 @@
{
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTD = ((PORTD & ~LEDMask) | ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
return (PORTD & LEDS_ALL_LEDS);
}
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/TEENSY/LEDs.h b/LUFA/Drivers/Board/TEENSY/LEDs.h
index 37ebb6a9b..ab2c7207a 100644
--- a/LUFA/Drivers/Board/TEENSY/LEDs.h
+++ b/LUFA/Drivers/Board/TEENSY/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __LEDS_TEENSY_H__
#define __LEDS_TEENSY_H__
@@ -76,7 +76,7 @@
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
@@ -84,7 +84,7 @@
DDRD |= LEDS_ALL_LEDS;
PORTD |= LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD &= ~LEDMask;
@@ -99,13 +99,13 @@
{
PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTD = ((PORTD | LEDMask) & ~ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
@@ -122,7 +122,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/Temperature.c b/LUFA/Drivers/Board/Temperature.c
index a5e82a2a1..1df6b9c98 100644
--- a/LUFA/Drivers/Board/Temperature.c
+++ b/LUFA/Drivers/Board/Temperature.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -58,3 +58,4 @@ int8_t Temperature_GetTemperature(void)
return TEMP_MAX_TEMP;
}
+
diff --git a/LUFA/Drivers/Board/Temperature.h b/LUFA/Drivers/Board/Temperature.h
index 40d8e9890..ba9752e5a 100644
--- a/LUFA/Drivers/Board/Temperature.h
+++ b/LUFA/Drivers/Board/Temperature.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -31,7 +31,7 @@
/** \file
* \brief Master include file for the board temperature sensor driver.
*
- * Master include file for the board temperature sensor driver, for the USB boards which contain a temperature sensor.
+ * Master include file for the board temperature sensor driver, for the USB boards which contain a temperature sensor.
*/
/** \ingroup Group_BoardDrivers
@@ -58,7 +58,7 @@
#include "../../Common/Common.h"
#include "../Peripheral/ADC.h"
-
+
#if (BOARD == BOARD_NONE)
#error The Board Temperature Sensor driver cannot be used if the makefile BOARD option is not set.
#elif ((BOARD != BOARD_USBKEY) && (BOARD != BOARD_STK525) && \
@@ -76,7 +76,7 @@
/* Macros: */
/** ADC channel number for the temperature sensor. */
#define TEMP_ADC_CHANNEL 0
-
+
/** ADC channel MUX mask for the temperature sensor. */
#define TEMP_ADC_CHANNEL_MASK ADC_CHANNEL0
@@ -85,7 +85,7 @@
/** Maximum returnable temperature from the \ref Temperature_GetTemperature() function. */
#define TEMP_MAX_TEMP ((TEMP_TABLE_SIZE - 1) + TEMP_TABLE_OFFSET)
-
+
/* Inline Functions: */
/** Initialises the temperature sensor driver, including setting up the appropriate ADC channel.
* This must be called before any other temperature sensor routines.
@@ -118,7 +118,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/UDIP/Buttons.h b/LUFA/Drivers/Board/UDIP/Buttons.h
index 2cc86d11a..fbaa2f1e7 100644
--- a/LUFA/Drivers/Board/UDIP/Buttons.h
+++ b/LUFA/Drivers/Board/UDIP/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-
+
/** \ingroup Group_Buttons
* @defgroup Group_Buttons_UDIP UDIP
*
@@ -66,12 +66,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 7)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -91,7 +91,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/UDIP/LEDs.h b/LUFA/Drivers/Board/UDIP/LEDs.h
index 36979f534..e605c1f18 100644
--- a/LUFA/Drivers/Board/UDIP/LEDs.h
+++ b/LUFA/Drivers/Board/UDIP/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -71,7 +71,7 @@
/* Macros: */
#define LEDS_PORTB_LEDS (LEDS_LED1 | LEDS_LED2)
#define LEDS_PORTD_LEDS (LEDS_LED3 | LEDS_LED4)
-
+
#define LEDS_PORTD_MASK_SHIFT 1
#endif
@@ -102,7 +102,7 @@
DDRB |= LEDS_PORTB_LEDS;
DDRD |= (LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT);
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTB |= (LEDMask & LEDS_PORTB_LEDS);
@@ -121,7 +121,7 @@
PORTD = (PORTD & ~(LEDS_PORTD_LEDS << LEDS_PORTD_MASK_SHIFT)) |
((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
@@ -129,13 +129,13 @@
PORTD = (PORTD & ~((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT)) |
((ActiveMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= (LEDMask & LEDS_PORTB_LEDS);
PORTD ^= ((LEDMask & LEDS_PORTD_LEDS) << LEDS_PORTD_MASK_SHIFT);
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -147,7 +147,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/UNO/LEDs.h b/LUFA/Drivers/Board/UNO/LEDs.h
index 7db32afda..37aff5326 100644
--- a/LUFA/Drivers/Board/UNO/LEDs.h
+++ b/LUFA/Drivers/Board/UNO/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -85,7 +85,7 @@
DDRD |= LEDS_ALL_LEDS;
PORTD |= LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD &= ~LEDMask;
@@ -100,7 +100,7 @@
{
PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
@@ -111,7 +111,7 @@
{
PORTD ^= LEDMask;
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -123,7 +123,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/USBFOO/Buttons.h b/LUFA/Drivers/Board/USBFOO/Buttons.h
index c0f40dcf0..782545d83 100644
--- a/LUFA/Drivers/Board/USBFOO/Buttons.h
+++ b/LUFA/Drivers/Board/USBFOO/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-
+
/** \ingroup Group_Buttons
* @defgroup Group_Buttons_USBFOO USBFOO
*
@@ -66,12 +66,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 7)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -91,7 +91,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/USBFOO/LEDS.h b/LUFA/Drivers/Board/USBFOO/LEDS.h
index 3ea9f4341..5f19f3096 100644
--- a/LUFA/Drivers/Board/USBFOO/LEDS.h
+++ b/LUFA/Drivers/Board/USBFOO/LEDS.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __LEDS_USBFOO_H__
#define __LEDS_USBFOO_H__
@@ -76,7 +76,7 @@
/** LED mask for none of the board LEDs. */
#define LEDS_NO_LEDS 0
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void LEDs_Init(void)
@@ -84,7 +84,7 @@
DDRD |= LEDS_ALL_LEDS;
PORTD |= LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD &= ~LEDMask;
@@ -99,13 +99,13 @@
{
PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTD = ((PORTD | LEDMask) & ~ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
@@ -122,7 +122,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/USBKEY/AT45DB642D.h b/LUFA/Drivers/Board/USBKEY/AT45DB642D.h
index f78ddb555..0374c99ed 100644
--- a/LUFA/Drivers/Board/USBKEY/AT45DB642D.h
+++ b/LUFA/Drivers/Board/USBKEY/AT45DB642D.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __DATAFLASH_CMDS_H__
#define __DATAFLASH_CMDS_H__
@@ -57,9 +57,9 @@
#define DF_STATUS_COMPMISMATCH (1 << 6)
#define DF_STATUS_SECTORPROTECTION_ON (1 << 1)
#define DF_STATUS_BINARYPAGESIZE_ON (1 << 0)
-
+
#define DF_MANUFACTURER_ATMEL 0x1F
-
+
#define DF_CMD_GETSTATUS 0xD7
#define DF_CMD_POWERDOWN 0xB9
#define DF_CMD_WAKEUP 0xAB
@@ -70,12 +70,12 @@
#define DF_CMD_MAINMEMTOBUFF2COMP 0x61
#define DF_CMD_AUTOREWRITEBUFF1 0x58
#define DF_CMD_AUTOREWRITEBUFF2 0x59
-
+
#define DF_CMD_MAINMEMPAGEREAD 0xD2
#define DF_CMD_CONTARRAYREAD_LF 0x03
#define DF_CMD_BUFF1READ_LF 0xD1
#define DF_CMD_BUFF2READ_LF 0xD3
-
+
#define DF_CMD_BUFF1WRITE 0x84
#define DF_CMD_BUFF2WRITE 0x87
#define DF_CMD_BUFF1TOMAINMEMWITHERASE 0x83
@@ -84,7 +84,7 @@
#define DF_CMD_BUFF2TOMAINMEM 0x89
#define DF_CMD_MAINMEMPAGETHROUGHBUFF1 0x82
#define DF_CMD_MAINMEMPAGETHROUGHBUFF2 0x85
-
+
#define DF_CMD_PAGEERASE 0x81
#define DF_CMD_BLOCKERASE 0x50
#define DF_CMD_SECTORERASE 0x7C
@@ -94,15 +94,16 @@
#define DF_CMD_CHIPERASE_BYTE2 0x94
#define DF_CMD_CHIPERASE_BYTE3 0x80
#define DF_CMD_CHIPERASE_BYTE4 0x9A
-
+
#define DF_CMD_SECTORPROTECTIONOFF ((char[]){0x3D, 0x2A, 0x7F, 0x9A})
#define DF_CMD_SECTORPROTECTIONOFF_BYTE1 0x3D
#define DF_CMD_SECTORPROTECTIONOFF_BYTE2 0x2A
#define DF_CMD_SECTORPROTECTIONOFF_BYTE3 0x7F
#define DF_CMD_SECTORPROTECTIONOFF_BYTE4 0x9A
-
+
#define DF_CMD_READMANUFACTURERDEVICEINFO 0x9F
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/USBKEY/Buttons.h b/LUFA/Drivers/Board/USBKEY/Buttons.h
index 82a3b0f5b..551ae6893 100644
--- a/LUFA/Drivers/Board/USBKEY/Buttons.h
+++ b/LUFA/Drivers/Board/USBKEY/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the Buttons driver
* dispatch header located in LUFA/Drivers/Board/Buttons.h.
*/
-
+
/** \ingroup Group_Buttons
* @defgroup Group_Buttons_USBKEY USBKEY
*
@@ -66,12 +66,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 2)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -91,7 +91,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/USBKEY/Dataflash.h b/LUFA/Drivers/Board/USBKEY/Dataflash.h
index 8b01c64c6..a1aa2a44b 100644
--- a/LUFA/Drivers/Board/USBKEY/Dataflash.h
+++ b/LUFA/Drivers/Board/USBKEY/Dataflash.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,7 +43,7 @@
* Board specific Dataflash driver header for the Atmel USBKEY board.
*
* \note This file should not be included directly. It is automatically included as needed by the dataflash driver
- * dispatch header located in LUFA/Drivers/Board/Dataflash.h.
+ * dispatch header located in LUFA/Drivers/Board/Dataflash.h.
*
* @{
*/
@@ -58,7 +58,7 @@
#if !defined(__INCLUDE_FROM_DATAFLASH_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead.
#endif
-
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
@@ -66,7 +66,7 @@
#define DATAFLASH_CHIPCS_DDR DDRE
#define DATAFLASH_CHIPCS_PORT PORTE
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Constant indicating the total number of dataflash ICs mounted on the selected board. */
@@ -80,13 +80,13 @@
/** Mask for the second dataflash chip selected. */
#define DATAFLASH_CHIP2 (1 << 0)
-
+
/** Internal main memory page size for the board's dataflash ICs. */
#define DATAFLASH_PAGE_SIZE 1024
/** Total number of pages inside each of the board's dataflash ICs. */
#define DATAFLASH_PAGES 8192
-
+
/* Inline Functions: */
/** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC.
* The AVR's SPI driver MUST be initialized before any of the dataflash commands are used.
@@ -125,7 +125,7 @@
{
Dataflash_SelectChip(DATAFLASH_NO_CHIP);
}
-
+
/** Selects a dataflash IC from the given page number, which should range from 0 to
* ((DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS) - 1). For boards containing only one
* dataflash IC, this will select DATAFLASH_CHIP1. If the given page number is outside
@@ -138,7 +138,7 @@
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress)
{
Dataflash_DeselectChip();
-
+
if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS))
return;
@@ -154,7 +154,7 @@
static inline void Dataflash_ToggleSelectedChipCS(void)
{
uint8_t SelectedChipMask = Dataflash_GetSelectedChip();
-
+
Dataflash_DeselectChip();
Dataflash_SelectChip(SelectedChipMask);
}
@@ -167,7 +167,7 @@
Dataflash_ToggleSelectedChipCS();
Dataflash_SendByte(DF_CMD_GETSTATUS);
while (!(Dataflash_ReceiveByte() & DF_STATUS_READY));
- Dataflash_ToggleSelectedChipCS();
+ Dataflash_ToggleSelectedChipCS();
}
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
@@ -178,14 +178,15 @@
*/
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress,
const uint16_t BufferByte)
- {
+ {
PageAddress >>= 1;
-
+
Dataflash_SendByte(PageAddress >> 5);
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
Dataflash_SendByte(BufferByte);
- }
+ }
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/USBKEY/Joystick.h b/LUFA/Drivers/Board/USBKEY/Joystick.h
index bea3073c1..3cc252480 100644
--- a/LUFA/Drivers/Board/USBKEY/Joystick.h
+++ b/LUFA/Drivers/Board/USBKEY/Joystick.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -72,7 +72,7 @@
#define JOY_BMASK ((1 << 5) | (1 << 6) | (1 << 7))
#define JOY_EMASK ((1 << 4) | (1 << 5))
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the joystick being pushed in the left direction. */
@@ -89,7 +89,7 @@
/** Mask for the joystick being pushed inward. */
#define JOY_PRESS (1 << 5)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Joystick_Init(void)
@@ -98,9 +98,9 @@
DDRE &= ~(JOY_EMASK);
PORTB |= JOY_BMASK;
- PORTE |= JOY_EMASK;
+ PORTE |= JOY_EMASK;
}
-
+
static inline uint8_t Joystick_GetStatus(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Joystick_GetStatus(void)
{
@@ -116,3 +116,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/USBKEY/LEDs.h b/LUFA/Drivers/Board/USBKEY/LEDs.h
index 754009440..6ee0ec343 100644
--- a/LUFA/Drivers/Board/USBKEY/LEDs.h
+++ b/LUFA/Drivers/Board/USBKEY/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -93,7 +93,7 @@
DDRD |= LEDS_ALL_LEDS;
PORTD &= ~LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTD |= LEDMask;
@@ -108,18 +108,18 @@
{
PORTD = ((PORTD & ~LEDS_ALL_LEDS) | LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTD = ((PORTD & ~LEDMask) | ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTD ^= LEDMask;
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
@@ -131,7 +131,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/USBTINYMKII/Buttons.h b/LUFA/Drivers/Board/USBTINYMKII/Buttons.h
index 7037ee3d6..ddfb9831c 100644
--- a/LUFA/Drivers/Board/USBTINYMKII/Buttons.h
+++ b/LUFA/Drivers/Board/USBTINYMKII/Buttons.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -66,12 +66,12 @@
#if !defined(__INCLUDE_FROM_BUTTONS_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Buttons.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Button mask for the first button on the board. */
#define BUTTONS_BUTTON1 (1 << 7)
-
+
/* Inline Functions: */
#if !defined(__DOXYGEN__)
static inline void Buttons_Init(void)
@@ -91,7 +91,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/USBTINYMKII/LEDs.h b/LUFA/Drivers/Board/USBTINYMKII/LEDs.h
index 9338a2007..7f252567c 100644
--- a/LUFA/Drivers/Board/USBTINYMKII/LEDs.h
+++ b/LUFA/Drivers/Board/USBTINYMKII/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -88,7 +88,7 @@
DDRB |= LEDS_ALL_LEDS;
PORTB &= ~LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LedMask)
{
PORTB |= LedMask;
@@ -103,13 +103,13 @@
{
PORTB = ((PORTB & ~LEDS_ALL_LEDS) | LedMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LedMask,
const uint8_t ActiveMask)
{
PORTB = ((PORTB & ~LedMask) | ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= LEDMask;
@@ -126,7 +126,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/XPLAIN/AT45DB642D.h b/LUFA/Drivers/Board/XPLAIN/AT45DB642D.h
index bbac11c89..ce7af9ea4 100644
--- a/LUFA/Drivers/Board/XPLAIN/AT45DB642D.h
+++ b/LUFA/Drivers/Board/XPLAIN/AT45DB642D.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __DATAFLASH_CMDS_H__
#define __DATAFLASH_CMDS_H__
@@ -57,9 +57,9 @@
#define DF_STATUS_COMPMISMATCH (1 << 6)
#define DF_STATUS_SECTORPROTECTION_ON (1 << 1)
#define DF_STATUS_BINARYPAGESIZE_ON (1 << 0)
-
+
#define DF_MANUFACTURER_ATMEL 0x1F
-
+
#define DF_CMD_GETSTATUS 0xD7
#define DF_CMD_POWERDOWN 0xB9
#define DF_CMD_WAKEUP 0xAB
@@ -70,12 +70,12 @@
#define DF_CMD_MAINMEMTOBUFF2COMP 0x61
#define DF_CMD_AUTOREWRITEBUFF1 0x58
#define DF_CMD_AUTOREWRITEBUFF2 0x59
-
+
#define DF_CMD_MAINMEMPAGEREAD 0xD2
#define DF_CMD_CONTARRAYREAD_LF 0x03
#define DF_CMD_BUFF1READ_LF 0xD1
#define DF_CMD_BUFF2READ_LF 0xD3
-
+
#define DF_CMD_BUFF1WRITE 0x84
#define DF_CMD_BUFF2WRITE 0x87
#define DF_CMD_BUFF1TOMAINMEMWITHERASE 0x83
@@ -84,7 +84,7 @@
#define DF_CMD_BUFF2TOMAINMEM 0x89
#define DF_CMD_MAINMEMPAGETHROUGHBUFF1 0x82
#define DF_CMD_MAINMEMPAGETHROUGHBUFF2 0x85
-
+
#define DF_CMD_PAGEERASE 0x81
#define DF_CMD_BLOCKERASE 0x50
#define DF_CMD_SECTORERASE 0x7C
@@ -94,15 +94,16 @@
#define DF_CMD_CHIPERASE_BYTE2 0x94
#define DF_CMD_CHIPERASE_BYTE3 0x80
#define DF_CMD_CHIPERASE_BYTE4 0x9A
-
+
#define DF_CMD_SECTORPROTECTIONOFF ((char[]){0x3D, 0x2A, 0x7F, 0x9A})
#define DF_CMD_SECTORPROTECTIONOFF_BYTE1 0x3D
#define DF_CMD_SECTORPROTECTIONOFF_BYTE2 0x2A
#define DF_CMD_SECTORPROTECTIONOFF_BYTE3 0x7F
#define DF_CMD_SECTORPROTECTIONOFF_BYTE4 0x9A
-
+
#define DF_CMD_READMANUFACTURERDEVICEINFO 0x9F
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/XPLAIN/Dataflash.h b/LUFA/Drivers/Board/XPLAIN/Dataflash.h
index 9edbf2e8a..670633135 100644
--- a/LUFA/Drivers/Board/XPLAIN/Dataflash.h
+++ b/LUFA/Drivers/Board/XPLAIN/Dataflash.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -58,7 +58,7 @@
#if !defined(__INCLUDE_FROM_DATAFLASH_H)
#error Do not include this file directly. Include LUFA/Drivers/Board/Dataflash.h instead.
#endif
-
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
@@ -66,7 +66,7 @@
#define DATAFLASH_CHIPCS_DDR DDRB
#define DATAFLASH_CHIPCS_PORT PORTB
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Constant indicating the total number of dataflash ICs mounted on the selected board. */
@@ -81,15 +81,15 @@
#if (BOARD == BOARD_XPLAIN_REV1)
#define DATAFLASH_PAGE_SIZE 256
- #define DATAFLASH_PAGES 2048
+ #define DATAFLASH_PAGES 2048
#else
/** Internal main memory page size for the board's dataflash ICs. */
#define DATAFLASH_PAGE_SIZE 1024
/** Total number of pages inside each of the board's dataflash ICs. */
- #define DATAFLASH_PAGES 8192
+ #define DATAFLASH_PAGES 8192
#endif
-
+
/* Inline Functions: */
/** Initialises the dataflash driver so that commands and data may be sent to an attached dataflash IC.
* The AVR's SPI driver MUST be initialized before any of the dataflash commands are used.
@@ -141,20 +141,20 @@
static inline void Dataflash_SelectChipFromPage(const uint16_t PageAddress)
{
Dataflash_DeselectChip();
-
+
if (PageAddress >= DATAFLASH_PAGES)
return;
Dataflash_SelectChip(DATAFLASH_CHIP1);
}
-
+
/** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive
* a new command.
*/
static inline void Dataflash_ToggleSelectedChipCS(void)
{
uint8_t SelectedChipMask = Dataflash_GetSelectedChip();
-
+
Dataflash_DeselectChip();
Dataflash_SelectChip(SelectedChipMask);
}
@@ -167,7 +167,7 @@
Dataflash_ToggleSelectedChipCS();
Dataflash_SendByte(DF_CMD_GETSTATUS);
while (!(Dataflash_ReceiveByte() & DF_STATUS_READY));
- Dataflash_ToggleSelectedChipCS();
+ Dataflash_ToggleSelectedChipCS();
}
/** Sends a set of page and buffer address bytes to the currently selected dataflash IC, for use with
@@ -182,8 +182,9 @@
Dataflash_SendByte(PageAddress >> 5);
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
Dataflash_SendByte(BufferByte);
- }
+ }
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Board/XPLAIN/LEDs.h b/LUFA/Drivers/Board/XPLAIN/LEDs.h
index cf53fa50b..d5f67d1ab 100644
--- a/LUFA/Drivers/Board/XPLAIN/LEDs.h
+++ b/LUFA/Drivers/Board/XPLAIN/LEDs.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __LEDS_XPLAIN_H__
#define __LEDS_XPLAIN_H__
@@ -84,7 +84,7 @@
DDRB |= LEDS_ALL_LEDS;
PORTB |= LEDS_ALL_LEDS;
}
-
+
static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask)
{
PORTB &= ~LEDMask;
@@ -99,30 +99,31 @@
{
PORTB = ((PORTB | LEDS_ALL_LEDS) & ~LEDMask);
}
-
+
static inline void LEDs_ChangeLEDs(const uint8_t LEDMask,
const uint8_t ActiveMask)
{
PORTB = ((PORTB | LEDMask) & ~ActiveMask);
}
-
+
static inline void LEDs_ToggleLEDs(const uint8_t LEDMask)
{
PORTB ^= LEDMask;
}
-
+
static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT;
static inline uint8_t LEDs_GetLEDs(void)
{
return (~PORTB & LEDS_ALL_LEDS);
}
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Misc/TerminalCodes.h b/LUFA/Drivers/Misc/TerminalCodes.h
index ec35d1262..5048e217d 100644
--- a/LUFA/Drivers/Misc/TerminalCodes.h
+++ b/LUFA/Drivers/Misc/TerminalCodes.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* ANSI terminal compatible escape sequences. These escape sequences are designed to be concatenated with existing
* strings to modify their display on a compatible terminal application.
*/
-
+
/** \ingroup Group_MiscDrivers
* @defgroup Group_Terminal ANSI Terminal Escape Codes - LUFA/Drivers/Misc/TerminalCodes.h
*
@@ -56,7 +56,7 @@
*
* @{
*/
-
+
#ifndef __TERMINALCODES_H__
#define __TERMINALCODES_H__
@@ -97,8 +97,8 @@
/** Turns off italics so that any following text is printed to the terminal in non italics. */
#define ESC_ITALICS_OFF ANSI_ESCAPE_SEQUENCE("23m")
-
- /** Turns off underline so that any following text is printed to the terminal non underlined. */
+
+ /** Turns off underline so that any following text is printed to the terminal non underlined. */
#define ESC_UNDERLINE_OFF ANSI_ESCAPE_SEQUENCE("24m")
/** Turns off inverse so that any following text is printed to the terminal in non inverted colours. */
@@ -162,7 +162,7 @@
/** Sets the text background colour to the terminal's default. */
#define ESC_BG_DEFAULT ANSI_ESCAPE_SEQUENCE("49m")
-
+
/** Sets the cursor position to the given line and column. */
#define ESC_CURSOR_POS(L, C) ANSI_ESCAPE_SEQUENCE(#L ";" #C "H")
@@ -183,7 +183,7 @@
/** Restores the cursor position to the last position saved with \ref ESC_CURSOR_POS_SAVE. */
#define ESC_CURSOR_POS_RESTORE ANSI_ESCAPE_SEQUENCE("u")
-
+
/** Erases the entire display, returning the cursor to the top left. */
#define ESC_ERASE_DISPLAY ANSI_ESCAPE_SEQUENCE("2J")
@@ -193,3 +193,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Peripheral/ADC.h b/LUFA/Drivers/Peripheral/ADC.h
index 24997f583..762208b34 100644
--- a/LUFA/Drivers/Peripheral/ADC.h
+++ b/LUFA/Drivers/Peripheral/ADC.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,7 +49,7 @@
* ADC present on many AVR models, for the conversion of analogue signals into the
* digital domain.
*/
-
+
#ifndef __ADC_H__
#define __ADC_H__
@@ -67,5 +67,6 @@
#else
#error "ADC is not available for the currently selected AVR model."
#endif
-
+
#endif
+
diff --git a/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h b/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h
index e927de182..0aaaa9306 100644
--- a/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h
+++ b/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,16 +49,16 @@
*
* @{
*/
-
+
#ifndef __ADC_AVRU4U6U7_H__
#define __ADC_AVRU4U6U7_H__
/* Includes: */
#include "../../../Common/Common.h"
-
+
#include <avr/io.h>
#include <stdbool.h>
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -70,7 +70,7 @@
#endif
/* Public Interface - May be used in end-application: */
- /* Macros: */
+ /* Macros: */
/** Reference mask, for using the voltage present at the AVR's AREF pin for the ADC reference. */
#define ADC_REFERENCE_AREF 0
@@ -79,7 +79,7 @@
/** Reference mask, for using the internally generated 2.56V reference voltage as the ADC reference. */
#define ADC_REFERENCE_INT2560MV ((1 << REFS1) | (1 << REFS0))
-
+
/** Left-adjusts the 10-bit ADC result, so that the upper 8 bits of the value returned by the
* ADC_GetResult() macro contain the 8 most significant bits of the result. */
#define ADC_LEFT_ADJUSTED (1 << ADLAR)
@@ -87,7 +87,7 @@
/** Right-adjusts the 10-bit ADC result, so that the lower 8 bits of the value returned by the
* ADC_GetResult() macro contain the 8 least significant bits of the result. */
#define ADC_RIGHT_ADJUSTED (0 << ADLAR)
-
+
/** Sets the ADC mode to free running, so that conversions take place continuously as fast as the ADC
* is capable of at the given input clock speed. */
#define ADC_FREE_RUNNING (1 << ADATE)
@@ -95,7 +95,7 @@
/** Sets the ADC mode to single conversion, so that only a single conversion will take place before
* the ADC returns to idle. */
#define ADC_SINGLE_CONVERSION (0 << ADATE)
-
+
/** Sets the ADC input clock to prescale by a factor of 2 the AVR's system clock. */
#define ADC_PRESCALE_2 (1 << ADPS0)
@@ -116,7 +116,7 @@
/** Sets the ADC input clock to prescale by a factor of 128 the AVR's system clock. */
#define ADC_PRESCALE_128 ((1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0))
-
+
//@{
/** MUX mask define for the ADC0 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. */
#define ADC_CHANNEL0 (0x00 << MUX0)
@@ -152,7 +152,7 @@
/** MUX mask define for the internal 1.1V bandgap channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. */
#define ADC_1100MV_BANDGAP (0x1E << MUX0)
-
+
#if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__))
/** MUX mask define for the ADC8 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
*
@@ -198,7 +198,7 @@
#define ADC_INT_TEMP_SENS ((1 << 8) | (0x07 << MUX0))
#endif
//@}
-
+
/* Inline Functions: */
/** Configures the given ADC channel, ready for ADC conversions. This function sets the
* associated port pin as an input and disables the digital portion of the I/O to reduce
@@ -216,7 +216,7 @@
{
#if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
- defined(__AVR_ATmega32U6__))
+ defined(__AVR_ATmega32U6__))
DDRF &= ~(1 << ChannelIndex);
DIDR0 |= (1 << ChannelIndex);
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
@@ -242,7 +242,7 @@
}
#endif
}
-
+
/** De-configures the given ADC channel, re-enabling digital I/O mode instead of analog. This
* function sets the associated port pin as an input and re-enabled the digital portion of
* the I/O.
@@ -259,7 +259,7 @@
{
#if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
- defined(__AVR_ATmega32U6__))
+ defined(__AVR_ATmega32U6__))
DDRF &= ~(1 << ChannelIndex);
DIDR0 &= ~(1 << ChannelIndex);
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
@@ -299,14 +299,14 @@
static inline void ADC_StartReading(const uint16_t MUXMask)
{
ADMUX = MUXMask;
-
+
#if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__))
if (MUXMask & (1 << 8))
ADCSRB |= (1 << MUX5);
else
ADCSRB &= ~(1 << MUX5);
#endif
-
+
ADCSRA |= (1 << ADSC);
}
@@ -320,7 +320,7 @@
{
return ((ADCSRA & (1 << ADIF)) ? true : false);
}
-
+
/** Retrieves the conversion value of the last completed ADC conversion and clears the reading
* completion flag.
*
@@ -346,9 +346,9 @@
static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask)
{
ADC_StartReading(MUXMask);
-
+
while (!(ADC_IsReadingComplete()));
-
+
return ADC_GetResult();
}
@@ -372,7 +372,7 @@
{
ADCSRA = 0;
}
-
+
/** Indicates if the ADC is currently enabled.
*
* \return Boolean true if the ADC subsystem is currently enabled, false otherwise.
@@ -382,12 +382,13 @@
{
return ((ADCSRA & (1 << ADEN)) ? true : false);
}
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h b/LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h
index 511105985..a35f729f3 100644
--- a/LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h
+++ b/LUFA/Drivers/Peripheral/AVRU4U6U7/TWI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -53,12 +53,12 @@
/* Includes: */
#include "../../../Common/Common.h"
-
+
#include <avr/io.h>
#include <stdbool.h>
#include <util/twi.h>
#include <util/delay.h>
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -79,10 +79,10 @@
{
TWCR |= (1 << TWEN);
}
-
+
/** Turns off the TWI driver hardware. If this is called, any further TWI operations will require a call to
* \ref TWI_Init() before the TWI can be used again.
- */
+ */
static inline void TWI_ShutDown(void) ATTR_ALWAYS_INLINE;
static inline void TWI_ShutDown(void)
{
@@ -105,7 +105,7 @@
static inline bool TWI_SendByte(const uint8_t Byte)
{
TWDR = Byte;
- TWCR = ((1 << TWINT) | (1 << TWEN));
+ TWCR = ((1 << TWINT) | (1 << TWEN));
while (!(TWCR & (1 << TWINT)));
return ((TWSR & TW_STATUS_MASK) == TW_MT_DATA_ACK);
@@ -122,7 +122,7 @@
const bool LastByte)
{
uint8_t TWCRMask = ((1 << TWINT) | (1 << TWEN));
-
+
if (!(LastByte))
TWCRMask |= (1 << TWEA);
@@ -152,3 +152,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Peripheral/SPI.h b/LUFA/Drivers/Peripheral/SPI.h
index 8c38dcc27..3858acabc 100644
--- a/LUFA/Drivers/Peripheral/SPI.h
+++ b/LUFA/Drivers/Peripheral/SPI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,7 +64,7 @@
/* Macros: */
#define SPI_USE_DOUBLESPEED (1 << SPE)
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 2. */
@@ -87,7 +87,7 @@
/** SPI prescaler mask for SPI_Init(). Divides the system clock by a factor of 128. */
#define SPI_SPEED_FCPU_DIV_128 ((1 << SPR1) | (1 << SPR0))
-
+
/** SPI clock polarity mask for SPI_Init(). Indicates that the SCK should lead on the rising edge. */
#define SPI_SCK_LEAD_RISING (0 << CPOL)
@@ -124,25 +124,25 @@
DDRB |= ((1 << 1) | (1 << 2));
DDRB &= ((1 << 0) | (1 << 3));
PORTB |= ((1 << 0) | (1 << 3));
-
+
SPCR = ((1 << SPE) | SPIOptions);
-
+
if (SPIOptions & SPI_USE_DOUBLESPEED)
SPSR |= (1 << SPI2X);
else
SPSR &= ~(1 << SPI2X);
}
-
+
/** Turns off the SPI driver, disabling and returning used hardware to their default configuration. */
static inline void SPI_ShutDown(void)
{
DDRB &= ~((1 << 1) | (1 << 2));
PORTB &= ~((1 << 0) | (1 << 3));
-
+
SPCR = 0;
SPSR = 0;
}
-
+
/** Sends and receives a byte through the SPI interface, blocking until the transfer is complete.
*
* \param[in] Byte Byte to send through the SPI interface.
@@ -186,7 +186,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Peripheral/Serial.c b/LUFA/Drivers/Peripheral/Serial.c
index b1141de14..97a1febdc 100644
--- a/LUFA/Drivers/Peripheral/Serial.c
+++ b/LUFA/Drivers/Peripheral/Serial.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -51,3 +51,4 @@ void Serial_TxString(const char* StringPtr)
StringPtr++;
}
}
+
diff --git a/LUFA/Drivers/Peripheral/Serial.h b/LUFA/Drivers/Peripheral/Serial.h
index 47f65ea7b..37722db0a 100644
--- a/LUFA/Drivers/Peripheral/Serial.h
+++ b/LUFA/Drivers/Peripheral/Serial.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
*
* Driver for the USART subsystem on supported USB AVRs.
*/
-
+
/** \ingroup Group_PeripheralDrivers
* @defgroup Group_Serial Serial USART Driver - LUFA/Drivers/Peripheral/Serial.h
*
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __SERIAL_H__
#define __SERIAL_H__
@@ -55,7 +55,7 @@
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <stdbool.h>
-
+
#include "../../Common/Common.h"
#include "../Misc/TerminalCodes.h"
@@ -104,7 +104,7 @@
UCSR1C = ((1 << UCSZ11) | (1 << UCSZ10));
UCSR1A = (DoubleSpeed ? (1 << U2X1) : 0);
UCSR1B = ((1 << TXEN1) | (1 << RXEN1));
-
+
DDRD |= (1 << 3);
PORTD |= (1 << 2);
}
@@ -117,7 +117,7 @@
UCSR1C = 0;
UBRR1 = 0;
-
+
DDRD &= ~(1 << 3);
PORTD &= ~(1 << 2);
}
@@ -131,7 +131,7 @@
{
return ((UCSR1A & (1 << RXC1)) ? true : false);
}
-
+
/** Transmits a given byte through the USART.
*
* \param[in] DataByte Byte to transmit through the USART.
@@ -153,14 +153,15 @@
static inline char Serial_RxByte(void)
{
while (!(UCSR1A & (1 << RXC1)));
- return UDR1;
+ return UDR1;
}
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Peripheral/SerialStream.c b/LUFA/Drivers/Peripheral/SerialStream.c
index 36a054876..9589420a0 100644
--- a/LUFA/Drivers/Peripheral/SerialStream.c
+++ b/LUFA/Drivers/Peripheral/SerialStream.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -37,7 +37,7 @@ static int SerialStream_TxByte(char DataByte,
FILE *Stream)
{
(void)Stream;
-
+
Serial_TxByte(DataByte);
return 0;
}
@@ -45,9 +45,10 @@ static int SerialStream_TxByte(char DataByte,
static int SerialStream_RxByte(FILE *Stream)
{
(void)Stream;
-
+
if (!(Serial_IsCharReceived()))
return _FDEV_EOF;
return Serial_RxByte();
}
+
diff --git a/LUFA/Drivers/Peripheral/SerialStream.h b/LUFA/Drivers/Peripheral/SerialStream.h
index 938d8f016..c0f15658d 100644
--- a/LUFA/Drivers/Peripheral/SerialStream.h
+++ b/LUFA/Drivers/Peripheral/SerialStream.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -59,15 +59,15 @@
/* Includes: */
#include <avr/io.h>
#include <stdio.h>
-
+
#include "Serial.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
- /* Private Interface - For use in library only: */
+ /* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* External Variables: */
extern FILE USARTStream;
@@ -92,18 +92,18 @@
const bool DoubleSpeed)
{
Serial_Init(BaudRate, DoubleSpeed);
-
+
stdout = &USARTStream;
stdin = &USARTStream;
}
-
+
/** Turns off the serial stream (and regular USART driver), disabling and returning used hardware to
* their default configuration.
*/
static inline void SerialStream_ShutDown(void)
{
Serial_ShutDown();
- }
+ }
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
@@ -113,3 +113,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/Peripheral/TWI.c b/LUFA/Drivers/Peripheral/TWI.c
index b8aec4852..64f847544 100644
--- a/LUFA/Drivers/Peripheral/TWI.c
+++ b/LUFA/Drivers/Peripheral/TWI.c
@@ -1,6 +1,6 @@
/*
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -15,7 +15,7 @@ bool TWI_StartTransmission(const uint8_t SlaveAddress,
bool BusCaptured = false;
uint16_t TimeoutRemaining;
- TWCR = ((1 << TWINT) | (1 << TWSTA) | (1 << TWEN));
+ TWCR = ((1 << TWINT) | (1 << TWSTA) | (1 << TWEN));
TimeoutRemaining = (TimeoutMS * 100);
while (TimeoutRemaining-- && !(BusCaptured))
@@ -29,35 +29,35 @@ bool TWI_StartTransmission(const uint8_t SlaveAddress,
BusCaptured = true;
break;
case TW_MT_ARB_LOST:
- TWCR = ((1 << TWINT) | (1 << TWSTA) | (1 << TWEN));
+ TWCR = ((1 << TWINT) | (1 << TWSTA) | (1 << TWEN));
continue;
default:
TWCR = (1 << TWEN);
return false;
}
}
-
+
_delay_us(10);
}
-
+
if (!(BusCaptured))
{
TWCR = (1 << TWEN);
return false;
}
-
+
TWDR = SlaveAddress;
TWCR = ((1 << TWINT) | (1 << TWEN));
-
+
TimeoutRemaining = (TimeoutMS * 100);
while (TimeoutRemaining--)
{
if (TWCR & (1 << TWINT))
break;
-
+
_delay_us(10);
}
-
+
if (!(TimeoutRemaining))
return false;
@@ -72,3 +72,4 @@ bool TWI_StartTransmission(const uint8_t SlaveAddress,
}
}
}
+
diff --git a/LUFA/Drivers/Peripheral/TWI.h b/LUFA/Drivers/Peripheral/TWI.h
index 42539203e..87c89a3a0 100644
--- a/LUFA/Drivers/Peripheral/TWI.h
+++ b/LUFA/Drivers/Peripheral/TWI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,7 +49,7 @@
* Master Mode Hardware TWI driver. This module provides an easy to use driver for the hardware
* TWI present on many AVR models, for the transmission and reception of data on a TWI bus.
*/
-
+
#ifndef __TWI_H__
#define __TWI_H__
@@ -67,5 +67,6 @@
#else
#error "TWI is not available for the currently selected AVR model."
#endif
-
+
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Audio.h b/LUFA/Drivers/USB/Class/Audio.h
index a482dfdc5..b28133811 100644
--- a/LUFA/Drivers/USB/Class/Audio.h
+++ b/LUFA/Drivers/USB/Class/Audio.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@
*
* \section Module Description
* Audio Class Driver module. This module contains an internal implementation of the USB Audio 1.0 Class, for Device
- * USB mode only. User applications can use this class driver instead of implementing the Audio class manually via
+ * USB mode only. User applications can use this class driver instead of implementing the Audio class manually via
* the low-level LUFA APIs.
*
* This module is designed to simplify the user code by exposing only the required interface needed to interface with
@@ -64,7 +64,7 @@
/* Includes: */
#include "../HighLevel/USBMode.h"
-
+
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
@@ -72,7 +72,8 @@
#if defined(USB_CAN_BE_DEVICE)
#include "Device/Audio.h"
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/CDC.h b/LUFA/Drivers/USB/Class/CDC.h
index a33ebb179..988edcdd7 100644
--- a/LUFA/Drivers/USB/Class/CDC.h
+++ b/LUFA/Drivers/USB/Class/CDC.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -55,7 +55,7 @@
*
* @{
*/
-
+
#ifndef _CDC_CLASS_H_
#define _CDC_CLASS_H_
@@ -73,11 +73,12 @@
#if defined(USB_CAN_BE_DEVICE)
#include "Device/CDC.h"
#endif
-
+
#if defined(USB_CAN_BE_HOST)
#include "Host/CDC.h"
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Common/Audio.h b/LUFA/Drivers/USB/Class/Common/Audio.h
index 0b023b019..5e65865a0 100644
--- a/LUFA/Drivers/USB/Class/Common/Audio.h
+++ b/LUFA/Drivers/USB/Class/Common/Audio.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -52,7 +52,7 @@
/* Includes: */
#include "../../USB.h"
-
+
#include <string.h>
/* Enable C linkage for C++ Compilers: */
@@ -72,7 +72,7 @@
*/
#define AUDIO_TOTAL_SAMPLE_RATES 1
#endif
-
+
/** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_CHANNEL_LEFT_FRONT (1 << 0)
@@ -139,58 +139,58 @@
/** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */
#define AUDIO_FEATURE_BASS_LOUDNESS (1 << 9)
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_UNDEFINED 0x0100
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_STREAMING 0x0101
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_VENDOR 0x01FF
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_IN_UNDEFINED 0x0200
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_IN_MIC 0x0201
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_IN_DESKTOP_MIC 0x0202
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_IN_PERSONAL_MIC 0x0203
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_IN_OMNIDIR_MIC 0x0204
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_IN_MIC_ARRAY 0x0205
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_IN_PROCESSING_MIC 0x0206
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_IN_OUT_UNDEFINED 0x0300
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_OUT_SPEAKER 0x0301
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_OUT_HEADPHONES 0x0302
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_OUT_HEAD_MOUNTED 0x0303
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_OUT_DESKTOP 0x0304
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_OUT_ROOM 0x0305
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_OUT_COMMUNICATION 0x0306
- /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
+ /** Terminal type constant for an Audio class terminal descriptor. See the Audio class specification for more details. */
#define AUDIO_TERMINAL_OUT_LOWFREQ 0x0307
/** Convenience macro to fill a 24-bit \ref USB_Audio_SampleFreq_t structure with the given sample rate as a 24-bit number.
@@ -198,7 +198,7 @@
* \param[in] freq Required audio sampling frequency in HZ
*/
#define AUDIO_SAMPLE_FREQ(freq) {((uint32_t)freq & 0x00FFFF), (((uint32_t)freq >> 16) & 0x0000FF)}
-
+
/** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint
* accepts only filled endpoint packets of audio samples.
*/
@@ -208,7 +208,7 @@
* will accept partially filled endpoint packets of audio samples.
*/
#define AUDIO_EP_ACCEPTS_SMALL_PACKETS (0 << 7)
-
+
/* Enums: */
/** Audio class specific interface description subtypes, for the Audio Control interface. */
enum Audio_CSInterface_AC_SubTypes_t
@@ -236,7 +236,7 @@
{
AUDIO_DSUBTYPE_CSEndpoint_General = 0x01, /**< Audio class specific endpoint general descriptor. */
};
-
+
/* Type Defines: */
/** \brief Audio class-specific Input Terminal Descriptor (LUFA naming conventions).
*
@@ -252,7 +252,7 @@
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
* must be \ref AUDIO_DSUBTYPE_CSInterface_InputTerminal.
*/
-
+
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask. */
uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals
@@ -260,7 +260,7 @@
*/
uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
uint16_t ChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal. */
-
+
uint8_t ChannelStrIndex; /**< Index of a string descriptor describing this channel within the device. */
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_Audio_Descriptor_InputTerminal_t;
@@ -291,7 +291,7 @@
*/
uint8_t bNrChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */
uint16_t wChannelConfig; /**< CHANNEL_* masks indicating what channel layout is supported by this terminal. */
-
+
uint8_t iChannelNames; /**< Index of a string descriptor describing this channel within the device. */
uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_Audio_StdDescriptor_InputTerminal_t;
@@ -310,14 +310,14 @@
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
* must be \ref AUDIO_DSUBTYPE_CSInterface_OutputTerminal.
*/
-
+
uint8_t TerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */
uint16_t TerminalType; /**< Type of terminal, a TERMINAL_* mask. */
uint8_t AssociatedInputTerminal; /**< ID of associated input terminal, for physically grouped terminals
* such as the speaker and microphone of a phone handset.
*/
uint8_t SourceID; /**< ID value of the unit this terminal's audio is sourced from. */
-
+
uint8_t TerminalStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_Audio_Descriptor_OutputTerminal_t;
@@ -346,7 +346,7 @@
* such as the speaker and microphone of a phone handset.
*/
uint8_t bSourceID; /**< ID value of the unit this terminal's audio is sourced from. */
-
+
uint8_t iTerminal; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_Audio_StdDescriptor_OutputTerminal_t;
@@ -367,7 +367,7 @@
uint16_t ACSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */
uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
-
+
uint8_t InCollection; /**< Total number of Audio Streaming interfaces linked to this Audio Control interface (must be 1). */
uint8_t InterfaceNumber; /**< Interface number of the associated Audio Streaming interface. */
} USB_Audio_Descriptor_Interface_AC_t;
@@ -394,11 +394,11 @@
uint16_t bcdADC; /**< Binary coded decimal value, indicating the supported Audio Class specification version. */
uint16_t wTotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
-
+
uint8_t bInCollection; /**< Total number of Audio Streaming interfaces linked to this Audio Control interface (must be 1). */
uint8_t bInterfaceNumbers; /**< Interface number of the associated Audio Streaming interface. */
} USB_Audio_StdDescriptor_Interface_AC_t;
-
+
/** \brief Audio class-specific Feature Unit Descriptor (LUFA naming conventions).
*
* Type define for an Audio class-specific Feature Unit descriptor. This indicates to the host what features
@@ -413,13 +413,13 @@
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
* must be \ref AUDIO_DSUBTYPE_CSInterface_Feature.
*/
-
+
uint8_t UnitID; /**< ID value of this feature unit - must be a unique value within the device. */
uint8_t SourceID; /**< Source ID value of the audio source input into this feature unit. */
-
+
uint8_t ControlSize; /**< Size of each element in the ChanelControlls array. */
uint8_t ChannelControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */
-
+
uint8_t FeatureUnitStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_Audio_Descriptor_FeatureUnit_t;
@@ -442,16 +442,16 @@
uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
* must be \ref AUDIO_DSUBTYPE_CSInterface_Feature.
*/
-
+
uint8_t bUnitID; /**< ID value of this feature unit - must be a unique value within the device. */
uint8_t bSourceID; /**< Source ID value of the audio source input into this feature unit. */
-
+
uint8_t bControlSize; /**< Size of each element in the ChanelControlls array. */
uint8_t bmaControls[3]; /**< Feature masks for the control channel, and each separate audio channel. */
-
+
uint8_t iFeature; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_Audio_StdDescriptor_FeatureUnit_t;
-
+
/** \brief Audio class-specific Streaming Audio Interface Descriptor (LUFA naming conventions).
*
* Type define for an Audio class-specific streaming interface descriptor. This indicates to the host
@@ -465,9 +465,9 @@
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
* a value from the \ref Audio_CSInterface_AS_SubTypes_t enum.
*/
-
+
uint8_t TerminalLink; /**< ID value of the output terminal this descriptor is describing. */
-
+
uint8_t FrameDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */
uint16_t AudioFormat; /**< Format of the audio stream, see Audio Device Formats specification. */
} USB_Audio_Descriptor_Interface_AS_t;
@@ -490,13 +490,13 @@
uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
* a value from the \ref Audio_CSInterface_AS_SubTypes_t enum.
*/
-
+
uint8_t bTerminalLink; /**< ID value of the output terminal this descriptor is describing. */
-
+
uint8_t bDelay; /**< Delay in frames resulting from the complete sample processing from input to output. */
uint16_t wFormatTag; /**< Format of the audio stream, see Audio Device Formats specification. */
} USB_Audio_StdDescriptor_Interface_AS_t;
-
+
/** \brief 24-Bit Audio Frequency Structure.
*
* Type define for a 24bit audio sample frequency structure. GCC does not contain a built in 24bit datatype,
@@ -522,14 +522,14 @@
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
* must be \ref AUDIO_DSUBTYPE_CSInterface_FormatType.
*/
-
+
uint8_t FormatType; /**< Format of the audio stream, see Audio Device Formats specification. */
uint8_t Channels; /**< Total number of discrete channels in the stream. */
-
+
uint8_t SubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */
uint8_t BitResolution; /**< Bits of resolution of each channel's samples in the stream. */
- uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device. */
+ uint8_t SampleFrequencyType; /**< Total number of sample frequencies supported by the device. */
USB_Audio_SampleFreq_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES]; /**< Sample frequencies supported by the device (must be 24-bit). */
} USB_Audio_Descriptor_Format_t;
@@ -555,17 +555,17 @@
uint8_t bFormatType; /**< Format of the audio stream, see Audio Device Formats specification. */
uint8_t bNrChannels; /**< Total number of discrete channels in the stream. */
-
+
uint8_t bSubFrameSize; /**< Size in bytes of each channel's sample data in the stream. */
uint8_t bBitResolution; /**< Bits of resolution of each channel's samples in the stream. */
- uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. */
+ uint8_t bSampleFrequencyType; /**< Total number of sample frequencies supported by the device. */
uint8_t SampleFrequencies[AUDIO_TOTAL_SAMPLE_RATES * 3]; /**< Sample frequencies supported by the device (must be 24-bit). */
} USB_Audio_StdDescriptor_Format_t;
-
+
/** \brief Audio class-specific Streaming Endpoint Descriptor (LUFA naming conventions).
*
- * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint
+ * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint
* descriptor with a few Audio-class-specific extensions. See the USB Audio specification for more details.
*
* \see \ref USB_Audio_StdDescriptor_StreamEndpoint_Std_t for the version of this type with standard element names.
@@ -580,7 +580,7 @@
/** \brief Audio class-specific Streaming Endpoint Descriptor (USB-IF naming conventions).
*
- * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint
+ * Type define for an Audio class-specific endpoint descriptor. This contains a regular endpoint
* descriptor with a few Audio-class-specific extensions. See the USB Audio specification for more details.
*
* \see \ref USB_Audio_Descriptor_StreamEndpoint_Std_t for the version of this type with non-standard LUFA specific
@@ -592,10 +592,10 @@
uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a
* value given by the specific class.
*/
- uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
+ uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
* configuration, including direction mask.
*/
- uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
+ uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
* and attributes (ENDPOINT_ATTR_*) masks.
*/
uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size
@@ -604,7 +604,7 @@
uint8_t bInterval; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or
* ISOCHRONOUS type.
*/
-
+
uint8_t bRefresh; /**< Always set to zero for Audio class devices. */
uint8_t bSynchAddress; /**< Endpoint address to send synchronization information to, if needed (zero otherwise). */
} USB_Audio_StdDescriptor_StreamEndpoint_Std_t;
@@ -623,7 +623,7 @@
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
* a value from the \ref Audio_CSEndpoint_SubTypes_t enum.
*/
-
+
uint8_t Attributes; /**< Audio class-specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS. */
uint8_t LockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */
@@ -649,18 +649,19 @@
uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors,
* a value from the \ref Audio_CSEndpoint_SubTypes_t enum.
*/
-
+
uint8_t bmAttributes; /**< Audio class-specific endpoint attributes, such as ACCEPTS_SMALL_PACKETS. */
uint8_t bLockDelayUnits; /**< Units used for the LockDelay field, see Audio class specification. */
uint16_t wLockDelay; /**< Time required to internally lock endpoint's internal clock recovery circuitry. */
} USB_Audio_StdDescriptor_StreamEndpoint_Spc_t;
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Common/CDC.h b/LUFA/Drivers/USB/Class/Common/CDC.h
index ac6f9daab..6d2c519b8 100644
--- a/LUFA/Drivers/USB/Class/Common/CDC.h
+++ b/LUFA/Drivers/USB/Class/Common/CDC.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@
*
* @{
*/
-
+
#ifndef _CDC_CLASS_COMMON_H_
#define _CDC_CLASS_COMMON_H_
@@ -64,7 +64,7 @@
#if !defined(__INCLUDE_FROM_CDC_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
#endif
-
+
/* Macros: */
/** Mask for the DTR handshake line for use with the \ref CDC_REQ_SetControlLineState class-specific request
* from the host, to indicate that the DTR line state should be high.
@@ -75,7 +75,7 @@
* from the host, to indicate that the RTS line state should be high.
*/
#define CDC_CONTROL_LINE_OUT_RTS (1 << 1)
-
+
/** Mask for the DCD handshake line for use with the \ref CDC_NOTIF_SerialState class-specific notification
* from the device to the host, to indicate that the DCD line state is currently high.
*/
@@ -110,7 +110,7 @@
* to indicate that a data overrun error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
-
+
/** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a
* uniform structure but variable sized data payloads, thus cannot be represented accurately by
* a single typedef struct. A macro is used instead so that functional descriptors can be created
@@ -125,19 +125,19 @@
uint8_t SubType; \
uint8_t Data[DataSize]; \
}
-
+
/* Enums: */
/** Enum for the CDC class specific control requests that can be issued by the USB bus host. */
enum CDC_ClassRequests_t
- {
+ {
CDC_REQ_SendEncapsulatedCommand = 0x00, /**< CDC class-specific request to send an encapsulated command to the device. */
- CDC_REQ_GetEncapsulatedResponse = 0x01, /**< CDC class-specific request to retrieve an encapsulated command response from the device. */
+ CDC_REQ_GetEncapsulatedResponse = 0x01, /**< CDC class-specific request to retrieve an encapsulated command response from the device. */
CDC_REQ_SetLineEncoding = 0x20, /**< CDC class-specific request to set the current virtual serial port configuration settings. */
CDC_REQ_GetLineEncoding = 0x21, /**< CDC class-specific request to get the current virtual serial port configuration settings. */
CDC_REQ_SetControlLineState = 0x22, /**< CDC class-specific request to set the current virtual serial port handshake line states. */
CDC_REQ_SendBreak = 0x23, /**< CDC class-specific request to send a break to the receiver via the carrier channel. */
};
-
+
/** Enum for the CDC class specific notification requests that can be issued by a CDC device to a host. */
enum CDC_ClassNotifications_t
{
@@ -147,7 +147,7 @@
* endpoint.
*/
};
-
+
/** Enum for the CDC class specific interface descriptor subtypes. */
enum CDC_DescriptorSubtypes_t
{
@@ -169,7 +169,7 @@
CDC_DSUBTYPE_CSInterface_Ethernet = 0x0F, /**< CDC class-specific Ethernet functional descriptor. */
CDC_DSUBTYPE_CSInterface_ATM = 0x10, /**< CDC class-specific Asynchronous Transfer Mode functional descriptor. */
};
-
+
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDC_LineEncodingFormats_t
{
@@ -177,7 +177,7 @@
CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits. */
CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits. */
};
-
+
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDC_LineEncodingParity_t
{
@@ -270,7 +270,7 @@
* to the CDC ACM specification.
*/
} USB_CDC_StdDescriptor_FunctionalACM_t;
-
+
/** \brief CDC class-specific Functional Union Descriptor (LUFA naming conventions).
*
* Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
@@ -287,7 +287,7 @@
uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */
uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */
} USB_CDC_Descriptor_FunctionalUnion_t;
-
+
/** \brief CDC class-specific Functional Union Descriptor (USB-IF naming conventions).
*
* Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
@@ -313,7 +313,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Common/HID.h b/LUFA/Drivers/USB/Class/Common/HID.h
index 822a8b502..3658c8eba 100644
--- a/LUFA/Drivers/USB/Class/Common/HID.h
+++ b/LUFA/Drivers/USB/Class/Common/HID.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@
*
* @{
*/
-
+
#ifndef _HID_CLASS_COMMON_H_
#define _HID_CLASS_COMMON_H_
@@ -59,8 +59,8 @@
#if !defined(__INCLUDE_FROM_HID_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/HID.h instead.
#endif
-
- /* Macros: */
+
+ /* Macros: */
/** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */
#define HID_KEYBOARD_MODIFER_LEFTCTRL (1 << 0)
@@ -84,10 +84,10 @@
/** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */
#define HID_KEYBOARD_MODIFER_RIGHTGUI (1 << 7)
-
+
/** Constant for a keyboard output report LED byte, indicating that the host's NUM LOCK mode is currently set. */
#define HID_KEYBOARD_LED_NUMLOCK (1 << 0)
-
+
/** Constant for a keyboard output report LED byte, indicating that the host's CAPS LOCK mode is currently set. */
#define HID_KEYBOARD_LED_CAPSLOCK (1 << 1)
@@ -108,14 +108,14 @@
HID_REQ_GetProtocol = 0x03, /**< HID class-specific Request to get the current HID report protocol mode. */
HID_REQ_SetProtocol = 0x0B, /**< HID class-specific Request to set the current HID report protocol mode. */
};
-
+
/** Enum for the HID class specific descriptor types. */
enum HID_DescriptorTypes_t
{
HID_DTYPE_HID = 0x21, /**< Descriptor header type value, to indicate a HID class HID descriptor. */
HID_DTYPE_Report = 0x22, /**< Descriptor header type value, to indicate a HID class HID report descriptor. */
};
-
+
/** Enum for the HID class boot protocols that may be supported by HID devices. */
enum HID_BootProtocols_t
{
@@ -132,7 +132,7 @@
* Specification).
*/
};
-
+
/** Enum for the different types of HID reports. */
enum HID_ReportItemTypes_t
{
@@ -151,10 +151,10 @@
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
-
+
uint16_t HIDSpec; /**< BCD encoded version that the HID descriptor and device complies to. */
uint8_t CountryCode; /**< Country code of the localized device, or zero if universal. */
-
+
uint8_t TotalReportDescriptors; /**< Total number of HID report descriptors for the interface. */
uint8_t HIDReportType; /**< Type of HID report, set to \ref HID_DTYPE_Report. */
@@ -175,10 +175,10 @@
uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
* given by the specific class.
*/
-
+
uint16_t bcdHID; /**< BCD encoded version that the HID descriptor and device complies to. */
uint8_t bCountryCode; /**< Country code of the localized device, or zero if universal. */
-
+
uint8_t bNumDescriptors; /**< Total number of HID report descriptors for the interface. */
uint8_t bDescriptorType2; /**< Type of HID report, set to \ref HID_DTYPE_Report. */
@@ -195,7 +195,7 @@
int8_t X; /**< Current delta X movement of the mouse. */
int8_t Y; /**< Current delta Y movement on the mouse. */
} USB_MouseReport_Data_t;
-
+
/** \brief Standard HID Boot Protocol Keyboard Report.
*
* Type define for a standard Boot Protocol Keyboard report
@@ -215,3 +215,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Common/MIDI.h b/LUFA/Drivers/USB/Class/Common/MIDI.h
index b3a40385c..ef3f8fcef 100644
--- a/LUFA/Drivers/USB/Class/Common/MIDI.h
+++ b/LUFA/Drivers/USB/Class/Common/MIDI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -68,7 +68,7 @@
#if !defined(__INCLUDE_FROM_MIDI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
#endif
-
+
/* Macros: */
/** MIDI command for a note on (activation) event. */
#define MIDI_COMMAND_NOTE_ON 0x90
@@ -78,21 +78,21 @@
/** Standard key press velocity value used for all note events. */
#define MIDI_STANDARD_VELOCITY 64
-
+
/** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
*
* \param[in] channel MIDI channel number to address.
*/
#define MIDI_CHANNEL(channel) ((channel) - 1)
-
+
/* Enums: */
enum MIDI_JackTypes_t
{
MIDI_JACKTYPE_Embedded = 0x01, /**< MIDI class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
MIDI_JACKTYPE_External = 0x02, /**< MIDI class descriptor jack type value for an external (physical) MIDI input or output jack. */
};
-
+
/* Type Defines: */
/** \brief MIDI class-specific Streaming Interface Descriptor (LUFA naming conventions).
*
@@ -106,13 +106,13 @@
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
-
+
uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class
* specification version.
*/
uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
} USB_MIDI_Descriptor_AudioInterface_AS_t;
-
+
/** \brief MIDI class-specific Streaming Interface Descriptor (USB-IF naming conventions).
*
* Type define for an Audio class-specific MIDI streaming interface descriptor. This indicates to the host
@@ -130,7 +130,7 @@
*/
uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */
-
+
uint16_t bcdMSC; /**< Binary coded decimal value, indicating the supported MIDI Class specification version. */
uint16_t wTotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */
} USB_MIDI_StdDescriptor_AudioInterface_AS_t;
@@ -149,7 +149,7 @@
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values. */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device. */
-
+
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_MIDI_Descriptor_InputJack_t;
@@ -172,7 +172,7 @@
uint8_t bJackType; /**< Type of jack, one of the JACKTYPE_* mask values. */
uint8_t bJackID; /**< ID value of this jack - must be a unique value within the device. */
-
+
uint8_t iJack; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_MIDI_StdDescriptor_InputJack_t;
@@ -190,14 +190,14 @@
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values. */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device. */
-
+
uint8_t NumberOfPins; /**< Number of output channels within the jack, either physical or logical. */
uint8_t SourceJackID[1]; /**< ID of each output pin's source data jack. */
uint8_t SourcePinID[1]; /**< Pin number in the input jack of each output pin's source data. */
-
+
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_MIDI_Descriptor_OutputJack_t;
-
+
/** \brief MIDI class-specific Output Jack Descriptor (USB-IF naming conventions).
*
* Type define for an Audio class-specific MIDI OUT jack. This gives information to the host on a MIDI output, either
@@ -217,11 +217,11 @@
uint8_t bJackType; /**< Type of jack, one of the JACKTYPE_* mask values. */
uint8_t bJackID; /**< ID value of this jack - must be a unique value within the device. */
-
+
uint8_t bNrInputPins; /**< Number of output channels within the jack, either physical or logical. */
uint8_t baSourceID[1]; /**< ID of each output pin's source data jack. */
uint8_t baSourcePin[1]; /**< Pin number in the input jack of each output pin's source data. */
-
+
uint8_t iJack; /**< Index of a string descriptor describing this descriptor within the device. */
} USB_MIDI_StdDescriptor_OutputJack_t;
@@ -272,17 +272,18 @@
{
unsigned char Command : 4; /**< Upper nibble of the MIDI command being sent or received in the event packet. */
unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface. */
-
+
uint8_t Data1; /**< First byte of data in the MIDI event. */
uint8_t Data2; /**< Second byte of data in the MIDI event. */
- uint8_t Data3; /**< Third byte of data in the MIDI event. */
+ uint8_t Data3; /**< Third byte of data in the MIDI event. */
} MIDI_EventPacket_t;
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Common/MassStorage.h b/LUFA/Drivers/USB/Class/Common/MassStorage.h
index ec6c39360..dea847c13 100644
--- a/LUFA/Drivers/USB/Class/Common/MassStorage.h
+++ b/LUFA/Drivers/USB/Class/Common/MassStorage.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,14 +64,14 @@
#if !defined(__INCLUDE_FROM_MS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MassStorage.h instead.
#endif
-
+
/* Macros: */
/** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define MS_CBW_SIGNATURE 0x43425355UL
/** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define MS_CSW_SIGNATURE 0x53425355UL
-
+
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */
#define MS_COMMAND_DIR_DATA_OUT (0 << 7)
@@ -203,7 +203,7 @@
/** SCSI Additional Sense Qualifier Code to indicate that an operation is currently in progress. */
#define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07
-
+
/* Enums: */
/** Enum for the Mass Storage class specific control requests that can be issued by the USB bus host. */
enum MS_ClassRequests_t
@@ -215,7 +215,7 @@
* ready for the next command.
*/
};
-
+
/** Enum for the possible command status wrapper return status codes. */
enum MS_CommandStatusCodes_t
{
@@ -240,7 +240,7 @@
uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array. */
uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block. */
} MS_CommandBlockWrapper_t;
-
+
/** \brief Mass Storage Class Command Status Wrapper.
*
* Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol.
@@ -252,9 +252,9 @@
uint32_t DataTransferResidue; /**< Number of bytes of data not processed in the SCSI command. */
uint8_t Status; /**< Status code of the issued command - a value from the \ref MS_CommandStatusCodes_t enum. */
} MS_CommandStatusWrapper_t;
-
+
/** \brief Mass Storage Class SCSI Sense Structure
- *
+ *
* Type define for a SCSI Sense structure. Structures of this type are filled out by the
* device via the \ref MS_Host_RequestSense() function, indicating the current sense data of the
* device (giving explicit error codes for the last issued command). For details of the
@@ -265,13 +265,13 @@
uint8_t ResponseCode;
uint8_t SegmentNumber;
-
+
unsigned char SenseKey : 4;
unsigned char Reserved : 1;
unsigned char ILI : 1;
unsigned char EOM : 1;
unsigned char FileMark : 1;
-
+
uint8_t Information[4];
uint8_t AdditionalLength;
uint8_t CmdSpecificInformation[4];
@@ -293,12 +293,12 @@
{
unsigned char DeviceType : 5;
unsigned char PeripheralQualifier : 3;
-
+
unsigned char Reserved : 7;
unsigned char Removable : 1;
-
+
uint8_t Version;
-
+
unsigned char ResponseDataFormat : 4;
unsigned char Reserved2 : 1;
unsigned char NormACA : 1;
@@ -316,17 +316,18 @@
unsigned char WideBus16Bit : 1;
unsigned char WideBus32Bit : 1;
unsigned char RelAddr : 1;
-
+
uint8_t VendorID[8];
uint8_t ProductID[16];
uint8_t RevisionID[4];
} SCSI_Inquiry_Response_t;
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Common/Printer.h b/LUFA/Drivers/USB/Class/Common/Printer.h
index 7e89b41be..97e94a3bc 100644
--- a/LUFA/Drivers/USB/Class/Common/Printer.h
+++ b/LUFA/Drivers/USB/Class/Common/Printer.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,7 +64,7 @@
#if !defined(__INCLUDE_FROM_PRINTER_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/Printer.h instead.
#endif
-
+
/* Macros: */
/** Port status mask for a printer device, indicating that an error has *not* occurred. */
#define PRNT_PORTSTATUS_NOTERROR (1 << 3)
@@ -74,12 +74,13 @@
/** Port status mask for a printer device, indicating that the device is currently out of paper. */
#define PRNT_PORTSTATUS_PAPEREMPTY (1 << 5)
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Common/RNDIS.h b/LUFA/Drivers/USB/Class/Common/RNDIS.h
index b9d50f93c..6b5234b13 100644
--- a/LUFA/Drivers/USB/Class/Common/RNDIS.h
+++ b/LUFA/Drivers/USB/Class/Common/RNDIS.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -57,9 +57,9 @@
#include "../../USB.h"
#include "RNDISConstants.h"
#include "CDC.h"
-
+
#include <string.h>
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -69,20 +69,20 @@
#if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
#endif
-
+
/* Macros: */
/** Implemented RNDIS Version Major. */
#define REMOTE_NDIS_VERSION_MAJOR 0x01
/** Implemented RNDIS Version Minor. */
#define REMOTE_NDIS_VERSION_MINOR 0x00
-
+
/** Maximum size in bytes of a RNDIS control message which can be sent or received. */
#define RNDIS_MESSAGE_BUFFER_SIZE 128
/** Maximum size in bytes of an Ethernet frame according to the Ethernet standard. */
#define ETHERNET_FRAME_SIZE_MAX 1500
-
+
/* Enums: */
/** Enum for the RNDIS class specific control requests that can be issued by the USB bus host. */
enum RNDIS_ClassRequests_t
@@ -90,7 +90,7 @@
RNDIS_REQ_SendEncapsulatedCommand = 0x00, /**< RNDIS request to issue a host-to-device NDIS command. */
RNDIS_REQ_GetEncapsulatedResponse = 0x01, /**< RNDIS request to issue a device-to-host NDIS response. */
};
-
+
/** Enum for the possible NDIS adapter states. */
enum RNDIS_States_t
{
@@ -114,7 +114,7 @@
NDIS_HardwareStatus_Closing, /**< Hardware currently closing. */
NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host. */
};
-
+
/* Type Defines: */
/** \brief MAC Address Structure.
*
@@ -174,12 +174,12 @@
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t MaxTransferSize;
} RNDIS_Initialize_Message_t;
-
+
/** \brief RNDIS Initialize Complete Message Structure.
*
* Type define for a RNDIS Initialize Complete response message.
@@ -190,7 +190,7 @@
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
-
+
uint32_t MajorVersion;
uint32_t MinorVersion;
uint32_t DeviceFlags;
@@ -201,7 +201,7 @@
uint32_t AFListOffset;
uint32_t AFListSize;
} RNDIS_Initialize_Complete_t;
-
+
/** \brief RNDIS Keep Alive Message Structure.
*
* Type define for a RNDIS Keep Alive command message.
@@ -237,7 +237,7 @@
uint32_t AddressingReset;
} RNDIS_Reset_Complete_t;
-
+
/** \brief RNDIS OID Property Set Message Structure.
*
* Type define for a RNDIS OID Property Set command message.
@@ -247,7 +247,7 @@
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
@@ -265,7 +265,7 @@
uint32_t RequestId;
uint32_t Status;
} RNDIS_Set_Complete_t;
-
+
/** \brief RNDIS OID Property Query Message Structure.
*
* Type define for a RNDIS OID Property Query command message.
@@ -275,13 +275,13 @@
uint32_t MessageType;
uint32_t MessageLength;
uint32_t RequestId;
-
+
uint32_t Oid;
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
uint32_t DeviceVcHandle;
} RNDIS_Query_Message_t;
-
+
/** \brief RNDIS OID Property Query Complete Message Structure.
*
* Type define for a RNDIS OID Property Query Complete response message.
@@ -292,16 +292,17 @@
uint32_t MessageLength;
uint32_t RequestId;
uint32_t Status;
-
+
uint32_t InformationBufferLength;
uint32_t InformationBufferOffset;
} RNDIS_Query_Complete_t;
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Common/RNDISConstants.h b/LUFA/Drivers/USB/Class/Common/RNDISConstants.h
index 7cd80aba7..8edbbd701 100644
--- a/LUFA/Drivers/USB/Class/Common/RNDISConstants.h
+++ b/LUFA/Drivers/USB/Class/Common/RNDISConstants.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
* RNDIS specification related constants. For more information on these
* constants, please refer to the Microsoft RNDIS specification.
*/
-
+
#ifndef _RNDIS_CONSTANTS_DEVICE_H_
#define _RNDIS_CONSTANTS_DEVICE_H_
@@ -61,19 +61,19 @@
#define REMOTE_NDIS_SET_CMPLT 0x80000005UL
#define REMOTE_NDIS_RESET_CMPLT 0x80000006UL
#define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL
-
+
#define REMOTE_NDIS_STATUS_SUCCESS 0x00000000UL
#define REMOTE_NDIS_STATUS_FAILURE 0xC0000001UL
#define REMOTE_NDIS_STATUS_INVALID_DATA 0xC0010015UL
#define REMOTE_NDIS_STATUS_NOT_SUPPORTED 0xC00000BBUL
#define REMOTE_NDIS_STATUS_MEDIA_CONNECT 0x4001000BUL
#define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT 0x4001000CUL
-
+
#define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL
#define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL
-
+
#define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL
-
+
#define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL
#define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL
@@ -88,8 +88,8 @@
#define REMOTE_NDIS_PACKET_GROUP 0x00001000UL
#define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL 0x00002000UL
#define REMOTE_NDIS_PACKET_FUNCTIONAL 0x00004000UL
- #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
-
+ #define REMOTE_NDIS_PACKET_MAC_FRAME 0x00008000UL
+
#define OID_GEN_SUPPORTED_LIST 0x00010101UL
#define OID_GEN_HARDWARE_STATUS 0x00010102UL
#define OID_GEN_MEDIA_SUPPORTED 0x00010103UL
@@ -119,3 +119,4 @@
#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Common/StillImage.h b/LUFA/Drivers/USB/Class/Common/StillImage.h
index 01cffbddb..2ba4227ac 100644
--- a/LUFA/Drivers/USB/Class/Common/StillImage.h
+++ b/LUFA/Drivers/USB/Class/Common/StillImage.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,7 +54,7 @@
#include "../../USB.h"
#include <string.h>
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -64,7 +64,7 @@
#if !defined(__INCLUDE_FROM_SI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/StillImage.h instead.
#endif
-
+
/* Macros: */
/** Length in bytes of a given Unicode string's character length.
*
@@ -73,7 +73,7 @@
* \return Number of bytes of the given unicode string.
*/
#define UNICODE_STRING_LENGTH(Chars) ((Chars) << 1)
-
+
/** Used in the DataLength field of a PIMA container, to give the total container size in bytes for
* a command container.
*
@@ -97,8 +97,8 @@
SI_PIMA_CONTAINER_DataBlock = 2, /**< Data Block container type. */
SI_PIMA_CONTAINER_ResponseBlock = 3, /**< Response container type. */
SI_PIMA_CONTAINER_EventBlock = 4, /**< Event Block container type. */
- };
-
+ };
+
/* Enums: */
/** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */
enum SI_PIMA_ResponseCodes_t
@@ -118,7 +118,7 @@
* parameters are not supported by the device.
*/
};
-
+
/* Type Defines: */
/** \brief PIMA Still Image Device Command/Response Container.
*
@@ -133,12 +133,13 @@
uint32_t TransactionID; /**< Unique container ID to link blocks together. */
uint32_t Params[3]; /**< Block parameters to be issued along with the block code (command blocks only). */
} SI_PIMA_Container_t;
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.c b/LUFA/Drivers/USB/Class/Device/Audio.c
index 302853335..106a968dc 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.c
+++ b/LUFA/Drivers/USB/Class/Device/Audio.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
{
if (!(Endpoint_IsSETUPReceived()))
return;
-
+
if (USB_ControlRequest.wIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber)
return;
@@ -84,14 +84,14 @@ bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioIn
{
continue;
}
-
+
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size, ENDPOINT_BANK_DOUBLE)))
{
return false;
}
}
-
+
return true;
}
-#endif \ No newline at end of file
+#endif
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.h b/LUFA/Drivers/USB/Class/Device/Audio.h
index 5491806f0..6520a3379 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.h
+++ b/LUFA/Drivers/USB/Class/Device/Audio.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,7 +56,7 @@
/* Includes: */
#include "../../USB.h"
#include "../Common/Audio.h"
-
+
#include <string.h>
/* Enable C linkage for C++ Compilers: */
@@ -97,7 +97,7 @@
*/
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing Audio Streaming data endpoint, if available
* (zero if unused).
- */
+ */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
*/
@@ -108,9 +108,9 @@
*/
} State; /**< State data for the USB class interface within the device. All elements in this section
* are reset to their defaults when the interface is enumerated.
- */
+ */
} USB_ClassInfo_Audio_Device_t;
-
+
/* Function Prototypes: */
/** Configures the endpoints of a given Audio interface, ready for use. This should be linked to the library
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing the
@@ -132,8 +132,8 @@
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state.
*/
void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
- /* Inline Functions: */
+
+ /* Inline Functions: */
/** General management task for a given Audio class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
*
@@ -162,8 +162,8 @@
{
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
return false;
-
- Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber);
+
+ Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpointNumber);
return Endpoint_IsOUTReceived();
}
@@ -183,7 +183,7 @@
{
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled))
return false;
-
+
Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpointNumber);
return Endpoint_IsINReady();
}
@@ -202,14 +202,14 @@
static inline int8_t Audio_Device_ReadSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo)
{
int8_t Sample;
-
+
(void)AudioInterfaceInfo;
Sample = Endpoint_Read_Byte();
if (!(Endpoint_BytesInEndpoint()))
Endpoint_ClearOUT();
-
+
return Sample;
}
@@ -231,7 +231,7 @@
(void)AudioInterfaceInfo;
Sample = (int16_t)Endpoint_Read_Word_LE();
-
+
if (!(Endpoint_BytesInEndpoint()))
Endpoint_ClearOUT();
@@ -256,7 +256,7 @@
(void)AudioInterfaceInfo;
Sample = (((uint32_t)Endpoint_Read_Byte() << 16) | Endpoint_Read_Word_LE());
-
+
if (!(Endpoint_BytesInEndpoint()))
Endpoint_ClearOUT();
@@ -325,7 +325,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c
index bb41a125a..f95496ebd 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.c
+++ b/LUFA/Drivers/USB/Class/Device/CDC.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,7 +45,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
{
if (!(Endpoint_IsSETUPReceived()))
return;
-
+
if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber)
return;
@@ -58,7 +58,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
Endpoint_Write_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding));
Endpoint_ClearOUT();
}
-
+
break;
case CDC_REQ_SetLineEncoding:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -69,11 +69,11 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);
}
-
+
break;
case CDC_REQ_SetControlLineState:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
- {
+ {
Endpoint_ClearSETUP();
Endpoint_ClearStatusStage();
@@ -81,11 +81,11 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter
EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo);
}
-
+
break;
case CDC_REQ_SendBreak:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
- {
+ {
Endpoint_ClearSETUP();
Endpoint_ClearStatusStage();
@@ -132,14 +132,14 @@ bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfac
{
continue;
}
-
+
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
-
+
return true;
}
@@ -147,7 +147,7 @@ void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
{
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
return;
-
+
CDC_Device_Flush(CDCInterfaceInfo);
}
@@ -157,7 +157,7 @@ uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo
{
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
return ENDPOINT_RWSTREAM_DeviceDisconnected;
-
+
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
return Endpoint_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
}
@@ -195,11 +195,11 @@ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
if (!(Endpoint_BytesInEndpoint()))
return ENDPOINT_READYWAIT_NoError;
-
+
bool BankFull = !(Endpoint_IsReadWriteAllowed());
-
+
Endpoint_ClearIN();
-
+
if (BankFull)
{
if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)
@@ -207,7 +207,7 @@ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
Endpoint_ClearIN();
}
-
+
return ENDPOINT_READYWAIT_NoError;
}
@@ -244,16 +244,16 @@ int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInf
int16_t ReceivedByte = -1;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpointNumber);
-
+
if (Endpoint_IsOUTReceived())
{
if (Endpoint_BytesInEndpoint())
ReceivedByte = Endpoint_Read_Byte();
-
+
if (!(Endpoint_BytesInEndpoint()))
Endpoint_ClearOUT();
}
-
+
return ReceivedByte;
}
@@ -263,7 +263,7 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDC
return;
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpointNumber);
-
+
USB_Request_Header_t Notification = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
@@ -313,17 +313,18 @@ static int CDC_Device_getchar(FILE* Stream)
static int CDC_Device_getchar_Blocking(FILE* Stream)
{
int16_t ReceivedByte;
-
+
while ((ReceivedByte = CDC_Device_ReceiveByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream))) < 0)
{
if (USB_DeviceState == DEVICE_STATE_Unattached)
return _FDEV_EOF;
-
+
CDC_Device_USBTask((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream));
- USB_USBTask();
+ USB_USBTask();
}
return ReceivedByte;
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h
index b5896f34d..956ff28de 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.h
+++ b/LUFA/Drivers/USB/Class/Device/CDC.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@
* \note There are several major drawbacks to the CDC-ACM standard USB class, however
* it is very standardized and thus usually available as a built-in driver on
* most platforms, and so is a better choice than a proprietary serial class.
- *
+ *
* One major issue with CDC-ACM is that it requires two Interface descriptors,
* which will upset most hosts when part of a multi-function "Composite" USB
* device, as each interface will be loaded into a separate driver instance. To
@@ -66,7 +66,7 @@
*
* @{
*/
-
+
#ifndef _CDC_CLASS_DEVICE_H_
#define _CDC_CLASS_DEVICE_H_
@@ -86,7 +86,7 @@
#if !defined(__INCLUDE_FROM_CDC_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/CDC.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief CDC Class Device Mode Configuration and State Structure.
@@ -140,13 +140,13 @@
uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */
} LineEncoding; /** Line encoding used in the virtual serial port, for the device's information. This is generally
* only used if the virtual serial port data is to be reconstructed on a physical UART.
- */
+ */
} State; /**< State data for the USB class interface within the device. All elements in this section
* are reset to their defaults when the interface is enumerated.
*/
} USB_ClassInfo_CDC_Device_t;
-
- /* Function Prototypes: */
+
+ /* Function Prototypes: */
/** Configures the endpoints of a given CDC interface, ready for use. This should be linked to the library
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration containing
* the given CDC interface is selected.
@@ -183,7 +183,7 @@
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
*/
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** CDC class driver event for a control line state change on a CDC interface. This event fires each time the host requests a
* control line state change (containing the virtual serial control line states, such as DTR) and may be hooked in the
* user program by declaring a handler function with the same name and parameters listed here. The new control line states
@@ -205,7 +205,7 @@
/** Sends a given string to the attached USB host, if connected. If a host is not connected when the function is called, the
* string is discarded. Bytes will be queued for transmission to the host until either the endpoint bank becomes full, or the
- * \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
+ * \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
* packed into a single endpoint packet, increasing data throughput.
*
* \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or
@@ -220,10 +220,10 @@
uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
const char* const Data,
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
-
+
/** Sends a given byte to the attached USB host, if connected. If a host is not connected when the function is called, the
* byte is discarded. Bytes will be queued for transmission to the host until either the endpoint bank becomes full, or the
- * \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
+ * \ref CDC_Device_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
* packed into a single endpoint packet, increasing data throughput.
*
* \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or
@@ -236,7 +236,7 @@
*/
uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Determines the number of bytes received by the CDC interface from the host, waiting to be read. This indicates the number
* of bytes in the OUT endpoint bank only, and thus the number of calls to \ref CDC_Device_ReceiveByte() which are guaranteed to
* succeed immediately. If multiple bytes are to be received, they should be buffered by the user application, as the endpoint
@@ -250,7 +250,7 @@
* \return Total number of buffered bytes received from the host.
*/
uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Reads a byte of data from the host. If no data is waiting to be read of if a USB host is not connected, the function
* returns a negative value. The \ref CDC_Device_BytesReceived() function may be queried in advance to determine how many
* bytes are currently buffered in the CDC interface's data receive endpoint bank, and thus how many repeated calls to this
@@ -264,7 +264,7 @@
* \return Next received byte from the host, or a negative value if no data received.
*/
int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
*
* \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or
@@ -275,10 +275,10 @@
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum.
*/
uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial
* control lines (DCD, DSR, etc.) have changed states, or to give BREAK notifications to the host. Line states persist
- * until they are cleared via a second notification. This should be called each time the CDC class driver's
+ * until they are cleared via a second notification. This should be called each time the CDC class driver's
* ControlLineStates.DeviceToHost value is updated to push the new states to the USB host.
*
* \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or
@@ -323,7 +323,7 @@
FILE* Stream) ATTR_NON_NULL_PTR_ARG(2);
static int CDC_Device_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1);
static int CDC_Device_getchar_Blocking(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1);
-
+
void CDC_Device_Event_Stub(void);
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(CDC_Device_Event_Stub);
@@ -335,12 +335,13 @@
#endif
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c
index 5111eba59..cdfe8497a 100644
--- a/LUFA/Drivers/USB/Class/Device/HID.c
+++ b/LUFA/Drivers/USB/Class/Device/HID.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
{
if (!(Endpoint_IsSETUPReceived()))
return;
-
+
if (USB_ControlRequest.wIndex != HIDInterfaceInfo->Config.InterfaceNumber)
return;
@@ -56,7 +56,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
memset(ReportData, 0, sizeof(ReportData));
CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType, ReportData, &ReportSize);
-
+
if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL)
memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportData, HIDInterfaceInfo->Config.PrevReportINBufferSize);
@@ -66,7 +66,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
Endpoint_Write_Control_Stream_LE(ReportData, ReportSize);
Endpoint_ClearOUT();
}
-
+
break;
case HID_REQ_SetReport:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -82,7 +82,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType, ReportData, ReportSize);
}
-
+
break;
case HID_REQ_GetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -92,7 +92,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
Endpoint_ClearIN();
Endpoint_ClearStatusStage();
}
-
+
break;
case HID_REQ_SetProtocol:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -100,9 +100,9 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
Endpoint_ClearSETUP();
Endpoint_ClearStatusStage();
- HIDInterfaceInfo->State.UsingReportProtocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
+ HIDInterfaceInfo->State.UsingReportProtocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00);
}
-
+
break;
case HID_REQ_SetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -112,11 +112,11 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
HIDInterfaceInfo->State.IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6);
}
-
+
break;
case HID_REQ_GetIdle:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
- {
+ {
Endpoint_ClearSETUP();
Endpoint_Write_Byte(HIDInterfaceInfo->State.IdleCount >> 2);
Endpoint_ClearIN();
@@ -139,17 +139,17 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfac
{
return false;
}
-
+
return true;
}
-
+
void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
{
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber);
-
+
if (Endpoint_IsReadWriteAllowed())
{
uint8_t ReportINData[HIDInterfaceInfo->Config.PrevReportINBufferSize];
@@ -162,7 +162,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
ReportINData, &ReportINSize);
bool StatesChanged = false;
bool IdlePeriodElapsed = (HIDInterfaceInfo->State.IdleCount && !(HIDInterfaceInfo->State.IdleMSRemaining));
-
+
if (HIDInterfaceInfo->Config.PrevReportINBuffer != NULL)
{
StatesChanged = (memcmp(ReportINData, HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINSize) != 0);
@@ -179,10 +179,11 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
Endpoint_Write_Byte(ReportID);
Endpoint_Write_Stream_LE(ReportINData, ReportINSize, NO_STREAM_CALLBACK);
-
+
Endpoint_ClearIN();
}
}
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Device/HID.h b/LUFA/Drivers/USB/Class/Device/HID.h
index 097b12f29..5329e294e 100644
--- a/LUFA/Drivers/USB/Class/Device/HID.h
+++ b/LUFA/Drivers/USB/Class/Device/HID.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,7 +49,7 @@
*
* @{
*/
-
+
#ifndef _HID_CLASS_DEVICE_H_
#define _HID_CLASS_DEVICE_H_
@@ -88,14 +88,14 @@
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device. */
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint. */
- uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint. */
+ uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint. */
bool ReportINEndpointDoubleBank; /**< Indicates if the HID interface's IN report endpoint should use double banking. */
-
+
void* PrevReportINBuffer; /**< Pointer to a buffer where the previously created HID input report can be
* stored by the driver, for comparison purposes to detect report changes that
* must be sent immediately to the host. This should point to a buffer big enough
* to hold the largest HID input report sent from the HID interface. If this is set
- * to NULL, it is up to the user to force transfers when needed in the
+ * to NULL, it is up to the user to force transfers when needed in the
* \ref CALLBACK_HID_Device_CreateHIDReport() callback function.
*
* \note Due to the single buffer, the internal driver can only correctly compare
@@ -111,18 +111,18 @@
*/
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
- */
+ */
struct
{
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode. */
uint16_t IdleCount; /**< Report idle period, in milliseconds, set by the host. */
- uint16_t IdleMSRemaining; /**< Total number of milliseconds remaining before the idle period elapsed - this
- * should be decremented by the user application if non-zero each millisecond. */
+ uint16_t IdleMSRemaining; /**< Total number of milliseconds remaining before the idle period elapsed - this
+ * should be decremented by the user application if non-zero each millisecond. */
} State; /**< State data for the USB class interface within the device. All elements in this section
* are reset to their defaults when the interface is enumerated.
*/
} USB_ClassInfo_HID_Device_t;
-
+
/* Function Prototypes: */
/** Configures the endpoints of a given HID interface, ready for use. This should be linked to the library
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
@@ -137,12 +137,12 @@
* \return Boolean true if the endpoints were successfully configured, false otherwise.
*/
bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Processes incoming control requests from the host, that are directed to the given HID class interface. This should be
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
*
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
- */
+ */
void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** General management task for a given HID class interface, required for the correct operation of the interface. This should
@@ -151,13 +151,13 @@
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
*/
void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** HID class driver callback for the user creation of a HID IN report. This callback may fire in response to either
* HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback the
* user is responsible for the creation of the next HID input report to be sent to the host.
*
* \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state.
- * \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero,
+ * \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero,
* this should be set to the report ID of the generated HID input report (if any). If multiple
* reports are not sent via the given HID interface, this parameter should be ignored.
* \param[in] ReportType Type of HID report to generate, either \ref HID_REPORT_ITEM_In or \ref HID_REPORT_ITEM_Feature.
@@ -173,7 +173,7 @@
void* ReportData,
uint16_t* const ReportSize) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(4) ATTR_NON_NULL_PTR_ARG(5);
-
+
/** HID class driver callback for the user processing of a received HID OUT report. This callback may fire in response to
* either HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback
* the user is responsible for the processing of the received HID output report from the host.
@@ -205,12 +205,13 @@
if (HIDInterfaceInfo->State.IdleMSRemaining)
HIDInterfaceInfo->State.IdleMSRemaining--;
}
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.c b/LUFA/Drivers/USB/Class/Device/MIDI.c
index fcf670aac..783b67ce7 100644
--- a/LUFA/Drivers/USB/Class/Device/MIDI.c
+++ b/LUFA/Drivers/USB/Class/Device/MIDI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,14 +64,14 @@ bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInter
{
continue;
}
-
+
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
-
+
return true;
}
@@ -80,7 +80,7 @@ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
{
if (USB_DeviceState != DEVICE_STATE_Configured)
return ENDPOINT_RWSTREAM_DeviceDisconnected;
-
+
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
if (Endpoint_IsReadWriteAllowed())
@@ -93,7 +93,7 @@ uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearIN();
}
-
+
return ENDPOINT_RWSTREAM_NoError;
}
@@ -101,7 +101,7 @@ uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
{
if (USB_DeviceState != DEVICE_STATE_Configured)
return ENDPOINT_RWSTREAM_DeviceDisconnected;
-
+
uint8_t ErrorCode;
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpointNumber);
@@ -122,18 +122,19 @@ bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInter
{
if (USB_DeviceState != DEVICE_STATE_Configured)
return false;
-
+
Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpointNumber);
if (!(Endpoint_IsReadWriteAllowed()))
return false;
Endpoint_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NO_STREAM_CALLBACK);
-
+
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearOUT();
-
+
return true;
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.h b/LUFA/Drivers/USB/Class/Device/MIDI.h
index fbb83498b..5af6e18a2 100644
--- a/LUFA/Drivers/USB/Class/Device/MIDI.h
+++ b/LUFA/Drivers/USB/Class/Device/MIDI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -92,15 +92,15 @@
bool DataOUTEndpointDoubleBank; /**< Indicates if the MIDI interface's IN data endpoint should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
- */
+ */
struct
{
// No state information for this class
} State; /**< State data for the USB class interface within the device. All elements in this section
* are reset to their defaults when the interface is enumerated.
*/
- } USB_ClassInfo_MIDI_Device_t;
-
+ } USB_ClassInfo_MIDI_Device_t;
+
/* Function Prototypes: */
/** Configures the endpoints of a given MIDI interface, ready for use. This should be linked to the library
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
@@ -115,7 +115,7 @@
* \return Boolean true if the endpoints were successfully configured, false otherwise.
*/
bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Sends a MIDI event packet to the host. If no host is connected, the event packet is discarded. Events are queued into the
* endpoint bank until either the endpoint bank is full, or \ref MIDI_Device_Flush() is called. This allows for multiple
* MIDI events to be packed into a single endpoint packet, increasing data throughput.
@@ -166,12 +166,12 @@
{
(void)MIDIInterfaceInfo;
}
-
+
/** Processes incoming control requests from the host, that are directed to the given MIDI class interface. This should be
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
*
* \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state.
- */
+ */
static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
{
@@ -182,7 +182,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.c b/LUFA/Drivers/USB/Class/Device/MassStorage.c
index cb276276c..039684437 100644
--- a/LUFA/Drivers/USB/Class/Device/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Device/MassStorage.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@ void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfac
{
if (!(Endpoint_IsSETUPReceived()))
return;
-
+
if (USB_ControlRequest.wIndex != MSInterfaceInfo->Config.InterfaceNumber)
return;
@@ -62,11 +62,11 @@ void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfac
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
{
Endpoint_ClearSETUP();
- Endpoint_Write_Byte(MSInterfaceInfo->Config.TotalLUNs - 1);
- Endpoint_ClearIN();
+ Endpoint_Write_Byte(MSInterfaceInfo->Config.TotalLUNs - 1);
+ Endpoint_ClearIN();
Endpoint_ClearStatusStage();
}
-
+
break;
}
}
@@ -100,14 +100,14 @@ bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
continue;
}
-
+
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
-
+
return true;
}
@@ -117,14 +117,14 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
return;
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
-
+
if (Endpoint_IsReadWriteAllowed())
{
if (MS_Device_ReadInCommandBlock(MSInterfaceInfo))
{
if (MSInterfaceInfo->State.CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN)
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
-
+
MSInterfaceInfo->State.CommandStatus.Status = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo) ?
MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail;
MSInterfaceInfo->State.CommandStatus.Signature = MS_CSW_SIGNATURE;
@@ -136,16 +136,16 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
Endpoint_StallTransaction();
}
-
+
MS_Device_ReturnCommandStatus(MSInterfaceInfo);
}
}
-
+
if (MSInterfaceInfo->State.IsMassStoreReset)
{
Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataINEndpointNumber);
-
+
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);
Endpoint_ClearStall();
Endpoint_ResetDataToggle();
@@ -168,7 +168,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
{
return false;
}
-
+
if ((MSInterfaceInfo->State.CommandBlock.Signature != MS_CBW_SIGNATURE) ||
(MSInterfaceInfo->State.CommandBlock.LUN >= MSInterfaceInfo->Config.TotalLUNs) ||
(MSInterfaceInfo->State.CommandBlock.Flags & 0x1F) ||
@@ -178,7 +178,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
Endpoint_StallTransaction();
Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);
Endpoint_StallTransaction();
-
+
return false;
}
@@ -191,7 +191,7 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
}
Endpoint_ClearOUT();
-
+
return true;
}
@@ -216,11 +216,11 @@ static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInt
#if !defined(INTERRUPT_CONTROL_ENDPOINT)
USB_USBTask();
#endif
-
+
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}
-
+
CallbackIsResetSource = &MSInterfaceInfo->State.IsMassStoreReset;
if (Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus, sizeof(MS_CommandStatusWrapper_t),
StreamCallback_MS_Device_AbortOnMassStoreReset))
@@ -244,3 +244,4 @@ static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void)
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Device/MassStorage.h b/LUFA/Drivers/USB/Class/Device/MassStorage.h
index 39a806eee..8201a3ce9 100644
--- a/LUFA/Drivers/USB/Class/Device/MassStorage.h
+++ b/LUFA/Drivers/USB/Class/Device/MassStorage.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,7 +56,7 @@
/* Includes: */
#include "../../USB.h"
#include "../Common/MassStorage.h"
-
+
#include <string.h>
/* Enable C linkage for C++ Compilers: */
@@ -70,7 +70,7 @@
#endif
/* Public Interface - May be used in end-application: */
- /* Type Defines: */
+ /* Type Defines: */
/** \brief Mass Storage Class Device Mode Configuration and State Structure.
*
* Class state structure. An instance of this structure should be made for each Mass Storage interface
@@ -125,12 +125,12 @@
* \return Boolean true if the endpoints were successfully configured, false otherwise.
*/
bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Processes incoming control requests from the host, that are directed to the given Mass Storage class interface. This should be
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
*
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state.
- */
+ */
void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should
@@ -139,7 +139,7 @@
* \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage configuration and state.
*/
void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Mass Storage class driver callback for the user processing of a received SCSI command. This callback will fire each time the
* host sends a SCSI command which requires processing by the user application. Inside this callback the user is responsible
* for the processing of the received SCSI command from the host. The SCSI command is available in the CommandBlock structure
@@ -150,7 +150,7 @@
* \return Boolean true if the SCSI command was successfully processed, false otherwise.
*/
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
@@ -159,14 +159,15 @@
static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void);
#endif
-
+
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.c b/LUFA/Drivers/USB/Class/Device/RNDIS.c
index 41e6b265d..7b6719da6 100644
--- a/LUFA/Drivers/USB/Class/Device/RNDIS.c
+++ b/LUFA/Drivers/USB/Class/Device/RNDIS.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -71,7 +71,7 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI
{
if (!(Endpoint_IsSETUPReceived()))
return;
-
+
if (USB_ControlRequest.wIndex != RNDISInterfaceInfo->Config.ControlInterfaceNumber)
return;
@@ -86,7 +86,7 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI
RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo);
}
-
+
break;
case RNDIS_REQ_GetEncapsulatedResponse:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -100,12 +100,12 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI
}
Endpoint_ClearSETUP();
- Endpoint_Write_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, MessageHeader->MessageLength);
+ Endpoint_Write_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, MessageHeader->MessageLength);
Endpoint_ClearOUT();
MessageHeader->MessageLength = 0;
}
-
+
break;
}
}
@@ -146,14 +146,14 @@ bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISIn
{
continue;
}
-
+
if (!(Endpoint_ConfigureEndpoint(EndpointNum, Type, Direction, Size,
DoubleBanked ? ENDPOINT_BANK_DOUBLE : ENDPOINT_BANK_SINGLE)))
{
return false;
}
}
-
+
return true;
}
@@ -176,14 +176,14 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
.wIndex = 0,
.wLength = 0,
};
-
+
Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK);
Endpoint_ClearIN();
RNDISInterfaceInfo->State.ResponseReady = false;
}
-
+
if ((RNDISInterfaceInfo->State.CurrRNDISState == RNDIS_Data_Initialized) && !(MessageHeader->MessageLength))
{
RNDIS_Packet_Message_t RNDISPacketHeader;
@@ -199,18 +199,18 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
Endpoint_StallTransaction();
return;
}
-
+
Endpoint_Read_Stream_LE(RNDISInterfaceInfo->State.FrameIN.FrameData, RNDISPacketHeader.DataLength, NO_STREAM_CALLBACK);
Endpoint_ClearOUT();
-
+
RNDISInterfaceInfo->State.FrameIN.FrameLength = RNDISPacketHeader.DataLength;
RNDISInterfaceInfo->State.FrameIN.FrameInBuffer = true;
}
-
+
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataINEndpointNumber);
-
+
if (Endpoint_IsINReady() && RNDISInterfaceInfo->State.FrameOUT.FrameInBuffer)
{
memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t));
@@ -223,11 +223,11 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_LE(RNDISInterfaceInfo->State.FrameOUT.FrameData, RNDISPacketHeader.DataLength, NO_STREAM_CALLBACK);
Endpoint_ClearIN();
-
+
RNDISInterfaceInfo->State.FrameOUT.FrameInBuffer = false;
}
}
-}
+}
void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
{
@@ -240,19 +240,19 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
{
case REMOTE_NDIS_INITIALIZE_MSG:
RNDISInterfaceInfo->State.ResponseReady = true;
-
+
RNDIS_Initialize_Message_t* INITIALIZE_Message =
(RNDIS_Initialize_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
RNDIS_Initialize_Complete_t* INITIALIZE_Response =
(RNDIS_Initialize_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
-
+
INITIALIZE_Response->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT;
INITIALIZE_Response->MessageLength = sizeof(RNDIS_Initialize_Complete_t);
INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId;
INITIALIZE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
-
+
INITIALIZE_Response->MajorVersion = REMOTE_NDIS_VERSION_MAJOR;
- INITIALIZE_Response->MinorVersion = REMOTE_NDIS_VERSION_MINOR;
+ INITIALIZE_Response->MinorVersion = REMOTE_NDIS_VERSION_MINOR;
INITIALIZE_Response->DeviceFlags = REMOTE_NDIS_DF_CONNECTIONLESS;
INITIALIZE_Response->Medium = REMOTE_NDIS_MEDIUM_802_3;
INITIALIZE_Response->MaxPacketsPerTransfer = 1;
@@ -260,9 +260,9 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
INITIALIZE_Response->PacketAlignmentFactor = 0;
INITIALIZE_Response->AFListOffset = 0;
INITIALIZE_Response->AFListSize = 0;
-
+
RNDISInterfaceInfo->State.CurrRNDISState = RNDIS_Initialized;
-
+
break;
case REMOTE_NDIS_HALT_MSG:
RNDISInterfaceInfo->State.ResponseReady = false;
@@ -273,40 +273,40 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
break;
case REMOTE_NDIS_QUERY_MSG:
RNDISInterfaceInfo->State.ResponseReady = true;
-
+
RNDIS_Query_Message_t* QUERY_Message = (RNDIS_Query_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
RNDIS_Query_Complete_t* QUERY_Response = (RNDIS_Query_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
uint32_t Query_Oid = QUERY_Message->Oid;
-
+
void* QueryData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
QUERY_Message->InformationBufferOffset];
- void* ResponseData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)];
+ void* ResponseData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)];
uint16_t ResponseSize;
QUERY_Response->MessageType = REMOTE_NDIS_QUERY_CMPLT;
QUERY_Response->MessageLength = sizeof(RNDIS_Query_Complete_t);
-
+
if (RNDIS_Device_ProcessNDISQuery(RNDISInterfaceInfo, Query_Oid, QueryData, QUERY_Message->InformationBufferLength,
ResponseData, &ResponseSize))
{
QUERY_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
QUERY_Response->MessageLength += ResponseSize;
-
+
QUERY_Response->InformationBufferLength = ResponseSize;
QUERY_Response->InformationBufferOffset = (sizeof(RNDIS_Query_Complete_t) - sizeof(RNDIS_Message_Header_t));
}
else
- {
+ {
QUERY_Response->Status = REMOTE_NDIS_STATUS_NOT_SUPPORTED;
QUERY_Response->InformationBufferLength = 0;
QUERY_Response->InformationBufferOffset = 0;
}
-
+
break;
case REMOTE_NDIS_SET_MSG:
RNDISInterfaceInfo->State.ResponseReady = true;
-
+
RNDIS_Set_Message_t* SET_Message = (RNDIS_Set_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
RNDIS_Set_Complete_t* SET_Response = (RNDIS_Set_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
uint32_t SET_Oid = SET_Message->Oid;
@@ -317,14 +317,14 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
void* SetData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) +
SET_Message->InformationBufferOffset];
-
+
SET_Response->Status = RNDIS_Device_ProcessNDISSet(RNDISInterfaceInfo, SET_Oid, SetData,
SET_Message->InformationBufferLength) ?
REMOTE_NDIS_STATUS_SUCCESS : REMOTE_NDIS_STATUS_NOT_SUPPORTED;
break;
case REMOTE_NDIS_RESET_MSG:
RNDISInterfaceInfo->State.ResponseReady = true;
-
+
RNDIS_Reset_Complete_t* RESET_Response = (RNDIS_Reset_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
RESET_Response->MessageType = REMOTE_NDIS_RESET_CMPLT;
@@ -335,7 +335,7 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
break;
case REMOTE_NDIS_KEEPALIVE_MSG:
RNDISInterfaceInfo->State.ResponseReady = true;
-
+
RNDIS_KeepAlive_Message_t* KEEPALIVE_Message =
(RNDIS_KeepAlive_Message_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
RNDIS_KeepAlive_Complete_t* KEEPALIVE_Response =
@@ -345,7 +345,7 @@ void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const
KEEPALIVE_Response->MessageLength = sizeof(RNDIS_KeepAlive_Complete_t);
KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId;
KEEPALIVE_Response->Status = REMOTE_NDIS_STATUS_SUCCESS;
-
+
break;
}
}
@@ -364,60 +364,60 @@ static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RN
{
case OID_GEN_SUPPORTED_LIST:
*ResponseSize = sizeof(AdapterSupportedOIDList);
-
+
memcpy_P(ResponseData, AdapterSupportedOIDList, sizeof(AdapterSupportedOIDList));
-
+
return true;
case OID_GEN_PHYSICAL_MEDIUM:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate that the device is a true ethernet link */
*((uint32_t*)ResponseData) = 0;
-
+
return true;
case OID_GEN_HARDWARE_STATUS:
*ResponseSize = sizeof(uint32_t);
-
+
*((uint32_t*)ResponseData) = NDIS_HardwareStatus_Ready;
-
+
return true;
case OID_GEN_MEDIA_SUPPORTED:
case OID_GEN_MEDIA_IN_USE:
*ResponseSize = sizeof(uint32_t);
-
+
*((uint32_t*)ResponseData) = REMOTE_NDIS_MEDIUM_802_3;
-
+
return true;
case OID_GEN_VENDOR_ID:
*ResponseSize = sizeof(uint32_t);
-
+
/* Vendor ID 0x0xFFFFFF is reserved for vendors who have not purchased a NDIS VID */
*((uint32_t*)ResponseData) = 0x00FFFFFF;
-
+
return true;
case OID_GEN_MAXIMUM_FRAME_SIZE:
case OID_GEN_TRANSMIT_BLOCK_SIZE:
case OID_GEN_RECEIVE_BLOCK_SIZE:
*ResponseSize = sizeof(uint32_t);
-
+
*((uint32_t*)ResponseData) = ETHERNET_FRAME_SIZE_MAX;
-
+
return true;
case OID_GEN_VENDOR_DESCRIPTION:
*ResponseSize = (strlen(RNDISInterfaceInfo->Config.AdapterVendorDescription) + 1);
-
+
memcpy(ResponseData, RNDISInterfaceInfo->Config.AdapterVendorDescription, *ResponseSize);
-
+
return true;
case OID_GEN_MEDIA_CONNECT_STATUS:
*ResponseSize = sizeof(uint32_t);
-
+
*((uint32_t*)ResponseData) = REMOTE_NDIS_MEDIA_STATE_CONNECTED;
-
+
return true;
case OID_GEN_LINK_SPEED:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate 10Mb/s link speed */
*((uint32_t*)ResponseData) = 100000;
@@ -425,23 +425,23 @@ static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RN
case OID_802_3_PERMANENT_ADDRESS:
case OID_802_3_CURRENT_ADDRESS:
*ResponseSize = sizeof(MAC_Address_t);
-
+
memcpy(ResponseData, &RNDISInterfaceInfo->Config.AdapterMACAddress, sizeof(MAC_Address_t));
return true;
case OID_802_3_MAXIMUM_LIST_SIZE:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate only one multicast address supported */
*((uint32_t*)ResponseData) = 1;
-
+
return true;
case OID_GEN_CURRENT_PACKET_FILTER:
*ResponseSize = sizeof(uint32_t);
-
+
*((uint32_t*)ResponseData) = RNDISInterfaceInfo->State.CurrPacketFilter;
-
- return true;
+
+ return true;
case OID_GEN_XMIT_OK:
case OID_GEN_RCV_OK:
case OID_GEN_XMIT_ERROR:
@@ -451,17 +451,17 @@ static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RN
case OID_802_3_XMIT_ONE_COLLISION:
case OID_802_3_XMIT_MORE_COLLISIONS:
*ResponseSize = sizeof(uint32_t);
-
+
/* Unused statistic OIDs - always return 0 for each */
*((uint32_t*)ResponseData) = 0;
-
+
return true;
case OID_GEN_MAXIMUM_TOTAL_SIZE:
*ResponseSize = sizeof(uint32_t);
-
+
/* Indicate maximum overall buffer (Ethernet frame and RNDIS header) the adapter can handle */
*((uint32_t*)ResponseData) = (RNDIS_MESSAGE_BUFFER_SIZE + ETHERNET_FRAME_SIZE_MAX);
-
+
return true;
default:
return false;
@@ -481,11 +481,11 @@ static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_Device_t* const RNDI
RNDISInterfaceInfo->State.CurrPacketFilter = *((uint32_t*)SetData);
RNDISInterfaceInfo->State.CurrRNDISState = ((RNDISInterfaceInfo->State.CurrPacketFilter) ?
RNDIS_Data_Initialized : RNDIS_Data_Initialized);
-
+
return true;
case OID_802_3_MULTICAST_LIST:
/* Do nothing - throw away the value from the host as it is unused */
-
+
return true;
default:
return false;
@@ -493,3 +493,4 @@ static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_Device_t* const RNDI
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.h b/LUFA/Drivers/USB/Class/Device/RNDIS.h
index ba958b4c2..5aebcc63a 100644
--- a/LUFA/Drivers/USB/Class/Device/RNDIS.h
+++ b/LUFA/Drivers/USB/Class/Device/RNDIS.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,9 +56,9 @@
/* Includes: */
#include "../../USB.h"
#include "../Common/RNDIS.h"
-
+
#include <string.h>
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -68,9 +68,9 @@
#if !defined(__INCLUDE_FROM_RNDIS_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/RNDIS.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
- /* Type Defines: */
+ /* Type Defines: */
/** \brief RNDIS Class Device Mode Configuration and State Structure.
*
* Class state structure. An instance of this structure should be made for each RNDIS interface
@@ -94,7 +94,7 @@
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used. */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used. */
bool NotificationEndpointDoubleBank; /**< Indicates if the RNDIS interface's notification endpoint should use double banking. */
-
+
char* AdapterVendorDescription; /**< String description of the adapter vendor. */
MAC_Address_t AdapterMACAddress; /**< MAC address of the adapter. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section.
@@ -118,7 +118,7 @@
* are reset to their defaults when the interface is enumerated.
*/
} USB_ClassInfo_RNDIS_Device_t;
-
+
/* Function Prototypes: */
/** Configures the endpoints of a given RNDIS interface, ready for use. This should be linked to the library
* \ref EVENT_USB_Device_ConfigurationChanged() event so that the endpoints are configured when the configuration
@@ -138,23 +138,23 @@
* linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
*
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state.
- */
+ */
void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** General management task for a given HID class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
*
* \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state.
*/
void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_RNDIS_CLASS_DEVICE_C)
static void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
ATTR_NON_NULL_PTR_ARG(1);
- static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
+ static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
const uint32_t OId,
void* const QueryData,
const uint16_t QuerySize,
@@ -167,14 +167,15 @@
const uint16_t SetSize) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(3);
#endif
-
+
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/HID.h b/LUFA/Drivers/USB/Class/HID.h
index 6def55d59..3fb74f379 100644
--- a/LUFA/Drivers/USB/Class/HID.h
+++ b/LUFA/Drivers/USB/Class/HID.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -47,8 +47,8 @@
* - LUFA/Drivers/USB/Class/Host/HIDParser.c <i>(Makefile source module name: LUFA_SRC_USB)</i>
*
* \section Module Description
- * HID Class Driver module. This module contains an internal implementation of the USB HID Class, for both Device
- * and Host USB modes. User applications can use this class driver instead of implementing the HID class manually
+ * HID Class Driver module. This module contains an internal implementation of the USB HID Class, for both Device
+ * and Host USB modes. User applications can use this class driver instead of implementing the HID class manually
* via the low-level LUFA APIs.
*
* This module is designed to simplify the user code by exposing only the required interface needed to interface with
@@ -56,14 +56,14 @@
*
* @{
*/
-
+
#ifndef _HID_CLASS_H_
#define _HID_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_HID_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
-
+
/* Includes: */
#include "../HighLevel/USBMode.h"
@@ -74,11 +74,12 @@
#if defined(USB_CAN_BE_DEVICE)
#include "Device/HID.h"
#endif
-
+
#if defined(USB_CAN_BE_HOST)
#include "Host/HID.h"
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c
index 0f81d0ea4..57ca35cdc 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.c
+++ b/LUFA/Drivers/USB/Class/Host/CDC.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -62,7 +62,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
DCOMP_CDC_Host_NextCDCDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
return CDC_ENUMERROR_NoCompatibleInterfaceFound;
- }
+ }
DataINEndpoint = NULL;
DataOUTEndpoint = NULL;
@@ -79,10 +79,10 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
NotificationEndpoint = NULL;
}
-
+
continue;
}
-
+
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
@@ -97,7 +97,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
DataOUTEndpoint = EndpointData;
}
}
-
+
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
if (PipeNum == CDCInterfaceInfo->Config.DataINPipeNumber)
@@ -141,7 +141,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescrip
{
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
USB_Descriptor_Interface_t);
-
+
if ((CurrentInterface->Class == CDC_CONTROL_CLASS) &&
(CurrentInterface->SubClass == CDC_CONTROL_SUBCLASS) &&
(CurrentInterface->Protocol == CDC_CONTROL_PROTOCOL))
@@ -149,7 +149,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescrip
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -159,7 +159,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor
{
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
USB_Descriptor_Interface_t);
-
+
if ((CurrentInterface->Class == CDC_DATA_CLASS) &&
(CurrentInterface->SubClass == CDC_DATA_SUBCLASS) &&
(CurrentInterface->Protocol == CDC_DATA_PROTOCOL))
@@ -167,7 +167,7 @@ static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -177,9 +177,9 @@ static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescri
{
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t);
-
+
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
-
+
if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
{
@@ -198,7 +198,7 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
{
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return;
-
+
Pipe_SelectPipe(CDCInterfaceInfo->Config.NotificationPipeNumber);
Pipe_Unfreeze();
@@ -206,14 +206,14 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
{
USB_Request_Header_t Notification;
Pipe_Read_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NO_STREAM_CALLBACK);
-
+
if ((Notification.bRequest == CDC_NOTIF_SerialState) &&
(Notification.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)))
{
Pipe_Read_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost,
sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost),
NO_STREAM_CALLBACK);
-
+
Pipe_ClearIN();
EVENT_CDC_Host_ControLineStateChanged(CDCInterfaceInfo);
@@ -223,7 +223,7 @@ void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
Pipe_ClearIN();
}
}
-
+
Pipe_Freeze();
CDC_Host_Flush(CDCInterfaceInfo);
@@ -241,7 +241,7 @@ uint8_t CDC_Host_SetLineEncoding(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInf
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
return USB_Host_SendControlRequest(&CDCInterfaceInfo->State.LineEncoding);
}
@@ -257,7 +257,7 @@ uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCI
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
return USB_Host_SendControlRequest(NULL);
}
@@ -274,7 +274,7 @@ uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
return USB_Host_SendControlRequest(NULL);
}
@@ -287,12 +287,12 @@ uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
uint8_t ErrorCode;
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
ErrorCode = Pipe_Write_Stream_LE(Data, Length, NO_STREAM_CALLBACK);
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -301,12 +301,12 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
{
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return PIPE_READYWAIT_DeviceDisconnected;
-
+
uint8_t ErrorCode;
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
-
+
if (!(Pipe_IsReadWriteAllowed()))
{
Pipe_ClearOUT();
@@ -315,9 +315,9 @@ uint8_t CDC_Host_SendByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
return ErrorCode;
}
- Pipe_Write_Byte(Data);
+ Pipe_Write_Byte(Data);
Pipe_Freeze();
-
+
return PIPE_READYWAIT_NoError;
}
@@ -325,7 +325,7 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
{
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return 0;
-
+
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
@@ -346,7 +346,7 @@ uint16_t CDC_Host_BytesReceived(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
else
{
Pipe_Freeze();
-
+
return 0;
}
}
@@ -355,7 +355,7 @@ int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
{
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return -1;
-
+
int16_t ReceivedByte = -1;
Pipe_SelectPipe(CDCInterfaceInfo->Config.DataINPipeNumber);
@@ -369,7 +369,7 @@ int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
if (!(Pipe_BytesInPipe()))
Pipe_ClearIN();
}
-
+
Pipe_Freeze();
return ReceivedByte;
@@ -379,12 +379,12 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
{
if ((USB_HostState != HOST_STATE_Configured) || !(CDCInterfaceInfo->State.IsActive))
return PIPE_READYWAIT_DeviceDisconnected;
-
+
uint8_t ErrorCode;
- Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
+ Pipe_SelectPipe(CDCInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
-
+
if (!(Pipe_BytesInPipe()))
return PIPE_READYWAIT_NoError;
@@ -401,7 +401,7 @@ uint8_t CDC_Host_Flush(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo)
}
Pipe_Freeze();
-
+
return PIPE_READYWAIT_NoError;
}
@@ -438,7 +438,7 @@ static int CDC_Host_getchar(FILE* Stream)
static int CDC_Host_getchar_Blocking(FILE* Stream)
{
int16_t ReceivedByte;
-
+
while ((ReceivedByte = CDC_Host_ReceiveByte((USB_ClassInfo_CDC_Host_t*)fdev_get_udata(Stream))) < 0)
{
if (USB_HostState == HOST_STATE_Unattached)
@@ -457,3 +457,4 @@ void CDC_Host_Event_Stub(void)
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h
index e80d01423..8a4b576ca 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.h
+++ b/LUFA/Drivers/USB/Class/Host/CDC.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -59,7 +59,7 @@
#include <stdio.h>
#include <string.h>
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -88,7 +88,7 @@
uint8_t DataOUTPipeNumber; /**< Pipe number of the CDC interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the CDC interface's OUT data pipe should use double banking. */
- uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used. */
+ uint8_t NotificationPipeNumber; /**< Pipe number of the CDC interface's IN notification endpoint, if used. */
bool NotificationPipeDoubleBank; /**< Indicates if the CDC interface's notification pipe should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
@@ -100,11 +100,11 @@
* Configured state.
*/
uint8_t ControlInterfaceNumber; /**< Interface index of the CDC-ACM control interface within the attached device. */
-
+
uint16_t DataINPipeSize; /**< Size in bytes of the CDC interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the CDC interface's OUT data pipe. */
uint16_t NotificationPipeSize; /**< Size in bytes of the CDC interface's IN notification pipe, if used. */
-
+
struct
{
uint8_t HostToDevice; /**< Control line states from the host to device, as a set of CDC_CONTROL_LINE_OUT_*
@@ -115,7 +115,7 @@
* masks. This value is updated each time \ref CDC_Host_USBTask() is called.
*/
} ControlLineStates; /**< Current states of the virtual serial port's control lines between the device and host. */
-
+
struct
{
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second. */
@@ -136,7 +136,7 @@
* the interface is enumerated.
*/
} USB_ClassInfo_CDC_Host_t;
-
+
/* Enums: */
/** Enum for the possible error codes returned by the \ref CDC_Host_ConfigurePipes() function. */
enum CDC_Host_EnumerationFailure_ErrorCodes_t
@@ -145,7 +145,7 @@
CDC_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
CDC_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible CDC interface was not found in the device's Configuration Descriptor. */
};
-
+
/* Function Prototypes: */
/** General management task for a given CDC host class interface, required for the correct operation of the interface. This should
* be called frequently in the main program loop, before the master USB management task \ref USB_USBTask().
@@ -153,7 +153,7 @@
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing an CDC Class host configuration and state.
*/
void CDC_Host_USBTask(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Host interface configuration routine, to configure a given CDC host interface instance using the Configuration
* Descriptor read from an attached USB device. This function automatically updates the given CDC Host instance's
* state values and configures the pipes required to communicate with the interface if it is found within the device.
@@ -173,7 +173,7 @@
uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
-
+
/** Sets the line encoding for the attached device's virtual serial port. This should be called when the LineEncoding
* values of the interface have been changed to push the new settings to the USB device.
*
@@ -193,7 +193,7 @@
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/
uint8_t CDC_Host_SendControlLineStateChange(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Sends a Send Break request to the device. This is generally used to separate data data or to indicate a special condition
* to the receiving device.
*
@@ -204,10 +204,10 @@
*/
uint8_t CDC_Host_SendBreak(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
const uint8_t Duration) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Sends a given string to the attached USB device, if connected. If a device is not connected when the function is called, the
* string is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the
- * \ref CDC_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
+ * \ref CDC_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
* packed into a single pipe packet, increasing data throughput.
*
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
@@ -222,10 +222,10 @@
uint8_t CDC_Host_SendString(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo,
const char* const Data,
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
-
+
/** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the
* byte is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the
- * \ref CDC_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
+ * \ref CDC_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
* packed into a single pipe packet, increasing data throughput.
*
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
@@ -265,7 +265,7 @@
* \return Next received byte from the device, or a negative value if no data received.
*/
int16_t CDC_Host_ReceiveByte(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
*
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
@@ -335,7 +335,7 @@
static uint8_t DCOMP_CDC_Host_NextCDCInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
#endif
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
@@ -344,3 +344,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c
index ce1ceb1ca..e5afca06c 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.c
+++ b/LUFA/Drivers/USB/Class/Host/HID.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -44,9 +44,9 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
-
+
memset(&HIDInterfaceInfo->State, 0x00, sizeof(HIDInterfaceInfo->State));
-
+
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return HID_ENUMERROR_InvalidConfigDescriptor;
@@ -58,7 +58,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
{
if (DataINEndpoint || DataOUTEndpoint)
break;
-
+
do
{
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
@@ -66,11 +66,11 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
{
return HID_ENUMERROR_NoCompatibleInterfaceFound;
}
-
+
HIDInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
} while (HIDInterfaceInfo->Config.HIDInterfaceProtocol &&
(HIDInterface->Protocol != HIDInterfaceInfo->Config.HIDInterfaceProtocol));
-
+
if (USB_GetNextDescriptorComp(&ConfigDescriptorSize, &ConfigDescriptorData,
DCOMP_HID_Host_NextHID) != DESCRIPTOR_SEARCH_COMP_Found)
{
@@ -84,15 +84,15 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
continue;
}
-
+
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
DataINEndpoint = EndpointData;
else
- DataOUTEndpoint = EndpointData;
+ DataOUTEndpoint = EndpointData;
}
-
+
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
if (PipeNum == HIDInterfaceInfo->Config.DataINPipeNumber)
@@ -101,7 +101,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
HIDInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
-
+
HIDInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == HIDInterfaceInfo->Config.DataOUTPipeNumber)
@@ -115,13 +115,13 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
HIDInterfaceInfo->State.DeviceUsesOUTPipe = true;
}
}
-
+
HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber;
HIDInterfaceInfo->State.HIDReportSize = HIDDescriptor->HIDReportLength;
HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_BOOTP_NonBootProtocol);
HIDInterfaceInfo->State.LargestReportSize = 8;
HIDInterfaceInfo->State.IsActive = true;
-
+
return HID_ENUMERROR_NoError;
}
@@ -131,11 +131,11 @@ static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor)
{
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
USB_Descriptor_Interface_t);
-
+
if (CurrentInterface->Class == HID_INTERFACE_CLASS)
return DESCRIPTOR_SEARCH_Found;
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -154,7 +154,7 @@ static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescri
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
{
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
- USB_Descriptor_Endpoint_t);
+ USB_Descriptor_Endpoint_t);
if (!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
return DESCRIPTOR_SEARCH_Found;
@@ -182,11 +182,11 @@ uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
return USB_Host_SendControlRequest(Buffer);
}
#endif
-
+
uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
void* Buffer)
{
@@ -197,7 +197,7 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
-
+
uint16_t ReportSize;
uint8_t* BufferPos = Buffer;
@@ -205,13 +205,13 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
if (!(HIDInterfaceInfo->State.UsingBootProtocol))
{
uint8_t ReportID = 0;
-
+
if (HIDInterfaceInfo->Config.HIDParserData->UsingReportIDs)
{
ReportID = Pipe_Read_Byte();
*(BufferPos++) = ReportID;
}
-
+
ReportSize = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, HID_REPORT_ITEM_In);
}
else
@@ -222,10 +222,10 @@ uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo,
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPos, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
Pipe_ClearIN();
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
@@ -244,19 +244,19 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
if (HIDInterfaceInfo->State.DeviceUsesOUTPipe && (ReportType == HID_REPORT_ITEM_Out))
{
uint8_t ErrorCode;
-
+
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
-
+
if (ReportID)
Pipe_Write_Stream_LE(&ReportID, sizeof(ReportID), NO_STREAM_CALLBACK);
-
+
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, ReportSize, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
Pipe_ClearOUT();
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
else
@@ -276,7 +276,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
return USB_Host_SendControlRequest(Buffer);
}
}
@@ -290,11 +290,11 @@ bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)
Pipe_SelectPipe(HIDInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
-
+
ReportReceived = Pipe_IsINReceived();
-
+
Pipe_Freeze();
-
+
return ReportReceived;
}
@@ -312,7 +312,7 @@ uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInf
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
if (!(HIDInterfaceInfo->State.SupportsBootProtocol))
return HID_ERROR_LOGICAL;
@@ -321,7 +321,7 @@ uint8_t HID_Host_SetBootProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInf
HIDInterfaceInfo->State.LargestReportSize = 8;
HIDInterfaceInfo->State.UsingBootProtocol = true;
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -331,7 +331,7 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
uint8_t ErrorCode;
uint8_t HIDReportData[HIDInterfaceInfo->State.HIDReportSize];
-
+
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
@@ -345,7 +345,7 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
if ((ErrorCode = USB_Host_SendControlRequest(HIDReportData)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
-
+
if (HIDInterfaceInfo->State.UsingBootProtocol)
{
USB_ControlRequest = (USB_Request_Header_t)
@@ -362,10 +362,10 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
HIDInterfaceInfo->State.UsingBootProtocol = false;
}
-
+
if (HIDInterfaceInfo->Config.HIDParserData == NULL)
return HID_ERROR_LOGICAL;
-
+
if ((ErrorCode = USB_ProcessHIDReport(HIDReportData, HIDInterfaceInfo->State.HIDReportSize,
HIDInterfaceInfo->Config.HIDParserData)) != HID_PARSE_Successful)
{
@@ -380,3 +380,4 @@ uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
#endif
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h
index eca94fbd8..0ef3674d8 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.h
+++ b/LUFA/Drivers/USB/Class/Host/HID.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -58,7 +58,7 @@
#include "../../USB.h"
#include "../Common/HID.h"
#include "HIDParser.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -73,7 +73,7 @@
/* Macros: */
/** Error code for some HID Host functions, indicating a logical (and not hardware) error. */
#define HID_ERROR_LOGICAL 0x80
-
+
/* Type Defines: */
/** \brief HID Class Host Mode Configuration and State Structure.
*
@@ -116,7 +116,7 @@
uint16_t DataINPipeSize; /**< Size in bytes of the HID interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the HID interface's OUT data pipe. */
-
+
bool SupportsBootProtocol; /**< Indicates if the current interface instance supports the HID Boot
* Protocol when enabled via \ref HID_Host_SetBootProtocol().
*/
@@ -125,7 +125,7 @@
*/
bool UsingBootProtocol; /**< Indicates that the interface is currently initialized in Boot Protocol mode */
uint16_t HIDReportSize; /**< Size in bytes of the HID report descriptor in the device. */
-
+
uint8_t LargestReportSize; /**< Largest report the device will send, in bytes. */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
@@ -141,7 +141,7 @@
HID_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
HID_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible HID interface was not found in the device's Configuration Descriptor. */
};
-
+
/* Function Prototypes: */
/** Host interface configuration routine, to configure a given HID host interface instance using the Configuration
* Descriptor read from an attached USB device. This function automatically updates the given HID Host instance's
@@ -169,7 +169,7 @@
/** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe.
- *
+ *
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
* call will fail.
*
@@ -202,7 +202,7 @@
const uint8_t ReportID,
void* Buffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
#endif
-
+
/** Sends an OUT or FEATURE report to the currently attached HID device, using the device's OUT pipe if available,
* or the device's Control pipe if not.
*
@@ -244,7 +244,7 @@
* \return Boolean true if a report has been received, false otherwise.
*/
bool HID_Host_IsReportReceived(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Switches the attached HID device's reporting protocol over to the Boot Report protocol mode, on supported devices.
*
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method must still be called
@@ -276,7 +276,7 @@
*/
uint8_t HID_Host_SetReportProtocol(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
#endif
-
+
/* Inline Functions: */
/** General management task for a given Human Interface Class host class interface, required for the correct operation of
* the interface. This should be called frequently in the main program loop, before the master USB management task
@@ -288,7 +288,7 @@
static inline void HID_Host_USBTask(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo)
{
(void)HIDInterfaceInfo;
- }
+ }
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
@@ -300,9 +300,9 @@
static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_HID_Host_NextHID(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_HID_Host_NextHIDInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
- #endif
- #endif
-
+ #endif
+ #endif
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
@@ -311,3 +311,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Host/HIDParser.c b/LUFA/Drivers/USB/Class/Host/HIDParser.c
index c5d5f948a..43f703a93 100644
--- a/LUFA/Drivers/USB/Class/Host/HIDParser.c
+++ b/LUFA/Drivers/USB/Class/Host/HIDParser.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -41,7 +41,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
HID_StateTable_t StateTable[HID_STATETABLE_STACK_DEPTH];
HID_StateTable_t* CurrStateTable = &StateTable[0];
HID_CollectionPath_t* CurrCollectionPath = NULL;
- HID_ReportSizeInfo_t* CurrReportIDInfo = &ParserData->ReportIDSizes[0];
+ HID_ReportSizeInfo_t* CurrReportIDInfo = &ParserData->ReportIDSizes[0];
uint16_t UsageList[HID_USAGE_STACK_DEPTH];
uint8_t UsageListSize = 0;
HID_MinMax_t UsageMinMax = {0, 0};
@@ -50,16 +50,16 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
memset(CurrStateTable, 0x00, sizeof(HID_StateTable_t));
memset(CurrReportIDInfo, 0x00, sizeof(HID_ReportSizeInfo_t));
- ParserData->TotalDeviceReports = 1;
+ ParserData->TotalDeviceReports = 1;
while (ReportSize)
{
uint8_t HIDReportItem = *ReportData;
uint32_t ReportItemData = 0;
-
+
ReportData++;
ReportSize--;
-
+
switch (HIDReportItem & DATA_SIZE_MASK)
{
case DATA_SIZE_4:
@@ -84,7 +84,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
case (TYPE_GLOBAL | TAG_GLOBAL_PUSH):
if (CurrStateTable == &StateTable[HID_STATETABLE_STACK_DEPTH - 1])
return HID_PARSE_HIDStackOverflow;
-
+
memcpy((CurrStateTable + 1),
CurrStateTable,
sizeof(HID_ReportItem_t));
@@ -94,7 +94,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
case (TYPE_GLOBAL | TAG_GLOBAL_POP):
if (CurrStateTable == &StateTable[0])
return HID_PARSE_HIDStackUnderflow;
-
+
CurrStateTable--;
break;
case (TYPE_GLOBAL | TAG_GLOBAL_USAGEPAGE):
@@ -139,25 +139,25 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
break;
}
}
-
+
if (CurrReportIDInfo == NULL)
{
if (ParserData->TotalDeviceReports == HID_MAX_REPORT_IDS)
return HID_PARSE_InsufficientReportIDItems;
-
+
CurrReportIDInfo = &ParserData->ReportIDSizes[ParserData->TotalDeviceReports++];
memset(CurrReportIDInfo, 0x00, sizeof(HID_ReportSizeInfo_t));
}
}
-
+
ParserData->UsingReportIDs = true;
-
+
CurrReportIDInfo->ReportID = CurrStateTable->ReportID;
break;
case (TYPE_LOCAL | TAG_LOCAL_USAGE):
if (UsageListSize == HID_USAGE_STACK_DEPTH)
return HID_PARSE_UsageListOverflow;
-
+
UsageList[UsageListSize++] = ReportItemData;
break;
case (TYPE_LOCAL | TAG_LOCAL_USAGEMIN):
@@ -174,42 +174,42 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
else
{
HID_CollectionPath_t* ParentCollectionPath = CurrCollectionPath;
-
+
CurrCollectionPath = &ParserData->CollectionPaths[1];
-
+
while (CurrCollectionPath->Parent != NULL)
{
if (CurrCollectionPath == &ParserData->CollectionPaths[HID_MAX_COLLECTIONS - 1])
return HID_PARSE_InsufficientCollectionPaths;
-
+
CurrCollectionPath++;
}
-
+
CurrCollectionPath->Parent = ParentCollectionPath;
}
-
+
CurrCollectionPath->Type = ReportItemData;
CurrCollectionPath->Usage.Page = CurrStateTable->Attributes.Usage.Page;
-
+
if (UsageListSize)
{
CurrCollectionPath->Usage.Usage = UsageList[0];
for (uint8_t i = 0; i < UsageListSize; i++)
UsageList[i] = UsageList[i + 1];
-
+
UsageListSize--;
}
else if (UsageMinMax.Minimum <= UsageMinMax.Maximum)
{
CurrCollectionPath->Usage.Usage = UsageMinMax.Minimum++;
}
-
+
break;
case (TYPE_MAIN | TAG_MAIN_ENDCOLLECTION):
if (CurrCollectionPath == NULL)
return HID_PARSE_UnexpectedEndCollection;
-
+
CurrCollectionPath = CurrCollectionPath->Parent;
break;
case (TYPE_MAIN | TAG_MAIN_INPUT):
@@ -218,60 +218,60 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
for (uint8_t ReportItemNum = 0; ReportItemNum < CurrStateTable->ReportCount; ReportItemNum++)
{
HID_ReportItem_t NewReportItem;
-
+
memcpy(&NewReportItem.Attributes,
&CurrStateTable->Attributes,
sizeof(HID_ReportItem_Attributes_t));
-
+
NewReportItem.ItemFlags = ReportItemData;
NewReportItem.CollectionPath = CurrCollectionPath;
NewReportItem.ReportID = CurrStateTable->ReportID;
-
+
if (UsageListSize)
{
NewReportItem.Attributes.Usage.Usage = UsageList[0];
-
+
for (uint8_t i = 0; i < UsageListSize; i++)
UsageList[i] = UsageList[i + 1];
-
+
UsageListSize--;
}
else if (UsageMinMax.Minimum <= UsageMinMax.Maximum)
{
NewReportItem.Attributes.Usage.Usage = UsageMinMax.Minimum++;
}
-
+
uint8_t ItemTag = (HIDReportItem & TAG_MASK);
-
+
if (ItemTag == TAG_MAIN_INPUT)
NewReportItem.ItemType = HID_REPORT_ITEM_In;
else if (ItemTag == TAG_MAIN_OUTPUT)
NewReportItem.ItemType = HID_REPORT_ITEM_Out;
else
NewReportItem.ItemType = HID_REPORT_ITEM_Feature;
-
+
NewReportItem.BitOffset = CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType];
-
+
CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType] += CurrStateTable->Attributes.BitSize;
-
+
if (ParserData->LargestReportSizeBits < NewReportItem.BitOffset)
ParserData->LargestReportSizeBits = NewReportItem.BitOffset;
-
+
if (!(ReportItemData & IOF_CONSTANT) && CALLBACK_HIDParser_FilterHIDReportItem(&NewReportItem))
{
if (ParserData->TotalReportItems == HID_MAX_REPORTITEMS)
return HID_PARSE_InsufficientReportItems;
-
+
memcpy(&ParserData->ReportItems[ParserData->TotalReportItems],
&NewReportItem, sizeof(HID_ReportItem_t));
-
+
ParserData->TotalReportItems++;
}
}
-
+
break;
}
-
+
if ((HIDReportItem & TYPE_MASK) == TYPE_MAIN)
{
UsageMinMax.Minimum = 0;
@@ -279,10 +279,10 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData,
UsageListSize = 0;
}
}
-
+
if (!(ParserData->TotalReportItems))
return HID_PARSE_NoUnfilteredReportItems;
-
+
return HID_PARSE_Successful;
}
@@ -292,27 +292,27 @@ bool USB_GetHIDReportItemInfo(const uint8_t* ReportData,
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
uint16_t CurrentBit = ReportItem->BitOffset;
uint32_t BitMask = (1 << 0);
-
+
if (ReportItem->ReportID)
{
if (ReportItem->ReportID != ReportData[0])
return false;
-
+
ReportData++;
}
-
+
ReportItem->PreviousValue = ReportItem->Value;
ReportItem->Value = 0;
-
+
while (DataBitsRem--)
{
if (ReportData[CurrentBit / 8] & (1 << (CurrentBit % 8)))
ReportItem->Value |= BitMask;
-
+
CurrentBit++;
BitMask <<= 1;
}
-
+
return true;
}
@@ -322,20 +322,20 @@ void USB_SetHIDReportItemInfo(uint8_t* ReportData,
uint16_t DataBitsRem = ReportItem->Attributes.BitSize;
uint16_t CurrentBit = ReportItem->BitOffset;
uint32_t BitMask = (1 << 0);
-
+
if (ReportItem->ReportID)
{
ReportData[0] = ReportItem->ReportID;
ReportData++;
}
-
+
ReportItem->PreviousValue = ReportItem->Value;
-
+
while (DataBitsRem--)
{
if (ReportItem->Value & (1 << (CurrentBit % 8)))
ReportData[CurrentBit / 8] |= BitMask;
-
+
CurrentBit++;
BitMask <<= 1;
}
@@ -348,7 +348,7 @@ uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData,
for (uint8_t i = 0; i < HID_MAX_REPORT_IDS; i++)
{
uint16_t ReportSizeBits = ParserData->ReportIDSizes[i].ReportSizeBits[ReportType];
-
+
if (ParserData->ReportIDSizes[i].ReportID == ReportID)
return ((ReportSizeBits >> 3) + ((ReportSizeBits & 0x07) ? 1 : 0));
}
@@ -357,3 +357,4 @@ uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData,
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Host/HIDParser.h b/LUFA/Drivers/USB/Class/Host/HIDParser.h
index f772fed20..ba7346968 100644
--- a/LUFA/Drivers/USB/Class/Host/HIDParser.h
+++ b/LUFA/Drivers/USB/Class/Host/HIDParser.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,7 +35,7 @@
* a HID device transmits to the host. It also provides an easy API for extracting and processing the data
* elements inside a HID report sent from an attached HID device.
*/
-
+
/** \ingroup Group_USB
* @defgroup Group_HIDParser HID Report Parser
*
@@ -86,7 +86,7 @@
*/
#define HID_STATETABLE_STACK_DEPTH 2
#endif
-
+
#if !defined(HID_USAGE_STACK_DEPTH) || defined(__DOXYGEN__)
/** Constant indicating the maximum stack depth of the usage table. A larger usage table
* allows for more USAGE items to be indicated sequentially for REPORT COUNT entries of more than
@@ -107,17 +107,17 @@
*/
#define HID_MAX_COLLECTIONS 10
#endif
-
+
#if !defined(HID_MAX_REPORTITEMS) || defined(__DOXYGEN__)
- /** Constant indicating the maximum number of report items (IN, OUT or FEATURE) that can be processed
+ /** Constant indicating the maximum number of report items (IN, OUT or FEATURE) that can be processed
* in the report item descriptor and stored in the user HID Report Info structure. A large value allows
- * for more report items to be stored, but consumes more memory. By default this is set to 20 items,
+ * for more report items to be stored, but consumes more memory. By default this is set to 20 items,
* but this can be overridden by defining HID_MAX_REPORTITEMS to another value in the user project
* makefile, and passing the define to the compiler using the -D compiler switch.
*/
#define HID_MAX_REPORTITEMS 20
#endif
-
+
#if !defined(HID_MAX_REPORT_IDS) || defined(__DOXYGEN__)
/** Constant indicating the maximum number of unique report IDs that can be processed in the report item
* descriptor for the report size information array in the user HID Report Info structure. A large value
@@ -141,12 +141,12 @@
#define HID_ALIGN_DATA(ReportItem, Type) ((Type)(ReportItem->Value << ((8 * sizeof(Type)) - ReportItem->Attributes.BitSize)))
/* Public Interface - May be used in end-application: */
- /* Enums: */
+ /* Enums: */
/** Enum for the possible error codes in the return value of the \ref USB_ProcessHIDReport() function. */
enum HID_Parse_ErrorCodes_t
{
HID_PARSE_Successful = 0, /**< Successful parse of the HID report descriptor, no error. */
- HID_PARSE_HIDStackOverflow = 1, /**< More than \ref HID_STATETABLE_STACK_DEPTH nested PUSHes in the report. */
+ HID_PARSE_HIDStackOverflow = 1, /**< More than \ref HID_STATETABLE_STACK_DEPTH nested PUSHes in the report. */
HID_PARSE_HIDStackUnderflow = 2, /**< A POP was found when the state table stack was empty. */
HID_PARSE_InsufficientReportItems = 3, /**< More than \ref HID_MAX_REPORTITEMS report items in the report. */
HID_PARSE_UnexpectedEndCollection = 4, /**< An END COLLECTION item found without matching COLLECTION item. */
@@ -155,8 +155,8 @@
HID_PARSE_InsufficientReportIDItems = 7, /**< More than \ref HID_MAX_REPORT_IDS report IDs in the device. */
HID_PARSE_NoUnfilteredReportItems = 8, /**< All report items from the device were filtered by the filtering callback routine. */
};
-
- /* Type Defines: */
+
+ /* Type Defines: */
/** \brief HID Parser Report Item Min/Max Structure.
*
* Type define for an attribute with both minimum and maximum values (e.g. Logical Min/Max).
@@ -176,7 +176,7 @@
uint32_t Type; /**< Unit type (refer to HID specifications for details). */
uint8_t Exponent; /**< Unit exponent (refer to HID specifications for details). */
} HID_Unit_t;
-
+
/** \brief HID Parser Report Item Usage Structure.
*
* Type define for the Usage attributes of a report item.
@@ -206,13 +206,13 @@
typedef struct
{
uint8_t BitSize; /**< Size in bits of the report item's data. */
-
+
HID_Usage_t Usage; /**< Usage of the report item. */
HID_Unit_t Unit; /**< Unit type and exponent of the report item. */
HID_MinMax_t Logical; /**< Logical minimum and maximum of the report item. */
HID_MinMax_t Physical; /**< Physical minimum and maximum of the report item. */
} HID_ReportItem_Attributes_t;
-
+
/** \brief HID Parser Report Item Details Structure.
*
* Type define for a report item (IN, OUT or FEATURE) layout attributes and other details.
@@ -226,13 +226,13 @@
HID_CollectionPath_t* CollectionPath; /**< Collection path of the item. */
HID_ReportItem_Attributes_t Attributes; /**< Report item attributes. */
-
+
uint32_t Value; /**< Current value of the report item - use \ref HID_ALIGN_DATA() when processing
* a retrieved value so that it is aligned to a specific type.
*/
- uint32_t PreviousValue; /**< Previous value of the report item. */
+ uint32_t PreviousValue; /**< Previous value of the report item. */
} HID_ReportItem_t;
-
+
/** \brief HID Parser Report Size Structure.
*
* Type define for a report item size information structure, to retain the size of a device's reports by ID.
@@ -267,7 +267,7 @@
* element in its HID report descriptor.
*/
} HID_ReportInfo_t;
-
+
/* Function Prototypes: */
/** Function to process a given HID report returned from an attached device, and store it into a given
* \ref HID_ReportInfo_t structure.
@@ -285,7 +285,7 @@
/** Extracts the given report item's value out of the given HID report and places it into the Value
* member of the report item's \ref HID_ReportItem_t structure.
*
- * When called on a report with an item that exists in that report, this copies the report item's Value
+ * When called on a report with an item that exists in that report, this copies the report item's Value
* to it's PreviousValue element for easy checking to see if an item's value has changed before processing
* a report. If the given item does not exist in the report, the function does not modify the report item's
* data.
@@ -348,7 +348,7 @@
uint8_t ReportID;
} HID_StateTable_t;
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
@@ -357,3 +357,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Host/HIDReportData.h b/LUFA/Drivers/USB/Class/Host/HIDReportData.h
index dca1ebb3a..848bfb5d4 100644
--- a/LUFA/Drivers/USB/Class/Host/HIDReportData.h
+++ b/LUFA/Drivers/USB/Class/Host/HIDReportData.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
*
* @{
*/
-
+
#ifndef __HIDREPORTDATA_H__
#define __HIDREPORTDATA_H__
@@ -107,11 +107,11 @@
#define DATA_SIZE_1 0x01
#define DATA_SIZE_2 0x02
#define DATA_SIZE_4 0x03
-
+
#define TYPE_MAIN 0x00
#define TYPE_GLOBAL 0x04
#define TYPE_LOCAL 0x08
-
+
#define TAG_MAIN_INPUT 0x80
#define TAG_MAIN_OUTPUT 0x90
#define TAG_MAIN_COLLECTION 0xA0
@@ -130,12 +130,13 @@
#define TAG_GLOBAL_REPORTCOUNT 0x90
#define TAG_GLOBAL_PUSH 0xA0
#define TAG_GLOBAL_POP 0xB0
-
+
#define TAG_LOCAL_USAGE 0x00
#define TAG_LOCAL_USAGEMIN 0x10
#define TAG_LOCAL_USAGEMAX 0x20
#endif
/** @} */
-
+
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.c b/LUFA/Drivers/USB/Class/Host/MIDI.c
index cf59193c2..99ae8a8ab 100644
--- a/LUFA/Drivers/USB/Class/Host/MIDI.c
+++ b/LUFA/Drivers/USB/Class/Host/MIDI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -68,7 +68,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
continue;
}
-
+
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
@@ -76,7 +76,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
else
DataOUTEndpoint = EndpointData;
}
-
+
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
if (PipeNum == MIDIInterfaceInfo->Config.DataINPipeNumber)
@@ -84,16 +84,16 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
MIDIInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
-
- MIDIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
+
+ MIDIInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == MIDIInterfaceInfo->Config.DataOUTPipeNumber)
{
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
MIDIInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
-
- MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
+
+ MIDIInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
}
@@ -117,7 +117,7 @@ static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDes
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -127,9 +127,9 @@ static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const Current
{
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t);
-
+
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
-
+
if ((EndpointType == EP_TYPE_BULK) && !(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
return DESCRIPTOR_SEARCH_Found;
}
@@ -145,7 +145,7 @@ uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo)
{
if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
return PIPE_RWSTREAM_DeviceDisconnected;
-
+
uint8_t ErrorCode;
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber);
@@ -166,7 +166,7 @@ uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
{
if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
-
+
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataOUTPipeNumber);
if (Pipe_IsReadWriteAllowed())
@@ -179,7 +179,7 @@ uint8_t MIDI_Host_SendEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
if (!(Pipe_IsReadWriteAllowed()))
Pipe_ClearOUT();
}
-
+
return PIPE_RWSTREAM_NoError;
}
@@ -188,7 +188,7 @@ bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
{
if ((USB_HostState != HOST_STATE_Configured) || !(MIDIInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
-
+
Pipe_SelectPipe(MIDIInterfaceInfo->Config.DataINPipeNumber);
if (!(Pipe_IsReadWriteAllowed()))
@@ -198,8 +198,9 @@ bool MIDI_Host_ReceiveEventPacket(USB_ClassInfo_MIDI_Host_t* const MIDIInterface
if (!(Pipe_IsReadWriteAllowed()))
Pipe_ClearIN();
-
+
return true;
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.h b/LUFA/Drivers/USB/Class/Host/MIDI.h
index 4aa6eb8e5..e77487db4 100644
--- a/LUFA/Drivers/USB/Class/Host/MIDI.h
+++ b/LUFA/Drivers/USB/Class/Host/MIDI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,7 +56,7 @@
/* Includes: */
#include "../../USB.h"
#include "../Common/MIDI.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -66,7 +66,7 @@
#if !defined(__INCLUDE_FROM_MIDI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/MIDI.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Type Defines: */
/** \brief MIDI Class Host Mode Configuration and State Structure.
@@ -81,7 +81,7 @@
{
uint8_t DataINPipeNumber; /**< Pipe number of the MIDI interface's streaming IN data pipe. */
bool DataINPipeDoubleBank; /**< Indicates if the MIDI interface's IN data pipe should use double banking. */
-
+
uint8_t DataOUTPipeNumber; /**< Pipe number of the MIDI interface's streaming OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the MIDI interface's OUT data pipe should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
@@ -102,7 +102,7 @@
* the interface is enumerated.
*/
} USB_ClassInfo_MIDI_Host_t;
-
+
/* Enums: */
/** Enum for the possible error codes returned by the \ref MIDI_Host_ConfigurePipes() function. */
enum MIDI_Host_EnumerationFailure_ErrorCodes_t
@@ -111,7 +111,7 @@
MIDI_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
MIDI_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible MIDI interface was not found in the device's Configuration Descriptor. */
};
-
+
/* Function Prototypes: */
/** Host interface configuration routine, to configure a given MIDI host interface instance using the Configuration
* Descriptor read from an attached USB device. This function automatically updates the given MIDI Host instance's
@@ -156,7 +156,7 @@
* \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum.
*/
uint8_t MIDI_Host_Flush(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Receives a MIDI event packet from the device.
*
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
@@ -193,9 +193,9 @@
#if defined(__INCLUDE_FROM_MIDI_CLASS_HOST_C)
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingDataEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
- #endif
+ #endif
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
@@ -204,3 +204,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c
index 2d7956e9f..26d096b4f 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -68,7 +68,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
continue;
}
-
+
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
@@ -76,7 +76,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
else
DataOUTEndpoint = EndpointData;
}
-
+
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
if (PipeNum == MSInterfaceInfo->Config.DataINPipeNumber)
@@ -84,16 +84,16 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
MSInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
-
- MSInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
+
+ MSInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == MSInterfaceInfo->Config.DataOUTPipeNumber)
{
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
MSInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
-
- MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
+
+ MSInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
}
@@ -117,7 +117,7 @@ static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -174,7 +174,7 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInf
Pipe_Freeze();
return ErrorCode;
}
-
+
return ErrorCode;
}
@@ -189,7 +189,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
while (!(Pipe_IsINReceived()))
{
uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber();
-
+
if (CurrentFrameNumber != PreviousFrameNumber)
{
PreviousFrameNumber = CurrentFrameNumber;
@@ -197,7 +197,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
if (!(TimeoutMSRem--))
return PIPE_RWSTREAM_Timeout;
}
-
+
Pipe_Freeze();
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
@@ -208,7 +208,7 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
return PIPE_RWSTREAM_PipeStalled;
}
-
+
Pipe_Freeze();
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
@@ -219,14 +219,14 @@ static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInte
return PIPE_RWSTREAM_PipeStalled;
}
-
+
if (USB_HostState == HOST_STATE_Unattached)
return PIPE_RWSTREAM_DeviceDisconnected;
};
-
+
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_Freeze();
-
+
Pipe_SelectPipe(MSInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Freeze();
@@ -250,7 +250,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
-
+
if ((ErrorCode = Pipe_Read_Stream_LE(BufferPtr, BytesRem, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -265,7 +265,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac
return ErrorCode;
Pipe_ClearOUT();
-
+
while (!(Pipe_IsOUTReady()))
{
if (USB_HostState == HOST_STATE_Unattached)
@@ -288,19 +288,19 @@ static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterf
Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
-
+
if ((ErrorCode = Pipe_Read_Stream_LE(SCSICommandStatus, sizeof(MS_CommandStatusWrapper_t),
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
{
return ErrorCode;
}
-
+
Pipe_ClearIN();
Pipe_Freeze();
-
+
if (SCSICommandStatus->Status != MS_SCSI_COMMAND_Pass)
ErrorCode = MS_ERROR_LOGICAL_CMD_FAILED;
-
+
return ErrorCode;
}
@@ -314,7 +314,7 @@ uint8_t MS_Host_ResetMSInterface(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo)
.wIndex = MSInterfaceInfo->State.InterfaceNumber,
.wLength = 0,
};
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
return USB_Host_SendControlRequest(NULL);
@@ -333,7 +333,7 @@ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
.wIndex = MSInterfaceInfo->State.InterfaceNumber,
.wLength = 1,
};
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
if ((ErrorCode = USB_Host_SendControlRequest(MaxLUNIndex)) != HOST_SENDCONTROL_Successful)
@@ -341,7 +341,7 @@ uint8_t MS_Host_GetMaxLUN(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
*MaxLUNIndex = 0;
ErrorCode = HOST_SENDCONTROL_Successful;
}
-
+
return ErrorCode;
}
@@ -351,7 +351,7 @@ uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
{
if ((USB_HostState != HOST_STATE_Configured) || !(MSInterfaceInfo->State.IsActive))
return HOST_SENDCONTROL_DeviceDisconnected;
-
+
uint8_t ErrorCode;
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
@@ -370,12 +370,12 @@ uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
0x00 // Unused (control)
}
};
-
+
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, InquiryData)) != PIPE_RWSTREAM_NoError)
- return ErrorCode;
-
+ return ErrorCode;
+
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -406,12 +406,12 @@ uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
0x00 // Unused (control)
}
};
-
+
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, NULL)) != PIPE_RWSTREAM_NoError)
- return ErrorCode;
-
+ return ErrorCode;
+
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -447,7 +447,7 @@ uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInf
0x00 // Unused (control)
}
};
-
+
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, DeviceCapacity)) != PIPE_RWSTREAM_NoError)
@@ -455,7 +455,7 @@ uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInf
SwapEndian_n(&DeviceCapacity->Blocks, sizeof(DeviceCapacity->Blocks));
SwapEndian_n(&DeviceCapacity->BlockSize, sizeof(DeviceCapacity->BlockSize));
-
+
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -487,7 +487,7 @@ uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
0x00 // Unused (control)
}
};
-
+
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, SenseData)) != PIPE_RWSTREAM_NoError)
@@ -524,12 +524,12 @@ uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInter
0x00 // Unused (control)
}
};
-
+
MS_CommandStatusWrapper_t SCSICommandStatus;
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, NULL)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -617,7 +617,7 @@ uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo
if ((ErrorCode = MS_Host_SendCommand(MSInterfaceInfo, &SCSICommandBlock, BlockBuffer)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
if ((ErrorCode = MS_Host_GetReturnedStatus(MSInterfaceInfo, &SCSICommandStatus)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -625,3 +625,4 @@ uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h
index 4feac0e7b..f442db846 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.h
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,7 +56,7 @@
/* Includes: */
#include "../../USB.h"
#include "../Common/MassStorage.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -71,7 +71,7 @@
/* Macros: */
/** Error code for some Mass Storage Host functions, indicating a logical (and not hardware) error. */
#define MS_ERROR_LOGICAL_CMD_FAILED 0x80
-
+
/* Type Defines: */
/** \brief Mass Storage Class Host Mode Configuration and State Structure.
*
@@ -101,14 +101,14 @@
uint16_t DataINPipeSize; /**< Size in bytes of the Mass Storage interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Mass Storage interface's OUT data pipe. */
-
+
uint32_t TransactionTag; /**< Current transaction tag for data synchronizing of packets. */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.
*/
} USB_ClassInfo_MS_Host_t;
-
+
/** \brief SCSI Device LUN Capacity Structure.
*
* SCSI capacity structure, to hold the total capacity of the device in both the number
@@ -128,7 +128,7 @@
MS_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
MS_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Mass Storage interface was not found in the device's Configuration Descriptor. */
};
-
+
/* Function Prototypes: */
/** Host interface configuration routine, to configure a given Mass Storage host interface instance using the
* Configuration Descriptor read from an attached USB device. This function automatically updates the given Mass
@@ -217,7 +217,7 @@
const uint8_t LUNIndex,
SCSI_Capacity_t* const DeviceCapacity) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(3);
-
+
/** Retrieves the device sense data, indicating the current device state and error codes for the previously
* issued command.
*
@@ -234,7 +234,7 @@
const uint8_t LUNIndex,
SCSI_Request_Sense_Response_t* const SenseData) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(3);
-
+
/** Issues a PREVENT MEDIUM REMOVAL command, to logically (or, depending on the type of device, physically) lock
* the device from removal so that blocks of data on the medium can be read or altered.
*
@@ -250,7 +250,7 @@
uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
const uint8_t LUNIndex,
const bool PreventRemoval) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Reads blocks of data from the attached Mass Storage device's medium.
*
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
@@ -271,7 +271,7 @@
const uint8_t Blocks,
const uint16_t BlockSize,
void* BlockBuffer) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(6);
-
+
/** Writes blocks of data to the attached Mass Storage device's medium.
*
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
@@ -318,22 +318,22 @@
#define CBW_SIGNATURE 0x43425355UL
#define CSW_SIGNATURE 0x53425355UL
-
+
#define COMMAND_DIRECTION_DATA_OUT (0 << 7)
#define COMMAND_DIRECTION_DATA_IN (1 << 7)
-
+
#define COMMAND_DATA_TIMEOUT_MS 10000
-
+
/* Function Prototypes: */
- #if defined(__INCLUDE_FROM_MS_CLASS_HOST_C)
+ #if defined(__INCLUDE_FROM_MS_CLASS_HOST_C)
static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_MS_Host_NextMSInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
-
+
static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
MS_CommandBlockWrapper_t* const SCSICommandBlock,
const void* const BufferPtr) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
- static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
+ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
MS_CommandBlockWrapper_t* const SCSICommandBlock,
void* BufferPtr) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
static uint8_t MS_Host_GetReturnedStatus(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
@@ -341,7 +341,7 @@
ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
#endif
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
@@ -350,3 +350,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Host/Printer.c b/LUFA/Drivers/USB/Class/Host/Printer.c
index 2c9a4eb8b..6cbd892dc 100644
--- a/LUFA/Drivers/USB/Class/Host/Printer.c
+++ b/LUFA/Drivers/USB/Class/Host/Printer.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,7 +48,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
if (DESCRIPTOR_TYPE(DeviceConfigDescriptor) != DTYPE_Configuration)
return PRNT_ENUMERROR_InvalidConfigDescriptor;
-
+
while (!(DataINEndpoint) || !(DataOUTEndpoint))
{
if (!(PrinterInterface) ||
@@ -60,15 +60,15 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
{
return PRNT_ENUMERROR_NoCompatibleInterfaceFound;
}
-
- PrinterInterface = DESCRIPTOR_PCAST(DeviceConfigDescriptor, USB_Descriptor_Interface_t);
+
+ PrinterInterface = DESCRIPTOR_PCAST(DeviceConfigDescriptor, USB_Descriptor_Interface_t);
DataINEndpoint = NULL;
DataOUTEndpoint = NULL;
continue;
}
-
+
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(DeviceConfigDescriptor, USB_Descriptor_Endpoint_t);
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
@@ -76,7 +76,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
else
DataOUTEndpoint = EndpointData;
}
-
+
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
if (PipeNum == PRNTInterfaceInfo->Config.DataINPipeNumber)
@@ -84,16 +84,16 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize,
PRNTInterfaceInfo->Config.DataINPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
-
- PRNTInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
+
+ PRNTInterfaceInfo->State.DataINPipeSize = DataINEndpoint->EndpointSize;
}
else if (PipeNum == PRNTInterfaceInfo->Config.DataOUTPipeNumber)
{
Pipe_ConfigurePipe(PipeNum, EP_TYPE_BULK, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize,
PRNTInterfaceInfo->Config.DataOUTPipeDoubleBank ? PIPE_BANK_DOUBLE : PIPE_BANK_SINGLE);
-
- PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
+
+ PRNTInterfaceInfo->State.DataOUTPipeSize = DataOUTEndpoint->EndpointSize;
}
}
@@ -118,7 +118,7 @@ static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -150,7 +150,7 @@ uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInte
if (PRNTInterfaceInfo->State.AlternateSetting)
{
uint8_t ErrorCode;
-
+
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE),
@@ -159,13 +159,13 @@ uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInte
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
.wLength = 0,
};
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
}
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -206,12 +206,12 @@ uint8_t PRNT_Host_Flush(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo)
{
if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive))
return PIPE_READYWAIT_DeviceDisconnected;
-
+
uint8_t ErrorCode;
- Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
+ Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
-
+
if (!(Pipe_BytesInPipe()))
return PIPE_READYWAIT_NoError;
@@ -228,7 +228,7 @@ uint8_t PRNT_Host_Flush(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo)
}
Pipe_Freeze();
-
+
return PIPE_READYWAIT_NoError;
}
@@ -237,12 +237,12 @@ uint8_t PRNT_Host_SendByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
{
if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive))
return PIPE_READYWAIT_DeviceDisconnected;
-
+
uint8_t ErrorCode;
- Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
+ Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
-
+
if (!(Pipe_IsReadWriteAllowed()))
{
Pipe_ClearOUT();
@@ -251,9 +251,9 @@ uint8_t PRNT_Host_SendByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
return ErrorCode;
}
- Pipe_Write_Byte(Data);
+ Pipe_Write_Byte(Data);
Pipe_Freeze();
-
+
return PIPE_READYWAIT_NoError;
}
@@ -268,14 +268,14 @@ uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
-
+
if ((ErrorCode = Pipe_Write_Stream_LE(Buffer, Length, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearOUT();
-
+
ErrorCode = Pipe_WaitUntilReady();
-
+
Pipe_Freeze();
return ErrorCode;
@@ -285,7 +285,7 @@ uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
{
if ((USB_HostState != HOST_STATE_Configured) || !(PRNTInterfaceInfo->State.IsActive))
return 0;
-
+
Pipe_SelectPipe(PRNTInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
@@ -306,7 +306,7 @@ uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
else
{
Pipe_Freeze();
-
+
return 0;
}
}
@@ -329,7 +329,7 @@ int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo
if (!(Pipe_BytesInPipe()))
Pipe_ClearIN();
}
-
+
Pipe_Freeze();
return ReceivedByte;
@@ -350,33 +350,34 @@ uint8_t PRNT_Host_GetDeviceID(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo
.wIndex = PRNTInterfaceInfo->State.InterfaceNumber,
.wLength = sizeof(DeviceIDStringLength),
};
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
if ((ErrorCode = USB_Host_SendControlRequest(&DeviceIDStringLength)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
-
+
if (!(DeviceIDStringLength))
{
DeviceIDString[0] = 0x00;
return HOST_SENDCONTROL_Successful;
}
-
+
DeviceIDStringLength = SwapEndian_16(DeviceIDStringLength);
if (DeviceIDStringLength > BufferSize)
DeviceIDStringLength = BufferSize;
USB_ControlRequest.wLength = DeviceIDStringLength;
-
+
if ((ErrorCode = USB_Host_SendControlRequest(DeviceIDString)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
-
+
memmove(&DeviceIDString[0], &DeviceIDString[2], DeviceIDStringLength - 2);
DeviceIDString[DeviceIDStringLength - 2] = 0x00;
-
+
return HOST_SENDCONTROL_Successful;
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Host/Printer.h b/LUFA/Drivers/USB/Class/Host/Printer.h
index b6298daae..96ecd0fd6 100644
--- a/LUFA/Drivers/USB/Class/Host/Printer.h
+++ b/LUFA/Drivers/USB/Class/Host/Printer.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,7 +56,7 @@
/* Includes: */
#include "../../USB.h"
#include "../Common/Printer.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -111,7 +111,7 @@
PRNT_ENUMERROR_InvalidConfigDescriptor = 1, /**< The device returned an invalid Configuration Descriptor. */
PRNT_ENUMERROR_NoCompatibleInterfaceFound = 2, /**< A compatible Printer interface was not found in the device's Configuration Descriptor. */
};
-
+
/* Function Prototypes: */
/** General management task for a given Printer host class interface, required for the correct operation of
* the interface. This should be called frequently in the main program loop, before the master USB management task
@@ -140,7 +140,7 @@
uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
uint16_t ConfigDescriptorSize,
void* DeviceConfigDescriptor) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3);
-
+
/** Configures the printer to enable Bidirectional mode, if it is not already in this mode. This should be called
* once the connected device's configuration has been set, to ensure the printer is ready to accept commands.
*
@@ -149,7 +149,7 @@
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum.
*/
uint8_t PRNT_Host_SetBidirectionalMode(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Retrieves the status of the virtual Printer port's inbound status lines. The result can then be masked against the
* PRNT_PORTSTATUS_* macros to determine the printer port's status.
*
@@ -195,12 +195,12 @@
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
*/
uint8_t PRNT_Host_SendString(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo,
- void* Buffer,
+ void* Buffer,
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
/** Sends a given byte to the attached USB device, if connected. If a device is not connected when the function is called, the
* byte is discarded. Bytes will be queued for transmission to the device until either the pipe bank becomes full, or the
- * \ref PRNT_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
+ * \ref PRNT_Host_Flush() function is called to flush the pending data to the host. This allows for multiple bytes to be
* packed into a single pipe packet, increasing data throughput.
*
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
@@ -226,8 +226,8 @@
*
* \return Total number of buffered bytes received from the device.
*/
- uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo);
-
+ uint16_t PRNT_Host_BytesReceived(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo);
+
/** Reads a byte of data from the device. If no data is waiting to be read of if a USB device is not connected, the function
* returns a negative value. The \ref PRNT_Host_BytesReceived() function may be queried in advance to determine how many bytes
* are currently buffered in the Printer interface's data receive pipe.
@@ -240,7 +240,7 @@
* \return Next received byte from the device, or a negative value if no data received.
*/
int16_t PRNT_Host_ReceiveByte(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceInfo);
-
+
/** Retrieves the attached printer device's ID string, formatted according to IEEE 1284. This string is sent as a
* Unicode string from the device and is automatically converted to an ASCII encoded C string by this function, thus
* the maximum reportable string length is two less than the size given (to accommodate the Unicode string length
@@ -268,14 +268,14 @@
#define REQ_GetDeviceID 0
#define REQ_GetPortStatus 1
#define REQ_SoftReset 2
-
+
/* Function Prototypes: */
- #if defined(__INCLUDE_FROM_PRINTER_CLASS_HOST_C)
+ #if defined(__INCLUDE_FROM_PRINTER_CLASS_HOST_C)
static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_PRNT_Host_NextPRNTInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
#endif
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
@@ -284,3 +284,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c
index 7663b6301..541b7d3d1 100644
--- a/LUFA/Drivers/USB/Class/Host/RNDIS.c
+++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,7 +64,7 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
DCOMP_RNDIS_Host_NextRNDISDataInterface) != DESCRIPTOR_SEARCH_COMP_Found)
{
return RNDIS_ENUMERROR_NoCompatibleInterfaceFound;
- }
+ }
DataINEndpoint = NULL;
DataOUTEndpoint = NULL;
@@ -76,15 +76,15 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
{
return RNDIS_ENUMERROR_NoCompatibleInterfaceFound;
}
-
+
RNDISControlInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
NotificationEndpoint = NULL;
}
-
+
continue;
}
-
+
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
@@ -99,7 +99,7 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
DataOUTEndpoint = EndpointData;
}
}
-
+
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
if (PipeNum == RNDISInterfaceInfo->Config.DataINPipeNumber)
@@ -141,7 +141,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDes
{
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
USB_Descriptor_Interface_t);
-
+
if ((CurrentInterface->Class == RNDIS_CONTROL_CLASS) &&
(CurrentInterface->SubClass == RNDIS_CONTROL_SUBCLASS) &&
(CurrentInterface->Protocol == RNDIS_CONTROL_PROTOCOL))
@@ -149,7 +149,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDes
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -159,7 +159,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescri
{
USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor,
USB_Descriptor_Interface_t);
-
+
if ((CurrentInterface->Class == RNDIS_DATA_CLASS) &&
(CurrentInterface->SubClass == RNDIS_DATA_SUBCLASS) &&
(CurrentInterface->Protocol == RNDIS_DATA_PROTOCOL))
@@ -167,7 +167,7 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescri
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -177,9 +177,9 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISInterfaceEndpoint(void* const CurrentDe
{
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t);
-
+
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
-
+
if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
!(Pipe_IsEndpointBound(CurrentEndpoint->EndpointAddress)))
{
@@ -223,7 +223,7 @@ static uint8_t RNDIS_GetEncapsulatedResponse(USB_ClassInfo_RNDIS_Host_t* const R
.wIndex = RNDISInterfaceInfo->State.ControlInterfaceNumber,
.wLength = Length,
};
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
return USB_Host_SendControlRequest(Buffer);
}
@@ -234,7 +234,7 @@ uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac
RNDIS_KeepAlive_Message_t KeepAliveMessage;
RNDIS_KeepAlive_Complete_t KeepAliveMessageResponse;
-
+
KeepAliveMessage.MessageType = REMOTE_NDIS_KEEPALIVE_MSG;
KeepAliveMessage.MessageLength = sizeof(RNDIS_KeepAlive_Message_t);
KeepAliveMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
@@ -244,13 +244,13 @@ uint8_t RNDIS_Host_SendKeepAlive(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &KeepAliveMessageResponse,
sizeof(RNDIS_KeepAlive_Complete_t))) != HOST_SENDCONTROL_Successful)
{
return ErrorCode;
}
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -268,13 +268,13 @@ uint8_t RNDIS_Host_InitializeDevice(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
InitMessage.MajorVersion = REMOTE_NDIS_VERSION_MAJOR;
InitMessage.MinorVersion = REMOTE_NDIS_VERSION_MINOR;
InitMessage.MaxTransferSize = RNDISInterfaceInfo->Config.HostMaxPacketSize;
-
+
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &InitMessage,
sizeof(RNDIS_Initialize_Message_t))) != HOST_SENDCONTROL_Successful)
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &InitMessageResponse,
sizeof(RNDIS_Initialize_Complete_t))) != HOST_SENDCONTROL_Successful)
{
@@ -283,9 +283,9 @@ uint8_t RNDIS_Host_InitializeDevice(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
if (InitMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
return RNDIS_COMMAND_FAILED;
-
+
RNDISInterfaceInfo->State.DeviceMaxPacketSize = InitMessageResponse.MaxTransferSize;
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -301,18 +301,18 @@ uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
RNDIS_Set_Message_t SetMessage;
uint8_t ContiguousBuffer[Length];
} SetMessageData;
-
+
RNDIS_Set_Complete_t SetMessageResponse;
-
+
SetMessageData.SetMessage.MessageType = REMOTE_NDIS_SET_MSG;
SetMessageData.SetMessage.MessageLength = sizeof(RNDIS_Set_Message_t) + Length;
SetMessageData.SetMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
-
+
SetMessageData.SetMessage.Oid = Oid;
SetMessageData.SetMessage.InformationBufferLength = Length;
SetMessageData.SetMessage.InformationBufferOffset = (sizeof(RNDIS_Set_Message_t) - sizeof(RNDIS_Message_Header_t));
SetMessageData.SetMessage.DeviceVcHandle = 0;
-
+
memcpy(&SetMessageData.ContiguousBuffer, Buffer, Length);
if ((ErrorCode = RNDIS_SendEncapsulatedCommand(RNDISInterfaceInfo, &SetMessageData,
@@ -320,7 +320,7 @@ uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &SetMessageResponse,
sizeof(RNDIS_Set_Complete_t))) != HOST_SENDCONTROL_Successful)
{
@@ -329,7 +329,7 @@ uint8_t RNDIS_Host_SetRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInter
if (SetMessageResponse.Status != REMOTE_NDIS_STATUS_SUCCESS)
return RNDIS_COMMAND_FAILED;
-
+
return HOST_SENDCONTROL_Successful;
}
@@ -351,7 +351,7 @@ uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInt
QueryMessage.MessageType = REMOTE_NDIS_QUERY_MSG;
QueryMessage.MessageLength = sizeof(RNDIS_Query_Message_t);
QueryMessage.RequestId = RNDISInterfaceInfo->State.RequestID++;
-
+
QueryMessage.Oid = Oid;
QueryMessage.InformationBufferLength = 0;
QueryMessage.InformationBufferOffset = 0;
@@ -362,7 +362,7 @@ uint8_t RNDIS_Host_QueryRNDISProperty(USB_ClassInfo_RNDIS_Host_t* const RNDISInt
{
return ErrorCode;
}
-
+
if ((ErrorCode = RNDIS_GetEncapsulatedResponse(RNDISInterfaceInfo, &QueryMessageResponseData,
sizeof(QueryMessageResponseData))) != HOST_SENDCONTROL_Successful)
{
@@ -385,11 +385,11 @@ bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfac
return false;
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber);
-
+
Pipe_Unfreeze();
- PacketWaiting = Pipe_IsINReceived();
+ PacketWaiting = Pipe_IsINReceived();
Pipe_Freeze();
-
+
return PacketWaiting;
}
@@ -404,19 +404,19 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
-
+
if (!(Pipe_IsReadWriteAllowed()))
{
if (Pipe_IsINReceived())
Pipe_ClearIN();
-
+
*PacketLength = 0;
Pipe_Freeze();
return PIPE_RWSTREAM_NoError;
}
RNDIS_Packet_Message_t DeviceMessage;
-
+
if ((ErrorCode = Pipe_Read_Stream_LE(&DeviceMessage, sizeof(RNDIS_Packet_Message_t),
NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
{
@@ -424,17 +424,17 @@ uint8_t RNDIS_Host_ReadPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
}
*PacketLength = (uint16_t)DeviceMessage.DataLength;
-
+
Pipe_Discard_Stream(DeviceMessage.DataOffset - (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)),
NO_STREAM_CALLBACK);
-
+
Pipe_Read_Stream_LE(Buffer, *PacketLength, NO_STREAM_CALLBACK);
-
+
if (!(Pipe_BytesInPipe()))
Pipe_ClearIN();
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
@@ -454,7 +454,7 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
DeviceMessage.MessageLength = (sizeof(RNDIS_Packet_Message_t) + PacketLength);
DeviceMessage.DataOffset = (sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t));
DeviceMessage.DataLength = PacketLength;
-
+
Pipe_SelectPipe(RNDISInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
@@ -468,8 +468,9 @@ uint8_t RNDIS_Host_SendPacket(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceIn
Pipe_ClearOUT();
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.h b/LUFA/Drivers/USB/Class/Host/RNDIS.h
index 71f96eb5d..5ff2e1b84 100644
--- a/LUFA/Drivers/USB/Class/Host/RNDIS.h
+++ b/LUFA/Drivers/USB/Class/Host/RNDIS.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -60,7 +60,7 @@
#include <stdio.h>
#include <string.h>
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -89,9 +89,9 @@
uint8_t DataOUTPipeNumber; /**< Pipe number of the RNDIS interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the RNDIS interface's OUT data pipe should use double banking. */
- uint8_t NotificationPipeNumber; /**< Pipe number of the RNDIS interface's IN notification endpoint, if used. */
+ uint8_t NotificationPipeNumber; /**< Pipe number of the RNDIS interface's IN notification endpoint, if used. */
bool NotificationPipeDoubleBank; /**< Indicates if the RNDIS interface's notification pipe should use double banking. */
-
+
uint32_t HostMaxPacketSize; /**< Maximum size of a packet which can be buffered by the host. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
@@ -103,20 +103,20 @@
* Configured state.
*/
uint8_t ControlInterfaceNumber; /**< Interface index of the RNDIS control interface within the attached device. */
-
+
uint16_t DataINPipeSize; /**< Size in bytes of the RNDIS interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the RNDIS interface's OUT data pipe. */
- uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used. */
+ uint16_t NotificationPipeSize; /**< Size in bytes of the RNDIS interface's IN notification pipe, if used. */
uint32_t DeviceMaxPacketSize; /**< Maximum size of a packet which can be buffered by the attached RNDIS device. */
-
+
uint32_t RequestID; /**< Request ID counter to give a unique ID for each command/response pair. */
} State; /**< State data for the USB class interface within the device. All elements in this section
* <b>may</b> be set to initial values, but may also be ignored to default to sane values when
* the interface is enumerated.
*/
} USB_ClassInfo_RNDIS_Host_t;
-
+
/* Enums: */
/** Enum for the possible error codes returned by the \ref RNDIS_Host_ConfigurePipes() function. */
enum RNDIS_Host_EnumerationFailure_ErrorCodes_t
@@ -211,7 +211,7 @@
* \return Boolean true if a packet is waiting to be read in by the host, false otherwise.
*/
bool RNDIS_Host_IsPacketReceived(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Retrieves the next pending packet from the device, discarding the remainder of the RNDIS packet header to leave
* only the packet contents for processing by the host in the nominated buffer.
*
@@ -268,7 +268,7 @@
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_RNDIS_CLASS_HOST_C)
- static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
+ static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo,
void* Buffer,
const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(2);
@@ -291,3 +291,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c
index c3ade3b55..f7f8637a2 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.c
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
USB_Descriptor_Interface_t* StillImageInterface = NULL;
memset(&SIInterfaceInfo->State, 0x00, sizeof(SIInterfaceInfo->State));
-
+
if (DESCRIPTOR_TYPE(ConfigDescriptorData) != DTYPE_Configuration)
return SI_ENUMERROR_InvalidConfigDescriptor;
@@ -63,7 +63,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
}
StillImageInterface = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Interface_t);
-
+
DataINEndpoint = NULL;
DataOUTEndpoint = NULL;
EventsEndpoint = NULL;
@@ -85,7 +85,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
DataOUTEndpoint = EndpointData;
}
}
-
+
for (uint8_t PipeNum = 1; PipeNum < PIPE_TOTAL_PIPES; PipeNum++)
{
if (PipeNum == SIInterfaceInfo->Config.DataINPipeNumber)
@@ -113,8 +113,8 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SIInterfaceInfo->State.EventsPipeSize = EventsEndpoint->EndpointSize;
}
- }
-
+ }
+
SIInterfaceInfo->State.InterfaceNumber = StillImageInterface->InterfaceNumber;
SIInterfaceInfo->State.IsActive = true;
@@ -135,7 +135,7 @@ uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -145,7 +145,7 @@ uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor)
{
USB_Descriptor_Endpoint_t* CurrentEndpoint = DESCRIPTOR_PCAST(CurrentDescriptor,
USB_Descriptor_Endpoint_t);
-
+
uint8_t EndpointType = (CurrentEndpoint->Attributes & EP_TYPE_MASK);
if (((EndpointType == EP_TYPE_BULK) || (EndpointType == EP_TYPE_INTERRUPT)) &&
@@ -166,7 +166,7 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader)
{
uint8_t ErrorCode;
-
+
if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive))
return PIPE_RWSTREAM_DeviceDisconnected;
@@ -178,7 +178,7 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
if ((ErrorCode = Pipe_Write_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
if (ParamBytes)
@@ -186,10 +186,10 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
if ((ErrorCode = Pipe_Write_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
}
-
+
Pipe_ClearOUT();
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
@@ -204,11 +204,11 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
Pipe_SelectPipe(SIInterfaceInfo->Config.DataINPipeNumber);
Pipe_Unfreeze();
-
+
while (!(Pipe_IsINReceived()))
{
uint16_t CurrentFrameNumber = USB_Host_GetFrameNumber();
-
+
if (CurrentFrameNumber != PreviousFrameNumber)
{
PreviousFrameNumber = CurrentFrameNumber;
@@ -216,7 +216,7 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
if (!(TimeoutMSRem--))
return PIPE_RWSTREAM_Timeout;
}
-
+
Pipe_Freeze();
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
@@ -236,25 +236,25 @@ uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
USB_Host_ClearPipeStall(SIInterfaceInfo->Config.DataINPipeNumber);
return PIPE_RWSTREAM_PipeStalled;
}
-
+
if (USB_HostState == HOST_STATE_Unattached)
return PIPE_RWSTREAM_DeviceDisconnected;
}
-
+
Pipe_Read_Stream_LE(PIMAHeader, PIMA_COMMAND_SIZE(0), NO_STREAM_CALLBACK);
-
+
if (PIMAHeader->Type == SI_PIMA_CONTAINER_ResponseBlock)
{
uint8_t ParamBytes = (PIMAHeader->DataLength - PIMA_COMMAND_SIZE(0));
if (ParamBytes)
Pipe_Read_Stream_LE(&PIMAHeader->Params, ParamBytes, NO_STREAM_CALLBACK);
-
+
Pipe_ClearIN();
}
-
+
Pipe_Freeze();
-
+
return PIPE_RWSTREAM_NoError;
}
@@ -269,12 +269,12 @@ uint8_t SI_Host_SendData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
Pipe_SelectPipe(SIInterfaceInfo->Config.DataOUTPipeNumber);
Pipe_Unfreeze();
-
+
ErrorCode = Pipe_Write_Stream_LE(Buffer, Bytes, NO_STREAM_CALLBACK);
Pipe_ClearOUT();
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -293,7 +293,7 @@ uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
ErrorCode = Pipe_Read_Stream_LE(Buffer, Bytes, NO_STREAM_CALLBACK);
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -306,12 +306,12 @@ bool SI_Host_IsEventReceived(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
Pipe_Unfreeze();
-
+
if (Pipe_BytesInPipe())
IsEventReceived = true;
-
+
Pipe_Freeze();
-
+
return IsEventReceived;
}
@@ -325,12 +325,12 @@ uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInf
Pipe_SelectPipe(SIInterfaceInfo->Config.EventsPipeNumber);
Pipe_Unfreeze();
-
+
ErrorCode = Pipe_Read_Stream_LE(PIMAHeader, sizeof(SI_PIMA_Container_t), NO_STREAM_CALLBACK);
-
+
Pipe_ClearIN();
Pipe_Freeze();
-
+
return ErrorCode;
}
@@ -351,16 +351,16 @@ uint8_t SI_Host_OpenSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
.Code = 0x1002,
.Params = {1},
};
-
+
if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
return SI_ERROR_LOGICAL_CMD_FAILED;
-
+
SIInterfaceInfo->State.IsSessionOpen = true;
return PIPE_RWSTREAM_NoError;
@@ -380,10 +380,10 @@ uint8_t SI_Host_CloseSession(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
.Code = 0x1003,
.Params = {1},
};
-
+
if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
-
+
if ((ErrorCode = SI_Host_ReceiveBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -411,9 +411,9 @@ uint8_t SI_Host_SendCommand(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
.Type = SI_PIMA_CONTAINER_CommandBlock,
.Code = Operation,
};
-
+
memcpy(&PIMABlock.Params, Params, sizeof(uint32_t) * TotalParams);
-
+
if ((ErrorCode = SI_Host_SendBlockHeader(SIInterfaceInfo, &PIMABlock)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
@@ -433,8 +433,9 @@ uint8_t SI_Host_ReceiveResponse(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
if ((PIMABlock.Type != SI_PIMA_CONTAINER_ResponseBlock) || (PIMABlock.Code != 0x2001))
return SI_ERROR_LOGICAL_CMD_FAILED;
-
+
return PIPE_RWSTREAM_NoError;
}
#endif
+
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h
index 0e1e8ac16..d2e6fe0d2 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.h
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,7 +56,7 @@
/* Includes: */
#include "../../USB.h"
#include "../Common/StillImage.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -66,7 +66,7 @@
#if !defined(__INCLUDE_FROM_SI_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/Class/StillImage.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Error code for some Still Image Host functions, indicating a logical (and not hardware) error. */
@@ -89,7 +89,7 @@
uint8_t DataOUTPipeNumber; /**< Pipe number of the Still Image interface's OUT data pipe. */
bool DataOUTPipeDoubleBank; /**< Indicates if the Still Image interface's OUT data pipe should use double banking. */
- uint8_t EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used. */
+ uint8_t EventsPipeNumber; /**< Pipe number of the Still Image interface's IN events endpoint, if used. */
bool EventsPipeDoubleBank; /**< Indicates if the Still Image interface's events data pipe should use double banking. */
} Config; /**< Config data for the USB class interface within the device. All elements in this section
* <b>must</b> be set or the interface will fail to enumerate and operate correctly.
@@ -105,7 +105,7 @@
uint16_t DataINPipeSize; /**< Size in bytes of the Still Image interface's IN data pipe. */
uint16_t DataOUTPipeSize; /**< Size in bytes of the Still Image interface's OUT data pipe. */
uint16_t EventsPipeSize; /**< Size in bytes of the Still Image interface's IN events pipe. */
-
+
bool IsSessionOpen; /**< Indicates if a PIMA session is currently open with the attached device. */
uint32_t TransactionID; /**< Transaction ID for the next transaction to send to the device. */
} State; /**< State data for the USB class interface within the device. All elements in this section
@@ -113,7 +113,7 @@
* the interface is enumerated.
*/
} USB_ClassInfo_SI_Host_t;
-
+
/* Enums: */
/** Enum for the possible error codes returned by the \ref SI_Host_ConfigurePipes() function. */
enum SI_Host_EnumerationFailure_ErrorCodes_t
@@ -148,7 +148,7 @@
/** Opens a new PIMA session with the attached device. This should be used before any session-orientated PIMA commands
* are issued to the device. Only one session can be open at the one time.
- *
+ *
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
* call will fail.
*
@@ -186,7 +186,7 @@
uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(2);
-
+
/** Receives a raw PIMA block header to the device. This can be used to receive arbitrary PIMA blocks from the device with
* or without parameters.
*
@@ -203,7 +203,7 @@
ATTR_NON_NULL_PTR_ARG(2);
/** Sends a given PIMA command to the attached device, filling out the PIMA command header's Transaction ID automatically.
- *
+ *
* \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or the
* call will fail.
*
@@ -258,7 +258,7 @@
uint8_t SI_Host_ReceiveEventHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
SI_PIMA_Container_t* const PIMAHeader) ATTR_NON_NULL_PTR_ARG(1)
ATTR_NON_NULL_PTR_ARG(2);
-
+
/** Sends arbitrary data to the attached device, for use in the data phase of PIMA commands which require data
* transfer beyond the regular PIMA command block parameters.
*
@@ -290,7 +290,7 @@
uint8_t SI_Host_ReadData(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
void* Buffer,
const uint16_t Bytes) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
-
+
/* Inline Functions: */
/** General management task for a given Still Image host class interface, required for the correct operation of the
* interface. This should be called frequently in the main program loop, before the master USB management task
@@ -302,7 +302,7 @@
static inline void SI_Host_USBTask(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo)
{
(void)SIInterfaceInfo;
- }
+ }
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
@@ -312,14 +312,14 @@
#define STILL_IMAGE_PROTOCOL 0x01
#define COMMAND_DATA_TIMEOUT_MS 10000
-
+
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_SI_CLASS_HOST_C)
static uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
static uint8_t DCOMP_SI_Host_NextSIInterfaceEndpoint(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1);
#endif
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
@@ -328,3 +328,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/MIDI.h b/LUFA/Drivers/USB/Class/MIDI.h
index 33be2b793..c7de15cfc 100644
--- a/LUFA/Drivers/USB/Class/MIDI.h
+++ b/LUFA/Drivers/USB/Class/MIDI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -65,7 +65,7 @@
/* Macros: */
#define __INCLUDE_FROM_MIDI_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
-
+
/* Includes: */
#include "../HighLevel/USBMode.h"
@@ -80,7 +80,8 @@
#if defined(USB_CAN_BE_HOST)
#include "Host/MIDI.h"
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/MassStorage.h b/LUFA/Drivers/USB/Class/MassStorage.h
index 9d61d380d..985300f00 100644
--- a/LUFA/Drivers/USB/Class/MassStorage.h
+++ b/LUFA/Drivers/USB/Class/MassStorage.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -62,7 +62,7 @@
/* Macros: */
#define __INCLUDE_FROM_MS_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
-
+
/* Includes: */
#include "../HighLevel/USBMode.h"
@@ -73,11 +73,12 @@
#if defined(USB_CAN_BE_DEVICE)
#include "Device/MassStorage.h"
#endif
-
+
#if defined(USB_CAN_BE_HOST)
#include "Host/MassStorage.h"
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/Printer.h b/LUFA/Drivers/USB/Class/Printer.h
index 74ee6e613..9bd3b5257 100644
--- a/LUFA/Drivers/USB/Class/Printer.h
+++ b/LUFA/Drivers/USB/Class/Printer.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -66,7 +66,7 @@
/* Includes: */
#include "../HighLevel/USBMode.h"
-
+
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
@@ -74,7 +74,8 @@
#if defined(USB_CAN_BE_HOST)
#include "Host/Printer.h"
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/RNDIS.h b/LUFA/Drivers/USB/Class/RNDIS.h
index 5f3bb5684..1b0381e8c 100644
--- a/LUFA/Drivers/USB/Class/RNDIS.h
+++ b/LUFA/Drivers/USB/Class/RNDIS.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -62,7 +62,7 @@
/* Macros: */
#define __INCLUDE_FROM_RNDIS_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
-
+
/* Includes: */
#include "../HighLevel/USBMode.h"
@@ -73,11 +73,12 @@
#if defined(USB_CAN_BE_DEVICE)
#include "Device/RNDIS.h"
#endif
-
+
#if defined(USB_CAN_BE_HOST)
#include "Host/RNDIS.h"
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/Class/StillImage.h b/LUFA/Drivers/USB/Class/StillImage.h
index 4c64e2d89..85a2eef48 100644
--- a/LUFA/Drivers/USB/Class/StillImage.h
+++ b/LUFA/Drivers/USB/Class/StillImage.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -61,10 +61,10 @@
/* Macros: */
#define __INCLUDE_FROM_SI_DRIVER
#define __INCLUDE_FROM_USB_DRIVER
-
+
/* Includes: */
#include "../HighLevel/USBMode.h"
-
+
#if defined(NO_STREAM_CALLBACKS)
#error The NO_STREAM_CALLBACKS compile time option cannot be used in projects using the library Class drivers.
#endif
@@ -72,7 +72,8 @@
#if defined(USB_CAN_BE_HOST)
#include "Host/StillImage.h"
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c b/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c
index b5d98c04d..a025e6184 100644
--- a/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c
+++ b/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -46,7 +46,7 @@ uint8_t USB_Host_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const
.wIndex = 0,
.wLength = sizeof(USB_Descriptor_Configuration_Header_t),
};
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
if ((ErrorCode = USB_Host_SendControlRequest(ConfigHeader)) != HOST_SENDCONTROL_Successful)
@@ -56,15 +56,15 @@ uint8_t USB_Host_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const
if (*ConfigSizePtr > BufferSize)
return HOST_GETCONFIG_BuffOverflow;
-
+
USB_ControlRequest.wLength = *ConfigSizePtr;
-
+
if ((ErrorCode = USB_Host_SendControlRequest(BufferPtr)) != HOST_SENDCONTROL_Successful)
return ErrorCode;
if (DESCRIPTOR_TYPE(BufferPtr) != DTYPE_Configuration)
return HOST_GETCONFIG_InvalidData;
-
+
return HOST_GETCONFIG_Successful;
}
#endif
@@ -75,7 +75,7 @@ void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,
{
while (*BytesRem)
{
- USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
+ USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type)
return;
@@ -109,22 +109,22 @@ void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
const uint8_t AfterType)
{
USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, AfterType);
-
+
if (*BytesRem)
USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type);
}
-
+
uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, void** const CurrConfigLoc, ConfigComparatorPtr_t const ComparatorRoutine)
{
uint8_t ErrorCode;
-
+
while (*BytesRem)
{
uint8_t* PrevDescLoc = *CurrConfigLoc;
uint16_t PrevBytesRem = *BytesRem;
USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
-
+
if ((ErrorCode = ComparatorRoutine(*CurrConfigLoc)) != DESCRIPTOR_SEARCH_NotFound)
{
if (ErrorCode == DESCRIPTOR_SEARCH_Fail)
@@ -132,10 +132,11 @@ uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, void** const CurrCon
*CurrConfigLoc = PrevDescLoc;
*BytesRem = PrevBytesRem;
}
-
+
return ErrorCode;
}
}
-
+
return DESCRIPTOR_SEARCH_COMP_EndOfDescriptor;
}
+
diff --git a/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h b/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h
index 001653b52..7c7540d52 100644
--- a/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h
+++ b/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -52,12 +52,12 @@
/* Includes: */
#include <stdint.h>
-
+
#include "../../../Common/Common.h"
#include "HostStandardReq.h"
#include "USBMode.h"
#include "StdDescriptors.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -67,8 +67,8 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
- /* Public Interface - May be used in end-application: */
+
+ /* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared
* with the EP_TYPE_* masks to determine the exact type of the endpoint.
@@ -108,7 +108,7 @@
* values can be accessed in the \ref USB_DescriptorTypes_t enum.
*/
#define DESCRIPTOR_TYPE(DescriptorPtr) DESCRIPTOR_CAST(DescriptorPtr, USB_Descriptor_Header_t).Type
-
+
/** Returns the descriptor's size, expressed as the 8-bit value indicating the number of bytes. */
#define DESCRIPTOR_SIZE(DescriptorPtr) DESCRIPTOR_CAST(DescriptorPtr, USB_Descriptor_Header_t).Size
@@ -119,7 +119,7 @@
* \see \ref USB_GetNextDescriptorComp function for more details.
*/
typedef uint8_t (* ConfigComparatorPtr_t)(void*);
-
+
/* Enums: */
/** Enum for the possible return codes of the \ref USB_Host_GetDeviceConfigDescriptor() function. */
enum USB_Host_GetConfigDescriptor_ErrorCodes_t
@@ -138,7 +138,7 @@
*/
HOST_GETCONFIG_InvalidData = 6, /**< The device returned invalid configuration descriptor data. */
};
-
+
/** Enum for return values of a descriptor comparator function. */
enum DSearch_Return_ErrorCodes_t
{
@@ -155,7 +155,7 @@
DESCRIPTOR_SEARCH_COMP_Fail = 1, /**< Comparator function returned Descriptor_Search_Fail. */
DESCRIPTOR_SEARCH_COMP_EndOfDescriptor = 2, /**< End of configuration descriptor reached before match found. */
};
-
+
/* Function Prototypes: */
/** Retrieves the configuration descriptor data from an attached device via a standard request into a buffer,
* including validity and size checking to prevent a buffer overflow.
@@ -266,16 +266,16 @@
* \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
*/
static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
- void** CurrConfigLoc) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
+ void** CurrConfigLoc) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
void** CurrConfigLoc)
{
uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size;
-
+
*CurrConfigLoc = ((uint8_t*)*CurrConfigLoc) + CurrDescriptorSize;
*BytesRem -= CurrDescriptorSize;
}
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
@@ -284,3 +284,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c
index e15a48d50..960e24367 100644
--- a/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c
+++ b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,12 +50,12 @@ void USB_Device_ProcessControlRequest(void)
{
bool RequestHandled = false;
uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest;
-
+
for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++)
*(RequestHeader++) = Endpoint_Read_Byte();
-
+
uint8_t bmRequestType = USB_ControlRequest.bmRequestType;
-
+
switch (USB_ControlRequest.bRequest)
{
case REQ_GetStatus:
@@ -92,7 +92,7 @@ void USB_Device_ProcessControlRequest(void)
USB_Device_GetDescriptor();
RequestHandled = true;
}
-
+
break;
case REQ_GetConfiguration:
if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE))
@@ -114,11 +114,11 @@ void USB_Device_ProcessControlRequest(void)
if (!(RequestHandled))
EVENT_USB_Device_UnhandledControlRequest();
-
+
if (Endpoint_IsSETUPReceived())
{
Endpoint_StallTransaction();
- Endpoint_ClearSETUP();
+ Endpoint_ClearSETUP();
}
}
@@ -129,9 +129,9 @@ static void USB_Device_SetAddress(void)
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Endpoint_ClearSETUP();
-
+
Endpoint_ClearStatusStage();
-
+
while (!(Endpoint_IsINReady()));
USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
@@ -157,7 +157,7 @@ static void USB_Device_SetConfiguration(void)
#else
uint8_t MemoryAddressSpace;
#endif
-
+
if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DevDescriptorPtr
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
, &MemoryAddressSpace
@@ -166,7 +166,7 @@ static void USB_Device_SetConfiguration(void)
{
return;
}
-
+
if (MemoryAddressSpace == MEMSPACE_FLASH)
{
if (((uint8_t)USB_ControlRequest.wValue > pgm_read_byte(&DevDescriptorPtr->NumberOfConfigurations)))
@@ -183,7 +183,7 @@ static void USB_Device_SetConfiguration(void)
return;
}
#endif
-
+
Endpoint_ClearSETUP();
USB_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue;
@@ -225,7 +225,7 @@ static void USB_Device_GetInternalSerialDescriptor(void)
SignatureDescriptor.Header.Type = DTYPE_String;
SignatureDescriptor.Header.Size = sizeof(SignatureDescriptor);
-
+
uint8_t SigReadAddress = 0x0E;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
@@ -233,17 +233,17 @@ static void USB_Device_GetInternalSerialDescriptor(void)
for (uint8_t SerialCharNum = 0; SerialCharNum < 20; SerialCharNum++)
{
uint8_t SerialByte = boot_signature_byte_get(SigReadAddress);
-
+
if (SerialCharNum & 0x01)
{
SerialByte >>= 4;
SigReadAddress++;
}
-
+
SignatureDescriptor.UnicodeString[SerialCharNum] = USB_Device_NibbleToASCII(SerialByte);
}
}
-
+
Endpoint_ClearSETUP();
Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor));
@@ -256,11 +256,11 @@ static void USB_Device_GetDescriptor(void)
{
const void* DescriptorPointer;
uint16_t DescriptorSize;
-
+
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
uint8_t DescriptorAddressSpace;
#endif
-
+
#if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)
if (USB_ControlRequest.wValue == ((DTYPE_String << 8) | USE_INTERNAL_SERIAL))
{
@@ -268,7 +268,7 @@ static void USB_Device_GetDescriptor(void)
return;
}
#endif
-
+
if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
&DescriptorPointer
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
@@ -278,7 +278,7 @@ static void USB_Device_GetDescriptor(void)
{
return;
}
-
+
Endpoint_ClearSETUP();
#if defined(USE_RAM_DESCRIPTORS)
@@ -286,14 +286,14 @@ static void USB_Device_GetDescriptor(void)
#elif defined(USE_EEPROM_DESCRIPTORS)
Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);
#elif defined(USE_FLASH_DESCRIPTORS)
- Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
+ Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
#else
if (DescriptorAddressSpace == MEMSPACE_FLASH)
- Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
+ Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
else if (DescriptorAddressSpace == MEMSPACE_EEPROM)
Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);
else
- Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);
+ Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);
#endif
Endpoint_ClearOUT();
@@ -305,14 +305,14 @@ static void USB_Device_GetStatus(void)
switch (USB_ControlRequest.bmRequestType)
{
- #if !defined(NO_DEVICE_SELF_POWER) || !defined(NO_DEVICE_REMOTE_WAKEUP)
+ #if !defined(NO_DEVICE_SELF_POWER) || !defined(NO_DEVICE_REMOTE_WAKEUP)
case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE):
#if !defined(NO_DEVICE_SELF_POWER)
if (USB_CurrentlySelfPowered)
CurrentStatus |= FEATURE_SELFPOWERED_ENABLED;
#endif
- #if !defined(NO_DEVICE_REMOTE_WAKEUP)
+ #if !defined(NO_DEVICE_REMOTE_WAKEUP)
if (USB_RemoteWakeupEnabled)
CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
#endif
@@ -324,7 +324,7 @@ static void USB_Device_GetStatus(void)
CurrentStatus = Endpoint_IsStalled();
- Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
+ Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
break;
#endif
@@ -336,7 +336,7 @@ static void USB_Device_GetStatus(void)
Endpoint_Write_Word_LE(CurrentStatus);
Endpoint_ClearIN();
-
+
Endpoint_ClearStatusStage();
}
@@ -344,28 +344,28 @@ static void USB_Device_ClearSetFeature(void)
{
switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)
{
- #if !defined(NO_DEVICE_REMOTE_WAKEUP)
+ #if !defined(NO_DEVICE_REMOTE_WAKEUP)
case REQREC_DEVICE:
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_REMOTE_WAKEUP)
USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
else
return;
-
- break;
+
+ break;
#endif
#if !defined(CONTROL_ONLY_DEVICE)
case REQREC_ENDPOINT:
if ((uint8_t)USB_ControlRequest.wValue == FEATURE_ENDPOINT_HALT)
{
uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
-
+
if (EndpointIndex == ENDPOINT_CONTROLEP)
return;
Endpoint_SelectEndpoint(EndpointIndex);
if (Endpoint_IsEnabled())
- {
+ {
if (USB_ControlRequest.bRequest == REQ_SetFeature)
{
Endpoint_StallTransaction();
@@ -375,10 +375,10 @@ static void USB_Device_ClearSetFeature(void)
Endpoint_ClearStall();
Endpoint_ResetFIFO(EndpointIndex);
Endpoint_ResetDataToggle();
- }
+ }
}
}
-
+
break;
#endif
default:
@@ -393,3 +393,4 @@ static void USB_Device_ClearSetFeature(void)
}
#endif
+
diff --git a/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h
index a65b93b62..43a8d2011 100644
--- a/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h
+++ b/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,7 +48,7 @@
#include <util/atomic.h>
#include <stdint.h>
#include <stdbool.h>
-
+
#include "StdDescriptors.h"
#include "Events.h"
#include "StdRequestType.h"
@@ -64,13 +64,13 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
#if defined(USE_SINGLE_DEVICE_CONFIGURATION)
#define FIXED_NUM_CONFIGURATIONS 1
#endif
-
+
/* Enums: */
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
/** Enum for the possible descriptor memory spaces, for the MemoryAddressSpace of the
@@ -86,7 +86,7 @@
MEMSPACE_RAM = 2, /**< Indicates the requested descriptor is located in RAM memory. */
};
#endif
-
+
/* Global Variables: */
/** Indicates the currently set configuration number of the device. USB devices may have several
* different configurations which the host can select between; this indicates the currently selected
@@ -98,7 +98,7 @@
* \ingroup Group_Device
*/
extern uint8_t USB_ConfigurationNumber;
-
+
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
/** Indicates if the host is currently allowing the device to issue remote wakeup events. If this
* flag is cleared, the device should not issue remote wakeup events to the host.
@@ -108,7 +108,7 @@
* \n\n
*
* \note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported,
- * this global and the underlying management code can be disabled by defining the
+ * this global and the underlying management code can be disabled by defining the
* NO_DEVICE_REMOTE_WAKEUP token in the project makefile and passing it to the compiler via
* the -D switch.
*
@@ -116,7 +116,7 @@
*/
extern bool USB_RemoteWakeupEnabled;
#endif
-
+
#if !defined(NO_DEVICE_SELF_POWER)
/** Indicates if the device is currently being powered by its own power supply, rather than being
* powered by the host's USB supply. This flag should remain cleared if the device does not
@@ -126,7 +126,7 @@
*/
extern bool USB_CurrentlySelfPowered;
#endif
-
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
#if defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)
@@ -138,10 +138,10 @@
#elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS)
#error Only one of the USE_*_DESCRIPTORS modes should be selected.
#endif
-
+
/* Function Prototypes: */
void USB_Device_ProcessControlRequest(void);
-
+
#if defined(__INCLUDE_FROM_DEVICESTDREQ_C)
static void USB_Device_SetAddress(void);
static void USB_Device_SetConfiguration(void);
@@ -149,11 +149,11 @@
static void USB_Device_GetDescriptor(void);
static void USB_Device_GetStatus(void);
static void USB_Device_ClearSetFeature(void);
-
+
#if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)
static char USB_Device_NibbleToASCII(uint8_t Nibble) ATTR_ALWAYS_INLINE;
static void USB_Device_GetInternalSerialDescriptor(void);
- #endif
+ #endif
#endif
#endif
@@ -161,5 +161,6 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
+
diff --git a/LUFA/Drivers/USB/HighLevel/EndpointStream.c b/LUFA/Drivers/USB/HighLevel/EndpointStream.c
index 841f661be..794c9179f 100644
--- a/LUFA/Drivers/USB/HighLevel/EndpointStream.c
+++ b/LUFA/Drivers/USB/HighLevel/EndpointStream.c
@@ -230,4 +230,4 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
#include "Template/Template_Endpoint_Control_R.c"
-#endif \ No newline at end of file
+#endif
diff --git a/LUFA/Drivers/USB/HighLevel/EndpointStream.h b/LUFA/Drivers/USB/HighLevel/EndpointStream.h
index ba2cce8de..49099980a 100644
--- a/LUFA/Drivers/USB/HighLevel/EndpointStream.h
+++ b/LUFA/Drivers/USB/HighLevel/EndpointStream.h
@@ -522,3 +522,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/HighLevel/Events.c b/LUFA/Drivers/USB/HighLevel/Events.c
index ee2030e1a..9bd217f1e 100644
--- a/LUFA/Drivers/USB/HighLevel/Events.c
+++ b/LUFA/Drivers/USB/HighLevel/Events.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,3 +36,4 @@ void USB_Event_Stub(void)
{
}
+
diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h
index f1d6f0316..5f74a95ec 100644
--- a/LUFA/Drivers/USB/HighLevel/Events.h
+++ b/LUFA/Drivers/USB/HighLevel/Events.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,13 +64,13 @@
*
* @{
*/
-
+
#ifndef __USBEVENTS_H__
#define __USBEVENTS_H__
/* Includes: */
#include <stdint.h>
-
+
#include "../../../Common/Common.h"
#include "USBMode.h"
@@ -83,8 +83,8 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
- /* Public Interface - May be used in end-application: */
+
+ /* Public Interface - May be used in end-application: */
/* Pseudo-Functions for Doxygen: */
#if !defined(__INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__)
/** Event for USB mode pin level change. This event fires when the USB interface is set to dual role
@@ -112,7 +112,7 @@
* \ref Group_USBManagement documentation).
*/
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
-
+
/** Event for USB device attachment. This event fires when a the USB interface is in host mode, and
* a USB device has been connected to the USB interface. This is interrupt driven, thus fires before
* the standard \ref EVENT_USB_Device_Connect() event and so can be used to programmatically start the USB
@@ -141,11 +141,11 @@
* \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
*/
void EVENT_USB_Host_DeviceUnattached(void);
-
+
/** Event for USB device enumeration failure. This event fires when a the USB interface is
* in host mode, and an attached USB device has failed to enumerate completely.
*
- * \param[in] ErrorCode Error code indicating the failure reason, a value in
+ * \param[in] ErrorCode Error code indicating the failure reason, a value in
* \ref USB_Host_EnumerationErrorCodes_t.
*
* \param[in] SubErrorCode Sub error code indicating the reason for failure - for example, if the
@@ -327,17 +327,17 @@
*/
void EVENT_USB_Device_StartOfFrame(void);
#endif
-
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_EVENTS_C)
void USB_Event_Stub(void) ATTR_CONST;
-
+
#if defined(USB_CAN_BE_BOTH)
void EVENT_USB_UIDChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
#endif
-
+
#if defined(USB_CAN_BE_HOST)
void EVENT_USB_Host_HostError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
void EVENT_USB_Host_DeviceAttached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
@@ -366,7 +366,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/HighLevel/HostStandardReq.c b/LUFA/Drivers/USB/HighLevel/HostStandardReq.c
index 182cd6979..42688b9e1 100644
--- a/LUFA/Drivers/USB/HighLevel/HostStandardReq.c
+++ b/LUFA/Drivers/USB/HighLevel/HostStandardReq.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,7 +45,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
uint16_t DataLen = USB_ControlRequest.wLength;
USB_Host_ResumeBus();
-
+
if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
goto End_Of_Control_Send;
@@ -58,7 +58,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
Pipe_Write_Byte(*(HeaderStream++));
Pipe_ClearSETUP();
-
+
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_SetupSent)) != HOST_SENDCONTROL_Successful)
goto End_Of_Control_Send;
@@ -70,7 +70,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_DIRECTION) == REQDIR_DEVICETOHOST)
{
Pipe_SetPipeToken(PIPE_TOKEN_IN);
-
+
if (DataStream != NULL)
{
while (DataLen)
@@ -79,10 +79,10 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful)
goto End_Of_Control_Send;
-
+
if (!(Pipe_BytesInPipe()))
DataLen = 0;
-
+
while (Pipe_BytesInPipe() && DataLen)
{
*(DataStream++) = Pipe_Read_Byte();
@@ -96,7 +96,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
Pipe_Unfreeze();
-
+
if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
goto End_Of_Control_Send;
@@ -110,7 +110,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
if (DataStream != NULL)
{
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
- Pipe_Unfreeze();
+ Pipe_Unfreeze();
while (DataLen)
{
@@ -118,11 +118,11 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
goto End_Of_Control_Send;
while (DataLen && (Pipe_BytesInPipe() < USB_ControlPipeSize))
- {
+ {
Pipe_Write_Byte(*(DataStream++));
DataLen--;
}
-
+
Pipe_ClearOUT();
}
@@ -131,7 +131,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
Pipe_Freeze();
}
-
+
Pipe_SetPipeToken(PIPE_TOKEN_IN);
Pipe_Unfreeze();
@@ -143,7 +143,7 @@ uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
End_Of_Control_Send:
Pipe_Freeze();
-
+
if (BusSuspended)
USB_Host_SuspendBus();
@@ -155,11 +155,11 @@ End_Of_Control_Send:
static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType)
{
#if (USB_HOST_TIMEOUT_MS < 0xFF)
- uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
+ uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
#else
uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
#endif
-
+
while (!(((WaitType == USB_HOST_WAITFOR_SetupSent) && Pipe_IsSETUPSent()) ||
((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) ||
((WaitType == USB_HOST_WAITFOR_OutReady) && Pipe_IsOUTReady())))
@@ -168,7 +168,7 @@ static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType)
if ((ErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
return ErrorCode;
-
+
if (!(TimeoutCounter--))
return HOST_SENDCONTROL_SoftwareTimeOut;
}
@@ -177,3 +177,4 @@ static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType)
}
#endif
+
diff --git a/LUFA/Drivers/USB/HighLevel/HostStandardReq.h b/LUFA/Drivers/USB/HighLevel/HostStandardReq.h
index 358f3d3ad..02b8bb81a 100644
--- a/LUFA/Drivers/USB/HighLevel/HostStandardReq.h
+++ b/LUFA/Drivers/USB/HighLevel/HostStandardReq.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -44,11 +44,11 @@
/* Includes: */
#include <stdint.h>
#include <stdbool.h>
-
+
#include "USBMode.h"
#include "StdRequestType.h"
#include "../LowLevel/USBController.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -58,7 +58,7 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Enums: */
/** Enum for the \ref USB_Host_SendControlRequest() return code, indicating the reason for the error
@@ -78,7 +78,7 @@
*/
HOST_SENDCONTROL_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */
};
-
+
/* Function Prototypes: */
/** Sends the request stored in the \ref USB_ControlRequest global structure to the attached device,
* and transfers the data stored in the buffer to the device, or from the device to the buffer
@@ -92,7 +92,7 @@
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
*/
uint8_t USB_Host_SendControlRequest(void* const BufferPtr);
-
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Enums: */
@@ -102,7 +102,7 @@
USB_HOST_WAITFOR_InReceived,
USB_HOST_WAITFOR_OutReady,
};
-
+
/* Function Prototypes: */
#if defined(__INCLUDE_FROM_HOSTSTDREQ_C)
static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType);
@@ -113,5 +113,6 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
+
diff --git a/LUFA/Drivers/USB/HighLevel/PipeStream.c b/LUFA/Drivers/USB/HighLevel/PipeStream.c
index 72a7e64d3..c5f9e8286 100644
--- a/LUFA/Drivers/USB/HighLevel/PipeStream.c
+++ b/LUFA/Drivers/USB/HighLevel/PipeStream.c
@@ -193,3 +193,4 @@ uint8_t Pipe_Discard_Stream(uint16_t Length
#include "Template/Template_Pipe_RW.c"
#endif
+
diff --git a/LUFA/Drivers/USB/HighLevel/PipeStream.h b/LUFA/Drivers/USB/HighLevel/PipeStream.h
index ba5df5788..3e2a3c324 100644
--- a/LUFA/Drivers/USB/HighLevel/PipeStream.h
+++ b/LUFA/Drivers/USB/HighLevel/PipeStream.h
@@ -296,3 +296,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h
index 00b60c3d3..2a87619b4 100644
--- a/LUFA/Drivers/USB/HighLevel/StdDescriptors.h
+++ b/LUFA/Drivers/USB/HighLevel/StdDescriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,7 +45,7 @@
*
* @{
*/
-
+
#ifndef __USBDESCRIPTORS_H__
#define __USBDESCRIPTORS_H__
@@ -58,7 +58,7 @@
#include "../../../Common/Common.h"
#include "USBMode.h"
#include "Events.h"
-
+
#if defined(USB_CAN_BE_DEVICE)
#include "../LowLevel/Device.h"
#endif
@@ -72,7 +72,7 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors
@@ -98,7 +98,7 @@
#else
#define USE_INTERNAL_SERIAL NO_DESCRIPTOR
#endif
-
+
/** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes. */
#define USB_CONFIG_POWER_MA(mA) ((mA) >> 1)
@@ -106,7 +106,7 @@
* Should be used in string descriptor's headers for giving the string descriptor's byte length.
*/
#define USB_STRING_LEN(str) (sizeof(USB_Descriptor_Header_t) + ((str) << 1))
-
+
/** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded
* Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the
* standard device descriptor.
@@ -129,7 +129,7 @@
* EndpointAddress value to indicate to the host that the endpoint is of the OUT direction (i.e, from
* host to device).
*/
- #define ENDPOINT_DESCRIPTOR_DIR_OUT 0x00
+ #define ENDPOINT_DESCRIPTOR_DIR_OUT 0x00
/** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t
* descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power
@@ -177,7 +177,7 @@
* \see The USB specification for more details on the possible Endpoint attributes.
*/
#define ENDPOINT_ATTR_SYNC (3 << 2)
-
+
/** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
* Attributes value to indicate that the specified endpoint is used for data transfers.
*
@@ -198,7 +198,7 @@
* \see The USB specification for more details on the possible Endpoint usage attributes.
*/
#define ENDPOINT_USAGE_IMPLICIT_FEEDBACK (2 << 4)
-
+
/* Enums: */
/** Enum for the possible standard descriptor types, as given in each descriptor's header. */
enum USB_DescriptorTypes_t
@@ -231,7 +231,7 @@
* given by the specific class.
*/
} USB_Descriptor_Header_t;
-
+
/** \brief Standard USB Descriptor Header (USB-IF naming conventions).
*
* Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure
@@ -246,7 +246,7 @@
* given by the specific class.
*/
} USB_StdDescriptor_Header_t;
-
+
/** \brief Standard USB Device Descriptor (LUFA naming conventions).
*
* Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each
@@ -262,13 +262,13 @@
uint8_t Class; /**< USB device class. */
uint8_t SubClass; /**< USB device subclass. */
uint8_t Protocol; /**< USB device protocol. */
-
+
uint8_t Endpoint0Size; /**< Size of the control (address 0) endpoint's bank in bytes. */
-
+
uint16_t VendorID; /**< Vendor ID for the USB product. */
uint16_t ProductID; /**< Unique product ID for the USB product. */
uint16_t ReleaseNumber; /**< Product release (version) number. */
-
+
uint8_t ManufacturerStrIndex; /**< String index for the manufacturer's name. The
* host will request this string via a separate
* control request for the string descriptor.
@@ -354,7 +354,7 @@
typedef struct
{
USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
-
+
uint16_t TotalConfigurationSize; /**< Size of the configuration descriptor header,
* and all sub descriptors inside the configuration.
*/
@@ -362,17 +362,17 @@
uint8_t ConfigurationNumber; /**< Configuration index of the current configuration. */
uint8_t ConfigurationStrIndex; /**< Index of a string descriptor describing the configuration. */
-
+
uint8_t ConfigAttributes; /**< Configuration attributes, comprised of a mask of zero or
* more USB_CONFIG_ATTR_* masks.
*/
-
+
uint8_t MaxPowerConsumption; /**< Maximum power consumption of the device while in the
* current configuration, calculated by the \ref USB_CONFIG_POWER_MA()
* macro.
*/
} USB_Descriptor_Configuration_Header_t;
-
+
/** \brief Standard USB Configuration Descriptor (USB-IF naming conventions).
*
* Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names
@@ -419,14 +419,14 @@
* selected by the host.
*/
uint8_t TotalEndpoints; /**< Total number of endpoints in the interface. */
-
+
uint8_t Class; /**< Interface class ID. */
uint8_t SubClass; /**< Interface subclass ID. */
uint8_t Protocol; /**< Interface protocol ID. */
uint8_t InterfaceStrIndex; /**< Index of the string descriptor describing the interface. */
} USB_Descriptor_Interface_t;
-
+
/** \brief Standard USB Interface Descriptor (USB-IF naming conventions).
*
* Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names
@@ -471,7 +471,7 @@
typedef struct
{
USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
-
+
uint8_t FirstInterfaceIndex; /**< Index of the first associated interface. */
uint8_t TotalInterfaces; /**< Total number of associated interfaces. */
@@ -483,7 +483,7 @@
* interface association.
*/
} USB_Descriptor_Interface_Association_t;
-
+
/** \brief Standard USB Interface Association Descriptor (USB-IF naming conventions).
*
* Type define for a standard Interface Association Descriptor. This structure uses the relevant standard's given
@@ -538,7 +538,7 @@
* or ISOCHRONOUS type.
*/
} USB_Descriptor_Endpoint_t;
-
+
/** \brief Standard USB Endpoint Descriptor (USB-IF naming conventions).
*
* Type define for a standard Endpoint Descriptor. This structure uses the relevant standard's given
@@ -553,10 +553,10 @@
uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a
* value given by the specific class.
*/
- uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
+ uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
* configuration, including direction mask.
*/
- uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
+ uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
* and attributes (ENDPOINT_ATTR_*) masks.
*/
uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size
@@ -583,7 +583,7 @@
typedef struct
{
USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
-
+
wchar_t UnicodeString[]; /**< String data, as unicode characters (alternatively,
* string language IDs). If normal ASCII characters are
* to be used, they must be added as an array of characters
@@ -636,12 +636,13 @@
#define VERSION_TENTHS(x) (int)(((x) - (int)(x)) * 10)
#define VERSION_HUNDREDTHS(x) (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x)))
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/HighLevel/StdRequestType.h b/LUFA/Drivers/USB/HighLevel/StdRequestType.h
index abb5431f7..3729c0a97 100644
--- a/LUFA/Drivers/USB/HighLevel/StdRequestType.h
+++ b/LUFA/Drivers/USB/HighLevel/StdRequestType.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
* \note This file should not be included directly. It is automatically included as needed by the USB driver
* dispatch header located in LUFA/Drivers/USB/USB.h.
*/
-
+
/** \ingroup Group_USB
* @defgroup Group_StdRequest Standard USB Requests
*
@@ -56,7 +56,7 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the request type parameter, to indicate the direction of the request data (Host to Device
@@ -137,7 +137,7 @@
* \see \ref CONTROL_REQTYPE_RECIPIENT macro.
*/
#define REQREC_OTHER (3 << 0)
-
+
/** Feature indicator for Clear Feature or Set Feature commands. When used in a Clear Feature
* request this indicates that an endpoint (whose address is given elsewhere in the request
* should have its stall condition cleared. If used in a similar manner inside a Set Feature
@@ -229,3 +229,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h b/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h
index dc3495285..991544cec 100644
--- a/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h
+++ b/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -37,7 +37,7 @@
* \note This file should not be included directly. It is automatically included as needed by the USB driver
* dispatch header located in LUFA/Drivers/USB/USB.h.
*/
-
+
/** \ingroup Group_USB
* @defgroup Group_StreamCallbacks Endpoint and Pipe Stream Callbacks
*
@@ -47,7 +47,7 @@
*
* @{
*/
-
+
#ifndef __STREAMCALLBACK_H__
#define __STREAMCALLBACK_H__
@@ -58,14 +58,14 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Used with the Endpoint and Pipe stream functions as the callback function parameter, indicating that the stream
* call has no callback function to be called between USB packets.
*/
#define NO_STREAM_CALLBACK NULL
-
+
/* Enums: */
/** Enum for the possible error return codes of a stream callback function. */
enum StreamCallback_Return_ErrorCodes_t
@@ -80,7 +80,8 @@
* are to be used as the callback parameter of the stream functions.
*/
typedef uint8_t (* const StreamCallbackPtr_t)(void);
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c
index c8bfaeb70..5cc11d7fe 100644
--- a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c
+++ b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c
@@ -2,10 +2,10 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
uint16_t Length)
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
-
+
if (!(Length))
Endpoint_ClearOUT();
-
+
while (Length)
{
uint8_t USB_DeviceState_LCL = USB_DeviceState;
@@ -16,7 +16,7 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
return ENDPOINT_RWCSTREAM_BusSuspended;
else if (Endpoint_IsSETUPReceived())
return ENDPOINT_RWCSTREAM_HostAborted;
-
+
if (Endpoint_IsOUTReceived())
{
while (Length && Endpoint_BytesInEndpoint())
@@ -24,11 +24,11 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
TEMPLATE_TRANSFER_BYTE(DataStream);
Length--;
}
-
+
Endpoint_ClearOUT();
- }
+ }
}
-
+
while (!(Endpoint_IsINReady()))
{
uint8_t USB_DeviceState_LCL = USB_DeviceState;
@@ -38,11 +38,11 @@ uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
return ENDPOINT_RWCSTREAM_BusSuspended;
}
-
+
return ENDPOINT_RWCSTREAM_NoError;
}
#undef TEMPLATE_BUFFER_OFFSET
#undef TEMPLATE_FUNC_NAME
-#undef TEMPLATE_TRANSFER_BYTE \ No newline at end of file
+#undef TEMPLATE_TRANSFER_BYTE
diff --git a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c
index 0ae7febc4..16fe3999b 100644
--- a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c
+++ b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c
@@ -3,7 +3,7 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
bool LastPacketFull = false;
-
+
if (Length > USB_ControlRequest.wLength)
Length = USB_ControlRequest.wLength;
else if (!(Length))
@@ -12,7 +12,7 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
while (Length || LastPacketFull)
{
uint8_t USB_DeviceState_LCL = USB_DeviceState;
-
+
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
return ENDPOINT_RWCSTREAM_DeviceDisconnected;
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
@@ -25,19 +25,19 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
if (Endpoint_IsINReady())
{
uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();
-
+
while (Length && (BytesInEndpoint < USB_ControlEndpointSize))
{
TEMPLATE_TRANSFER_BYTE(DataStream);
Length--;
BytesInEndpoint++;
}
-
+
LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize);
Endpoint_ClearIN();
}
}
-
+
while (!(Endpoint_IsOUTReceived()))
{
uint8_t USB_DeviceState_LCL = USB_DeviceState;
@@ -53,4 +53,4 @@ uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
#undef TEMPLATE_BUFFER_OFFSET
#undef TEMPLATE_FUNC_NAME
-#undef TEMPLATE_TRANSFER_BYTE \ No newline at end of file
+#undef TEMPLATE_TRANSFER_BYTE
diff --git a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c
index fc9df951d..6657f38eb 100644
--- a/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c
+++ b/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c
@@ -4,7 +4,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t ErrorCode;
-
+
if ((ErrorCode = Endpoint_WaitUntilReady()))
return ErrorCode;
@@ -34,7 +34,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
}
Length -= 8;
-
+
TEMPLATE_TRANSFER_BYTE(DataStream);
case 7: TEMPLATE_TRANSFER_BYTE(DataStream);
case 6: TEMPLATE_TRANSFER_BYTE(DataStream);
@@ -43,7 +43,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
case 3: TEMPLATE_TRANSFER_BYTE(DataStream);
case 2: TEMPLATE_TRANSFER_BYTE(DataStream);
case 1: TEMPLATE_TRANSFER_BYTE(DataStream);
- } while (Length >= 8);
+ } while (Length >= 8);
}
}
#endif
@@ -76,4 +76,4 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
#undef TEMPLATE_BUFFER_TYPE
#undef TEMPLATE_TRANSFER_BYTE
#undef TEMPLATE_CLEAR_ENDPOINT
-#undef TEMPLATE_BUFFER_OFFSET \ No newline at end of file
+#undef TEMPLATE_BUFFER_OFFSET
diff --git a/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c b/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c
index fb64dd837..a998469d2 100644
--- a/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c
+++ b/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c
@@ -4,7 +4,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
{
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
uint8_t ErrorCode;
-
+
Pipe_SetPipeToken(TEMPLATE_TOKEN);
if ((ErrorCode = Pipe_WaitUntilReady()))
@@ -36,7 +36,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
}
Length -= 8;
-
+
TEMPLATE_TRANSFER_BYTE(DataStream);
case 7: TEMPLATE_TRANSFER_BYTE(DataStream);
case 6: TEMPLATE_TRANSFER_BYTE(DataStream);
@@ -45,7 +45,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
case 3: TEMPLATE_TRANSFER_BYTE(DataStream);
case 2: TEMPLATE_TRANSFER_BYTE(DataStream);
case 1: TEMPLATE_TRANSFER_BYTE(DataStream);
- } while (Length >= 8);
+ } while (Length >= 8);
}
}
#endif
@@ -70,7 +70,7 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
Length--;
}
}
-
+
return PIPE_RWSTREAM_NoError;
}
@@ -80,3 +80,4 @@ uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
#undef TEMPLATE_TRANSFER_BYTE
#undef TEMPLATE_CLEAR_PIPE
#undef TEMPLATE_BUFFER_OFFSET
+
diff --git a/LUFA/Drivers/USB/HighLevel/USBMode.h b/LUFA/Drivers/USB/HighLevel/USBMode.h
index f9abd9988..4f44972db 100644
--- a/LUFA/Drivers/USB/HighLevel/USBMode.h
+++ b/LUFA/Drivers/USB/HighLevel/USBMode.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -58,7 +58,7 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
#if defined(__DOXYGEN__)
/** Indicates that the target AVR microcontroller belongs to the Series 2 USB controller
@@ -96,7 +96,7 @@
*/
#define USB_CAN_BE_BOTH
#else
- /* Macros: */
+ /* Macros: */
#if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__))
#define USB_SERIES_2_AVR
@@ -106,13 +106,13 @@
#define USB_SERIES_6_AVR
#elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
#define USB_SERIES_7_AVR
- #endif
+ #endif
- #if !defined(USB_SERIES_7_AVR)
+ #if !defined(USB_SERIES_7_AVR)
#if defined(USB_HOST_ONLY)
#error USB_HOST_ONLY is not available for the currently selected USB AVR model.
#endif
-
+
#if !defined(USB_DEVICE_ONLY)
#define USB_DEVICE_ONLY
#endif
@@ -127,12 +127,12 @@
#elif defined(USB_DEVICE_ONLY)
#define USB_CAN_BE_DEVICE
#endif
-
+
#if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
#error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
#endif
#endif
-
+
#endif
-/** @} */ \ No newline at end of file
+/** @} */
diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.c b/LUFA/Drivers/USB/HighLevel/USBTask.c
index a2737f7d0..aeb9e787d 100644
--- a/LUFA/Drivers/USB/HighLevel/USBTask.c
+++ b/LUFA/Drivers/USB/HighLevel/USBTask.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -63,12 +63,12 @@ static void USB_DeviceTask(void)
if (USB_DeviceState != DEVICE_STATE_Unattached)
{
uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint();
-
+
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
if (Endpoint_IsSETUPReceived())
USB_Device_ProcessControlRequest();
-
+
Endpoint_SelectEndpoint(PrevEndpoint);
}
}
@@ -78,11 +78,12 @@ static void USB_DeviceTask(void)
static void USB_HostTask(void)
{
uint8_t PrevPipe = Pipe_GetCurrentPipe();
-
+
Pipe_SelectPipe(PIPE_CONTROLPIPE);
USB_Host_ProcessNextHostState();
-
+
Pipe_SelectPipe(PrevPipe);
}
#endif
+
diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.h b/LUFA/Drivers/USB/HighLevel/USBTask.h
index 2af1bd3d2..3b7f5c827 100644
--- a/LUFA/Drivers/USB/HighLevel/USBTask.h
+++ b/LUFA/Drivers/USB/HighLevel/USBTask.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,7 +45,7 @@
#include <avr/interrupt.h>
#include <stdint.h>
#include <stdbool.h>
-
+
#include "../LowLevel/USBController.h"
#include "Events.h"
#include "StdRequestType.h"
@@ -59,7 +59,7 @@
#if defined(USB_CAN_BE_HOST)
#include "HostStandardReq.h"
#endif
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -69,7 +69,7 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Global Variables: */
/** Indicates if the USB interface is currently initialized but not necessarily connected to a host
@@ -90,7 +90,7 @@
* \ingroup Group_USBManagement
*/
extern USB_Request_Header_t USB_ControlRequest;
-
+
#if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)
#if !defined(HOST_STATE_AS_GPIOR) || defined(__DOXYGEN__)
/** Indicates the current host state machine state. When in host mode, this indicates the state
@@ -101,7 +101,7 @@
* the library internally.
*
* To reduce program size and speed up checks of this global, it can be placed into one of the AVR's
- * GPIOR hardware registers instead of RAM by defining the HOST_STATE_AS_GPIOR token to a value
+ * GPIOR hardware registers instead of RAM by defining the HOST_STATE_AS_GPIOR token to a value
* between 0 and 2 in the project makefile and passing it to the compiler via the -D switch. When
* defined, the corresponding GPIOR register should not be used in the user application except
* implicitly via the library APIs.
@@ -130,7 +130,7 @@
* (see \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events).
*
* To reduce program size and speed up checks of this global, it can be placed into one of the AVR's
- * GPIOR hardware registers instead of RAM by defining the DEVICE_STATE_AS_GPIOR token to a value
+ * GPIOR hardware registers instead of RAM by defining the DEVICE_STATE_AS_GPIOR token to a value
* between 0 and 2 in the project makefile and passing it to the compiler via the -D switch. When
* defined, the corresponding GPIOR register should not be used in the user application except
* implicitly via the library APIs.
@@ -162,7 +162,7 @@
* The USB task must be serviced within 30ms while in device mode, or within 1ms while in host mode.
* The task may be serviced at all times, or (for minimum CPU consumption):
*
- * - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Device_Connect()
+ * - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Device_Connect()
* event and disabled again on the firing of the \ref EVENT_USB_Device_Disconnect() event.
*
* - In host mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Host_DeviceAttached()
@@ -185,21 +185,22 @@
#if defined(USB_CAN_BE_HOST)
static void USB_HostTask(void);
#endif
-
+
#if defined(USB_CAN_BE_DEVICE)
static void USB_DeviceTask(void);
#endif
#endif
-
+
/* Macros: */
#define HOST_TASK_NONBLOCK_WAIT(Duration, NextState) MACROS{ USB_HostState = HOST_STATE_WaitForDevice; \
WaitMSRemaining = (Duration); \
PostWaitState = (NextState); }MACROE
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
+
diff --git a/LUFA/Drivers/USB/LowLevel/Device.c b/LUFA/Drivers/USB/LowLevel/Device.c
index 5355ca27c..29dca81cf 100644
--- a/LUFA/Drivers/USB/LowLevel/Device.c
+++ b/LUFA/Drivers/USB/LowLevel/Device.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,3 +50,4 @@ void USB_Device_SendRemoteWakeup(void)
}
#endif
+
diff --git a/LUFA/Drivers/USB/LowLevel/Device.h b/LUFA/Drivers/USB/LowLevel/Device.h
index 03440d28f..20c915783 100644
--- a/LUFA/Drivers/USB/LowLevel/Device.h
+++ b/LUFA/Drivers/USB/LowLevel/Device.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,7 +54,7 @@
#include <avr/pgmspace.h>
#include <avr/eeprom.h>
- #include "../../../Common/Common.h"
+ #include "../../../Common/Common.h"
#include "../HighLevel/StdDescriptors.h"
#include "USBInterrupt.h"
#include "Endpoint.h"
@@ -67,7 +67,7 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
@@ -82,7 +82,7 @@
*/
#define USB_DEVICE_OPT_LOWSPEED (1 << 0)
#endif
-
+
/** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the
* USB interface should be initialized in full speed (12Mb/s) mode.
*/
@@ -109,7 +109,7 @@
* \see \ref Group_Descriptors for more information on the RMWAKEUP feature and device descriptors.
*/
void USB_Device_SendRemoteWakeup(void);
-
+
/* Type Defines: */
enum USB_Device_States_t
{
@@ -138,7 +138,7 @@
* resumed.
*/
};
-
+
/* Inline Functions: */
/** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host)
* the frame number is incremented by one.
@@ -147,7 +147,7 @@
{
return UDFNUM;
}
-
+
#if !defined(NO_SOF_EVENTS)
/** Enables the device mode Start Of Frame events. When enabled, this causes the
* \ref EVENT_USB_Device_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus,
@@ -160,7 +160,7 @@
{
USB_INT_Enable(USB_INT_SOFI);
}
-
+
/** Disables the device mode Start Of Frame events. When disabled, this stops the firing of the
* \ref EVENT_USB_Device_StartOfFrame() event when enumerated in device mode.
*
@@ -172,13 +172,13 @@
USB_INT_Disable(USB_INT_SOFI);
}
#endif
-
+
/* Function Prototypes: */
/** Function to retrieve a given descriptor's size and memory location from the given descriptor type value,
- * index and language ID. This function MUST be overridden in the user application (added with full, identical
+ * index and language ID. This function MUST be overridden in the user application (added with full, identical
* prototype and name so that the library can call it to retrieve descriptor data.
*
- * \param[in] wValue The type of the descriptor to retrieve in the upper byte, and the index in the
+ * \param[in] wValue The type of the descriptor to retrieve in the upper byte, and the index in the
* lower byte (when more than one descriptor of the given type exists, such as the
* case of string descriptors). The type may be one of the standard types defined
* in the DescriptorTypes_t enum, or may be a class-specific descriptor type value.
@@ -193,7 +193,7 @@
*
* \note By default, the library expects all descriptors to be located in flash memory via the PROGMEM attribute.
* If descriptors should be located in RAM or EEPROM instead (to speed up access in the case of RAM, or to
- * allow the descriptors to be changed dynamically at runtime) either the USE_RAM_DESCRIPTORS or the
+ * allow the descriptors to be changed dynamically at runtime) either the USE_RAM_DESCRIPTORS or the
* USE_EEPROM_DESCRIPTORS tokens may be defined in the project makefile and passed to the compiler by the -D
* switch.
*
@@ -216,14 +216,14 @@
{
UDCON |= (1 << LSM);
}
-
+
static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE;
static inline void USB_Device_SetFullSpeed(void)
{
UDCON &= ~(1 << LSM);
}
#endif
-
+
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void USB_Device_SetDeviceAddress(const uint8_t Address)
{
@@ -241,3 +241,4 @@
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.c b/LUFA/Drivers/USB/LowLevel/Endpoint.c
index fc2bff154..c0e639209 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.c
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -59,7 +59,7 @@ void Endpoint_ClearEndpoints(void)
for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++)
{
- Endpoint_SelectEndpoint(EPNum);
+ Endpoint_SelectEndpoint(EPNum);
UEIENX = 0;
UEINTX = 0;
UECFG1X = 0;
@@ -86,7 +86,7 @@ void Endpoint_ClearStatusStage(void)
if (USB_DeviceState == DEVICE_STATE_Unattached)
return;
}
-
+
Endpoint_ClearIN();
}
}
@@ -95,7 +95,7 @@ void Endpoint_ClearStatusStage(void)
uint8_t Endpoint_WaitUntilReady(void)
{
#if (USB_STREAM_TIMEOUT_MS < 0xFF)
- uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
+ uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
#else
uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
#endif
@@ -114,13 +114,13 @@ uint8_t Endpoint_WaitUntilReady(void)
if (Endpoint_IsOUTReceived())
return ENDPOINT_READYWAIT_NoError;
}
-
+
uint8_t USB_DeviceState_LCL = USB_DeviceState;
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
return ENDPOINT_READYWAIT_DeviceDisconnected;
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
- return ENDPOINT_READYWAIT_BusSuspended;
+ return ENDPOINT_READYWAIT_BusSuspended;
else if (Endpoint_IsStalled())
return ENDPOINT_READYWAIT_EndpointStalled;
@@ -138,3 +138,4 @@ uint8_t Endpoint_WaitUntilReady(void)
#endif
#endif
+
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h
index 66f5591f0..25ed9bad9 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.h
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,13 +43,13 @@
*
* Functions, macros, variables, enums and types related to data reading and writing from and to endpoints.
*/
-
+
/** \ingroup Group_EndpointRW
* @defgroup Group_EndpointPrimitiveRW Read/Write of Primitive Data Types
*
* Functions, macros, variables, enums and types related to data reading and writing of primitive data types
* from and to endpoints.
- */
+ */
/** \ingroup Group_EndpointManagement
* @defgroup Group_EndpointPacketManagement Endpoint Packet Management
@@ -77,7 +77,7 @@
#include "../../../Common/Common.h"
#include "../HighLevel/USBTask.h"
#include "USBInterrupt.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -98,10 +98,10 @@
#define _ENDPOINT_GET_DOUBLEBANK(EPIndex) _ENDPOINT_GET_DOUBLEBANK2(ENDPOINT_DETAILS_EP ## EPIndex)
#define _ENDPOINT_GET_DOUBLEBANK2(EPDetails) _ENDPOINT_GET_DOUBLEBANK3(EPDetails)
#define _ENDPOINT_GET_DOUBLEBANK3(MaxSize, DB) (DB)
-
+
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
#define ENDPOINT_DETAILS_MAXEP 7
-
+
#define ENDPOINT_DETAILS_EP0 64, true
#define ENDPOINT_DETAILS_EP1 256, true
#define ENDPOINT_DETAILS_EP2 64, true
@@ -116,7 +116,7 @@
#define ENDPOINT_DETAILS_EP1 64, false
#define ENDPOINT_DETAILS_EP2 64, false
#define ENDPOINT_DETAILS_EP3 64, true
- #define ENDPOINT_DETAILS_EP4 64, true
+ #define ENDPOINT_DETAILS_EP4 64, true
#endif
/* Inline Functions: */
@@ -126,13 +126,13 @@
{
uint8_t MaskVal = 0;
uint16_t CheckBytes = 8;
-
+
while (CheckBytes < Bytes)
{
MaskVal++;
CheckBytes <<= 1;
}
-
+
return (MaskVal << EPSIZE0);
}
@@ -143,7 +143,7 @@
const uint8_t UECFG1XData);
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
@@ -169,19 +169,19 @@
* accesses the second bank.
*/
#define ENDPOINT_BANK_DOUBLE (1 << EPBK0)
-
+
/** Endpoint address for the default control endpoint, which always resides in address 0. This is
* defined for convenience to give more readable code when used with the endpoint macros.
*/
#define ENDPOINT_CONTROLEP 0
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__))
- /** Default size of the default control endpoint's bank, until altered by the control endpoint bank size
+ /** Default size of the default control endpoint's bank, until altered by the control endpoint bank size
* value in the device descriptor. Not available if the FIXED_CONTROL_ENDPOINT_SIZE token is defined.
*/
#define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8
#endif
-
+
/** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's
* numerical address in the device.
*/
@@ -196,17 +196,17 @@
* bank size in the device.
*/
#define ENDPOINT_EPSIZE_MASK 0x7F
-
+
/** Maximum size in bytes of a given endpoint.
*
* \param[in] EPIndex Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1)
- */
+ */
#define ENDPOINT_MAX_SIZE(EPIndex) _ENDPOINT_GET_MAXSIZE(EPIndex)
/** Indicates if the given endpoint supports double banking.
*
* \param[in] EPIndex Endpoint number, a value between 0 and (ENDPOINT_TOTAL_ENDPOINTS - 1)
- */
+ */
#define ENDPOINT_DOUBLEBANK_SUPPORTED(EPIndex) _ENDPOINT_GET_DOUBLEBANK(EPIndex)
#if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__)
@@ -243,7 +243,7 @@
*/
};
- /* Inline Functions: */
+ /* Inline Functions: */
/** Configures the specified endpoint number with the given endpoint type, direction, bank size
* and banking mode. Once configured, the endpoint may be read from or written to, depending
* on its direction.
@@ -274,7 +274,7 @@
* index - refer to the chosen USB AVR's datasheet to determine the maximum bank size for each endpoint.
* \n\n
*
- * \note The default control endpoint should not be manually configured by the user application, as
+ * \note The default control endpoint should not be manually configured by the user application, as
* it is automatically configured by the library internally.
* \n\n
*
@@ -318,7 +318,7 @@
return UEBCLX;
#endif
}
-
+
/** Get the endpoint address of the currently selected endpoint. This is typically used to save
* the currently selected endpoint number so that it can be restored after another endpoint has
* been manipulated.
@@ -334,7 +334,7 @@
return ENDPOINT_CONTROLEP;
#endif
}
-
+
/** Selects the given endpoint number. If the address from the device descriptors is used, the
* value should be masked with the \ref ENDPOINT_EPNUM_MASK constant to extract only the endpoint
* number (and discarding the endpoint direction bit).
@@ -349,9 +349,9 @@
{
#if !defined(CONTROL_ONLY_DEVICE)
UENUM = EndpointNumber;
- #endif
+ #endif
}
-
+
/** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
* In and Out pointers to the bank's contents.
*
@@ -363,7 +363,7 @@
UERST = (1 << EndpointNumber);
UERST = 0;
}
-
+
/** Enables the currently selected endpoint so that data can be sent and received through it to
* and from a host.
*
@@ -383,7 +383,7 @@
{
UECONX &= ~(1 << EPEN);
}
-
+
/** Determines if the currently selected endpoint is enabled, but not necessarily configured.
*
* \return Boolean True if the currently selected endpoint is enabled, false otherwise.
@@ -393,7 +393,7 @@
{
return ((UECONX & (1 << EPEN)) ? true : false);
}
-
+
/** Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint
* bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an IN
* direction). This function will return false if an error has occurred in the endpoint, if the endpoint
@@ -409,7 +409,7 @@
{
return ((UEINTX & (1 << RWAL)) ? true : false);
}
-
+
/** Determines if the currently selected endpoint is configured.
*
* \return Boolean true if the currently selected endpoint has been configured, false otherwise.
@@ -419,7 +419,7 @@
{
return ((UESTA0X & (1 << CFGOK)) ? true : false);
}
-
+
/** Returns a mask indicating which INTERRUPT type endpoints have interrupted - i.e. their
* interrupt duration has elapsed. Which endpoints have interrupted can be determined by
* masking the return value against (1 << {Endpoint Number}).
@@ -431,7 +431,7 @@
{
return UEINT;
}
-
+
/** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type
* endpoints).
*
@@ -444,7 +444,7 @@
{
return ((UEINT & (1 << EndpointNumber)) ? true : false);
}
-
+
/** Determines if the selected IN endpoint is ready for a new packet to be sent to the host.
*
* \ingroup Group_EndpointPacketManagement
@@ -456,7 +456,7 @@
{
return ((UEINTX & (1 << TXINI)) ? true : false);
}
-
+
/** Determines if the selected OUT endpoint has received new packet from the host.
*
* \ingroup Group_EndpointPacketManagement
@@ -468,7 +468,7 @@
{
return ((UEINTX & (1 << RXOUTI)) ? true : false);
}
-
+
/** Determines if the current CONTROL type endpoint has received a SETUP packet.
*
* \ingroup Group_EndpointPacketManagement
@@ -480,20 +480,20 @@
{
return ((UEINTX & (1 << RXSTPI)) ? true : false);
}
-
+
/** Clears a received SETUP packet on the currently selected CONTROL type endpoint, freeing up the
* endpoint for the next packet.
*
* \ingroup Group_EndpointPacketManagement
*
- * \note This is not applicable for non CONTROL type endpoints.
+ * \note This is not applicable for non CONTROL type endpoints.
*/
static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ClearSETUP(void)
{
UEINTX &= ~(1 << RXSTPI);
}
-
+
/** Sends an IN packet to the host on the currently selected endpoint, freeing up the endpoint for the
* next packet and switching to the alternative endpoint bank if double banked.
*
@@ -508,7 +508,7 @@
UEINTX &= ~(1 << TXINI);
#endif
}
-
+
/** Acknowledges an OUT packet to the host on the currently selected endpoint, freeing up the endpoint
* for the next packet and switching to the alternative endpoint bank if double banked.
*
@@ -520,10 +520,10 @@
#if !defined(CONTROL_ONLY_DEVICE)
UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON));
#else
- UEINTX &= ~(1 << RXOUTI);
+ UEINTX &= ~(1 << RXOUTI);
#endif
}
-
+
/** Stalls the current endpoint, indicating to the host that a logical problem occurred with the
* indicated endpoint and that the current transfer sequence should be aborted. This provides a
* way for devices to indicate invalid commands to the host so that the current transfer can be
@@ -540,7 +540,7 @@
{
UECONX |= (1 << STALLRQ);
}
-
+
/** Clears the STALL condition on the currently selected endpoint.
*
* \ingroup Group_EndpointPacketManagement
@@ -550,7 +550,7 @@
{
UECONX |= (1 << STALLRQC);
}
-
+
/** Determines if the currently selected endpoint is stalled, false otherwise.
*
* \ingroup Group_EndpointPacketManagement
@@ -562,14 +562,14 @@
{
return ((UECONX & (1 << STALLRQ)) ? true : false);
}
-
+
/** Resets the data toggle of the currently selected endpoint. */
static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE;
static inline void Endpoint_ResetDataToggle(void)
{
UECONX |= (1 << RSTDT);
}
-
+
/** Determines the currently selected endpoint's direction.
*
* \return The currently selected endpoint's direction, as a ENDPOINT_DIR_* mask.
@@ -622,10 +622,10 @@
static inline void Endpoint_Discard_Byte(void)
{
uint8_t Dummy;
-
+
Dummy = UEDATX;
}
-
+
/** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT
* direction endpoints.
*
@@ -641,10 +641,10 @@
uint16_t Word;
uint8_t Bytes[2];
} Data;
-
+
Data.Bytes[0] = UEDATX;
Data.Bytes[1] = UEDATX;
-
+
return Data.Word;
}
@@ -663,10 +663,10 @@
uint16_t Word;
uint8_t Bytes[2];
} Data;
-
+
Data.Bytes[1] = UEDATX;
Data.Bytes[0] = UEDATX;
-
+
return Data.Word;
}
@@ -683,7 +683,7 @@
UEDATX = (Word & 0xFF);
UEDATX = (Word >> 8);
}
-
+
/** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN
* direction endpoints.
*
@@ -706,7 +706,7 @@
static inline void Endpoint_Discard_Word(void)
{
uint8_t Dummy;
-
+
Dummy = UEDATX;
Dummy = UEDATX;
}
@@ -726,12 +726,12 @@
uint32_t DWord;
uint8_t Bytes[4];
} Data;
-
+
Data.Bytes[0] = UEDATX;
Data.Bytes[1] = UEDATX;
Data.Bytes[2] = UEDATX;
Data.Bytes[3] = UEDATX;
-
+
return Data.DWord;
}
@@ -750,12 +750,12 @@
uint32_t DWord;
uint8_t Bytes[4];
} Data;
-
+
Data.Bytes[3] = UEDATX;
Data.Bytes[2] = UEDATX;
Data.Bytes[1] = UEDATX;
Data.Bytes[0] = UEDATX;
-
+
return Data.DWord;
}
@@ -774,7 +774,7 @@
UEDATX = (DWord >> 16);
UEDATX = (DWord >> 24);
}
-
+
/** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN
* direction endpoints.
*
@@ -791,7 +791,7 @@
UEDATX = (DWord & 0xFF);
}
- /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
+ /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
*
* \ingroup Group_EndpointPrimitiveRW
*/
@@ -799,7 +799,7 @@
static inline void Endpoint_Discard_DWord(void)
{
uint8_t Dummy;
-
+
Dummy = UEDATX;
Dummy = UEDATX;
Dummy = UEDATX;
@@ -850,7 +850,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/LowLevel/Host.c b/LUFA/Drivers/USB/LowLevel/Host.c
index 1fa5290fc..25b08b73b 100644
--- a/LUFA/Drivers/USB/LowLevel/Host.c
+++ b/LUFA/Drivers/USB/LowLevel/Host.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -55,15 +55,15 @@ void USB_Host_ProcessNextHostState(void)
ErrorCode = HOST_ENUMERROR_WaitStage;
break;
}
-
+
if (!(--WaitMSRemaining))
USB_HostState = PostWaitState;
}
-
+
break;
case HOST_STATE_Powered:
WaitMSRemaining = HOST_DEVICE_SETTLE_DELAY_MS;
-
+
USB_HostState = HOST_STATE_Powered_WaitForDeviceSettle;
break;
case HOST_STATE_Powered_WaitForDeviceSettle:
@@ -79,23 +79,23 @@ void USB_Host_ProcessNextHostState(void)
USB_OTGPAD_On();
USB_Host_VBUS_Auto_Enable();
USB_Host_VBUS_Auto_On();
-
+
USB_HostState = HOST_STATE_Powered_WaitForConnect;
}
-
+
break;
- case HOST_STATE_Powered_WaitForConnect:
+ case HOST_STATE_Powered_WaitForConnect:
if (USB_INT_HasOccurred(USB_INT_DCONNI))
- {
+ {
USB_INT_Clear(USB_INT_DCONNI);
USB_INT_Clear(USB_INT_DDISCI);
USB_INT_Clear(USB_INT_VBERRI);
USB_INT_Enable(USB_INT_VBERRI);
-
+
USB_Host_ResumeBus();
Pipe_ClearPipes();
-
+
HOST_TASK_NONBLOCK_WAIT(100, HOST_STATE_Powered_DoReset);
}
@@ -108,8 +108,8 @@ void USB_Host_ProcessNextHostState(void)
case HOST_STATE_Powered_ConfigPipe:
Pipe_ConfigurePipe(PIPE_CONTROLPIPE, EP_TYPE_CONTROL,
PIPE_TOKEN_SETUP, ENDPOINT_CONTROLEP,
- PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE);
-
+ PIPE_CONTROLPIPE_DEFAULT_SIZE, PIPE_BANK_SINGLE);
+
if (!(Pipe_IsConfigured()))
{
ErrorCode = HOST_ENUMERROR_PipeConfigError;
@@ -138,9 +138,9 @@ void USB_Host_ProcessNextHostState(void)
}
USB_ControlPipeSize = DataBuffer[offsetof(USB_Descriptor_Device_t, Endpoint0Size)];
-
+
USB_Host_ResetDevice();
-
+
HOST_TASK_NONBLOCK_WAIT(200, HOST_STATE_Default_PostReset);
break;
case HOST_STATE_Default_PostReset:
@@ -197,7 +197,7 @@ uint8_t USB_Host_WaitMS(uint8_t MS)
bool BusSuspended = USB_Host_IsBusSuspended();
uint8_t ErrorCode = HOST_WAITERROR_Successful;
bool HSOFIEnabled = USB_INT_IsEnabled(USB_INT_HSOFI);
-
+
USB_INT_Disable(USB_INT_HSOFI);
USB_INT_Clear(USB_INT_HSOFI);
@@ -210,11 +210,11 @@ uint8_t USB_Host_WaitMS(uint8_t MS)
USB_INT_Clear(USB_INT_HSOFI);
MS--;
}
-
+
if ((USB_HostState == HOST_STATE_Unattached) || (USB_CurrentMode != USB_MODE_Host))
{
ErrorCode = HOST_WAITERROR_DeviceDisconnect;
-
+
break;
}
@@ -222,16 +222,16 @@ uint8_t USB_Host_WaitMS(uint8_t MS)
{
Pipe_ClearError();
ErrorCode = HOST_WAITERROR_PipeError;
-
+
break;
}
-
+
if (Pipe_IsStalled() == true)
{
Pipe_ClearStall();
ErrorCode = HOST_WAITERROR_SetupStalled;
-
- break;
+
+ break;
}
}
@@ -249,7 +249,7 @@ static void USB_Host_ResetDevice(void)
bool BusSuspended = USB_Host_IsBusSuspended();
USB_INT_Disable(USB_INT_DDISCI);
-
+
USB_Host_ResetBus();
while (!(USB_Host_IsBusResetComplete()));
USB_Host_ResumeBus();
@@ -258,7 +258,7 @@ static void USB_Host_ResetDevice(void)
USB_INT_Disable(USB_INT_HSOFI);
USB_INT_Clear(USB_INT_HSOFI);
-
+
for (uint8_t MSRem = 10; MSRem != 0; MSRem--)
{
/* Workaround for powerless-pull-up devices. After a USB bus reset,
@@ -272,7 +272,7 @@ static void USB_Host_ResetDevice(void)
USB_INT_Clear(USB_INT_DDISCI);
break;
}
-
+
_delay_ms(1);
}
@@ -297,7 +297,7 @@ uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber)
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
return USB_Host_SendControlRequest(NULL);
}
@@ -313,7 +313,7 @@ uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr)
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
return USB_Host_SendControlRequest(DeviceDescriptorPtr);
}
@@ -331,7 +331,7 @@ uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index,
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
return USB_Host_SendControlRequest(Buffer);
}
@@ -347,8 +347,9 @@ uint8_t USB_Host_ClearPipeStall(const uint8_t EndpointNum)
};
Pipe_SelectPipe(PIPE_CONTROLPIPE);
-
+
return USB_Host_SendControlRequest(NULL);
}
#endif
+
diff --git a/LUFA/Drivers/USB/LowLevel/Host.h b/LUFA/Drivers/USB/LowLevel/Host.h
index 2da2e4ce6..f29ab1b3b 100644
--- a/LUFA/Drivers/USB/LowLevel/Host.h
+++ b/LUFA/Drivers/USB/LowLevel/Host.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,7 +45,7 @@
*
* @{
*/
-
+
#ifndef __USBHOST_H__
#define __USBHOST_H__
@@ -68,7 +68,7 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Indicates the fixed USB device address which any attached device is enumerated to when in
@@ -83,12 +83,12 @@
* device. If a device fails to respond to a sent control request within this period, the
* library will return a timeout error code.
*
- * This value may be overridden in the user project makefile as the value of the
+ * This value may be overridden in the user project makefile as the value of the
* \ref USB_HOST_TIMEOUT_MS token, and passed to the compiler using the -D switch.
*/
#define USB_HOST_TIMEOUT_MS 1000
#endif
-
+
#if !defined(HOST_DEVICE_SETTLE_DELAY_MS) || defined(__DOXYGEN__)
/** Constant for the delay in milliseconds after a device is connected before the library
* will start the enumeration process. Some devices require a delay of up to 5 seconds
@@ -131,52 +131,52 @@
HOST_STATE_Unattached = 2, /**< Internally implemented by the library. This state indicates
* that the host state machine is waiting for a device to be
* attached so that it can start the enumeration process.
- *
+ *
* \note Do not manually change to this state in the user code.
*/
HOST_STATE_Powered = 3, /**< Internally implemented by the library. This state indicates
* that a device has been attached, and the library's internals
* are being configured to begin the enumeration process.
- *
+ *
* \note Do not manually change to this state in the user code.
*/
HOST_STATE_Powered_WaitForDeviceSettle = 4, /**< Internally implemented by the library. This state indicates
* that the stack is waiting for the initial settling period to
* elapse before beginning the enumeration process.
- *
+ *
* \note Do not manually change to this state in the user code.
*/
HOST_STATE_Powered_WaitForConnect = 5, /**< Internally implemented by the library. This state indicates
* that the stack is waiting for a connection event from the USB
* controller to indicate a valid USB device has been attached to
* the bus and is ready to be enumerated.
- *
+ *
* \note Do not manually change to this state in the user code.
*/
HOST_STATE_Powered_DoReset = 6, /**< Internally implemented by the library. This state indicates
* that a valid USB device has been attached, and that it is
* will now be reset to ensure it is ready for enumeration.
- *
+ *
* \note Do not manually change to this state in the user code.
*/
HOST_STATE_Powered_ConfigPipe = 7, /**< Internally implemented by the library. This state indicates
* that the attached device is currently powered and reset, and
* that the control pipe is now being configured by the stack.
- *
+ *
* \note Do not manually change to this state in the user code.
*/
HOST_STATE_Default = 8, /**< Internally implemented by the library. This state indicates
* that the stack is currently retrieving the control endpoint's
* size from the device, so that the control pipe can be altered
* to match.
- *
+ *
* \note Do not manually change to this state in the user code.
*/
HOST_STATE_Default_PostReset = 9, /**< Internally implemented by the library. This state indicates that
* the control pipe is being reconfigured to match the retrieved
* control endpoint size from the device, and the device's USB bus
* address is being set.
- *
+ *
* \note Do not manually change to this state in the user code.
*/
HOST_STATE_Default_PostAddressSet = 10, /**< Internally implemented by the library. This state indicates that
@@ -185,7 +185,7 @@
* stack to change the current USB device address to that set for
* the connected device, before progressing to the user-implemented
* \ref HOST_STATE_Addressed state for further communications.
- *
+ *
* \note Do not manually change to this state in the user code.
*/
HOST_STATE_Addressed = 11, /**< May be implemented by the user project. This state should
@@ -204,7 +204,7 @@
* \ref HOST_STATE_WaitForDeviceRemoval states as needed.
*/
};
-
+
/** Enum for the error codes for the \ref EVENT_USB_Host_HostError() event.
*
* \see \ref Group_Events for more information on this event.
@@ -218,7 +218,7 @@
* current.
*/
};
-
+
/** Enum for the error codes for the \ref EVENT_USB_Host_DeviceEnumerationFailed() event.
*
* \see \ref Group_Events for more information on this event.
@@ -252,7 +252,7 @@
{
return UHFNUM;
}
-
+
#if !defined(NO_SOF_EVENTS)
/** Enables the host mode Start Of Frame events. When enabled, this causes the
* \ref EVENT_USB_Host_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus,
@@ -265,7 +265,7 @@
{
USB_INT_Enable(USB_INT_HSOFI);
}
-
+
/** Disables the host mode Start Of Frame events. When disabled, this stops the firing of the
* \ref EVENT_USB_Host_StartOfFrame() event when enumerated in host mode.
*
@@ -277,7 +277,7 @@
USB_INT_Disable(USB_INT_HSOFI);
}
#endif
-
+
/** Resets the USB bus, including the endpoints in any attached device and pipes on the AVR host.
* USB bus resets leave the default control pipe configured (if already configured).
*
@@ -320,7 +320,7 @@
{
UHCON &= ~(1 << SOFEN);
}
-
+
/** Determines if the USB bus has been suspended via the use of the \ref USB_Host_SuspendBus() macro,
* false otherwise. While suspended, no USB communications can occur until the bus is resumed,
* except for the Remote Wakeup event from the device if supported.
@@ -332,7 +332,7 @@
{
return ((UHCON & (1 << SOFEN)) ? false : true);
}
-
+
/** Determines if the attached device is currently enumerated in Full Speed mode (12Mb/s), or
* false if the attached device is enumerated in Low Speed mode (1.5Mb/s).
*
@@ -371,7 +371,7 @@
{
UHCON |= (1 << RESUME);
}
-
+
/** Determines if a resume from Remote Wakeup request is currently being sent to an attached
* device.
*
@@ -395,7 +395,7 @@
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
*/
uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber);
-
+
/** Convenience function. This routine sends a GetDescriptor standard request to the attached
* device, requesting the device descriptor. This can be used to easily retrieve information
* about the device such as its VID, PID and power requirements.
@@ -408,7 +408,7 @@
* \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
*/
uint8_t USB_Host_GetDeviceDescriptor(void* const DeviceDescriptorPtr);
-
+
/** Convenience function. This routine sends a GetDescriptor standard request to the attached
* device, requesting the string descriptor of the specified index. This can be used to easily
* retrieve string descriptors from the device by index, after the index is obtained from the
@@ -426,7 +426,7 @@
uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index,
void* const Buffer,
const uint8_t BufferLength);
-
+
/** Clears a stall condition on the given pipe, via a ClearFeature request to the attached device.
*
* \note After this routine returns, the control pipe will be selected.
@@ -458,13 +458,13 @@
OTGCON &= ~(1 << VBUSHWC);
UHWCON |= (1 << UVCONE);
}
-
+
static inline void USB_Host_VBUS_Manual_Enable(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Manual_Enable(void)
{
OTGCON |= (1 << VBUSHWC);
UHWCON &= ~(1 << UVCONE);
-
+
DDRE |= (1 << 7);
}
@@ -479,7 +479,7 @@
{
PORTE |= (1 << 7);
}
-
+
static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_Host_VBUS_Auto_Off(void)
{
@@ -490,7 +490,7 @@
static inline void USB_Host_VBUS_Manual_Off(void)
{
PORTE &= ~(1 << 7);
- }
+ }
static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;
static inline void USB_Host_SetDeviceAddress(const uint8_t Address)
@@ -510,7 +510,7 @@
/* Function Prototypes: */
void USB_Host_ProcessNextHostState(void);
uint8_t USB_Host_WaitMS(uint8_t MS);
-
+
#if defined(__INCLUDE_FROM_HOST_C)
static void USB_Host_ResetDevice(void);
#endif
@@ -520,7 +520,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/LowLevel/OTG.h b/LUFA/Drivers/USB/LowLevel/OTG.h
index 5afa8b3a2..d77b41b49 100644
--- a/LUFA/Drivers/USB/LowLevel/OTG.h
+++ b/LUFA/Drivers/USB/LowLevel/OTG.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -27,7 +27,7 @@
arising out of or in connection with the use or performance of
this software.
*/
-
+
/** \file
* \brief USB OTG mode definitions.
*
@@ -54,26 +54,26 @@
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
-
+
#include "../../../Common/Common.h"
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for the VBUS pulsing method of SRP, supported by some OTG devices.
*
* \see \ref USB_OTG_Device_InitiateSRP().
- */
+ */
#define USB_OTG_SRP_VBUS (1 << SRPSEL)
/** Mask for the Data + pulsing method of SRP, supported by some OTG devices.
*
* \see \ref USB_OTG_Device_InitiateSRP().
- */
+ */
#define USB_OTG_STP_DATA 0
/* Inline Functions: */
@@ -85,7 +85,7 @@
{
OTGCON |= (1 << HNPREQ);
}
-
+
/** Cancel a Host Negotiation Protocol request. This stops a pending HNP request to the other
* connected device.
*/
@@ -94,7 +94,7 @@
{
OTGCON &= ~(1 << HNPREQ);
}
-
+
/** Determines if the device is currently sending a HNP to an attached host.
*
* \return Boolean true if currently sending a HNP to the other connected device, false otherwise
@@ -104,7 +104,7 @@
{
return ((OTGCON & (1 << HNPREQ)) ? true : false);
}
-
+
/** Initiates a Session Request Protocol request. Most OTG devices turn off VBUS when the USB
* interface is not in use, to conserve power. Sending a SRP to a USB OTG device running in
* host mode indicates that VBUS should be applied and a session started.
@@ -129,7 +129,7 @@
{
OTGCON |= (1 << HNPREQ);
}
-
+
/** Rejects a HNP from a connected device, indicating that both devices should remain in their
* current device/host roles.
*/
@@ -138,7 +138,7 @@
{
OTGCON &= ~(1 << HNPREQ);
}
-
+
/** Indicates if the connected device is not currently sending a HNP request.
*
* \return Boolean true if a HNP is currently being issued by the connected device, false otherwise.
@@ -148,7 +148,8 @@
{
return ((OTGCON & (1 << HNPREQ)) ? true : false);
}
-
+
#endif
-
+
/** @} */
+
diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.c b/LUFA/Drivers/USB/LowLevel/Pipe.c
index e5c30e4b5..74a8f51e4 100644
--- a/LUFA/Drivers/USB/LowLevel/Pipe.c
+++ b/LUFA/Drivers/USB/LowLevel/Pipe.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,7 +48,7 @@ bool Pipe_ConfigurePipe(const uint8_t Number,
Pipe_EnablePipe();
UPCFG1X = 0;
-
+
UPCFG0X = ((Type << EPTYPE0) | Token | ((EndpointNumber & PIPE_EPNUM_MASK) << PEPNUM0));
UPCFG1X = ((1 << ALLOC) | Banks | Pipe_BytesToEPSizeMask(Size));
@@ -78,20 +78,20 @@ bool Pipe_IsEndpointBound(const uint8_t EndpointAddress)
for (uint8_t PNum = 0; PNum < PIPE_TOTAL_PIPES; PNum++)
{
Pipe_SelectPipe(PNum);
-
+
if (!(Pipe_IsConfigured()))
continue;
-
+
uint8_t PipeToken = Pipe_GetPipeToken();
bool PipeTokenCorrect = true;
if (PipeToken != PIPE_TOKEN_SETUP)
PipeTokenCorrect = (PipeToken == ((EndpointAddress & PIPE_EPDIR_MASK) ? PIPE_TOKEN_IN : PIPE_TOKEN_OUT));
-
+
if (PipeTokenCorrect && (Pipe_BoundEndpointNumber() == (EndpointAddress & PIPE_EPNUM_MASK)))
return true;
}
-
+
Pipe_SelectPipe(PrevPipeNumber);
return false;
}
@@ -99,13 +99,13 @@ bool Pipe_IsEndpointBound(const uint8_t EndpointAddress)
uint8_t Pipe_WaitUntilReady(void)
{
#if (USB_STREAM_TIMEOUT_MS < 0xFF)
- uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
+ uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
#else
uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS;
#endif
uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber();
-
+
for (;;)
{
if (Pipe_GetPipeToken() == PIPE_TOKEN_IN)
@@ -116,7 +116,7 @@ uint8_t Pipe_WaitUntilReady(void)
else
{
if (Pipe_IsOUTReady())
- return PIPE_READYWAIT_NoError;
+ return PIPE_READYWAIT_NoError;
}
if (Pipe_IsStalled())
@@ -137,3 +137,4 @@ uint8_t Pipe_WaitUntilReady(void)
}
#endif
+
diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h
index 58a5c9464..d8ba1bb02 100644
--- a/LUFA/Drivers/USB/LowLevel/Pipe.h
+++ b/LUFA/Drivers/USB/LowLevel/Pipe.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -27,7 +27,7 @@
arising out of or in connection with the use or performance of
this software.
*/
-
+
/** \file
* \brief USB host pipe management definitions.
*
@@ -36,27 +36,27 @@
*
* \note This file should not be included directly. It is automatically included as needed by the USB driver
* dispatch header located in LUFA/Drivers/USB/USB.h.
- */
+ */
/** \ingroup Group_PipeManagement
* @defgroup Group_PipeRW Pipe Data Reading and Writing
*
* Functions, macros, variables, enums and types related to data reading and writing from and to pipes.
*/
-
-/** \ingroup Group_PipeRW
+
+/** \ingroup Group_PipeRW
* @defgroup Group_PipePrimitiveRW Read/Write of Primitive Data Types
*
* Functions, macros, variables, enums and types related to data reading and writing of primitive data types
* from and to pipes.
*/
-
+
/** \ingroup Group_PipeManagement
* @defgroup Group_PipePacketManagement Pipe Packet Management
*
* Functions, macros, variables, enums and types related to packet management of pipes.
*/
-
+
/** \ingroup Group_PipeManagement
* @defgroup Group_PipeControlReq Pipe Control Request Management
*
@@ -64,7 +64,7 @@
* vendor control requests to the default control endpoint of an attached device while in host mode.
*
* \see Chapter 9 of the USB 2.0 specification.
- */
+ */
/** \ingroup Group_USB
* @defgroup Group_PipeManagement Pipe Management
@@ -85,7 +85,7 @@
#include "../../../Common/Common.h"
#include "../HighLevel/USBTask.h"
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -95,7 +95,7 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Public Interface - May be used in end-application: */
/* Macros: */
/** Mask for \ref Pipe_GetErrorFlags(), indicating that an overflow error occurred in the pipe on the received data. */
@@ -146,17 +146,17 @@
* bank.
*/
#define PIPE_BANK_DOUBLE (1 << EPBK0)
-
+
/** Pipe address for the default control pipe, which always resides in address 0. This is
* defined for convenience to give more readable code when used with the pipe macros.
*/
#define PIPE_CONTROLPIPE 0
- /** Default size of the default control pipe's bank, until altered by the Endpoint0Size value
+ /** Default size of the default control pipe's bank, until altered by the Endpoint0Size value
* in the device descriptor of the attached device.
*/
#define PIPE_CONTROLPIPE_DEFAULT_SIZE 64
-
+
/** Pipe number mask, for masking against pipe addresses to retrieve the pipe's numerical address
* in the device.
*/
@@ -193,7 +193,7 @@
enum Pipe_WaitUntilReady_ErrorCodes_t
{
PIPE_READYWAIT_NoError = 0, /**< Pipe ready for next packet, no error. */
- PIPE_READYWAIT_PipeStalled = 1, /**< The device stalled the pipe while waiting. */
+ PIPE_READYWAIT_PipeStalled = 1, /**< The device stalled the pipe while waiting. */
PIPE_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while waiting. */
PIPE_READYWAIT_Timeout = 3, /**< The device failed to accept or send the next packet
* within the software timeout period set by the
@@ -216,7 +216,7 @@
{
return UPBCX;
}
-
+
/** Returns the pipe address of the currently selected pipe. This is typically used to save the
* currently selected pipe number so that it can be restored after another pipe has been manipulated.
*
@@ -238,7 +238,7 @@
{
UPNUM = PipeNumber;
}
-
+
/** Resets the desired pipe, including the pipe banks and flags.
*
* \param[in] PipeNumber Index of the pipe to reset.
@@ -249,7 +249,7 @@
UPRST = (1 << PipeNumber);
UPRST = 0;
}
-
+
/** Enables the currently selected pipe so that data can be sent and received through it to and from
* an attached device.
*
@@ -279,7 +279,7 @@
{
return ((UPCONX & (1 << PEN)) ? true : false);
}
-
+
/** Gets the current pipe token, indicating the pipe's data direction and type.
*
* \return The current pipe token, as a PIPE_TOKEN_* mask.
@@ -289,7 +289,7 @@
{
return (UPCFG0X & (0x03 << PTOKEN0));
}
-
+
/** Sets the token for the currently selected pipe to one of the tokens specified by the PIPE_TOKEN_*
* masks. This can be used on CONTROL type pipes, to allow for bidirectional transfer of data during
* control requests, or on regular pipes to allow for half-duplex bidirectional data transfer to devices
@@ -302,14 +302,14 @@
{
UPCFG0X = ((UPCFG0X & ~(0x03 << PTOKEN0)) | Token);
}
-
+
/** Configures the currently selected pipe to allow for an unlimited number of IN requests. */
static inline void Pipe_SetInfiniteINRequests(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_SetInfiniteINRequests(void)
{
UPCONX |= (1 << INMODE);
}
-
+
/** Configures the currently selected pipe to only allow the specified number of IN requests to be
* accepted by the pipe before it is automatically frozen.
*
@@ -331,7 +331,7 @@
{
return ((UPSTAX & (1 << CFGOK)) ? true : false);
}
-
+
/** Retrieves the endpoint number of the endpoint within the attached device that the currently selected
* pipe is bound to.
*
@@ -352,7 +352,7 @@
{
UPCFG2X = Milliseconds;
}
-
+
/** Returns a mask indicating which pipe's interrupt periods have elapsed, indicating that the pipe should
* be serviced.
*
@@ -363,7 +363,7 @@
{
return UPINT;
}
-
+
/** Determines if the specified pipe number has interrupted (valid only for INTERRUPT type
* pipes).
*
@@ -376,14 +376,14 @@
{
return ((UPINT & (1 << PipeNumber)) ? true : false);
}
-
+
/** Unfreezes the selected pipe, allowing it to communicate with an attached device. */
static inline void Pipe_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Unfreeze(void)
{
UPCONX &= ~(1 << PFREEZE);
}
-
+
/** Freezes the selected pipe, preventing it from communicating with an attached device. */
static inline void Pipe_Freeze(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_Freeze(void)
@@ -400,14 +400,14 @@
{
return ((UPCONX & (1 << PFREEZE)) ? true : false);
}
-
+
/** Clears the master pipe error flag. */
static inline void Pipe_ClearError(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearError(void)
{
UPINTX &= ~(1 << PERRI);
}
-
+
/** Determines if the master pipe error flag is set for the currently selected pipe, indicating that
* some sort of hardware error has occurred on the pipe.
*
@@ -420,7 +420,7 @@
{
return ((UPINTX & (1 << PERRI)) ? true : false);
}
-
+
/** Clears all the currently selected pipe's hardware error flags, but does not clear the master error
* flag for the pipe.
*/
@@ -429,7 +429,7 @@
{
UPERRX = 0;
}
-
+
/** Gets a mask of the hardware error flags which have occurred on the currently selected pipe. This
* value can then be masked against the PIPE_ERRORFLAG_* masks to determine what error has occurred.
*
@@ -443,7 +443,7 @@
PIPE_ERRORFLAG_DATATGL)) |
(UPSTAX & (PIPE_ERRORFLAG_OVERFLOW | PIPE_ERRORFLAG_UNDERFLOW)));
}
-
+
/** Determines if the currently selected pipe may be read from (if data is waiting in the pipe
* bank and the pipe is an IN direction, or if the bank is not yet full if the pipe is an OUT
* direction). This function will return false if an error has occurred in the pipe, or if the pipe
@@ -453,7 +453,7 @@
* \note This function is not valid on CONTROL type pipes.
*
* \ingroup Group_PipePacketManagement
- *
+ *
* \return Boolean true if the currently selected pipe may be read from or written to, depending on its direction.
*/
static inline bool Pipe_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
@@ -461,7 +461,7 @@
{
return ((UPINTX & (1 << RWAL)) ? true : false);
}
-
+
/** Determines if a packet has been received on the currently selected IN pipe from the attached device.
*
* \ingroup Group_PipePacketManagement
@@ -473,7 +473,7 @@
{
return ((UPINTX & (1 << RXINI)) ? true : false);
}
-
+
/** Determines if the currently selected OUT pipe is ready to send an OUT packet to the attached device.
*
* \ingroup Group_PipePacketManagement
@@ -498,10 +498,10 @@
{
return ((UPINTX & (1 << TXSTPI)) ? true : false);
}
-
+
/** Sends the currently selected CONTROL type pipe's contents to the device as a SETUP packet.
*
- * \ingroup Group_PipePacketManagement
+ * \ingroup Group_PipePacketManagement
*/
static inline void Pipe_ClearSETUP(void) ATTR_ALWAYS_INLINE;
static inline void Pipe_ClearSETUP(void)
@@ -558,7 +558,7 @@
{
UPINTX &= ~(1 << NAKEDI);
}
-
+
/** Determines if the currently selected pipe has had the STALL condition set by the attached device.
*
* \ingroup Group_PipePacketManagement
@@ -570,7 +570,7 @@
{
return ((UPINTX & (1 << RXSTALLI)) ? true : false);
}
-
+
/** Clears the STALL condition detection flag on the currently selected pipe, but does not clear the
* STALL condition itself (this must be done via a ClearFeature control request to the device).
*
@@ -614,10 +614,10 @@
static inline void Pipe_Discard_Byte(void)
{
uint8_t Dummy;
-
+
Dummy = UPDATX;
}
-
+
/** Reads two bytes from the currently selected pipe's bank in little endian format, for OUT
* direction pipes.
*
@@ -633,10 +633,10 @@
uint16_t Word;
uint8_t Bytes[2];
} Data;
-
+
Data.Bytes[0] = UPDATX;
Data.Bytes[1] = UPDATX;
-
+
return Data.Word;
}
@@ -655,13 +655,13 @@
uint16_t Word;
uint8_t Bytes[2];
} Data;
-
+
Data.Bytes[1] = UPDATX;
Data.Bytes[0] = UPDATX;
-
+
return Data.Word;
}
-
+
/** Writes two bytes to the currently selected pipe's bank in little endian format, for IN
* direction pipes.
*
@@ -675,7 +675,7 @@
UPDATX = (Word & 0xFF);
UPDATX = (Word >> 8);
}
-
+
/** Writes two bytes to the currently selected pipe's bank in big endian format, for IN
* direction pipes.
*
@@ -698,7 +698,7 @@
static inline void Pipe_Discard_Word(void)
{
uint8_t Dummy;
-
+
Dummy = UPDATX;
Dummy = UPDATX;
}
@@ -718,12 +718,12 @@
uint32_t DWord;
uint8_t Bytes[4];
} Data;
-
+
Data.Bytes[0] = UPDATX;
Data.Bytes[1] = UPDATX;
Data.Bytes[2] = UPDATX;
Data.Bytes[3] = UPDATX;
-
+
return Data.DWord;
}
@@ -742,12 +742,12 @@
uint32_t DWord;
uint8_t Bytes[4];
} Data;
-
+
Data.Bytes[3] = UPDATX;
Data.Bytes[2] = UPDATX;
Data.Bytes[1] = UPDATX;
Data.Bytes[0] = UPDATX;
-
+
return Data.DWord;
}
@@ -766,7 +766,7 @@
UPDATX = (DWord >> 16);
UPDATX = (DWord >> 24);
}
-
+
/** Writes four bytes to the currently selected pipe's bank in big endian format, for IN
* direction pipes.
*
@@ -781,9 +781,9 @@
UPDATX = (DWord >> 16);
UPDATX = (DWord >> 8);
UPDATX = (DWord & 0xFF);
- }
-
- /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.
+ }
+
+ /** Discards four bytes from the currently selected pipe's bank, for OUT direction pipes.
*
* \ingroup Group_PipePrimitiveRW
*/
@@ -791,7 +791,7 @@
static inline void Pipe_Discard_DWord(void)
{
uint8_t Dummy;
-
+
Dummy = UPDATX;
Dummy = UPDATX;
Dummy = UPDATX;
@@ -825,14 +825,14 @@
* Speed USB devices - refer to the USB 2.0 specification.
*
* \param[in] Token Pipe data token, either \ref PIPE_TOKEN_SETUP, \ref PIPE_TOKEN_OUT or \ref PIPE_TOKEN_IN.
- * All pipes (except Control type) are unidirectional - data may only be read from or
+ * All pipes (except Control type) are unidirectional - data may only be read from or
* written to the pipe bank based on its direction, not both.
*
* \param[in] EndpointNumber Endpoint index within the attached device that the pipe should interface to.
*
* \param[in] Size Size of the pipe's bank, where packets are stored before they are transmitted to
- * the USB device, or after they have been received from the USB device (depending on
- * the pipe's data direction). The bank size must indicate the maximum packet size that
+ * the USB device, or after they have been received from the USB device (depending on
+ * the pipe's data direction). The bank size must indicate the maximum packet size that
* the pipe can handle.
*
* \param[in] Banks Number of banks to use for the pipe being configured, a PIPE_BANK_* mask. More banks
@@ -862,7 +862,7 @@
const uint16_t Size,
const uint8_t Banks);
- /** Spin-loops until the currently selected non-control pipe is ready for the next packed of data to be read
+ /** Spin-loops until the currently selected non-control pipe is ready for the next packed of data to be read
* or written to it, aborting in the case of an error condition (such as a timeout or device disconnect).
*
* \ingroup Group_PipeRW
@@ -870,7 +870,7 @@
* \return A value from the \ref Pipe_WaitUntilReady_ErrorCodes_t enum.
*/
uint8_t Pipe_WaitUntilReady(void);
-
+
/** Determines if a pipe has been bound to the given device endpoint address. If a pipe which is bound to the given
* endpoint is found, it is automatically selected.
*
@@ -887,20 +887,20 @@
#if !defined(ENDPOINT_CONTROLEP)
#define ENDPOINT_CONTROLEP 0
#endif
-
+
/* Inline Functions: */
static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint8_t Pipe_BytesToEPSizeMask(const uint16_t Bytes)
{
uint8_t MaskVal = 0;
uint16_t CheckBytes = 8;
-
+
while ((CheckBytes < Bytes) && (CheckBytes < PIPE_MAX_SIZE))
{
MaskVal++;
CheckBytes <<= 1;
}
-
+
return (MaskVal << EPSIZE0);
}
@@ -912,7 +912,8 @@
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/LowLevel/USBController.c b/LUFA/Drivers/USB/LowLevel/USBController.c
index 6d4a89dd0..b409582a0 100644
--- a/LUFA/Drivers/USB/LowLevel/USBController.c
+++ b/LUFA/Drivers/USB/LowLevel/USBController.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ void USB_Init(
#elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS))
void
#endif
-
+
#if !defined(USE_STATIC_OPTIONS)
const uint8_t Options
#endif
@@ -59,7 +59,7 @@ void USB_Init(
#if !defined(USE_STATIC_OPTIONS)
USB_Options = Options;
#endif
-
+
if (!(USB_Options & USB_OPT_REG_DISABLED))
USB_REG_On();
else
@@ -69,7 +69,7 @@ void USB_Init(
if (Mode == USB_MODE_UID)
{
UHWCON |= (1 << UIDE);
- USB_INT_Enable(USB_INT_IDTI);
+ USB_INT_Enable(USB_INT_IDTI);
USB_CurrentMode = USB_GetUSBModeFromUID();
}
else
@@ -90,10 +90,10 @@ void USB_ShutDown(void)
USB_Detach();
USB_Controller_Disable();
-
+
if (!(USB_Options & USB_OPT_MANUAL_PLL))
USB_PLL_Off();
-
+
USB_REG_Off();
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
@@ -115,9 +115,9 @@ void USB_ResetInterface(void)
USB_INT_DisableAllInterrupts();
USB_INT_ClearAllInterrupts();
-
+
USB_Controller_Reset();
-
+
if (!(USB_Options & USB_OPT_MANUAL_PLL))
{
#if defined(USB_SERIES_4_AVR)
@@ -137,14 +137,14 @@ void USB_ResetInterface(void)
#endif
USB_CLK_Unfreeze();
-
+
if (USB_CurrentMode == USB_MODE_Device)
{
#if defined(USB_CAN_BE_DEVICE)
#if (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
UHWCON |= (1 << UIMOD);
#endif
-
+
USB_Init_Device();
#endif
}
@@ -155,7 +155,7 @@ void USB_ResetInterface(void)
USB_Init_Host();
#endif
}
-
+
#if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
USB_OTGPAD_On();
#endif
@@ -170,7 +170,7 @@ static void USB_Init_Device(void)
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
USB_RemoteWakeupEnabled = false;
#endif
-
+
#if !defined(NO_DEVICE_SELF_POWER)
USB_CurrentlySelfPowered = false;
#endif
@@ -179,7 +179,7 @@ static void USB_Init_Device(void)
USB_Descriptor_Device_t* DeviceDescriptorPtr;
if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR)
- {
+ {
#if defined(USE_RAM_DESCRIPTORS)
USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size;
#elif defined(USE_EEPROM_DESCRIPTORS)
@@ -201,7 +201,7 @@ static void USB_Init_Device(void)
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,
ENDPOINT_DIR_OUT, USB_ControlEndpointSize,
- ENDPOINT_BANK_SINGLE);
+ ENDPOINT_BANK_SINGLE);
USB_INT_Clear(USB_INT_SUSPI);
USB_INT_Enable(USB_INT_SUSPI);
@@ -218,7 +218,7 @@ static void USB_Init_Host(void)
USB_ControlPipeSize = PIPE_CONTROLPIPE_DEFAULT_SIZE;
USB_Host_HostMode_On();
-
+
USB_Host_VBUS_Auto_Off();
USB_Host_VBUS_Manual_Enable();
USB_Host_VBUS_Manual_On();
@@ -229,3 +229,4 @@ static void USB_Init_Host(void)
USB_Attach();
}
#endif
+
diff --git a/LUFA/Drivers/USB/LowLevel/USBController.h b/LUFA/Drivers/USB/LowLevel/USBController.h
index 8a2fec788..fb71eb504 100644
--- a/LUFA/Drivers/USB/LowLevel/USBController.h
+++ b/LUFA/Drivers/USB/LowLevel/USBController.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -37,7 +37,7 @@
* \note This file should not be included directly. It is automatically included as needed by the USB driver
* dispatch header located in LUFA/Drivers/USB/USB.h.
*/
-
+
/** \ingroup Group_USB
* @defgroup Group_USBManagement USB Interface Management
*
@@ -53,7 +53,7 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
-
+
#include "../HighLevel/USBMode.h"
#include "../../../Common/Common.h"
@@ -61,7 +61,7 @@
#include "../HighLevel/Events.h"
#include "../HighLevel/USBTask.h"
#include "USBInterrupt.h"
-
+
#if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)
#include "Host.h"
#include "OTG.h"
@@ -69,7 +69,7 @@
#include "../HighLevel/HostStandardReq.h"
#include "../HighLevel/PipeStream.h"
#endif
-
+
#if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)
#include "Device.h"
#include "Endpoint.h"
@@ -90,7 +90,7 @@
#if !defined(F_CLOCK)
#error F_CLOCK is not defined. You must define F_CLOCK to the frequency of the unprescaled input clock in your project makefile.
#endif
-
+
#if (F_CLOCK == 8000000)
#if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || \
defined(__AVR_ATmega8U2__) || defined(__AVR_ATmega16U2__) || \
@@ -116,13 +116,13 @@
#define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP0))
#endif
#endif
-
+
#if !defined(USB_PLL_PSC)
#error No PLL prescale value available for chosen F_CPU value and AVR model.
#endif
-
+
/* Public Interface - May be used in end-application: */
- /* Macros: */
+ /* Macros: */
/** Regulator disable option mask for \ref USB_Init(). This indicates that the internal 3.3V USB data pad
* regulator should be enabled to regulate the data pin voltages to within the USB standard.
*
@@ -136,7 +136,7 @@
* \note See USB AVR data sheet for more information on the internal pad regulator.
*/
#define USB_OPT_REG_ENABLED (0 << 1)
-
+
/** Manual PLL control option mask for \ref USB_Init(). This indicates to the library that the user application
* will take full responsibility for controlling the AVR's PLL (used to generate the high frequency clock
* that the USB controller requires) and ensuring that it is locked at the correct frequency for USB operations.
@@ -178,12 +178,12 @@
* (both control and standard) when in either device or host mode. If the next packet of a stream
* is not received or acknowledged within this time period, the stream function will fail.
*
- * This value may be overridden in the user project makefile as the value of the
+ * This value may be overridden in the user project makefile as the value of the
* \ref USB_STREAM_TIMEOUT_MS token, and passed to the compiler using the -D switch.
*/
#define USB_STREAM_TIMEOUT_MS 100
#endif
-
+
/* Inline Functions: */
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)
/** Returns boolean true if the VBUS line is currently high (i.e. the USB host is supplying power),
@@ -246,21 +246,21 @@
* PLL, and a USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device
* mode speed.
*
- * \note To reduce the FLASH requirements of the library if only device or host mode is required,
+ * \note To reduce the FLASH requirements of the library if only device or host mode is required,
* the mode can be statically set in the project makefile by defining the token USB_DEVICE_ONLY
- * (for device mode) or USB_HOST_ONLY (for host mode), passing the token to the compiler
+ * (for device mode) or USB_HOST_ONLY (for host mode), passing the token to the compiler
* via the -D switch. If the mode is statically set, this parameter does not exist in the
* function prototype.
* \n\n
*
* \note To reduce the FLASH requirements of the library if only fixed settings are are required,
- * the options may be set statically in the same manner as the mode (see the Mode parameter of
+ * the options may be set statically in the same manner as the mode (see the Mode parameter of
* this function). To statically set the USB options, pass in the USE_STATIC_OPTIONS token,
* defined to the appropriate options masks. When the options are statically set, this
* parameter does not exist in the function prototype.
* \n\n
- *
- * \note The mode parameter does not exist on devices where only one mode is possible, such as USB
+ *
+ * \note The mode parameter does not exist on devices where only one mode is possible, such as USB
* AVR models which only implement the USB device mode in hardware.
*
* \see Device.h for the USB_DEVICE_OPT_* masks.
@@ -280,7 +280,7 @@
const uint8_t Options
#endif
);
-
+
/** Shuts down the USB interface. This turns off the USB interface after deallocating all USB FIFO
* memory, endpoints and pipes. When turned off, no USB functionality can be used until the interface
* is restarted with the \ref USB_Init() function.
@@ -314,7 +314,7 @@
#elif defined(USB_DEVICE_ONLY)
#define USB_CurrentMode USB_MODE_Device
#endif
-
+
#if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__)
/** Indicates the current USB options that the USB interface was initialized with when \ref USB_Init()
* was called. This value will be one of the USB_MODE_* masks defined elsewhere in this module.
@@ -348,12 +348,12 @@
#if defined(USB_CAN_BE_DEVICE)
static void USB_Init_Device(void);
#endif
-
+
#if defined(USB_CAN_BE_HOST)
static void USB_Init_Host(void);
#endif
#endif
-
+
/* Inline Functions: */
static inline void USB_PLL_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_PLL_On(void)
@@ -361,13 +361,13 @@
PLLCSR = USB_PLL_PSC;
PLLCSR |= (1 << PLLE);
}
-
+
static inline void USB_PLL_Off(void) ATTR_ALWAYS_INLINE;
static inline void USB_PLL_Off(void)
{
PLLCSR = 0;
}
-
+
static inline bool USB_PLL_IsReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline bool USB_PLL_IsReady(void)
{
@@ -381,7 +381,7 @@
UHWCON |= (1 << UVREGE);
#else
REGCR &= ~(1 << REGDIS);
- #endif
+ #endif
}
static inline void USB_REG_Off(void) ATTR_ALWAYS_INLINE;
@@ -391,9 +391,9 @@
UHWCON &= ~(1 << UVREGE);
#else
REGCR |= (1 << REGDIS);
- #endif
+ #endif
}
-
+
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
static inline void USB_OTGPAD_On(void) ATTR_ALWAYS_INLINE;
static inline void USB_OTGPAD_On(void)
@@ -413,13 +413,13 @@
{
USBCON |= (1 << FRZCLK);
}
-
+
static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE;
static inline void USB_CLK_Unfreeze(void)
{
USBCON &= ~(1 << FRZCLK);
}
-
+
static inline void USB_Controller_Enable(void) ATTR_ALWAYS_INLINE;
static inline void USB_Controller_Enable(void)
{
@@ -436,11 +436,11 @@
static inline void USB_Controller_Reset(void)
{
const uint8_t Temp = USBCON;
-
+
USBCON = (Temp & ~(1 << USBE));
USBCON = (Temp | (1 << USBE));
}
-
+
#if defined(USB_CAN_BE_BOTH)
static inline uint8_t USB_GetUSBModeFromUID(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;
static inline uint8_t USB_GetUSBModeFromUID(void)
@@ -453,12 +453,13 @@
#endif
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Drivers/USB/LowLevel/USBInterrupt.c b/LUFA/Drivers/USB/LowLevel/USBInterrupt.c
index 54983c09e..92723ef0e 100644
--- a/LUFA/Drivers/USB/LowLevel/USBInterrupt.c
+++ b/LUFA/Drivers/USB/LowLevel/USBInterrupt.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,19 +34,19 @@
void USB_INT_DisableAllInterrupts(void)
{
#if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
- USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
+ USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
#elif defined(USB_SERIES_4_AVR)
USBCON &= ~(1 << VBUSTE);
#endif
-
+
#if defined(USB_CAN_BE_BOTH)
OTGIEN = 0;
#endif
-
+
#if defined(USB_CAN_BE_HOST)
UHIEN = 0;
#endif
-
+
#if defined(USB_CAN_BE_DEVICE)
UDIEN = 0;
#endif
@@ -57,15 +57,15 @@ void USB_INT_ClearAllInterrupts(void)
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USBINT = 0;
#endif
-
+
#if defined(USB_CAN_BE_BOTH)
OTGINT = 0;
#endif
-
+
#if defined(USB_CAN_BE_HOST)
UHINT = 0;
#endif
-
+
#if defined(USB_CAN_BE_DEVICE)
UDINT = 0;
#endif
@@ -86,7 +86,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
}
else
{
- USB_DeviceState = DEVICE_STATE_Unattached;
+ USB_DeviceState = DEVICE_STATE_Unattached;
EVENT_USB_Device_Disconnect();
}
}
@@ -98,9 +98,9 @@ ISR(USB_GEN_vect, ISR_BLOCK)
USB_INT_Disable(USB_INT_SUSPI);
USB_INT_Enable(USB_INT_WAKEUPI);
-
+
USB_CLK_Freeze();
-
+
if (!(USB_Options & USB_OPT_MANUAL_PLL))
USB_PLL_Off();
@@ -127,19 +127,19 @@ ISR(USB_GEN_vect, ISR_BLOCK)
USB_INT_Disable(USB_INT_WAKEUPI);
USB_INT_Enable(USB_INT_SUSPI);
-
+
if (USB_ConfigurationNumber)
USB_DeviceState = DEVICE_STATE_Configured;
else
USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
-
+
#if defined(USB_SERIES_2_AVR) && !defined(NO_LIMITED_CONTROLLER_CONNECT)
EVENT_USB_Device_Connect();
#else
- EVENT_USB_Device_WakeUp();
+ EVENT_USB_Device_WakeUp();
#endif
}
-
+
if (USB_INT_HasOccurred(USB_INT_EORSTI) && USB_INT_IsEnabled(USB_INT_EORSTI))
{
USB_INT_Clear(USB_INT_EORSTI);
@@ -161,29 +161,29 @@ ISR(USB_GEN_vect, ISR_BLOCK)
EVENT_USB_Device_Reset();
}
-
+
#if !defined(NO_SOF_EVENTS)
if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI))
{
USB_INT_Clear(USB_INT_SOFI);
-
+
EVENT_USB_Device_StartOfFrame();
}
- #endif
#endif
-
+ #endif
+
#if defined(USB_CAN_BE_HOST)
if (USB_INT_HasOccurred(USB_INT_DDISCI) && USB_INT_IsEnabled(USB_INT_DDISCI))
{
USB_INT_Clear(USB_INT_DDISCI);
USB_INT_Clear(USB_INT_DCONNI);
USB_INT_Disable(USB_INT_DDISCI);
-
+
EVENT_USB_Host_DeviceUnattached();
USB_ResetInterface();
}
-
+
if (USB_INT_HasOccurred(USB_INT_VBERRI) && USB_INT_IsEnabled(USB_INT_VBERRI))
{
USB_INT_Clear(USB_INT_VBERRI);
@@ -201,18 +201,18 @@ ISR(USB_GEN_vect, ISR_BLOCK)
{
USB_INT_Clear(USB_INT_SRPI);
USB_INT_Disable(USB_INT_SRPI);
-
+
EVENT_USB_Host_DeviceAttached();
USB_INT_Enable(USB_INT_DDISCI);
-
+
USB_HostState = HOST_STATE_Powered;
}
if (USB_INT_HasOccurred(USB_INT_BCERRI) && USB_INT_IsEnabled(USB_INT_BCERRI))
{
USB_INT_Clear(USB_INT_BCERRI);
-
+
EVENT_USB_Host_DeviceEnumerationFailed(HOST_ENUMERROR_NoDeviceDetected, 0);
EVENT_USB_Host_DeviceUnattached();
@@ -223,7 +223,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
if (USB_INT_HasOccurred(USB_INT_HSOFI) && USB_INT_IsEnabled(USB_INT_HSOFI))
{
USB_INT_Clear(USB_INT_HSOFI);
-
+
EVENT_USB_Host_StartOfFrame();
}
#endif
@@ -231,7 +231,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
#if defined(USB_CAN_BE_BOTH)
if (USB_INT_HasOccurred(USB_INT_IDTI) && USB_INT_IsEnabled(USB_INT_IDTI))
- {
+ {
USB_INT_Clear(USB_INT_IDTI);
if (USB_DeviceState != DEVICE_STATE_Unattached)
@@ -239,7 +239,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
if (USB_HostState != HOST_STATE_Unattached)
EVENT_USB_Host_DeviceUnattached();
-
+
USB_CurrentMode = USB_GetUSBModeFromUID();
USB_ResetInterface();
@@ -251,7 +251,7 @@ ISR(USB_GEN_vect, ISR_BLOCK)
#if defined(INTERRUPT_CONTROL_ENDPOINT) && defined(USB_CAN_BE_DEVICE)
ISR(USB_COM_vect, ISR_BLOCK)
{
- uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
+ uint8_t PrevSelectedEndpoint = Endpoint_GetCurrentEndpoint();
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
USB_INT_Disable(USB_INT_RXSTPI);
@@ -266,3 +266,4 @@ ISR(USB_COM_vect, ISR_BLOCK)
Endpoint_SelectEndpoint(PrevSelectedEndpoint);
}
#endif
+
diff --git a/LUFA/Drivers/USB/LowLevel/USBInterrupt.h b/LUFA/Drivers/USB/LowLevel/USBInterrupt.h
index 8c9b2db1d..51e7a803e 100644
--- a/LUFA/Drivers/USB/LowLevel/USBInterrupt.h
+++ b/LUFA/Drivers/USB/LowLevel/USBInterrupt.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -37,7 +37,7 @@
* \note This file should not be included directly. It is automatically included as needed by the USB driver
* dispatch header located in LUFA/Drivers/USB/USB.h.
*/
-
+
#ifndef __USBINTERRUPT_H__
#define __USBINTERRUPT_H__
@@ -46,7 +46,7 @@
#include <avr/interrupt.h>
#include <util/atomic.h>
#include <stdbool.h>
-
+
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
@@ -56,7 +56,7 @@
#if !defined(__INCLUDE_FROM_USB_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
#endif
-
+
/* Private Interface - For use in library only: */
#if !defined(__DOXYGEN__)
/* Macros: */
@@ -91,15 +91,16 @@
#include "../HighLevel/USBMode.h"
#include "../HighLevel/Events.h"
#include "USBController.h"
-
+
/* Function Prototypes: */
void USB_INT_ClearAllInterrupts(void);
void USB_INT_DisableAllInterrupts(void);
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
#endif
+
diff --git a/LUFA/Drivers/USB/USB.h b/LUFA/Drivers/USB/USB.h
index 552af0f2e..b8dce821e 100644
--- a/LUFA/Drivers/USB/USB.h
+++ b/LUFA/Drivers/USB/USB.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -86,9 +86,9 @@
*
* <table>
* <tr>
- * <th width="100px">USB Class</th>
- * <th width="90px">Device Mode</th>
- * <th width="90px">Host Mode</th>
+ * <th width="100px">USB Class</th>
+ * <th width="90px">Device Mode</th>
+ * <th width="90px">Host Mode</th>
* </tr>
* <tr>
* <td>Audio</td>
@@ -141,10 +141,10 @@
*
* \subsection SSec_ClassDriverDevice Device Mode Class Drivers
* Implementing a Device Mode Class Driver in a user application requires a number of steps to be followed. Firstly,
- * the module configuration and state structure must be added to the project source. These structures are named in a
+ * the module configuration and state structure must be added to the project source. These structures are named in a
* similar manner between classes, that of <i>USB_ClassInfo_<b>{Class Name}</b>_Device_t</i>, and are used to hold the
- * complete state and configuration for each class instance. Multiple class instances is where the power of the class
- * drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's ClassInfo
+ * complete state and configuration for each class instance. Multiple class instances is where the power of the class
+ * drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's ClassInfo
* structure.
*
* Inside the ClassInfo structure lies two sections, a <i>Config</i> section, and a <i>State</i> section. The Config
@@ -163,7 +163,7 @@
* .Config =
* {
* .StreamingInterfaceNumber = 1,
- *
+ *
* .DataINEndpointNumber = 1,
* .DataINEndpointSize = 256,
* },
@@ -183,12 +183,12 @@
* void EVENT_USB_Device_ConfigurationChanged(void)
* {
* LEDs_SetAllLEDs(LEDMASK_USB_READY);
- *
+ *
* if (!(Audio_Device_ConfigureEndpoints(&My_Audio_Interface)))
* LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
* }
* \endcode
- *
+ *
* Once initialized, it is important to maintain the class driver's state by repeatedly calling the Class Driver's
* <i><b>{Class Name}</b>_Device_USBTask()</i> function in the main program loop. The exact implementation of this
* function varies between class drivers, and can be used for any internal class driver purpose to maintain each
@@ -199,13 +199,13 @@
* int main(void)
* {
* SetupHardware();
- *
+ *
* LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
- *
+ *
* for (;;)
* {
* Create_And_Process_Samples();
- *
+ *
* Audio_Device_USBTask(&My_Audio_Interface);
* USB_USBTask();
* }
@@ -240,10 +240,10 @@
*
* \subsection SSec_ClassDriverHost Host Mode Class Drivers
* Implementing a Host Mode Class Driver in a user application requires a number of steps to be followed. Firstly,
- * the module configuration and state structure must be added to the project source. These structures are named in a
+ * the module configuration and state structure must be added to the project source. These structures are named in a
* similar manner between classes, that of <i>USB_ClassInfo_<b>{Class Name}</b>_Host_t</i>, and are used to hold the
- * complete state and configuration for each class instance. Multiple class instances is where the power of the class
- * drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's ClassInfo
+ * complete state and configuration for each class instance. Multiple class instances is where the power of the class
+ * drivers lie; multiple interfaces of the same class simply require more instances of the Class Driver's ClassInfo
* structure.
*
* Inside the ClassInfo structure lies two sections, a <i>Config</i> section, and a <i>State</i> section. The Config
@@ -263,7 +263,7 @@
* {
* .DataINPipeNumber = 1,
* .DataINPipeDoubleBank = false,
- *
+ *
* .DataOUTPipeNumber = 2,
* .DataOUTPipeDoubleBank = false,
* },
@@ -274,7 +274,7 @@
* should be called in response to the host state machine entering the \ref HOST_STATE_Addressed state. This function
* will return an error code from the class driver's <i><b>{Class Name}</b>_EnumerationFailure_ErrorCodes_t</i> enum
* to indicate if the driver successfully initialized the instance and bound it to an interface in the attached device.
- * Like all the class driver functions, this function takes in the address of the specific instance you wish to initialize -
+ * Like all the class driver functions, this function takes in the address of the specific instance you wish to initialize -
* in this manner, multiple separate instances of the same class type can be initialized. A fragment of a Class Driver
* based Host mode application may look like the following:
*
@@ -283,7 +283,7 @@
* {
* case HOST_STATE_Addressed:
* LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
- *
+ *
* uint16_t ConfigDescriptorSize;
* uint8_t ConfigDescriptorData[512];
*
@@ -323,16 +323,16 @@
* int main(void)
* {
* SetupHardware();
- *
+ *
* LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
- *
+ *
* for (;;)
* {
* switch (USB_HostState)
* {
* // Host state machine handling here
- * }
- *
+ * }
+ *
* MIDI_Host_USBTask(&My_Audio_Interface);
* USB_USBTask();
* }
@@ -350,7 +350,7 @@
* read and write routines. See each driver's individual documentation for more information on the
* class-specific functions.
*/
-
+
#ifndef __USB_H__
#define __USB_H__
@@ -362,12 +362,12 @@
/* Includes: */
#include "HighLevel/USBMode.h"
- /* Preprocessor Checks: */
+ /* Preprocessor Checks: */
#if (!defined(USB_SERIES_2_AVR) && !defined(USB_SERIES_4_AVR) && \
!defined(USB_SERIES_6_AVR) && !defined(USB_SERIES_7_AVR))
#error The currently selected AVR model is not supported under the USB component of the LUFA library.
#endif
-
+
/* Includes: */
#include "HighLevel/USBTask.h"
#include "HighLevel/Events.h"
@@ -376,24 +376,24 @@
#include "LowLevel/USBController.h"
#include "LowLevel/USBInterrupt.h"
-
+
#if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)
#include "LowLevel/Host.h"
#include "LowLevel/Pipe.h"
#include "HighLevel/HostStandardReq.h"
#include "HighLevel/PipeStream.h"
#endif
-
+
#if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)
#include "LowLevel/Device.h"
#include "LowLevel/Endpoint.h"
#include "HighLevel/DeviceStandardReq.h"
#include "HighLevel/EndpointStream.h"
#endif
-
+
#if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__)
#include "LowLevel/OTG.h"
#endif
-
+
#endif
diff --git a/LUFA/License.txt b/LUFA/License.txt
index 82e3f74ec..a2228be8e 100644
--- a/LUFA/License.txt
+++ b/LUFA/License.txt
@@ -15,3 +15,4 @@ whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
+
diff --git a/LUFA/ManPages/AboutLUFA.txt b/LUFA/ManPages/AboutLUFA.txt
index 7728347c6..c7374bce6 100644
--- a/LUFA/ManPages/AboutLUFA.txt
+++ b/LUFA/ManPages/AboutLUFA.txt
@@ -17,4 +17,4 @@
* \li \subpage Page_FutureChanges - Planned Changes to the Library
* \li \subpage Page_LUFAPoweredProjects - Other Projects Using LUFA
*/
- \ No newline at end of file
+
diff --git a/LUFA/ManPages/AlternativeStacks.txt b/LUFA/ManPages/AlternativeStacks.txt
index a1ba858da..f9d6cbbcd 100644
--- a/LUFA/ManPages/AlternativeStacks.txt
+++ b/LUFA/ManPages/AlternativeStacks.txt
@@ -42,8 +42,8 @@
* <b>Website:</b> http://www.pjrc.com/teensy/usb_debug_only.html \n
* <b>Description:</b> Not so much a complete stack as a collection of USB enabled demos, this library is specifically
* designed for the PJRC Teensy line of USB AVRs, and thus may need to be modified for other USB AVR
- * chips. These minimal code samples shows the inner workings of the USB controller, without all the
- * abstraction present in most other USB AVR stacks.
+ * chips. These minimal code samples shows the inner workings of the USB controller, without all the
+ * abstraction present in most other USB AVR stacks.
*
* \section Sec_SoftwareStacks Software AVR Stacks
* These are the known alternative USB stacks which can run on regular AVR models, lacking dedicated hardware USB controllers
@@ -66,4 +66,4 @@
* Used in many commercial and non-commercial designs, with user-submitted projects available for viewing
* on the company's website. Uses C language code mixed with assembly for time-critical sections.
*/
-
+
diff --git a/LUFA/ManPages/BuildingLinkableLibraries.txt b/LUFA/ManPages/BuildingLinkableLibraries.txt
index 70919c0a2..e5782df9f 100644
--- a/LUFA/ManPages/BuildingLinkableLibraries.txt
+++ b/LUFA/ManPages/BuildingLinkableLibraries.txt
@@ -20,3 +20,4 @@
* demonstrated in the library demos and applications. This is the preferred method, as the library is recompiled
* each time to ensure that all static options for a particular application are applied.
*/
+
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index a15fe828a..68e3826f3 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -208,7 +208,7 @@
* read (thanks to Andrei Krainev)
* - Fixed device state not being reset back to the default state if the host sets the address to 0
* - Fixed Set Configuration requests not being stalled until the host has set the device's address
- * - Fixed Host mode HID class driver not sending the correct report type when HID_Host_SendReportByID() was called and the
+ * - Fixed Host mode HID class driver not sending the correct report type when HID_Host_SendReportByID() was called and the
* HID_HOST_BOOT_PROTOCOL_ONLY compile time option is set
* - Fixed INTERRUPT_CONTROL_ENDPOINT compile time option preventing other interrupts from occurring while the control endpoint
* request is being processed, causing possible lockups if a USB interrupt occurs during a transfer
@@ -323,7 +323,7 @@
* - Fixed Mass Storage Host Class driver and Low Level demo not clearing the error condition if an attached device returns a
* STALL to a GET MAX LUN request (thanks to Martin Luxen)
* - Fixed TeensyHID bootloader not properly shutting down the USB interface to trigger a disconnection on the host before resetting
- * - Fixed MassStorageHost Class driver demo not having USB_STREAM_TIMEOUT_MS compile time option set properly to prevent slow
+ * - Fixed MassStorageHost Class driver demo not having USB_STREAM_TIMEOUT_MS compile time option set properly to prevent slow
* devices from timing out the data pipes
* - Fixed the definition of the Endpoint_BytesInEndpoint() macro for the U4 series AVR parts
* - Fixed MIDI host Class driver MIDI_Host_SendEventPacket() routine not properly checking for Pipe ready before writing
@@ -400,7 +400,7 @@
* - Added new Pipe_IsFrozen() macro to determine if the currently selected pipe is frozen
* - Added new USB_GetHIDReportSize() function to the HID report parser to retrieve the size of a given report by its ID
* - Added new combined Mass Storage and Keyboard demo (thanks to Matthias Hullin)
- *
+ *
* <b>Changed:</b>
* - SetIdle requests to the HID device driver with a 0 idle period (send changes only) now only affect the requested
* HID interface within the device, not all HID interfaces
@@ -479,7 +479,7 @@
* - Added new Pipe_BoundEndpointNumber() and Pipe_IsEndpointBound() functions
* - Added new DEVICE_STATE_AS_GPIOR and HOST_STATE_AS_GPIOR compile time options
* - Added 404 Not Found errors to the webserver in the RNDIS demos to indicate invalid URLs
- *
+ *
* <b>Changed:</b>
* - Deprecated pseudo-scheduler and removed dynamic memory allocator from the library (first no longer needed and second unused)
* - The device-mode CALLBACK_USB_GetDescriptor() function now has an extra parameter so that the memory space in which the requested
@@ -635,7 +635,7 @@
* - Changed HWB board driver to Buttons driver, to allow for the support of future boards with more than one mounted GPIO button
* - Serial driver now correctly calculates the baud register value when in double speed mode
* - Init function of the Serial driver is now static inline to product smaller code for the common-case of static init values
- *
+ *
*
* \section Sec_ChangeLog090401 Version 090401
*
@@ -757,9 +757,9 @@
* - Doxygen documentation now contains documentation on all the projects, bootloaders and most demos included with the library
* - CDC bootloader now runs user application when USB disconnected rather than waiting for a hard reset
* - MouseHostWithParser and KeyboardHostWithParser now support multiple-report devices
- * - RNDIS demo can now close connections correctly using the new TCP_APP_CLOSECONNECTION() macro - used in Webserver
+ * - RNDIS demo can now close connections correctly using the new TCP_APP_CLOSECONNECTION() macro - used in Webserver
* - Fixed the DFU bootloader, no longer freezes up when certain files are programmed into an AVR, made reading/writing faster
- * - Fixed mouse/joystick up/down movements reversed - HID mouse X/Y coordinates use a left-handed coordinate system, not a normal
+ * - Fixed mouse/joystick up/down movements reversed - HID mouse X/Y coordinates use a left-handed coordinate system, not a normal
* right-handed system
* - Added stub code to the CDC and USBtoSerial demos showing how to read and set the RS-232 handshake lines - not currently used in
* the demos, but the example code and supporting defines are now in place
@@ -814,7 +814,7 @@
* - All HID demos now pass the USB.org automated HID compliance tests
* - Polling interval of the interrupt endpoint in the CDC based demos changed to 0xFF to fix problems on Linux systems
* - Changed stream functions to accept a new callback function, with NO_STREAM_CALLBACKS used to disable all callbacks
- * - Mass Storage demo dataflash management routines changed to use the endpoint stream functions
+ * - Mass Storage demo dataflash management routines changed to use the endpoint stream functions
* - Added AVRStudio project files for each demo in addition to the existing Programmer's Notepad master project file
* - Re-added call to ReconfigureUSART() in USBtoSerial SetLineCoding request, so that baud rate changes
* are reflected in the hardware (change was previously lost)
@@ -950,7 +950,7 @@
*
* - Added call to ReconfigureUSART() in USBtoSerial SetLineCoding request, so that baud rate changes
* are reflected in the hardware
- * - Fixed CDC and USBtoSerial demos - Stream commands do not work for control endpoints, and the
+ * - Fixed CDC and USBtoSerial demos - Stream commands do not work for control endpoints, and the
* GetLineCoding request had an incorrect RequestType mask preventing it from being processed
* - Improved reliability of the USBtoSerial demo, adding a busy wait while the buffer is full
* - Device control endpoint size is now determined from the device's descriptors rather than being fixed
@@ -1057,6 +1057,7 @@
* - ID transition interrupt now raises the appropriate device/host disconnect event if device attached
* - Fixed double VBUS change (and VBUS -) event when detaching in device mode
* - Added ability to disable ANSI terminal codes by the defining of DISABLE_TERMINAL_CODES in makefile
- * - Removed return from ConfigurePipe and ConfigureEndpoint functions - use Pipe_IsConfigured() and
+ * - Removed return from ConfigurePipe and ConfigureEndpoint functions - use Pipe_IsConfigured() and
* Endpoint_IsConfigured() after calling the config functions to determine success
*/
+
diff --git a/LUFA/ManPages/CompileTimeTokens.txt b/LUFA/ManPages/CompileTimeTokens.txt
index d74cb4314..f74898452 100644
--- a/LUFA/ManPages/CompileTimeTokens.txt
+++ b/LUFA/ManPages/CompileTimeTokens.txt
@@ -30,7 +30,7 @@
* Mouse or Keyboard operation is desired, using boot compatible devices), the code responsible for the Report protocol
* mode can be removed to save space in the compiled application by defining this token. When defined, it is still necessary
* to explicitly put the attached device into Boot protocol mode via a call to \ref HID_Host_SetBootProtocol().
- *
+ *
* <b>HID_STATETABLE_STACK_DEPTH</b>=<i>x</i> - ( \ref Group_HIDParser ) \n
* HID reports may contain PUSH and POP elements, to store and retrieve the current HID state table onto a stack. This
* allows for reports to save the state table before modifying it slightly for a data item, and then restore the previous
@@ -203,3 +203,4 @@
* back to a known idle state before communications occur with the device. This token may be defined to a 16-bit value to set the device
* settle period, specified in milliseconds. If not defined, the default value specified in Host.h is used instead.
*/
+
diff --git a/LUFA/ManPages/CompilingApps.txt b/LUFA/ManPages/CompilingApps.txt
index 60c5a8ae2..45cbdd678 100644
--- a/LUFA/ManPages/CompilingApps.txt
+++ b/LUFA/ManPages/CompilingApps.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \page Page_CompilingApps Compiling the Demos, Bootloaders and Projects
*
* The following details how to compile the included LUFA demos, applications and bootloaders using AVR-GCC.
@@ -27,4 +27,4 @@
* files), execute <b>"make clean"</b>. Once a "make all" has been run and no errors were encountered, the resulting binary will
* be located in the generated ".HEX" file. If your project makes use of pre-initialized EEPROM variables, the generated ".EEP"
* file will contain the project's EEPROM data.
- */ \ No newline at end of file
+ */
diff --git a/LUFA/ManPages/ConfiguringApps.txt b/LUFA/ManPages/ConfiguringApps.txt
index f601efacf..e5ce9fd51 100644
--- a/LUFA/ManPages/ConfiguringApps.txt
+++ b/LUFA/ManPages/ConfiguringApps.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \page Page_ConfiguringApps Configuring the Demos, Bootloaders and Projects
*
* If the target AVR model, clock speed, board or other settings are different from the current settings, they must be changed
@@ -86,4 +86,4 @@
* model and cannot be made to function through the altering of the makefile settings alone (or at all). Settings such as the USB mode (device, host or both),
* the USB interface speed (Low or Full speed) and other LUFA configuration options can be set here - see \ref Page_TokenSummary documentation for details
* on the available LUFA compile time configuration options.
- */ \ No newline at end of file
+ */
diff --git a/LUFA/ManPages/DevelopingWithLUFA.txt b/LUFA/ManPages/DevelopingWithLUFA.txt
index 695d36c51..4ea379938 100644
--- a/LUFA/ManPages/DevelopingWithLUFA.txt
+++ b/LUFA/ManPages/DevelopingWithLUFA.txt
@@ -18,4 +18,4 @@
* \li \subpage Page_WritingBoardDrivers - How to Write Custom Board Drivers
* \li \subpage Page_SoftwareBootloaderStart - How to jump to the bootloader in software
*/
- \ No newline at end of file
+
diff --git a/LUFA/ManPages/DeviceSupport.txt b/LUFA/ManPages/DeviceSupport.txt
index 76d32d4fa..b9a0e5170 100644
--- a/LUFA/ManPages/DeviceSupport.txt
+++ b/LUFA/ManPages/DeviceSupport.txt
@@ -44,4 +44,4 @@
* - Arduino Uno
* - Any Other Custom User Boards (with Board Drivers if desired, see \ref Page_WritingBoardDrivers)
*/
- \ No newline at end of file
+
diff --git a/LUFA/ManPages/DirectorySummaries.txt b/LUFA/ManPages/DirectorySummaries.txt
index bb7460321..36ba26d65 100644
--- a/LUFA/ManPages/DirectorySummaries.txt
+++ b/LUFA/ManPages/DirectorySummaries.txt
@@ -6,30 +6,30 @@
/** \dir LUFA/Common
* \brief Common library header files.
- *
+ *
* This folder contains header files which are common to all parts of the LUFA library. They may be used freely in
* user applications.
*
* \dir LUFA/Drivers
* \brief Library hardware and software drivers.
- *
+ *
* This folder contains all the library hardware and software drivers for each supported board and USB AVR
* microcontroller model.
- *
+ *
* \dir LUFA/Drivers/Misc
* \brief Miscellaneous driver files.
- *
+ *
* This folder contains drivers for aspects other than the USB interface, board hardware or AVR peripherals.
- *
+ *
* \dir LUFA/Drivers/Peripheral
* \brief USB AVR peripheral driver files.
- *
+ *
* This folder contains drivers for several of the AVR internal peripherals such as the USART, compatible with
* all USB AVR models.
*
* \dir LUFA/Drivers/Peripheral/AVRU4U6U7
* \brief AT90USBXXX6, AT90USBXXX7 and ATMEGAXXU4 AVR model peripheral driver files.
- *
+ *
* This folder contains drivers for several of the AVR internal peripherals such as the USART, compatible only with
* the AT90USBXXX6, AT90USBXXX7 and ATMEGAXXU4 USB AVR models, such as the AT90USB1287. Its contents should <b>not</b> be
* included by the user application - the dispatch header file located in the parent directory should be used
@@ -37,7 +37,7 @@
*
* \dir LUFA/Drivers/USB
* \brief USB controller peripheral driver files.
- *
+ *
* This folder contains the main header files required to implement the USB interface in the USB supporting AVR models.
* The header files contained directly in this folder should be included in the user application in order to gain USB
* functionality, and the appropriate C source files in the LowLevel and HighLevel driver folders added to the compile
@@ -45,147 +45,148 @@
*
* \dir LUFA/Drivers/USB/LowLevel
* \brief Low level USB driver files.
- *
+ *
* This folder contains low level USB driver source files required to implement USB functionality on the USB AVR microcontrollers.
*
* \dir LUFA/Drivers/USB/HighLevel
* \brief High level USB driver files.
- *
+ *
* This folder contains high level USB driver source files required to implement USB functionality on the USB AVR microcontrollers.
*
* \dir LUFA/Drivers/USB/Class
* \brief USB Class helper driver files.
- *
+ *
* This folder contains drivers for implementing functionality of standardized USB classes. These are not used directly by the library,
* but provide a standard and library-maintained way of implementing functionality from some of the defined USB classes without extensive
* development effort. Is is recommended that these drivers be used where possible to reduce maintenance of user applications.
*
* \dir LUFA/Drivers/USB/Class/Device
* \brief USB Device Class helper driver files.
- *
+ *
* Device mode drivers for the standard USB classes.
*
* \dir LUFA/Drivers/USB/Class/Host
* \brief USB Host Class helper driver files.
- *
+ *
* Host mode drivers for the standard USB classes.
*
* \dir LUFA/Drivers/Board
* \brief Board hardware driver files.
- *
+ *
* This folder contains drivers for interfacing with the physical hardware on supported commercial boards, primarily from
* the Atmel corporation. Header files in this folder should be included in user applications requiring the functionality of
* hardware placed on supported boards.
*
* \dir LUFA/Drivers/Board/USBKEY
* \brief USBKEY board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the Atmel USBKEY demonstration board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir LUFA/Drivers/Board/STK526
* \brief STK526 board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the Atmel STK526 development board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir LUFA/Drivers/Board/STK525
* \brief STK525 board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the Atmel STK525 development board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir LUFA/Drivers/Board/RZUSBSTICK
* \brief RZUSBSTICK board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the Atmel RZUSBSTICK board, as used in the Atmel "Raven" wireless kits. The header
* files in this folder should not be included directly in user applications; the similarly named dispatch header files located in
* the parent Board directory should be included instead.
*
* \dir LUFA/Drivers/Board/ATAVRUSBRF01
* \brief ATAVRUSBRF01 board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the Atmel ATAVRUSBRF01 board, as used in several Atmel wireless demo kits. The header
* files in this folder should not be included directly in user applications; the similarly named dispatch header files located in
* the parent Board directory should be included instead.
*
* \dir LUFA/Drivers/Board/BUMBLEB
* \brief BUMBLEB board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the Fletchtronics Bumble-B board (http://fletchtronics.net/bumble-b). The header
* files in this folder should not be included directly in user applications; the similarly named dispatch header files located in
* the parent Board directory should be included instead.
*
* \dir LUFA/Drivers/Board/XPLAIN
* \brief XPLAIN board hardware driver files.
- *
- * This folder contains drivers for hardware on the Atmel XPLAIN board (all hardware revisions). The header files in this folder
- * should not be included directly in user applications; the similarly named dispatch header files located in the parent Board
+ *
+ * This folder contains drivers for hardware on the Atmel XPLAIN board (all hardware revisions). The header files in this folder
+ * should not be included directly in user applications; the similarly named dispatch header files located in the parent Board
* directory should be included instead.
*
* \dir LUFA/Drivers/Board/EVK527
* \brief XPLAIN board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the Atmel EVK527 development board. The header files in this folder should
* not be included directly in user applications; the similarly named dispatch header files located in the parent Board directory
* should be included instead.
*
* \dir LUFA/Drivers/Board/TEENSY
* \brief TEENSY board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on all revisions of the PJRC Teensy boards (http://www.pjrc.com/teensy/). The header
* files in this folder should not be included directly in user applications; the similarly named dispatch header files located
* in the parent Board directory should be included instead.
*
* \dir LUFA/Drivers/Board/USBTINYMKII
* \brief USBTINY-MKII board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on all revisions of the USBTINY-MKII boards (http://tom-itx.dyndns.org:81/~webpage/).
* The header files in this folder should not be included directly in user applications; the similarly named dispatch header files
* located in the parent Board directory should be included instead.
*
* \dir LUFA/Drivers/Board/BENITO
* \brief BENITO board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the Benito boards (http://dorkbotpdx.org/wiki/benito). The header files in this
* folder should not be included directly in user applications; the similarly named dispatch header files located in the parent
* Board directory should be included instead.
*
* \dir LUFA/Drivers/Board/JMDBU2
* \brief JM-DB-U2 board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the JM-DB-U2 boards (http://u2.mattair.net/). The header files in this folder
* should not be included directly in user applications; the similarly named dispatch header files located in the parent Board
* directory should be included instead.
*
* \dir LUFA/Drivers/Board/OLIMEX162
* \brief Olimex USB-STK-162 board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the Olimex AVR-USB-162 boards (http://www.olimex.com/dev/avr-usb-162.html).
* The header files in this folder should not be included directly in user applications; the similarly named dispatch header files
* located in the parent Board directory should be included instead.
*
* \dir LUFA/Drivers/Board/USBFOO
* \brief USBFOO board hardware driver files.
- *
+ *
* This folder contains drivers for hardware on the USBFOO boards (http://shop.kernelconcepts.de/product_info.php?products_id=102).
* The header files in this folder should not be included directly in user applications; the similarly named dispatch header files
* located in the parent Board directory should be included instead.
*
* \dir LUFA/CodeTemplates
* \brief Code templates for use in LUFA powered applications.
- *
+ *
* This contains code templates for board drivers, sample LUFA project makefiles and other similar templates that can be copied into
* a LUFA powered application and modified to speed up development.
*
* \dir LUFA/CodeTemplates/DriverStubs
* \brief Driver stub header files for custom boards, to allow the LUFA board drivers to operate.
- *
+ *
* This contains stub files for the LUFA board drivers. If the LUFA board drivers are used with board hardware other than those
* directly supported by the library, the BOARD parameter of the application's makefile can be set to "USER", and these stub files
* copied to the "/Board/" directory of the application's folder. When fleshed out with working driver code for the custom board,
* the corresponding LUFA board APIs will work correctly with the non-standard board hardware.
*/
+
diff --git a/LUFA/ManPages/Donating.txt b/LUFA/ManPages/Donating.txt
index 8a4d601ad..6e476c827 100644
--- a/LUFA/ManPages/Donating.txt
+++ b/LUFA/ManPages/Donating.txt
@@ -21,4 +21,4 @@
* \image html "http://www.pledgie.com/campaigns/6927.png?skin_name=chrome"
* <a href='http://www.pledgie.com/campaigns/6927'>Donate to this project via PayPal</a> - Thanks in Advance!
*/
-
+
diff --git a/LUFA/ManPages/FutureChanges.txt b/LUFA/ManPages/FutureChanges.txt
index a6f52d119..15d5df492 100644
--- a/LUFA/ManPages/FutureChanges.txt
+++ b/LUFA/ManPages/FutureChanges.txt
@@ -40,3 +40,4 @@
* -# Atmel ARM7 series microcontrollers
* -# Other (commercial) C compilers
*/
+
diff --git a/LUFA/ManPages/GettingStarted.txt b/LUFA/ManPages/GettingStarted.txt
index c161bfe1f..ab460cb6e 100644
--- a/LUFA/ManPages/GettingStarted.txt
+++ b/LUFA/ManPages/GettingStarted.txt
@@ -24,3 +24,4 @@
* \li \subpage Page_CompilingApps - How to Compile the Included Demos, Projects and Bootloaders
* \li \subpage Page_ProgrammingApps - How to Program an AVR with the Included Demos, Projects and Bootloaders
*/
+
diff --git a/LUFA/ManPages/Groups.txt b/LUFA/ManPages/Groups.txt
index a204412e1..0c9f4a657 100644
--- a/LUFA/ManPages/Groups.txt
+++ b/LUFA/ManPages/Groups.txt
@@ -13,8 +13,9 @@
*
* Functions, macros, variables, enums and types related to the control of AVR subsystems.
*/
-
+
/** @defgroup Group_MiscDrivers Miscellaneous Drivers
*
* Miscellaneous driver Functions, macros, variables, enums and types.
*/
+
diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt
index f1cf03135..1e41d5353 100644
--- a/LUFA/ManPages/LUFAPoweredProjects.txt
+++ b/LUFA/ManPages/LUFAPoweredProjects.txt
@@ -28,7 +28,7 @@
* - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html
* - U2DIL/U4DIL, a set of DIP layout USB AVR boards: http://www.reworld.eu/re/en/products/u2dil/
* - USBFOO 2, AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102
- *
+ *
* \section Sec_LUFAProjects Projects Using LUFA (Hobbyist)
*
* The following are known hobbyist projects using LUFA. Most are open source, and show off interesting ways that the LUFA library
@@ -70,7 +70,7 @@
* - USB Interface for Playstation Portable Devices: http://forums.ps2dev.org/viewtopic.php?t=11001
* - Userial, a USB to Serial converter with SPI, I2C and other protocols: http://www.tty1.net/userial/
* - XUM1541, a Commodore 64 floppy drive to USB adapter: http://www.root.org/~nate/c64/xum1541/
- *
+ *
* \section Sec_LUFACommercialProjects Projects Using LUFA (Commercial)
*
* The following is a list of known commercial products using LUFA. Some of these are open source, although many are "black-box"
@@ -91,4 +91,4 @@
* - Elektor Magazine, "USB is Cool/Sucks" by Jerry Jacobs and Chris Vossen (minor mention), January 2010 Issue
* - Elektor Magazine, "20 x Open Source" by Jens Nickel, March 2010 Issue
* - Circuit Cellar Magazine, "Advanced USB Design Debugging" by Collin O'Flynn, August 2010 Issue
- */ \ No newline at end of file
+ */
diff --git a/LUFA/ManPages/LUFAvsAtmelStack.txt b/LUFA/ManPages/LUFAvsAtmelStack.txt
index 1eb6d008c..b4fce2df0 100644
--- a/LUFA/ManPages/LUFAvsAtmelStack.txt
+++ b/LUFA/ManPages/LUFAvsAtmelStack.txt
@@ -43,4 +43,4 @@
* As many people are now using LUFA, there is a community being built around it. You can get answers to your LUFA related questions
* quickly by either emailing the library author (subject to author's schedule) or by posting to the official LUFA support mailing list.
*/
-
+
diff --git a/LUFA/ManPages/LibraryApps.txt b/LUFA/ManPages/LibraryApps.txt
index 2a6159af3..0f64345f9 100644
--- a/LUFA/ManPages/LibraryApps.txt
+++ b/LUFA/ManPages/LibraryApps.txt
@@ -75,7 +75,7 @@
* - <b>StillImageHost</b> - Still Image Camera host demo, using the library USB Still Image Class driver framework
* - <b>VirtualSerialHost</b> - Virtual Serial Port host demo, using the library USB CDC Class driver framework
* - <b>LowLevel</b>
- * - <b>JoystickHostWithParser</b> - Joystick host demo with HID Descriptor parser, using the low level LUFA APIs to implement
+ * - <b>JoystickHostWithParser</b> - Joystick host demo with HID Descriptor parser, using the low level LUFA APIs to implement
* the USB HID class
* - <b>GenericHIDHost</b> - Generic HID host demo, using the low level LUFA APIs to implement the USB HID class
* - <b>KeyboardHost</b> - USB Keyboard host demo, using the low level LUFA APIs to implement the USB HID class
@@ -113,3 +113,4 @@
*
* </small>
*/
+
diff --git a/LUFA/ManPages/LibraryResources.txt b/LUFA/ManPages/LibraryResources.txt
index 10f98d90d..14c24048a 100644
--- a/LUFA/ManPages/LibraryResources.txt
+++ b/LUFA/ManPages/LibraryResources.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/**
* \page Page_Resources Library Resources
*
@@ -32,4 +32,4 @@
* \section Sec_USBResources USB Resources
* USB-IF Website: http://www.usb.org \n
*/
-
+
diff --git a/LUFA/ManPages/LicenseInfo.txt b/LUFA/ManPages/LicenseInfo.txt
index 03b30a90b..447bec68c 100644
--- a/LUFA/ManPages/LicenseInfo.txt
+++ b/LUFA/ManPages/LicenseInfo.txt
@@ -19,3 +19,4 @@
*
* \verbinclude License.txt
*/
+
diff --git a/LUFA/ManPages/MainPage.txt b/LUFA/ManPages/MainPage.txt
index f8cd2e576..533591a41 100644
--- a/LUFA/ManPages/MainPage.txt
+++ b/LUFA/ManPages/MainPage.txt
@@ -26,7 +26,7 @@
* both host and device modes. For information about the project progression, see the blog link at \ref Page_Resources.
*
* LUFA is written specifically for the free AVR-GCC compiler, and uses several GCC-only extensions to make the
- * library API more streamlined and robust. You can download AVR-GCC for free in a convenient windows package,
+ * library API more streamlined and robust. You can download AVR-GCC for free in a convenient windows package,
* from the the WinAVR website (see \ref Page_Resources).
*
* The only required AVR peripherals for LUFA is the USB controller itself and interrupts - LUFA does not require the use of the
@@ -43,3 +43,4 @@
* \li \subpage Page_Donating - Donating to support this project
* \li \subpage Page_LibraryApps - Overview of included Demos, Bootloaders and Projects
*/
+
diff --git a/LUFA/ManPages/MigrationInformation.txt b/LUFA/ManPages/MigrationInformation.txt
index 6f8c8642a..474e9f4c7 100644
--- a/LUFA/ManPages/MigrationInformation.txt
+++ b/LUFA/ManPages/MigrationInformation.txt
@@ -57,7 +57,7 @@
* be updated in all project makefiles, or the makefile should be updated to use the new module source variables.
* - The Drivers/USB/LowLevel/HostChapter9.h source file has moved to Drivers/USB/HighLevel/HostStandardReq.c - this should
* be updated in all project makefiles, or the makefile should be updated to use the new module source variables.
- * - The Drivers/USB/LowLevel/LowLevel.c source file has moved to Drivers/LowLevel/USBController.c - this should be updated
+ * - The Drivers/USB/LowLevel/LowLevel.c source file has moved to Drivers/LowLevel/USBController.c - this should be updated
* in all project makefiles, or the makefile should be updated to use the new module source variables.
*
* <b>Device Mode</b>
@@ -107,8 +107,8 @@
*
* <b>Non-USB Library Components</b>
* - Due to some ADC channels not being identical to their ADC MUX selection masks for single-ended conversions on some AVR models,
- * the ADC driver now has explicit masks for each of the standard ADC channels (see \ref Group_ADC). These masks should be used
- * when calling the ADC functions to ensure proper operation across all AVR models. Note that the \ref ADC_SetupChannel() function
+ * the ADC driver now has explicit masks for each of the standard ADC channels (see \ref Group_ADC). These masks should be used
+ * when calling the ADC functions to ensure proper operation across all AVR models. Note that the \ref ADC_SetupChannel() function
* is an exception, and should always be called with a channel number rather than a channel mask.
*
* <b>Host Mode</b>
@@ -142,7 +142,7 @@
* indicate the report type to generate. Existing applications may simply add and ignore this additional parameter.
*
* \section Sec_Migration091122 Migrating from 090924 to 091122
- *
+ *
* <b>Host Mode</b>
* - The HID_PARSE_UsageStackOverflow HID parser error constant is now named \ref HID_PARSE_UsageListOverflow
* - The \ref CALLBACK_HIDParser_FilterHIDReportItem() HID Parser callback now passes a complete HID_ReportItem_t to the
@@ -267,7 +267,7 @@
* library demos should update to the latest versions.
*
* <b>Device Mode</b>
- * - The Endpoint_ClearCurrentBank() macro has been removed, and is now replaced with the Endpoint_ClearIN(), Endpoint_ClearOUT()
+ * - The Endpoint_ClearCurrentBank() macro has been removed, and is now replaced with the Endpoint_ClearIN(), Endpoint_ClearOUT()
* macros. See Endpoint.h documentation for more details on the new endpoint management macros.
* - The Endpoint_ReadWriteAllowed() macro has been renamed to Endpoint_IsReadWriteAllowed() to be more consistent with the rest of
* the API naming scheme.
@@ -339,7 +339,7 @@
*
* <b>Device Mode</b>
* - The NO_CLEARSET_FEATURE_REQUEST compile time token has been renamed to FEATURELESS_CONTROL_ONLY_DEVICE, and its function expanded
- * to also remove parts of the Get Status chapter 9 request to further reduce code usage. On all applications currently using the
+ * to also remove parts of the Get Status chapter 9 request to further reduce code usage. On all applications currently using the
* NO_CLEARSET_FEATURE_REQUEST compile time token, it can be replaced with the FEATURELESS_CONTROL_ONLY_DEVICE token with no further
* modifications required.
*
@@ -560,3 +560,4 @@
* finished enumerating the device. Projects relying on the event only firing in Host mode should be updated
* so that the event action only occurs when the USB_Mode global is set to USB_MODE_HOST.
*/
+
diff --git a/LUFA/ManPages/ProgrammingApps.txt b/LUFA/ManPages/ProgrammingApps.txt
index 4f3107502..c1b2181c8 100644
--- a/LUFA/ManPages/ProgrammingApps.txt
+++ b/LUFA/ManPages/ProgrammingApps.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \page Page_ProgrammingApps Programming an Application into a USB AVR
*
* Once you have built an application, you will need a way to program in the resulting ".HEX" file (and, if your
@@ -24,4 +24,4 @@
* If you wish to use the DFU bootloader to program in your application, refer to your DFU programmer's documentation.
* Atmel provides a free utility called FLIP which is USB AVR compatible, and an open source (Linux compatible)
* alternative exists called "dfu-programmer".
- */ \ No newline at end of file
+ */
diff --git a/LUFA/ManPages/SoftwareBootloaderJump.txt b/LUFA/ManPages/SoftwareBootloaderJump.txt
index 574398c8f..2591a8645 100644
--- a/LUFA/ManPages/SoftwareBootloaderJump.txt
+++ b/LUFA/ManPages/SoftwareBootloaderJump.txt
@@ -30,7 +30,7 @@
*
* #define MAGIC_BOOT_KEY 0xDC42ACCA
* #define BOOTLOADER_START_ADDRESS (FLASH_SIZE_BYTES - BOOTLOADER_SEC_SIZE_BYTES)
- *
+ *
* void Bootloader_Jump_Check(void) ATTR_INIT_SECTION(3);
* void Bootloader_Jump_Check(void)
* {
@@ -38,7 +38,7 @@
* if ((MCUSR & (1 << WDRF)) && (Boot_Key == MAGIC_BOOT_KEY))
* {
* Boot_Key = 0;
- * ((void (*)(void))BOOTLOADER_START_ADDRESS)();
+ * ((void (*)(void))BOOTLOADER_START_ADDRESS)();
* }
* }
*
@@ -57,12 +57,13 @@
* // Set the bootloader key to the magic value and force a reset
* Boot_Key = MAGIC_BOOT_KEY;
* wdt_enable(WDTO_250MS);
- * for (;;);
+ * for (;;);
* }
* \endcode
*
* Note that the bootloader magic key can be any arbitrary value. The <em>FLASH_SIZE_BYTES</em> and
* <em>BOOTLOADER_SEC_SIZE_BYTES</em> tokens should be replaced with the total flash size of the AVR
* in bytes, and the allocated size of the bootloader section for the target AVR.
- *
+ *
*/
+
diff --git a/LUFA/ManPages/VIDAndPIDValues.txt b/LUFA/ManPages/VIDAndPIDValues.txt
index 9f4183e26..0b88a0c71 100644
--- a/LUFA/ManPages/VIDAndPIDValues.txt
+++ b/LUFA/ManPages/VIDAndPIDValues.txt
@@ -421,3 +421,4 @@
* to be resolved by using a unique release number in the Device Descriptor. No devices using this
* VID/PID combination may be released to the general public.
*/
+
diff --git a/LUFA/ManPages/WhyUseLUFA.txt b/LUFA/ManPages/WhyUseLUFA.txt
index b6c93580b..7a90c67e1 100644
--- a/LUFA/ManPages/WhyUseLUFA.txt
+++ b/LUFA/ManPages/WhyUseLUFA.txt
@@ -43,4 +43,4 @@
* <small>* Atmel Stack Mouse Device Demo 4292 bytes, LUFA Mouse Low Level Device Demo 3332 bytes, under identical build
* environments</small>
*/
-
+
diff --git a/LUFA/ManPages/WritingBoardDrivers.txt b/LUFA/ManPages/WritingBoardDrivers.txt
index dd0ea47c7..e09e7d0d9 100644
--- a/LUFA/ManPages/WritingBoardDrivers.txt
+++ b/LUFA/ManPages/WritingBoardDrivers.txt
@@ -24,3 +24,4 @@
* user board drivers, maintaining code compatibility and allowing for a different board to be selected through the
* project makefile with no code changes.
*/
+
diff --git a/LUFA/Scheduler/Scheduler.c b/LUFA/Scheduler/Scheduler.c
index 7113ee322..6ef1c4de4 100644
--- a/LUFA/Scheduler/Scheduler.c
+++ b/LUFA/Scheduler/Scheduler.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,14 +38,14 @@ bool Scheduler_HasDelayElapsed(const uint16_t Delay,
{
SchedulerDelayCounter_t CurrentTickValue_LCL;
SchedulerDelayCounter_t DelayCounter_LCL;
-
+
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
CurrentTickValue_LCL = Scheduler_TickCounter;
}
-
+
DelayCounter_LCL = *DelayCounter;
-
+
if (CurrentTickValue_LCL >= DelayCounter_LCL)
{
if ((CurrentTickValue_LCL - DelayCounter_LCL) >= Delay)
@@ -60,9 +60,9 @@ bool Scheduler_HasDelayElapsed(const uint16_t Delay,
{
*DelayCounter = CurrentTickValue_LCL;
return true;
- }
+ }
}
-
+
return false;
}
@@ -70,7 +70,7 @@ void Scheduler_SetTaskMode(const TaskPtr_t Task,
const bool TaskStatus)
{
TaskEntry_t* CurrTask = &Scheduler_TaskList[0];
-
+
while (CurrTask != &Scheduler_TaskList[Scheduler_TotalTasks])
{
if (CurrTask->Task == Task)
@@ -78,7 +78,7 @@ void Scheduler_SetTaskMode(const TaskPtr_t Task,
CurrTask->TaskStatus = TaskStatus;
break;
}
-
+
CurrTask++;
}
}
@@ -87,12 +87,13 @@ void Scheduler_SetGroupTaskMode(const uint8_t GroupID,
const bool TaskStatus)
{
TaskEntry_t* CurrTask = &Scheduler_TaskList[0];
-
+
while (CurrTask != &Scheduler_TaskList[Scheduler_TotalTasks])
{
if (CurrTask->GroupID == GroupID)
CurrTask->TaskStatus = TaskStatus;
-
+
CurrTask++;
}
}
+
diff --git a/LUFA/Scheduler/Scheduler.h b/LUFA/Scheduler/Scheduler.h
index b77ec5468..b4946d65c 100644
--- a/LUFA/Scheduler/Scheduler.h
+++ b/LUFA/Scheduler/Scheduler.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -36,7 +36,7 @@
*
* \deprecated This module is deprecated and will be removed in a future library release.
*/
-
+
/** @defgroup Group_Scheduler Simple Task Scheduler - LUFA/Scheduler/Scheduler.h
*
* \deprecated This module is deprecated and will be removed in a future library release.
@@ -63,10 +63,10 @@
* Usage Example:
* \code
* #include <LUFA/Scheduler/Scheduler.h>
- *
+ *
* TASK(MyTask1); // Task prototype
* TASK(MyTask2); // Task prototype
- *
+ *
* TASK_LIST
* {
* { .Task = MyTask1, .TaskStatus = TASK_RUN, .GroupID = 1 },
@@ -100,14 +100,14 @@
*
* @{
*/
-
+
#ifndef __SCHEDULER_H__
#define __SCHEDULER_H__
/* Includes: */
#include <stdint.h>
#include <stdbool.h>
-
+
#include <util/atomic.h>
#include "../Common/Common.h"
@@ -130,7 +130,7 @@
* \endcode
*/
#define TASK(name) void name (void)
-
+
/** Defines a task list array, containing one or more task entries of the type TaskEntry_t. Each task list
* should be encased in curly braces and ended with a comma.
*
@@ -143,8 +143,8 @@
* }
* \endcode
*/
- #define TASK_LIST TaskEntry_t Scheduler_TaskList[] =
-
+ #define TASK_LIST TaskEntry_t Scheduler_TaskList[] =
+
/** Constant, giving the maximum delay in scheduler ticks which can be stored in a variable of type
* \ref SchedulerDelayCounter_t.
*/
@@ -155,14 +155,14 @@
/** Task status mode constant, for passing to \ref Scheduler_SetTaskMode() or \ref Scheduler_SetGroupTaskMode(). */
#define TASK_STOP false
-
+
/* Pseudo-Function Macros: */
#if defined(__DOXYGEN__)
/** Starts the scheduler in its infinite loop, executing running tasks. This should be placed at the end
* of the user application's main() function, as it can never return to the calling function.
*/
void Scheduler_Start(void);
-
+
/** Initialises the scheduler so that the scheduler functions can be called before the scheduler itself
* is started. This must be executed before any scheduler function calls other than Scheduler_Start(),
* and can be omitted if no such functions could be called before the scheduler is started.
@@ -176,12 +176,12 @@
/* Type Defines: */
/** Type define for a pointer to a scheduler task. */
typedef void (*TaskPtr_t)(void);
-
+
/** Type define for a variable which can hold a tick delay value for the scheduler up to the maximum delay
* possible.
*/
typedef uint16_t SchedulerDelayCounter_t;
-
+
/** \brief Scheduler Task List Entry Structure.
*
* Structure for holding a single task's information in the scheduler task list.
@@ -199,7 +199,7 @@
* functions should be used instead of direct manipulation.
*/
exter TaskEntry_t Scheduler_TaskList[];
-
+
/** Contains the total number of tasks in the task list, irrespective of if the task's status is set to
* \ref TASK_RUN or \ref TASK_STOP.
*
@@ -228,7 +228,7 @@
*DelayCounter = Scheduler_TickCounter;
}
}
-
+
/* Function Prototypes: */
/** Determines if the given tick delay has elapsed, based on the given delay period and tick counter value.
*
@@ -251,7 +251,7 @@
bool Scheduler_HasDelayElapsed(const uint16_t Delay,
SchedulerDelayCounter_t* const DelayCounter)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(2);
-
+
/** Sets the task mode for a given task.
*
* \param[in] Task Name of the task whose status is to be changed.
@@ -259,7 +259,7 @@
*/
void Scheduler_SetTaskMode(const TaskPtr_t Task,
const bool TaskStatus);
-
+
/** Sets the task mode for a given task group ID, allowing for an entire group of tasks to have their
* statuses changed at once.
*
@@ -281,7 +281,7 @@
{
Scheduler_TotalTasks = TotalTasks;
}
-
+
static inline void Scheduler_GoSchedule(const uint8_t TotalTasks) ATTR_NO_RETURN ATTR_ALWAYS_INLINE ATTR_DEPRECATED;
static inline void Scheduler_GoSchedule(const uint8_t TotalTasks)
{
@@ -290,7 +290,7 @@
for (;;)
{
TaskEntry_t* CurrTask = &Scheduler_TaskList[0];
-
+
while (CurrTask != &Scheduler_TaskList[TotalTasks])
{
if (CurrTask->TaskStatus == TASK_RUN)
@@ -301,12 +301,13 @@
}
}
#endif
-
+
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}
#endif
-
+
#endif
/** @} */
+
diff --git a/LUFA/Version.h b/LUFA/Version.h
index 986ad1e7f..db69d3bda 100644
--- a/LUFA/Version.h
+++ b/LUFA/Version.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* \brief LUFA library version constants.
*
* Version constants for informational purposes and version-specific macro creation. This header file contains the
- * current LUFA version number in several forms, for use in the user-application (for example, for printing out
+ * current LUFA version number in several forms, for use in the user-application (for example, for printing out
* whilst debugging, or for testing for version compatibility).
*/
@@ -49,3 +49,4 @@
#define LUFA_VERSION_STRING "XXXXXX"
#endif
+
diff --git a/LUFA/makefile b/LUFA/makefile
index 2dbecaf8e..a28773586 100644
--- a/LUFA/makefile
+++ b/LUFA/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -62,7 +62,7 @@ ifeq ($(origin LUFA_PATH), undefined)
clean:
rm -f $(LUFA_SRC_ALL_FILES:%.c=%.o)
-
+
clean_list:
doxygen:
@@ -74,4 +74,4 @@ ifeq ($(origin LUFA_PATH), undefined)
rm -rf Documentation
.PHONY: all clean clean_list doxygen clean_doxygen
-endif \ No newline at end of file
+endif
diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.c b/Projects/AVRISP-MKII/AVRISP-MKII.c
index 8f27a9b22..b7e551e99 100644
--- a/Projects/AVRISP-MKII/AVRISP-MKII.c
+++ b/Projects/AVRISP-MKII/AVRISP-MKII.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,7 +43,7 @@ int main(void)
{
SetupHardware();
V2Protocol_Init();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
@@ -54,7 +54,7 @@ int main(void)
mode - either VBUS, or sourced from the VTARGET pin of the programming connectors */
LEDs_ChangeLEDs(LEDMASK_VBUSPOWER, (PIND & (1 << 0)) ? 0 : LEDMASK_VBUSPOWER);
#endif
-
+
AVRISP_Task();
USB_USBTask();
}
@@ -72,7 +72,7 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
- USB_Init();
+ USB_Init();
}
/** Event handler for the library USB Connection event. */
@@ -100,9 +100,9 @@ void EVENT_USB_Device_ConfigurationChanged(void)
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
AVRISP_DATA_EPSIZE, ENDPOINT_BANK_SINGLE);
#endif
-
+
/* Indicate endpoint configuration success or failure */
- LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
+ LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR);
}
/** Processes incoming V2 Protocol commands from the host, returning a response when required. */
@@ -115,7 +115,7 @@ void AVRISP_Task(void)
V2Params_UpdateParamValues();
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
-
+
/* Check to see if a V2 Protocol command has been received */
if (Endpoint_IsOUTReceived())
{
diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.h b/Projects/AVRISP-MKII/AVRISP-MKII.h
index 3491abf0c..6e7f12edb 100644
--- a/Projects/AVRISP-MKII/AVRISP-MKII.h
+++ b/Projects/AVRISP-MKII/AVRISP-MKII.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,11 +45,11 @@
#include <LUFA/Version.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
-
+
#if defined(ADC)
#include <LUFA/Drivers/Peripheral/ADC.h>
#endif
-
+
#include "Descriptors.h"
#include "Lib/V2Protocol.h"
@@ -68,16 +68,17 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2)
-
+
/** LED mask for the library LED driver, to indicate that the target is being powered by VBUS. */
#define LEDMASK_VBUSPOWER LEDS_LED3
/* Function Prototypes: */
void SetupHardware(void);
void AVRISP_Task(void);
-
+
void EVENT_USB_Device_Connect(void);
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
-
+
#endif
+
diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.txt b/Projects/AVRISP-MKII/AVRISP-MKII.txt
index eb6431477..e36ffe231 100644
--- a/Projects/AVRISP-MKII/AVRISP-MKII.txt
+++ b/Projects/AVRISP-MKII/AVRISP-MKII.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage AVRISP MKII Programmer Project
*
* \section SSec_Compat Project Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Vendor Specific Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -42,7 +42,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Firmware for an AVRStudio compatible AVRISP-MKII clone programmer. This project will enable the USB AVR series of
* microcontrollers to act as a clone of the official Atmel AVRISP-MKII programmer, usable within AVRStudio. In its
@@ -240,31 +240,31 @@
* <td>VTARGET_ADC_CHANNEL</td>
* <td>Makefile LUFA_OPTS</td>
* <td>ADC channel number (on supported AVRs) to use for VTARGET level detection, if NO_VTARGET_DETECT is not defined.
- * <i>Ignored when compiled for targets lacking an ADC.</i></td>
+ * <i>Ignored when compiled for targets lacking an ADC.</i></td>
* </tr>
* <tr>
* <td>ENABLE_ISP_PROTOCOL</td>
* <td>Makefile LUFA_OPTS</td>
- * <td>Define to enable SPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>
+ * <td>Define to enable SPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>
* </tr>
* <tr>
* <td>ENABLE_XPROG_PROTOCOL</td>
* <td>Makefile LUFA_OPTS</td>
- * <td>Define to enable PDI and TPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>
+ * <td>Define to enable PDI and TPI programming protocol support. <i>Ignored when compiled for the XPLAIN board.</i></td>
* </tr>
* <tr>
* <td>NO_VTARGET_DETECT</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Define to disable VTARGET sampling and reporting on AVR models with an ADC converter. This will cause the programmer
* to report a fixed 5V target voltage to the host regardless of the real target voltage. <i>Ignored when compiled for
- * targets lacking an ADC.</i></td>
+ * targets lacking an ADC.</i></td>
* </tr>
* <tr>
* <td>VTARGET_REF_VOLTS</td>
* <td>Makefile LUFA_OPTS</td>
* <td>Indicates the programmer AVR's AVCC reference voltage when measuring the target's supply voltage. Note that the supply
* voltage should never exceed the reference voltage on the programmer AVR without some form of protection to prevent damage
- * to the ADC. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
+ * to the ADC. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
* </tr>
* <tr>
* <td>VTARGET_SCALE_FACTOR</td>
@@ -272,8 +272,8 @@
* <td>Indicates the target's supply voltage scale factor when applied to the ADC. A simple resistive divider can be used on the
* ADC pin for measuring the target's supply voltage, so that voltages above the programmer AVR's AVCC reference voltage can be
* measured. This should be the reciprocal of the division performed - e.g. if the VTARGET voltage is halved, this should be set
- * to 2. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
- * </tr>
+ * to 2. <i>Ignored when compiled for targets lacking an ADC, or when NO_VTARGET_DETECT is defined.</i></td>
+ * </tr>
* <tr>
* <td>LIBUSB_DRIVER_COMPAT</td>
* <td>Makefile LUFA_OPTS</td>
@@ -282,3 +282,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/AVRISP-MKII/Descriptors.c b/Projects/AVRISP-MKII/Descriptors.c
index 5559bc11e..01a93cb64 100644
--- a/Projects/AVRISP-MKII/Descriptors.c
+++ b/Projects/AVRISP-MKII/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0xFF,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2104,
.ReleaseNumber = VERSION_BCD(02.00),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = 0x03,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,41 +71,41 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
- .AVRISP_Interface =
+ .AVRISP_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0xFF,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .AVRISP_DataInEndpoint =
+ .AVRISP_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AVRISP_DATA_EPSIZE,
@@ -115,7 +115,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.AVRISP_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AVRISP_DATA_EPSIZE,
@@ -130,7 +130,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -141,7 +141,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -152,7 +152,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA AVRISP MkII Clone"
};
@@ -162,7 +162,7 @@ USB_Descriptor_String_t PROGMEM ProductString =
USB_Descriptor_String_t PROGMEM SerialString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
-
+
.UnicodeString = L"0000A00128255"
};
@@ -181,41 +181,42 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
-
+
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
case 0x03:
Address = &SerialString;
Size = pgm_read_byte(&SerialString.Header.Size);
- break;
+ break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/AVRISP-MKII/Descriptors.h b/Projects/AVRISP-MKII/Descriptors.h
index 6c0e0d163..b707e7f26 100644
--- a/Projects/AVRISP-MKII/Descriptors.h
+++ b/Projects/AVRISP-MKII/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -79,3 +79,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
index aff84a962..8821ac991 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -53,7 +53,7 @@ void ISPProtocol_EnterISPMode(void)
uint8_t PollIndex;
uint8_t EnterProgBytes[4];
} Enter_ISP_Params;
-
+
Endpoint_Read_Stream_LE(&Enter_ISP_Params, sizeof(Enter_ISP_Params), NO_STREAM_CALLBACK);
Endpoint_ClearOUT();
@@ -61,9 +61,9 @@ void ISPProtocol_EnterISPMode(void)
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint8_t ResponseStatus = STATUS_CMD_FAILED;
-
+
CurrentAddress = 0;
-
+
/* Set up the synchronous USART to generate the .5MHz recovery clock on XCK pin */
UBRR1 = (F_CPU / 500000UL);
UCSR1B = (1 << TXEN1);
@@ -71,7 +71,7 @@ void ISPProtocol_EnterISPMode(void)
DDRD |= (1 << 5);
/* Perform execution delay, initialize SPI bus */
- ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);
+ ISPProtocol_DelayMS(Enter_ISP_Params.ExecutionDelayMS);
ISPTarget_Init();
/* Continuously attempt to synchronize with the target until either the number of attempts specified
@@ -88,7 +88,7 @@ void ISPProtocol_EnterISPMode(void)
ISPProtocol_DelayMS(Enter_ISP_Params.ByteDelay);
ResponseBytes[RByte] = ISPTarget_TransferByte(Enter_ISP_Params.EnterProgBytes[RByte]);
}
-
+
/* Check if polling disabled, or if the polled value matches the expected value */
if (!(Enter_ISP_Params.PollIndex) || (ResponseBytes[Enter_ISP_Params.PollIndex - 1] == Enter_ISP_Params.PollValue))
{
@@ -116,7 +116,7 @@ void ISPProtocol_LeaveISPMode(void)
} Leave_ISP_Params;
Endpoint_Read_Stream_LE(&Leave_ISP_Params, sizeof(Leave_ISP_Params), NO_STREAM_CALLBACK);
-
+
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
@@ -155,13 +155,13 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
uint8_t PollValue2;
uint8_t ProgData[256]; // Note, the Jungo driver has a very short ACK timeout period, need to buffer the
} Write_Memory_Params; // whole page and ACK the packet as fast as possible to prevent it from aborting
-
+
Endpoint_Read_Stream_LE(&Write_Memory_Params, (sizeof(Write_Memory_Params) -
sizeof(Write_Memory_Params.ProgData)), NO_STREAM_CALLBACK);
Write_Memory_Params.BytesToWrite = SwapEndian_16(Write_Memory_Params.BytesToWrite);
-
+
if (Write_Memory_Params.BytesToWrite > sizeof(Write_Memory_Params.ProgData))
{
Endpoint_ClearOUT();
@@ -173,14 +173,14 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
Endpoint_ClearIN();
return;
}
-
+
Endpoint_Read_Stream_LE(&Write_Memory_Params.ProgData, Write_Memory_Params.BytesToWrite, NO_STREAM_CALLBACK);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
- uint8_t ProgrammingStatus = STATUS_CMD_OK;
+ uint8_t ProgrammingStatus = STATUS_CMD_OK;
uint16_t PollAddress = 0;
uint8_t PollValue = (V2Command == CMD_PROGRAM_FLASH_ISP) ? Write_Memory_Params.PollValue1 :
Write_Memory_Params.PollValue2;
@@ -190,7 +190,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
if (Write_Memory_Params.ProgrammingMode & PROG_MODE_PAGED_WRITES_MASK)
{
uint16_t StartAddress = (CurrentAddress & 0xFFFF);
-
+
/* Check to see if we need to send a LOAD EXTENDED ADDRESS command to the target */
if (MustLoadExtendedAddress)
{
@@ -203,12 +203,12 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
{
bool IsOddByte = (CurrentByte & 0x01);
uint8_t ByteToWrite = *(NextWriteByte++);
-
+
ISPTarget_SendByte(Write_Memory_Params.ProgrammingCommands[0]);
ISPTarget_SendByte(CurrentAddress >> 8);
ISPTarget_SendByte(CurrentAddress & 0xFF);
ISPTarget_SendByte(ByteToWrite);
-
+
/* AVR FLASH addressing requires us to modify the write command based on if we are writing a high
* or low byte at the current word address */
if (V2Command == CMD_PROGRAM_FLASH_ISP)
@@ -220,14 +220,14 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))
Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;
- PollAddress = (CurrentAddress & 0xFFFF);
- }
+ PollAddress = (CurrentAddress & 0xFFFF);
+ }
/* EEPROM increments the address on each byte, flash needs to increment on each word */
if (IsOddByte || (V2Command == CMD_PROGRAM_EEPROM_ISP))
CurrentAddress++;
}
-
+
/* If the current page must be committed, send the PROGRAM PAGE command to the target */
if (Write_Memory_Params.ProgrammingMode & PROG_MODE_COMMIT_PAGE_MASK)
{
@@ -235,12 +235,12 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
ISPTarget_SendByte(StartAddress >> 8);
ISPTarget_SendByte(StartAddress & 0xFF);
ISPTarget_SendByte(0x00);
-
+
/* Check if polling is possible and enabled, if not switch to timed delay mode */
if (!(PollAddress) && (Write_Memory_Params.ProgrammingMode & PROG_MODE_PAGED_VALUE_MASK))
{
Write_Memory_Params.ProgrammingMode &= ~PROG_MODE_PAGED_VALUE_MASK;
- Write_Memory_Params.ProgrammingMode |= PROG_MODE_PAGED_TIMEDELAY_MASK;
+ Write_Memory_Params.ProgrammingMode |= PROG_MODE_PAGED_TIMEDELAY_MASK;
}
ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue,
@@ -248,7 +248,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
/* Check to see if the FLASH address has crossed the extended address boundary */
if ((V2Command == CMD_PROGRAM_FLASH_ISP) && !(CurrentAddress & 0xFFFF))
- MustLoadExtendedAddress = true;
+ MustLoadExtendedAddress = true;
}
}
else
@@ -258,7 +258,7 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
{
bool IsOddByte = (CurrentByte & 0x01);
uint8_t ByteToWrite = *(NextWriteByte++);
-
+
/* Check to see if we need to send a LOAD EXTENDED ADDRESS command to the target */
if (MustLoadExtendedAddress)
{
@@ -270,12 +270,12 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
ISPTarget_SendByte(CurrentAddress >> 8);
ISPTarget_SendByte(CurrentAddress & 0xFF);
ISPTarget_SendByte(ByteToWrite);
-
+
/* AVR FLASH addressing requires us to modify the write command based on if we are writing a high
* or low byte at the current word address */
if (V2Command == CMD_PROGRAM_FLASH_ISP)
Write_Memory_Params.ProgrammingCommands[0] ^= READ_WRITE_HIGH_BYTE_MASK;
-
+
/* Save previous programming mode in case we modify it for the current word */
uint8_t PreviousProgrammingMode = Write_Memory_Params.ProgrammingMode;
@@ -283,18 +283,18 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
{
if (IsOddByte && (V2Command == CMD_PROGRAM_FLASH_ISP))
Write_Memory_Params.ProgrammingCommands[2] |= READ_WRITE_HIGH_BYTE_MASK;
-
+
PollAddress = (CurrentAddress & 0xFFFF);
}
else if (!(Write_Memory_Params.ProgrammingMode & PROG_MODE_WORD_READYBUSY_MASK))
{
Write_Memory_Params.ProgrammingMode &= ~PROG_MODE_WORD_VALUE_MASK;
- Write_Memory_Params.ProgrammingMode |= PROG_MODE_WORD_TIMEDELAY_MASK;
+ Write_Memory_Params.ProgrammingMode |= PROG_MODE_WORD_TIMEDELAY_MASK;
}
-
+
ProgrammingStatus = ISPTarget_WaitForProgComplete(Write_Memory_Params.ProgrammingMode, PollAddress, PollValue,
Write_Memory_Params.DelayMS, Write_Memory_Params.ProgrammingCommands[2]);
-
+
/* Restore previous programming mode mask in case the current word needed to change it */
Write_Memory_Params.ProgrammingMode = PreviousProgrammingMode;
@@ -308,9 +308,9 @@ void ISPProtocol_ProgramMemory(uint8_t V2Command)
if ((CurrentByte & 0x01) || (V2Command == CMD_PROGRAM_EEPROM_ISP))
{
CurrentAddress++;
-
+
if ((V2Command != CMD_PROGRAM_EEPROM_ISP) && !(CurrentAddress & 0xFFFF))
- MustLoadExtendedAddress = true;
+ MustLoadExtendedAddress = true;
}
}
}
@@ -332,14 +332,14 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
uint16_t BytesToRead;
uint8_t ReadMemoryCommand;
} Read_Memory_Params;
-
+
Endpoint_Read_Stream_LE(&Read_Memory_Params, sizeof(Read_Memory_Params), NO_STREAM_CALLBACK);
Read_Memory_Params.BytesToRead = SwapEndian_16(Read_Memory_Params.BytesToRead);
-
+
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
Endpoint_Write_Byte(V2Command);
Endpoint_Write_Byte(STATUS_CMD_OK);
@@ -358,28 +358,28 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
ISPTarget_SendByte(CurrentAddress >> 8);
ISPTarget_SendByte(CurrentAddress & 0xFF);
Endpoint_Write_Byte(ISPTarget_ReceiveByte());
-
+
/* Check if the endpoint bank is currently full, if so send the packet */
if (!(Endpoint_IsReadWriteAllowed()))
{
Endpoint_ClearIN();
Endpoint_WaitUntilReady();
}
-
+
/* AVR FLASH addressing requires us to modify the read command based on if we are reading a high
* or low byte at the current word address */
if (V2Command == CMD_READ_FLASH_ISP)
Read_Memory_Params.ReadMemoryCommand ^= READ_WRITE_HIGH_BYTE_MASK;
-
+
/* EEPROM just increments the address each byte, flash needs to increment on each word and
* also check to ensure that a LOAD EXTENDED ADDRESS command is issued each time the extended
* address boundary has been crossed */
if ((CurrentByte & 0x01) || (V2Command == CMD_READ_EEPROM_ISP))
{
CurrentAddress++;
-
+
if ((V2Command != CMD_READ_EEPROM_ISP) && !(CurrentAddress & 0xFFFF))
- MustLoadExtendedAddress = true;
+ MustLoadExtendedAddress = true;
}
}
@@ -387,13 +387,13 @@ void ISPProtocol_ReadMemory(uint8_t V2Command)
bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
Endpoint_ClearIN();
-
+
/* Ensure last packet is a short packet to terminate the transfer */
if (IsEndpointFull)
{
- Endpoint_WaitUntilReady();
+ Endpoint_WaitUntilReady();
Endpoint_ClearIN();
- Endpoint_WaitUntilReady();
+ Endpoint_WaitUntilReady();
}
}
@@ -406,15 +406,15 @@ void ISPProtocol_ChipErase(void)
uint8_t PollMethod;
uint8_t EraseCommandBytes[4];
} Erase_Chip_Params;
-
+
Endpoint_Read_Stream_LE(&Erase_Chip_Params, sizeof(Erase_Chip_Params), NO_STREAM_CALLBACK);
-
+
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
uint8_t ResponseStatus = STATUS_CMD_OK;
-
+
/* Send the chip erase commands as given by the host to the device */
for (uint8_t SByte = 0; SByte < sizeof(Erase_Chip_Params.EraseCommandBytes); SByte++)
ISPTarget_SendByte(Erase_Chip_Params.EraseCommandBytes[SByte]);
@@ -424,7 +424,7 @@ void ISPProtocol_ChipErase(void)
ISPProtocol_DelayMS(Erase_Chip_Params.EraseDelayMS);
else
ResponseStatus = ISPTarget_WaitWhileTargetBusy();
-
+
Endpoint_Write_Byte(CMD_CHIP_ERASE_ISP);
Endpoint_Write_Byte(ResponseStatus);
Endpoint_ClearIN();
@@ -442,7 +442,7 @@ void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command)
uint8_t RetByte;
uint8_t ReadCommandBytes[4];
} Read_FuseLockSigOSCCAL_Params;
-
+
Endpoint_Read_Stream_LE(&Read_FuseLockSigOSCCAL_Params, sizeof(Read_FuseLockSigOSCCAL_Params), NO_STREAM_CALLBACK);
Endpoint_ClearOUT();
@@ -454,7 +454,7 @@ void ISPProtocol_ReadFuseLockSigOSCCAL(uint8_t V2Command)
/* Send the Fuse or Lock byte read commands as given by the host to the device, store response */
for (uint8_t RByte = 0; RByte < sizeof(ResponseBytes); RByte++)
ResponseBytes[RByte] = ISPTarget_TransferByte(Read_FuseLockSigOSCCAL_Params.ReadCommandBytes[RByte]);
-
+
Endpoint_Write_Byte(V2Command);
Endpoint_Write_Byte(STATUS_CMD_OK);
Endpoint_Write_Byte(ResponseBytes[Read_FuseLockSigOSCCAL_Params.RetByte - 1]);
@@ -473,7 +473,7 @@ void ISPProtocol_WriteFuseLock(uint8_t V2Command)
{
uint8_t WriteCommandBytes[4];
} Write_FuseLockSig_Params;
-
+
Endpoint_Read_Stream_LE(&Write_FuseLockSig_Params, sizeof(Write_FuseLockSig_Params), NO_STREAM_CALLBACK);
Endpoint_ClearOUT();
@@ -483,7 +483,7 @@ void ISPProtocol_WriteFuseLock(uint8_t V2Command)
/* Send the Fuse or Lock byte program commands as given by the host to the device */
for (uint8_t SByte = 0; SByte < sizeof(Write_FuseLockSig_Params.WriteCommandBytes); SByte++)
ISPTarget_SendByte(Write_FuseLockSig_Params.WriteCommandBytes[SByte]);
-
+
Endpoint_Write_Byte(V2Command);
Endpoint_Write_Byte(STATUS_CMD_OK);
Endpoint_Write_Byte(STATUS_CMD_OK);
@@ -500,14 +500,14 @@ void ISPProtocol_SPIMulti(void)
uint8_t RxStartAddr;
uint8_t TxData[255];
} SPI_Multi_Params;
-
+
Endpoint_Read_Stream_LE(&SPI_Multi_Params, (sizeof(SPI_Multi_Params) - sizeof(SPI_Multi_Params.TxData)), NO_STREAM_CALLBACK);
Endpoint_Read_Stream_LE(&SPI_Multi_Params.TxData, SPI_Multi_Params.TxBytes, NO_STREAM_CALLBACK);
-
+
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
Endpoint_Write_Byte(CMD_SPI_MULTI);
Endpoint_Write_Byte(STATUS_CMD_OK);
@@ -521,7 +521,7 @@ void ISPProtocol_SPIMulti(void)
ISPTarget_SendByte(SPI_Multi_Params.TxData[CurrTxPos]);
else
ISPTarget_SendByte(0);
-
+
CurrTxPos++;
}
@@ -532,28 +532,28 @@ void ISPProtocol_SPIMulti(void)
Endpoint_Write_Byte(ISPTarget_TransferByte(SPI_Multi_Params.TxData[CurrTxPos++]));
else
Endpoint_Write_Byte(ISPTarget_ReceiveByte());
-
+
/* Check to see if we have filled the endpoint bank and need to send the packet */
if (!(Endpoint_IsReadWriteAllowed()))
{
Endpoint_ClearIN();
Endpoint_WaitUntilReady();
}
-
+
CurrRxPos++;
- }
-
+ }
+
Endpoint_Write_Byte(STATUS_CMD_OK);
bool IsEndpointFull = !(Endpoint_IsReadWriteAllowed());
Endpoint_ClearIN();
-
+
/* Ensure last packet is a short packet to terminate the transfer */
if (IsEndpointFull)
{
- Endpoint_WaitUntilReady();
+ Endpoint_WaitUntilReady();
Endpoint_ClearIN();
- Endpoint_WaitUntilReady();
+ Endpoint_WaitUntilReady();
}
}
@@ -567,4 +567,4 @@ void ISPProtocol_DelayMS(uint8_t DelayMS)
_delay_ms(1);
}
-#endif \ No newline at end of file
+#endif
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
index bc6bb5de1..c7058f5b5 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPProtocol.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,15 +39,15 @@
/* Includes: */
#include <avr/io.h>
#include <util/delay.h>
-
+
#include <LUFA/Drivers/USB/USB.h>
#include "../V2Protocol.h"
-
+
/* Preprocessor Checks: */
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
#undef ENABLE_ISP_PROTOCOL
-
+
#if !defined(ENABLE_XPROG_PROTOCOL)
#define ENABLE_XPROG_PROTOCOL
#endif
@@ -77,3 +77,4 @@
void ISPProtocol_SPIMulti(void);
void ISPProtocol_DelayMS(uint8_t DelayMS);
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
index 6fea24435..0aa0c6986 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -132,10 +132,10 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
TCCR1B = 0;
if (PINB & (1 << 3))
- SoftSPI_Data |= 0x01;
+ SoftSPI_Data |= 0x01;
}
- PORTB ^= (1 << 1);
+ PORTB ^= (1 << 1);
}
/** Initialises the appropriate SPI driver (hardware or software, depending on the selected ISP speed) ready for
@@ -155,7 +155,7 @@ void ISPTarget_Init(void)
else
{
HardwareSPIMode = false;
-
+
DDRB |= ((1 << 1) | (1 << 2));
PORTB |= ((1 << 0) | (1 << 3));
@@ -176,7 +176,7 @@ void ISPTarget_ShutDown(void)
else
{
DDRB &= ~((1 << 1) | (1 << 2));
- PORTB &= ~((1 << 0) | (1 << 3));
+ PORTB &= ~((1 << 0) | (1 << 3));
}
}
@@ -200,7 +200,7 @@ uint8_t ISPTarget_TransferSoftSPIByte(const uint8_t Byte)
TCCR1B = ((1 << WGM12) | (1 << CS11));
while (SoftSPI_BitsRemaining && TimeoutTicksRemaining);
TCCR1B = 0;
-
+
return SoftSPI_Data;
}
@@ -214,7 +214,7 @@ void ISPTarget_ChangeTargetResetLine(const bool ResetTarget)
if (ResetTarget)
{
AUX_LINE_DDR |= AUX_LINE_MASK;
-
+
if (!(V2Params_GetParameterValue(PARAM_RESET_POLARITY)))
AUX_LINE_PORT |= AUX_LINE_MASK;
else
@@ -254,7 +254,7 @@ void ISPTarget_LoadExtendedAddress(void)
ISPTarget_SendByte(LOAD_EXTENDED_ADDRESS_CMD);
ISPTarget_SendByte(0x00);
ISPTarget_SendByte((CurrentAddress & 0x00FF0000) >> 16);
- ISPTarget_SendByte(0x00);
+ ISPTarget_SendByte(0x00);
}
/** Waits until the last issued target memory programming command has completed, via the check mode given and using
@@ -296,8 +296,8 @@ uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode,
if (!(TimeoutTicksRemaining))
ProgrammingStatus = STATUS_CMD_TOUT;
-
- break;
+
+ break;
case PROG_MODE_WORD_READYBUSY_MASK:
case PROG_MODE_PAGED_READYBUSY_MASK:
ProgrammingStatus = ISPTarget_WaitWhileTargetBusy();
@@ -308,3 +308,4 @@ uint8_t ISPTarget_WaitForProgComplete(const uint8_t ProgrammingMode,
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h
index 967849abd..dfcf7ee8b 100644
--- a/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h
+++ b/Projects/AVRISP-MKII/Lib/ISP/ISPTarget.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,13 +43,13 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SPI.h>
-
+
#include "../V2ProtocolParams.h"
/* Preprocessor Checks: */
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
#undef ENABLE_ISP_PROTOCOL
-
+
#if !defined(ENABLE_XPROG_PROTOCOL)
#define ENABLE_XPROG_PROTOCOL
#endif
@@ -58,7 +58,7 @@
/* Macros: */
/** Low level device command to issue an extended FLASH address, for devices with other 128KB of FLASH. */
#define LOAD_EXTENDED_ADDRESS_CMD 0x4D
-
+
/** Macro to convert an ISP frequency to a number of timer clock cycles for the software SPI driver */
#define TIMER_COMP(freq) ((((F_CPU / 8) / freq) / 2) - 1)
@@ -121,3 +121,4 @@
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.c b/Projects/AVRISP-MKII/Lib/V2Protocol.c
index 4ef1b94a1..3ee3ebd54 100644
--- a/Projects/AVRISP-MKII/Lib/V2Protocol.c
+++ b/Projects/AVRISP-MKII/Lib/V2Protocol.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -59,12 +59,12 @@ void V2Protocol_Init(void)
ADC_SetupChannel(VTARGET_ADC_CHANNEL);
ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | VTARGET_ADC_CHANNEL_MASK);
#endif
-
+
/* Timeout timer initialization (10ms period) */
OCR0A = ((F_CPU / 1024) / 100);
TCCR0A = (1 << WGM01);
TIMSK0 = (1 << OCIE0A);
-
+
V2Params_LoadNonVolatileParamValues();
}
@@ -75,11 +75,11 @@ void V2Protocol_Init(void)
void V2Protocol_ProcessCommand(void)
{
uint8_t V2Command = Endpoint_Read_Byte();
-
+
/* Start the timeout management timer */
TimeoutTicksRemaining = COMMAND_TIMEOUT_TICKS;
TCCR0B = ((1 << CS02) | (1 << CS00));
-
+
switch (V2Command)
{
case CMD_SIGN_ON:
@@ -104,7 +104,7 @@ void V2Protocol_ProcessCommand(void)
break;
case CMD_PROGRAM_FLASH_ISP:
case CMD_PROGRAM_EEPROM_ISP:
- ISPProtocol_ProgramMemory(V2Command);
+ ISPProtocol_ProgramMemory(V2Command);
break;
case CMD_READ_FLASH_ISP:
case CMD_READ_EEPROM_ISP:
@@ -139,7 +139,7 @@ void V2Protocol_ProcessCommand(void)
V2Protocol_UnknownCommand(V2Command);
break;
}
-
+
/* Disable the timeout management timer */
TCCR0B = 0;
@@ -193,10 +193,10 @@ static void V2Protocol_ResetProtection(void)
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
Endpoint_Write_Byte(CMD_RESET_PROTECTION);
Endpoint_Write_Byte(STATUS_CMD_OK);
- Endpoint_ClearIN();
+ Endpoint_ClearIN();
}
@@ -209,18 +209,18 @@ static void V2Protocol_GetSetParam(const uint8_t V2Command)
{
uint8_t ParamID = Endpoint_Read_Byte();
uint8_t ParamValue;
-
+
if (V2Command == CMD_SET_PARAMETER)
ParamValue = Endpoint_Read_Byte();
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
Endpoint_Write_Byte(V2Command);
-
+
uint8_t ParamPrivs = V2Params_GetParameterPrivileges(ParamID);
-
+
if ((V2Command == CMD_SET_PARAMETER) && (ParamPrivs & PARAM_PRIV_WRITE))
{
Endpoint_Write_Byte(STATUS_CMD_OK);
@@ -232,7 +232,7 @@ static void V2Protocol_GetSetParam(const uint8_t V2Command)
Endpoint_Write_Byte(V2Params_GetParameterValue(ParamID));
}
else
- {
+ {
Endpoint_Write_Byte(STATUS_CMD_FAILED);
}
@@ -250,7 +250,7 @@ static void V2Protocol_LoadAddress(void)
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
if (CurrentAddress & (1UL << 31))
MustLoadExtendedAddress = true;
@@ -258,3 +258,4 @@ static void V2Protocol_LoadAddress(void)
Endpoint_Write_Byte(STATUS_CMD_OK);
Endpoint_ClearIN();
}
+
diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.h b/Projects/AVRISP-MKII/Lib/V2Protocol.h
index 8cbd45531..48dc78733 100644
--- a/Projects/AVRISP-MKII/Lib/V2Protocol.h
+++ b/Projects/AVRISP-MKII/Lib/V2Protocol.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,7 +38,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "../Descriptors.h"
#include "V2ProtocolConstants.h"
#include "V2ProtocolParams.h"
@@ -48,12 +48,12 @@
/* Preprocessor Checks: */
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
#undef ENABLE_ISP_PROTOCOL
-
+
#if !defined(ENABLE_XPROG_PROTOCOL)
#define ENABLE_XPROG_PROTOCOL
#endif
#endif
-
+
#if defined(USB_SERIES_4_AVR) && ((VTARGET_ADC_CHANNEL == 2) || (VTARGET_ADC_CHANNEL == 3))
#error The U4 AVR chips do not contain ADC channels 2 or 3. Please change VTARGET_ADC_CHANNEL or define NO_VTARGET_DETECT in the makefile.
#endif
@@ -66,10 +66,10 @@
/** Programmer ID string, returned to the host during the CMD_SIGN_ON command processing. */
#define PROGRAMMER_ID "AVRISP_MK2"
-
+
/** Timeout period for each issued command from the host before it is aborted (in 10ms ticks). */
#define COMMAND_TIMEOUT_TICKS 100
-
+
/** Command timeout counter register, GPIOR for speed. */
#define TimeoutTicksRemaining GPIOR1
@@ -83,7 +83,7 @@
/* Function Prototypes: */
void V2Protocol_Init(void);
void V2Protocol_ProcessCommand(void);
-
+
#if defined(INCLUDE_FROM_V2PROTOCOL_C)
static void V2Protocol_UnknownCommand(const uint8_t V2Command);
static void V2Protocol_SignOn(void);
diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h b/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h
index 94c60766b..107daa360 100644
--- a/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h
+++ b/Projects/AVRISP-MKII/Lib/V2ProtocolConstants.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -86,3 +86,4 @@
#define PARAM_DISCHARGEDELAY 0xA4
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c
index 31303c77d..1982fb90f 100644
--- a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c
+++ b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,7 +40,7 @@
uint8_t EEMEM EEPROM_Rest_Polarity = 0x00;
/* Volatile Parameter Values for RAM storage */
-static ParameterItem_t ParameterTable[] =
+static ParameterItem_t ParameterTable[] =
{
{ .ParamID = PARAM_BUILD_NUMBER_LOW,
.ParamPrivileges = PARAM_PRIV_READ,
@@ -109,11 +109,11 @@ void V2Params_UpdateParamValues(void)
* \param[in] ParamID Parameter ID whose privileges are to be retrieved from the table
*
* \return Privileges for the requested parameter, as a mask of PARAM_PRIV_* masks
- */
+ */
uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID)
{
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
-
+
if (ParamInfo == NULL)
return 0;
@@ -129,14 +129,14 @@ uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID)
* \param[in] ParamID Parameter ID whose value is to be retrieved from the table
*
* \return Current value of the parameter in the table, or 0 if not found
- */
+ */
uint8_t V2Params_GetParameterValue(const uint8_t ParamID)
{
ParameterItem_t* ParamInfo = V2Params_GetParamFromTable(ParamID);
-
+
if (ParamInfo == NULL)
return 0;
-
+
return ParamInfo->ParamValue;
}
@@ -163,7 +163,7 @@ void V2Params_SetParameterValue(const uint8_t ParamID,
/* The target RESET line polarity is a non-volatile parameter, save to EEPROM when changed */
if (ParamID == PARAM_RESET_POLARITY)
- eeprom_update_byte(&EEPROM_Rest_Polarity, Value);
+ eeprom_update_byte(&EEPROM_Rest_Polarity, Value);
}
/** Retrieves a parameter entry (including ID, value and privileges) from the parameter table that matches the given
@@ -182,9 +182,10 @@ static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID)
{
if (ParamID == CurrTableItem->ParamID)
return CurrTableItem;
-
+
CurrTableItem++;
}
return NULL;
}
+
diff --git a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h
index 4b7e18913..2336f686f 100644
--- a/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h
+++ b/Projects/AVRISP-MKII/Lib/V2ProtocolParams.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,7 +45,7 @@
#if defined(ADC)
#include <LUFA/Drivers/Peripheral/ADC.h>
#endif
-
+
#include "V2Protocol.h"
#include "V2ProtocolConstants.h"
#include "ISP/ISPTarget.h"
@@ -56,7 +56,7 @@
/** Parameter privilege mask to allow the host PC to change the parameter's value. */
#define PARAM_PRIV_WRITE (1 << 1)
-
+
/** Total number of parameters in the parameter table */
#define TABLE_PARAM_COUNT (sizeof(ParameterTable) / sizeof(ParameterTable[0]))
@@ -72,12 +72,12 @@
/* Function Prototypes: */
void V2Params_LoadNonVolatileParamValues(void);
void V2Params_UpdateParamValues(void);
-
+
uint8_t V2Params_GetParameterPrivileges(const uint8_t ParamID);
uint8_t V2Params_GetParameterValue(const uint8_t ParamID);
void V2Params_SetParameterValue(const uint8_t ParamID,
const uint8_t Value);
-
+
#if defined(INCLUDE_FROM_V2PROTOCOL_PARAMS_C)
static ParameterItem_t* V2Params_GetParamFromTable(const uint8_t ParamID);
#endif
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
index d45e42a1a..7522dc81f 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -138,17 +138,17 @@ bool TINYNVM_ReadMemory(const uint16_t ReadAddress,
/* Set the NVM control register to the NO OP command for memory reading */
TINYNVM_SendWriteNVMRegister(XPROG_Param_NVMCMDRegAddr);
XPROGTarget_SendByte(TINY_NVM_CMD_NOOP);
-
+
/* Send the address of the location to read from */
TINYNVM_SendPointerAddress(ReadAddress);
-
+
while (ReadSize-- && TimeoutTicksRemaining)
{
/* Read the byte of data from the target */
XPROGTarget_SendByte(TPI_CMD_SLD | TPI_POINTER_INDIRECT_PI);
*(ReadBuffer++) = XPROGTarget_ReceiveByte();
}
-
+
return (TimeoutTicksRemaining != 0);
}
@@ -167,7 +167,7 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
/* Wait until the NVM controller is no longer busy */
if (!(TINYNVM_WaitWhileNVMControllerBusy()))
return false;
-
+
/* Must have an integer number of words to write - if extra byte, word-align via a dummy high byte */
if (WriteLength & 0x01)
WriteBuffer[WriteLength++] = 0xFF;
@@ -175,10 +175,10 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
/* Set the NVM control register to the WORD WRITE command for memory reading */
TINYNVM_SendWriteNVMRegister(XPROG_Param_NVMCMDRegAddr);
XPROGTarget_SendByte(TINY_NVM_CMD_WORDWRITE);
-
+
/* Send the address of the location to write to */
TINYNVM_SendPointerAddress(WriteAddress);
-
+
while (WriteLength)
{
/* Wait until the NVM controller is no longer busy */
@@ -188,7 +188,7 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
/* Write the low byte of data to the target */
XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);
XPROGTarget_SendByte(*(WriteBuffer++));
-
+
/* Write the high byte of data to the target */
XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI);
XPROGTarget_SendByte(*(WriteBuffer++));
@@ -196,7 +196,7 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress,
/* Need to decrement the write length twice, since we read out a whole word */
WriteLength -= 2;
}
-
+
return true;
}
@@ -226,8 +226,9 @@ bool TINYNVM_EraseMemory(const uint8_t EraseCommand,
/* Wait until the NVM controller is no longer busy */
if (!(TINYNVM_WaitWhileNVMControllerBusy()))
return false;
-
+
return true;
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h
index cbb2c27aa..339b299d2 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,16 +40,16 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
-
+
#include <LUFA/Common/Common.h>
-
+
#include "XPROGProtocol.h"
#include "XPROGTarget.h"
-
+
/* Preprocessor Checks: */
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
#undef ENABLE_ISP_PROTOCOL
-
+
#if !defined(ENABLE_XPROG_PROTOCOL)
#define ENABLE_XPROG_PROTOCOL
#endif
@@ -61,7 +61,7 @@
#define TINY_NVM_CMD_SECTIONERASE 0x14
#define TINY_NVM_CMD_WORDWRITE 0x1D
- /* Function Prototypes: */
+ /* Function Prototypes: */
bool TINYNVM_WaitWhileNVMBusBusy(void);
bool TINYNVM_WaitWhileNVMControllerBusy(void);
bool TINYNVM_ReadMemory(const uint16_t ReadAddress,
@@ -80,3 +80,4 @@
#endif
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
index 22f4e93e0..322f2ea80 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -76,13 +76,13 @@ bool XMEGANVM_WaitWhileNVMBusBusy(void)
{
/* Send the LDCS command to read the PDI STATUS register to see the NVM bus is active */
XPROGTarget_SendByte(PDI_CMD_LDCS | PDI_STATUS_REG);
-
+
uint8_t StatusRegister = XPROGTarget_ReceiveByte();
-
+
/* We might have timed out waiting for the status register read response, check here */
if (!(TimeoutTicksRemaining))
return false;
-
+
/* Check the status register read response to see if the NVM bus is enabled */
if (StatusRegister & PDI_STATUS_NVM)
return true;
@@ -102,7 +102,7 @@ bool XMEGANVM_WaitWhileNVMControllerBusy(void)
/* Send a LDS command to read the NVM STATUS register to check the BUSY flag */
XPROGTarget_SendByte(PDI_CMD_LDS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_STATUS);
-
+
uint8_t StatusRegister = XPROGTarget_ReceiveByte();
/* We might have timed out waiting for the status register read response, check here */
@@ -127,7 +127,7 @@ bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest)
/* Wait until the NVM controller is no longer busy */
if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
return false;
-
+
/* Set the NVM command to the correct CRC read command */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
@@ -145,7 +145,7 @@ bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest)
/* Wait until the NVM controller is no longer busy */
if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
return false;
-
+
/* Load the PDI pointer register with the DAT0 register start address */
XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_DIRECT << 2) | PDI_DATSIZE_4BYTES);
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_DAT0);
@@ -153,12 +153,12 @@ bool XMEGANVM_GetMemoryCRC(const uint8_t CRCCommand, uint32_t* const CRCDest)
/* Send the REPEAT command to grab the CRC bytes */
XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
XPROGTarget_SendByte(XMEGA_CRC_LENGTH - 1);
-
+
/* Read in the CRC bytes from the target */
XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
for (uint8_t i = 0; i < XMEGA_CRC_LENGTH; i++)
((uint8_t*)CRCDest)[i] = XPROGTarget_ReceiveByte();
-
+
return (TimeoutTicksRemaining != 0);
}
@@ -175,7 +175,7 @@ bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16
/* Wait until the NVM controller is no longer busy */
if (!(XMEGANVM_WaitWhileNVMControllerBusy()))
return false;
-
+
/* Send the READNVM command to the NVM controller for reading of an arbitrary location */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
@@ -188,12 +188,12 @@ bool XMEGANVM_ReadMemory(const uint32_t ReadAddress, uint8_t* ReadBuffer, uint16
/* Send the REPEAT command with the specified number of bytes to read */
XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
XPROGTarget_SendByte(ReadSize - 1);
-
+
/* Send a LD command with indirect access and post-increment to read out the bytes */
XPROGTarget_SendByte(PDI_CMD_LD | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
while (ReadSize-- && TimeoutTicksRemaining)
*(ReadBuffer++) = XPROGTarget_ReceiveByte();
-
+
return (TimeoutTicksRemaining != 0);
}
@@ -215,12 +215,12 @@ bool XMEGANVM_WriteByteMemory(const uint8_t WriteCommand, const uint32_t WriteAd
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
XPROGTarget_SendByte(WriteCommand);
-
+
/* Send new memory byte to the memory of the target */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendAddress(WriteAddress);
XPROGTarget_SendByte(Byte);
-
+
return true;
}
@@ -275,13 +275,13 @@ bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t Eras
/* Send the REPEAT command with the specified number of bytes to write */
XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
XPROGTarget_SendByte(WriteSize - 1);
-
+
/* Send a ST command with indirect access and post-increment to write the bytes */
XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
while (WriteSize--)
XPROGTarget_SendByte(*(WriteBuffer++));
}
-
+
if (PageMode & XPRG_PAGEMODE_WRITE)
{
/* Wait until the NVM controller is no longer busy */
@@ -292,7 +292,7 @@ bool XMEGANVM_WritePageMemory(const uint8_t WriteBuffCommand, const uint8_t Eras
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
XPROGTarget_SendByte(WritePageCommand);
-
+
/* Send the address of the first page location to write the memory page */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendAddress(WriteAddress);
@@ -322,11 +322,11 @@ bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
XPROGTarget_SendByte(EraseCommand);
-
+
/* Set CMDEX bit in NVM CTRLA register to start the erase sequence */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
- XPROGTarget_SendByte(1 << 0);
+ XPROGTarget_SendByte(1 << 0);
}
else if (EraseCommand == XMEGA_NVM_CMD_ERASEEEPROM)
{
@@ -356,21 +356,21 @@ bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
/* Send the REPEAT command with the specified number of bytes to write */
XPROGTarget_SendByte(PDI_CMD_REPEAT | PDI_DATSIZE_1BYTE);
XPROGTarget_SendByte(XPROG_Param_EEPageSize - 1);
-
+
/* Send a ST command with indirect access and post-increment to tag each byte in the EEPROM page buffer */
XPROGTarget_SendByte(PDI_CMD_ST | (PDI_POINTER_INDIRECT_PI << 2) | PDI_DATSIZE_1BYTE);
for (uint8_t PageByte = 0; PageByte < XPROG_Param_EEPageSize; PageByte++)
XPROGTarget_SendByte(0x00);
-
+
/* Send the memory erase command to the target */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
XPROGTarget_SendByte(EraseCommand);
-
+
/* Set CMDEX bit in NVM CTRLA register to start the EEPROM erase sequence */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CTRLA);
- XPROGTarget_SendByte(1 << 0);
+ XPROGTarget_SendByte(1 << 0);
}
else
{
@@ -378,18 +378,19 @@ bool XMEGANVM_EraseMemory(const uint8_t EraseCommand, const uint32_t Address)
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendNVMRegAddress(XMEGA_NVM_REG_CMD);
XPROGTarget_SendByte(EraseCommand);
-
+
/* Other erase modes just need us to address a byte within the target memory space */
XPROGTarget_SendByte(PDI_CMD_STS | (PDI_DATSIZE_4BYTES << 2));
XMEGANVM_SendAddress(Address);
XPROGTarget_SendByte(0x00);
}
-
+
/* Wait until the NVM bus is ready again */
if (!(XMEGANVM_WaitWhileNVMBusBusy()))
return false;
-
+
return true;
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h
index af38afdac..f65e88ad8 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XMEGANVM.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,16 +40,16 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
-
+
#include <LUFA/Common/Common.h>
-
+
#include "XPROGProtocol.h"
#include "XPROGTarget.h"
-
+
/* Preprocessor Checks: */
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
#undef ENABLE_ISP_PROTOCOL
-
+
#if !defined(ENABLE_XPROG_PROTOCOL)
#define ENABLE_XPROG_PROTOCOL
#endif
@@ -57,7 +57,7 @@
/* Defines: */
#define XMEGA_CRC_LENGTH 3
-
+
#define XMEGA_NVM_REG_ADDR0 0x00
#define XMEGA_NVM_REG_ADDR1 0x01
#define XMEGA_NVM_REG_ADDR2 0x02
@@ -70,7 +70,7 @@
#define XMEGA_NVM_REG_INTCTRL 0x0D
#define XMEGA_NVM_REG_STATUS 0x0F
#define XMEGA_NVM_REG_LOCKBITS 0x10
-
+
#define XMEGA_NVM_CMD_NOOP 0x00
#define XMEGA_NVM_CMD_CHIPERASE 0x40
#define XMEGA_NVM_CMD_READNVM 0x43
@@ -118,7 +118,8 @@
#if defined(INCLUDE_FROM_XMEGANVM_C)
static void XMEGANVM_SendNVMRegAddress(const uint8_t Register);
- static void XMEGANVM_SendAddress(const uint32_t AbsoluteAddress);
+ static void XMEGANVM_SendAddress(const uint32_t AbsoluteAddress);
#endif
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
index 85820fd31..edd362b48 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -61,18 +61,18 @@ void XPROGProtocol_SetMode(void)
{
uint8_t Protocol;
} SetMode_XPROG_Params;
-
+
Endpoint_Read_Stream_LE(&SetMode_XPROG_Params, sizeof(SetMode_XPROG_Params), NO_STREAM_CALLBACK);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
XPROG_SelectedProtocol = SetMode_XPROG_Params.Protocol;
-
+
Endpoint_Write_Byte(CMD_XPROG_SETMODE);
Endpoint_Write_Byte((SetMode_XPROG_Params.Protocol != XPRG_PROTOCOL_JTAG) ? STATUS_CMD_OK : STATUS_CMD_FAILED);
- Endpoint_ClearIN();
+ Endpoint_ClearIN();
}
/** Handler for the CMD_XPROG command, which wraps up XPROG commands in a V2 wrapper which need to be
@@ -81,7 +81,7 @@ void XPROGProtocol_SetMode(void)
void XPROGProtocol_Command(void)
{
uint8_t XPROGCommand = Endpoint_Read_Byte();
-
+
switch (XPROGCommand)
{
case XPRG_CMD_ENTER_PROGMODE:
@@ -114,7 +114,7 @@ static void XPROGProtocol_EnterXPROGMode(void)
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
bool NVMBusEnabled = false;
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
@@ -123,11 +123,11 @@ static void XPROGProtocol_EnterXPROGMode(void)
XPROGTarget_EnableTargetPDI();
/* Store the RESET key into the RESET PDI register to keep the XMEGA in reset */
- XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
XPROGTarget_SendByte(PDI_RESET_KEY);
/* Lower direction change guard time to 0 USART bits */
- XPROGTarget_SendByte(PDI_CMD_STCS | PDI_CTRL_REG);
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_CTRL_REG);
XPROGTarget_SendByte(0x07);
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
@@ -142,20 +142,20 @@ static void XPROGProtocol_EnterXPROGMode(void)
{
/* Enable TPI programming mode with the attached target */
XPROGTarget_EnableTargetTPI();
-
+
/* Lower direction change guard time to 0 USART bits */
XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
XPROGTarget_SendByte(0x07);
-
+
/* Enable access to the XPROG NVM bus by sending the documented NVM access key to the device */
- XPROGTarget_SendByte(TPI_CMD_SKEY);
+ XPROGTarget_SendByte(TPI_CMD_SKEY);
for (uint8_t i = sizeof(TPI_NVMENABLE_KEY); i > 0; i--)
XPROGTarget_SendByte(TPI_NVMENABLE_KEY[i - 1]);
/* Wait until the NVM bus becomes active */
NVMBusEnabled = TINYNVM_WaitWhileNVMBusBusy();
}
-
+
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_ENTER_PROGMODE);
Endpoint_Write_Byte(NVMBusEnabled ? XPRG_ERR_OK : XPRG_ERR_FAILED);
@@ -170,17 +170,17 @@ static void XPROGProtocol_LeaveXPROGMode(void)
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
{
XMEGANVM_WaitWhileNVMBusBusy();
/* Clear the RESET key in the RESET PDI register to allow the XMEGA to run */
- XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
XPROGTarget_SendByte(0x00);
/* Do it twice to make sure it takes affect (silicon bug?) */
- XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
+ XPROGTarget_SendByte(PDI_CMD_STCS | PDI_RESET_REG);
XPROGTarget_SendByte(0x00);
XPROGTarget_DisableTargetPDI();
@@ -190,12 +190,12 @@ static void XPROGProtocol_LeaveXPROGMode(void)
TINYNVM_WaitWhileNVMBusBusy();
/* Clear the NVMEN bit in the TPI CONTROL register to disable TPI mode */
- XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
+ XPROGTarget_SendByte(TPI_CMD_SSTCS | TPI_CTRL_REG);
XPROGTarget_SendByte(0x00);
-
+
XPROGTarget_DisableTargetTPI();
}
-
+
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_LEAVE_PROGMODE);
Endpoint_Write_Byte(XPRG_ERR_OK);
@@ -219,11 +219,11 @@ static void XPROGProtocol_Erase(void)
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
uint8_t EraseCommand;
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
- {
+ {
/* Determine which NVM command to send to the device depending on the memory to erase */
switch (Erase_XPROG_Params.MemoryType)
{
@@ -255,7 +255,7 @@ static void XPROGProtocol_Erase(void)
EraseCommand = XMEGA_NVM_CMD_NOOP;
break;
}
-
+
/* Erase the target memory, indicate timeout if occurred */
if (!(XMEGANVM_EraseMemory(EraseCommand, Erase_XPROG_Params.Address)))
ReturnStatus = XPRG_ERR_TIMEOUT;
@@ -266,16 +266,16 @@ static void XPROGProtocol_Erase(void)
EraseCommand = TINY_NVM_CMD_CHIPERASE;
else
EraseCommand = TINY_NVM_CMD_SECTIONERASE;
-
+
/* Erase the target memory, indicate timeout if occurred */
if (!(TINYNVM_EraseMemory(EraseCommand, Erase_XPROG_Params.Address)))
ReturnStatus = XPRG_ERR_TIMEOUT;
}
-
+
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_ERASE);
Endpoint_Write_Byte(ReturnStatus);
- Endpoint_ClearIN();
+ Endpoint_ClearIN();
}
/** Handler for the XPROG WRITE_MEMORY command to write to a specific memory space within the attached device. */
@@ -291,7 +291,7 @@ static void XPROGProtocol_WriteMemory(void)
uint16_t Length;
uint8_t ProgData[256];
} WriteMemory_XPROG_Params;
-
+
Endpoint_Read_Stream_LE(&WriteMemory_XPROG_Params, (sizeof(WriteMemory_XPROG_Params) -
sizeof(WriteMemory_XPROG_Params).ProgData), NO_STREAM_CALLBACK);
WriteMemory_XPROG_Params.Address = SwapEndian_32(WriteMemory_XPROG_Params.Address);
@@ -309,7 +309,7 @@ static void XPROGProtocol_WriteMemory(void)
uint8_t WriteBuffCommand = XMEGA_NVM_CMD_LOADFLASHPAGEBUFF;
uint8_t EraseBuffCommand = XMEGA_NVM_CMD_ERASEFLASHPAGEBUFF;
bool PagedMemory = true;
-
+
switch (WriteMemory_XPROG_Params.MemoryType)
{
case XPRG_MEM_TYPE_APPL:
@@ -321,7 +321,7 @@ static void XPROGProtocol_WriteMemory(void)
case XPRG_MEM_TYPE_EEPROM:
WriteCommand = XMEGA_NVM_CMD_ERASEWRITEEEPROMPAGE;
WriteBuffCommand = XMEGA_NVM_CMD_LOADEEPROMPAGEBUFF;
- EraseBuffCommand = XMEGA_NVM_CMD_ERASEEEPROMPAGEBUFF;
+ EraseBuffCommand = XMEGA_NVM_CMD_ERASEEEPROMPAGEBUFF;
break;
case XPRG_MEM_TYPE_USERSIG:
WriteCommand = XMEGA_NVM_CMD_WRITEUSERSIG;
@@ -335,9 +335,9 @@ static void XPROGProtocol_WriteMemory(void)
PagedMemory = false;
break;
}
-
+
/* Send the appropriate memory write commands to the device, indicate timeout if occurred */
- if ((PagedMemory && !(XMEGANVM_WritePageMemory(WriteBuffCommand, EraseBuffCommand, WriteCommand,
+ if ((PagedMemory && !(XMEGANVM_WritePageMemory(WriteBuffCommand, EraseBuffCommand, WriteCommand,
WriteMemory_XPROG_Params.PageMode, WriteMemory_XPROG_Params.Address,
WriteMemory_XPROG_Params.ProgData, WriteMemory_XPROG_Params.Length))) ||
(!PagedMemory && !(XMEGANVM_WriteByteMemory(WriteCommand, WriteMemory_XPROG_Params.Address,
@@ -355,10 +355,10 @@ static void XPROGProtocol_WriteMemory(void)
ReturnStatus = XPRG_ERR_TIMEOUT;
}
}
-
+
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_WRITE_MEM);
- Endpoint_Write_Byte(ReturnStatus);
+ Endpoint_Write_Byte(ReturnStatus);
Endpoint_ClearIN();
}
@@ -375,7 +375,7 @@ static void XPROGProtocol_ReadMemory(void)
uint32_t Address;
uint16_t Length;
} ReadMemory_XPROG_Params;
-
+
Endpoint_Read_Stream_LE(&ReadMemory_XPROG_Params, sizeof(ReadMemory_XPROG_Params), NO_STREAM_CALLBACK);
ReadMemory_XPROG_Params.Address = SwapEndian_32(ReadMemory_XPROG_Params.Address);
ReadMemory_XPROG_Params.Length = SwapEndian_16(ReadMemory_XPROG_Params.Length);
@@ -385,7 +385,7 @@ static void XPROGProtocol_ReadMemory(void)
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
uint8_t ReadBuffer[256];
-
+
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
{
/* Read the PDI target's memory, indicate timeout if occurred */
@@ -402,10 +402,10 @@ static void XPROGProtocol_ReadMemory(void)
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_READ_MEM);
Endpoint_Write_Byte(ReturnStatus);
-
+
if (ReturnStatus == XPRG_ERR_OK)
Endpoint_Write_Stream_LE(ReadBuffer, ReadMemory_XPROG_Params.Length, NO_STREAM_CALLBACK);
-
+
Endpoint_ClearIN();
}
@@ -415,18 +415,18 @@ static void XPROGProtocol_ReadMemory(void)
static void XPROGProtocol_ReadCRC(void)
{
uint8_t ReturnStatus = XPRG_ERR_OK;
-
+
struct
{
uint8_t CRCType;
} ReadCRC_XPROG_Params;
-
+
Endpoint_Read_Stream_LE(&ReadCRC_XPROG_Params, sizeof(ReadCRC_XPROG_Params), NO_STREAM_CALLBACK);
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
uint32_t MemoryCRC;
if (XPROG_SelectedProtocol == XPRG_PROTOCOL_PDI)
@@ -446,7 +446,7 @@ static void XPROGProtocol_ReadCRC(void)
CRCCommand = XMEGA_NVM_CMD_FLASHCRC;
break;
}
-
+
/* Perform and retrieve the memory CRC, indicate timeout if occurred */
if (!(XMEGANVM_GetMemoryCRC(CRCCommand, &MemoryCRC)))
ReturnStatus = XPRG_ERR_TIMEOUT;
@@ -456,18 +456,18 @@ static void XPROGProtocol_ReadCRC(void)
/* TPI does not support memory CRC */
ReturnStatus = XPRG_ERR_FAILED;
}
-
+
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_CRC);
Endpoint_Write_Byte(ReturnStatus);
-
+
if (ReturnStatus == XPRG_ERR_OK)
{
Endpoint_Write_Byte(MemoryCRC >> 16);
- Endpoint_Write_Word_LE(MemoryCRC & 0xFFFF);
+ Endpoint_Write_Word_LE(MemoryCRC & 0xFFFF);
}
-
- Endpoint_ClearIN();
+
+ Endpoint_ClearIN();
}
/** Handler for the XPROG SET_PARAM command to set a XPROG parameter for use when communicating with the
@@ -478,7 +478,7 @@ static void XPROGProtocol_SetParam(void)
uint8_t ReturnStatus = XPRG_ERR_OK;
uint8_t XPROGParam = Endpoint_Read_Byte();
-
+
/* Determine which parameter is being set, store the new parameter value */
switch (XPROGParam)
{
@@ -502,7 +502,7 @@ static void XPROGProtocol_SetParam(void)
Endpoint_ClearOUT();
Endpoint_SelectEndpoint(AVRISP_DATA_IN_EPNUM);
Endpoint_SetEndpointDirection(ENDPOINT_DIR_IN);
-
+
Endpoint_Write_Byte(CMD_XPROG);
Endpoint_Write_Byte(XPRG_CMD_SET_PARAM);
Endpoint_Write_Byte(ReturnStatus);
@@ -510,3 +510,4 @@ static void XPROGProtocol_SetParam(void)
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h
index 978a5a2ab..a4a7a8413 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGProtocol.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,10 +40,10 @@
#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>
-
+
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Peripheral/SerialStream.h>
-
+
#include "../V2Protocol.h"
#include "XPROGTarget.h"
#include "XMEGANVM.h"
@@ -52,12 +52,12 @@
/* Preprocessor Checks: */
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
#undef ENABLE_ISP_PROTOCOL
-
+
#if !defined(ENABLE_XPROG_PROTOCOL)
#define ENABLE_XPROG_PROTOCOL
#endif
#endif
-
+
/* Macros: */
#define XPRG_CMD_ENTER_PROGMODE 0x01
#define XPRG_CMD_LEAVE_PROGMODE 0x02
@@ -100,25 +100,25 @@
#define XPRG_PARAM_EEPPAGESIZE 0x02
#define XPRG_PARAM_NVMCMD_REG 0x03
#define XPRG_PARAM_NVMCSR_REG 0x04
-
+
#define XPRG_PROTOCOL_PDI 0x00
#define XPRG_PROTOCOL_JTAG 0x01
#define XPRG_PROTOCOL_TPI 0x02
-
+
#define XPRG_PAGEMODE_WRITE (1 << 1)
#define XPRG_PAGEMODE_ERASE (1 << 0)
-
+
/* External Variables: */
extern uint32_t XPROG_Param_NVMBase;
extern uint16_t XPROG_Param_EEPageSize;
extern uint8_t XPROG_Param_NVMCSRRegAddr;
extern uint8_t XPROG_Param_NVMCMDRegAddr;
extern uint8_t XPROG_SelectedProtocol;
-
+
/* Function Prototypes: */
void XPROGProtocol_SetMode(void);
void XPROGProtocol_Command(void);
-
+
#if (defined(INCLUDE_FROM_XPROGPROTOCOL_C) && defined(ENABLE_XPROG_PROTOCOL))
static void XPROGProtocol_EnterXPROGMode(void);
static void XPROGProtocol_LeaveXPROGMode(void);
@@ -128,5 +128,6 @@
static void XPROGProtocol_ReadMemory(void);
static void XPROGProtocol_ReadCRC(void);
#endif
-
+
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
index 2e5200561..28cb6abca 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -49,11 +49,11 @@ void XPROGTarget_EnableTargetPDI(void)
/* Set Tx and XCK as outputs, Rx as input */
DDRD |= (1 << 5) | (1 << 3);
DDRD &= ~(1 << 2);
-
+
/* Set DATA line high for at least 90ns to disable /RESET functionality */
PORTD |= (1 << 3);
_delay_us(1);
-
+
/* Set up the synchronous USART for XMEGA communications - 8 data bits, even parity, 2 stop bits */
UBRR1 = (F_CPU / XPROG_HARDWARE_SPEED);
UCSR1B = (1 << TXEN1);
@@ -77,7 +77,7 @@ void XPROGTarget_EnableTargetTPI(void)
/* Set Tx and XCK as outputs, Rx as input */
DDRD |= (1 << 5) | (1 << 3);
DDRD &= ~(1 << 2);
-
+
/* Set up the synchronous USART for TINY communications - 8 data bits, even parity, 2 stop bits */
UBRR1 = (F_CPU / XPROG_HARDWARE_SPEED);
UCSR1B = (1 << TXEN1);
@@ -133,7 +133,7 @@ void XPROGTarget_SendByte(const uint8_t Byte)
/* Switch to Tx mode if currently in Rx mode */
if (!(IsSending))
XPROGTarget_SetTxMode();
-
+
/* Wait until there is space in the hardware Tx buffer before writing */
while (!(UCSR1A & (1 << UDRE1)));
UCSR1A |= (1 << TXC1);
@@ -202,3 +202,4 @@ static void XPROGTarget_SetRxMode(void)
}
#endif
+
diff --git a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
index 0e5d373ef..6aedea6fb 100644
--- a/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
+++ b/Projects/AVRISP-MKII/Lib/XPROG/XPROGTarget.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,27 +40,27 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
-
+
#include <LUFA/Common/Common.h>
-
+
#include "../V2Protocol.h"
#include "XPROGProtocol.h"
-
+
/* Preprocessor Checks: */
#if ((BOARD == BOARD_XPLAIN) || (BOARD == BOARD_XPLAIN_REV1))
#undef ENABLE_ISP_PROTOCOL
-
+
#if !defined(ENABLE_XPROG_PROTOCOL)
#define ENABLE_XPROG_PROTOCOL
#endif
#endif
-
+
/** Serial carrier TPI/PDI speed when hardware TPI/PDI mode is used. */
#define XPROG_HARDWARE_SPEED 500000
/** Total number of bits in a single USART frame. */
#define BITS_IN_USART_FRAME 12
-
+
#define PDI_CMD_LDS 0x00
#define PDI_CMD_LD 0x20
#define PDI_CMD_STS 0x40
@@ -69,11 +69,11 @@
#define PDI_CMD_REPEAT 0xA0
#define PDI_CMD_STCS 0xC0
#define PDI_CMD_KEY 0xE0
-
+
#define PDI_STATUS_REG 0
#define PDI_RESET_REG 1
#define PDI_CTRL_REG 2
-
+
#define PDI_STATUS_NVM (1 << 1)
#define PDI_RESET_KEY 0x59
@@ -83,7 +83,7 @@
#define PDI_DATSIZE_2BYTES 1
#define PDI_DATSIZE_3BYTES 2
#define PDI_DATSIZE_4BYTES 3
-
+
#define PDI_POINTER_INDIRECT 0
#define PDI_POINTER_INDIRECT_PI 1
#define PDI_POINTER_DIRECT 2
@@ -100,14 +100,14 @@
#define TPI_STATUS_REG 0x00
#define TPI_CTRL_REG 0x02
#define TPI_ID_REG 0x0F
-
+
#define TPI_STATUS_NVM (1 << 1)
#define TPI_NVMENABLE_KEY (uint8_t[]){0x12, 0x89, 0xAB, 0x45, 0xCD, 0xD8, 0x88, 0xFF}
#define TPI_POINTER_INDIRECT 0
#define TPI_POINTER_INDIRECT_PI 4
-
+
/* Function Prototypes: */
void XPROGTarget_EnableTargetPDI(void);
void XPROGTarget_EnableTargetTPI(void);
@@ -117,10 +117,11 @@
uint8_t XPROGTarget_ReceiveByte(void);
void XPROGTarget_SendBreak(void);
bool XPROGTarget_WaitWhileNVMBusBusy(void);
-
+
#if (defined(INCLUDE_FROM_XPROGTARGET_C) && defined(ENABLE_XPROG_PROTOCOL))
static void XPROGTarget_SetTxMode(void);
static void XPROGTarget_SetRxMode(void);
#endif
#endif
+
diff --git a/Projects/AVRISP-MKII/makefile b/Projects/AVRISP-MKII/makefile
index fad461aa3..6c6e11708 100644
--- a/Projects/AVRISP-MKII/makefile
+++ b/Projects/AVRISP-MKII/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -158,7 +158,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -171,7 +171,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -285,7 +285,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -298,7 +298,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -310,7 +310,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -322,7 +322,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -345,7 +345,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -379,7 +379,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -413,7 +413,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -442,7 +442,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -461,10 +461,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -529,11 +529,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -560,9 +560,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -660,14 +660,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -689,7 +689,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -733,3 +733,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c
index a9afda4a3..735d7346b 100644
--- a/Projects/Benito/Benito.c
+++ b/Projects/Benito/Benito.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -60,7 +60,7 @@ uint8_t FlushPeriodRemaining = RECEIVE_BUFFER_FLUSH_MS;
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
- .Config =
+ .Config =
{
.ControlInterfaceNumber = 0,
@@ -84,9 +84,9 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
int main(void)
{
SetupHardware();
-
+
RingBuffer_InitBuffer(&Tx_Buffer);
-
+
sei();
for (;;)
@@ -98,9 +98,9 @@ int main(void)
UDR1 = ReceivedByte;
LEDs_TurnOnLEDs(LEDMASK_TX);
- PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS;
+ PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS;
}
-
+
/* Check if the millisecond timer has elapsed */
if (TIFR0 & (1 << OCF0A))
{
@@ -110,14 +110,14 @@ int main(void)
LEDs_TurnOffLEDs(LEDMASK_BUSY);
AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;
}
-
+
/* Check if the LEDs should be ping-ponging (during enumeration) */
if (PulseMSRemaining.PingPongLEDPulse && !(--PulseMSRemaining.PingPongLEDPulse))
{
LEDs_ToggleLEDs(LEDMASK_TX | LEDMASK_RX);
PulseMSRemaining.PingPongLEDPulse = PING_PONG_LED_PULSE_MS;
}
-
+
/* Turn off TX LED(s) once the TX pulse period has elapsed */
if (PulseMSRemaining.TxLEDPulse && !(--PulseMSRemaining.TxLEDPulse))
LEDs_TurnOffLEDs(LEDMASK_TX);
@@ -139,14 +139,14 @@ int main(void)
LEDs_TurnOnLEDs(LEDMASK_RX);
PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS;
}
-
+
FlushPeriodRemaining = RECEIVE_BUFFER_FLUSH_MS;
}
/* Clear the millisecond timer CTC flag (cleared by writing logic one to the register) */
- TIFR0 |= (1 << OCF0A);
+ TIFR0 |= (1 << OCF0A);
}
-
+
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
@@ -167,7 +167,7 @@ void SetupHardware(void)
OCR0A = (F_CPU / 64 / 1000);
TCCR0A = (1 << WGM01);
TCCR0B = ((1 << CS01) | (1 << CS00));
-
+
/* Tristate target /RESET Line */
AVR_RESET_LINE_PORT &= ~AVR_RESET_LINE_MASK;
AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;
@@ -216,10 +216,10 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
switch (CDCInterfaceInfo->State.LineEncoding.ParityType)
{
case CDC_PARITY_Odd:
- ConfigMask = ((1 << UPM11) | (1 << UPM10));
+ ConfigMask = ((1 << UPM11) | (1 << UPM10));
break;
case CDC_PARITY_Even:
- ConfigMask = (1 << UPM11);
+ ConfigMask = (1 << UPM11);
break;
}
@@ -238,7 +238,7 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
ConfigMask |= ((1 << UCSZ11) | (1 << UCSZ10));
break;
}
-
+
/* Must turn off USART before reconfiguring it, otherwise incorrect operation may occur */
UCSR1B = 0;
UCSR1A = 0;
@@ -246,10 +246,10 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
/* Set the new baud rate before configuring the USART */
UBRR1 = SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
-
+
/* Reconfigure the USART in double speed mode for a wider baud rate range at the expense of accuracy */
UCSR1C = ConfigMask;
- UCSR1A = (1 << U2X1);
+ UCSR1A = (1 << U2X1);
UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));
}
@@ -276,10 +276,11 @@ void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const C
if (!(PreviousDTRState) && CurrentDTRState)
{
LEDs_SetAllLEDs(LEDMASK_BUSY);
-
+
AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK;
PulseMSRemaining.ResetPulse = AVR_RESET_PULSE_MS;
}
-
+
PreviousDTRState = CurrentDTRState;
}
+
diff --git a/Projects/Benito/Benito.h b/Projects/Benito/Benito.h
index 34bc797ed..974956993 100644
--- a/Projects/Benito/Benito.h
+++ b/Projects/Benito/Benito.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -56,10 +56,10 @@
/** LED mask for the library LED driver, to indicate RX activity. */
#define LEDMASK_RX LEDS_LED2
-
+
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_ERROR (LEDS_LED1 | LEDS_LED2)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2)
@@ -70,8 +70,9 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
-
+
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
-
+
#endif
+
diff --git a/Projects/Benito/Benito.txt b/Projects/Benito/Benito.txt
index d7bf870e2..60d77cd4a 100644
--- a/Projects/Benito/Benito.txt
+++ b/Projects/Benito/Benito.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Benito Arduino Programmer Project
*
* \section SSec_Compat Project Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -43,7 +43,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Firmware for a USB AVR powered programmer for Arduino boards using the official Arduino bootloader. This
* project acts like a regular USB to Serial bridge, except that asserting the DTR line will cause a pulse
@@ -103,3 +103,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/Benito/Descriptors.c b/Projects/Benito/Descriptors.c
index fc9d5aba3..f4c68bab7 100644
--- a/Projects/Benito/Descriptors.c
+++ b/Projects/Benito/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x02,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2060,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,102 +71,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_DataOutEndpoint =
+ .CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC_DataInEndpoint =
+
+ .CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -181,7 +181,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -192,7 +192,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -203,7 +203,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(25), .Type = DTYPE_String},
-
+
.UnicodeString = L"Benito Arduino Programmer"
};
@@ -225,34 +225,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/Benito/Descriptors.h b/Projects/Benito/Descriptors.h
index 361fe9032..ddd9495ea 100644
--- a/Projects/Benito/Descriptors.h
+++ b/Projects/Benito/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -47,10 +47,10 @@
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
+ #define CDC_TX_EPNUM 3
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
+ #define CDC_RX_EPNUM 4
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
@@ -83,3 +83,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/Benito/Lib/LightweightRingBuff.h b/Projects/Benito/Lib/LightweightRingBuff.h
index 768e49a50..2fbc164cb 100644
--- a/Projects/Benito/Lib/LightweightRingBuff.h
+++ b/Projects/Benito/Lib/LightweightRingBuff.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,20 +39,20 @@
* or deletions) must not overlap. If there is possibility of two or more of the same kind of
* operating occuring at the same point in time, atomic (mutex) locking should be used.
*/
-
+
#ifndef _ULW_RING_BUFF_H_
#define _ULW_RING_BUFF_H_
/* Includes: */
#include <util/atomic.h>
-
+
#include <stdint.h>
#include <stdbool.h>
/* Defines: */
/** Size of each ring buffer, in data elements - must be between 1 and 255. */
#define BUFFER_SIZE 255
-
+
/** Type of data to store into the buffer. */
#define RingBuff_Data_t uint8_t
@@ -76,7 +76,7 @@
RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */
RingBuff_Count_t Count;
} RingBuff_t;
-
+
/* Inline Functions: */
/** Initializes a ring buffer ready for use. Buffers must be initialized via this function
* before any operations are called upon them. Already initialized buffers may be reset
@@ -92,7 +92,7 @@
Buffer->Out = Buffer->Buffer;
}
}
-
+
/** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed
* by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that
* the buffer cannot be modified while the computation takes place. This value should be cached
@@ -109,15 +109,15 @@
static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer)
{
RingBuff_Count_t Count;
-
+
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Count = Buffer->Count;
}
-
+
return Count;
}
-
+
/** Atomically determines if the specified ring buffer contains any free space. This should
* be tested before storing data to the buffer, to ensure that no data is lost due to a
* buffer overrun.
@@ -125,7 +125,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE);
@@ -142,7 +142,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == 0);
@@ -161,7 +161,7 @@
const RingBuff_Data_t Data)
{
*Buffer->In = Data;
-
+
if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE])
Buffer->In = Buffer->Buffer;
@@ -184,7 +184,7 @@
static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer)
{
RingBuff_Data_t Data = *Buffer->Out;
-
+
if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE])
Buffer->Out = Buffer->Buffer;
@@ -192,8 +192,9 @@
{
Buffer->Count--;
}
-
+
return Data;
}
#endif
+
diff --git a/Projects/Benito/makefile b/Projects/Benito/makefile
index b6432599e..535bdbdbb 100644
--- a/Projects/Benito/makefile
+++ b/Projects/Benito/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = atmega32u2
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = BENITO
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -144,7 +144,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -157,7 +157,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -271,7 +271,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -284,7 +284,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -296,7 +296,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -308,7 +308,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -331,7 +331,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -365,7 +365,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -399,7 +399,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -428,7 +428,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -447,10 +447,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -515,11 +515,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -546,9 +546,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -646,14 +646,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -675,7 +675,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -719,3 +719,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Descriptors.c b/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
index eda170cee..5dbb0b0b6 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -59,22 +59,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0xEF,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2063,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -85,38 +85,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
- .MS_Interface =
+ .MS_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x08,
.SubClass = 0x06,
.Protocol = 0x50,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .MS_DataInEndpoint =
+ .MS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -126,7 +126,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .MS_DataOutEndpoint =
+ .MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -144,7 +144,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -155,7 +155,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -166,7 +166,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(26), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Standalone Programmer"
};
@@ -188,36 +188,37 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Descriptors.h b/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
index 4065209b4..62399db30 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -60,15 +60,15 @@
#define CDC_TXRX_EPSIZE 16
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
+ #define MASS_STORAGE_IN_EPNUM 3
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
+ #define MASS_STORAGE_OUT_EPNUM 4
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
-
- /* Type Defines: */
+
+ /* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@@ -80,7 +80,7 @@
USB_Descriptor_Endpoint_t MS_DataInEndpoint;
USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -88,3 +88,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
index 3a0ff53d7..b18de1057 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -93,11 +93,12 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
bool CommandSuccess;
-
+
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
+
return CommandSuccess;
}
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h
index 85977522b..76e528e5e 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskDevice.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,7 +38,7 @@
/* Includes: */
#include <avr/io.h>
-
+
#include "Descriptors.h"
#include "StandaloneProgrammer.h"
@@ -59,3 +59,4 @@
#endif
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskHost.c b/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
index e7831cd71..696c7ad33 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskHost.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -41,7 +41,7 @@ USB_ClassInfo_MS_Host_t DiskHost_MS_Interface =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
-
+
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
},
@@ -52,7 +52,7 @@ void DiskHost_USBTask(void)
if (USB_HostState == HOST_STATE_Addressed)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -71,14 +71,14 @@ void DiskHost_USBTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
return;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
return;
}
-
+
uint8_t MaxLUNIndex;
if (MS_Host_GetMaxLUN(&DiskHost_MS_Interface, &MaxLUNIndex))
{
@@ -86,17 +86,17 @@ void DiskHost_USBTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
return;
}
-
+
if (MS_Host_ResetMSInterface(&DiskHost_MS_Interface))
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
return;
}
-
+
USB_HostState = HOST_STATE_Configured;
-
- /* Note: For the RequestSense call to work, the host state machine must be in the
+
+ /* Note: For the RequestSense call to work, the host state machine must be in the
* Configured state, or the call will be aborted */
SCSI_Request_Sense_Response_t SenseData;
if (MS_Host_RequestSense(&DiskHost_MS_Interface, 0, &SenseData) != 0)
@@ -105,13 +105,13 @@ void DiskHost_USBTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
return;
}
-
+
pf_mount(&DiskFATState);
-
+
LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
- MS_Host_USBTask(&DiskHost_MS_Interface);
+ MS_Host_USBTask(&DiskHost_MS_Interface);
}
void EVENT_USB_Host_DeviceAttached(void)
@@ -125,3 +125,4 @@ void EVENT_USB_Host_DeviceUnattached(void)
}
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/DiskHost.h b/Projects/Incomplete/StandaloneProgrammer/DiskHost.h
index 72c4f621b..cbb63577a 100644
--- a/Projects/Incomplete/StandaloneProgrammer/DiskHost.h
+++ b/Projects/Incomplete/StandaloneProgrammer/DiskHost.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,7 +38,7 @@
/* Includes: */
#include <avr/io.h>
-
+
#include "Descriptors.h"
#include "StandaloneProgrammer.h"
@@ -54,9 +54,10 @@
/* Function Prototypes: */
#if defined(USB_CAN_BE_HOST)
void DiskHost_USBTask(void);
-
+
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
#endif
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c
index af6c865a6..033bc805c 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -78,7 +78,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -87,7 +87,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
/* Clear the current endpoint bank */
Endpoint_ClearOUT();
-
+
/* Wait until the host has sent another packet */
if (Endpoint_WaitUntilReady())
return;
@@ -126,7 +126,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Send the Dataflash buffer write command */
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
+ Dataflash_SendAddressBytes(0, 0);
}
/* Write one 16-byte chunk of data to the Dataflash */
@@ -146,7 +146,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
@@ -155,9 +155,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Check if the current command is being aborted by the host */
if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
+ return;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -202,15 +202,15 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
-
+
/* Wait until endpoint is ready before continuing */
if (Endpoint_WaitUntilReady())
return;
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -219,12 +219,12 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
{
/* Clear the endpoint bank to send its contents to the host */
Endpoint_ClearIN();
-
+
/* Wait until the endpoint is ready for more data */
if (Endpoint_WaitUntilReady())
return;
}
-
+
/* Check if end of Dataflash page reached */
if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
{
@@ -234,7 +234,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -242,7 +242,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
Endpoint_Write_Byte(Dataflash_ReceiveByte());
@@ -261,10 +261,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
@@ -272,11 +272,11 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
-
+
/* If the endpoint is full, send its contents to the host */
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearIN();
@@ -316,11 +316,11 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
/* Send the Dataflash buffer write command */
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -360,18 +360,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, 0);
}
-
+
/* Write one 16-byte chunk of data to the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
Dataflash_SendByte(*(BufferPtr++));
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
/* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
+ BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -417,7 +417,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -430,7 +430,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -438,19 +438,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
*(BufferPtr++) = Dataflash_ReceiveByte();
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
@@ -465,7 +465,7 @@ void DataflashManager_ResetDataflashProtections(void)
/* Select first Dataflash chip, send the read status register command */
Dataflash_SelectChip(DATAFLASH_CHIP1);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -477,12 +477,12 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
-
+
/* Select second Dataflash chip (if present on selected board), send read status register command */
#if (DATAFLASH_TOTALCHIPS == 2)
Dataflash_SelectChip(DATAFLASH_CHIP2);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -495,7 +495,7 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
#endif
-
+
/* Deselect current Dataflash chip */
Dataflash_DeselectChip();
}
@@ -529,7 +529,8 @@ bool DataflashManager_CheckDataflashOperation(void)
if (ReturnByte != DF_MANUFACTURER_ATMEL)
return false;
#endif
-
+
return true;
}
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h
index 406ae62af..b42b13297 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/DataflashManager.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,13 +32,13 @@
*
* Header file for DataflashManager.c.
*/
-
+
#ifndef _DATAFLASH_MANAGER_H_
#define _DATAFLASH_MANAGER_H_
/* Includes: */
#include <avr/io.h>
-
+
#include "StandaloneProgrammer.h"
#include "Descriptors.h"
@@ -59,12 +59,12 @@
* storage media (Dataflash) using a different native block size. Do not change this value.
*/
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
-
+
/** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
* change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
*/
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
-
+
/* Function Prototypes: */
#if defined(USB_CAN_BE_DEVICE)
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
@@ -84,3 +84,4 @@
#endif
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt
index ee8effcf4..b8a001cdc 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/00readme.txt
@@ -34,3 +34,4 @@ AGREEMENTS
REVISION HISTORY
Jun 15, 2010 R0.01a First release (Branched from FatFs R0.07b)
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h
index 43ba78403..b1a09855b 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/diskio.h
@@ -34,3 +34,4 @@ BOOL assign_drives (int argc, char *argv[]);
#define _DISKIO
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h
index 851a78da2..5ecedd9a9 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/integer.h
@@ -35,3 +35,4 @@ typedef enum { FALSE = 0, TRUE } BOOL;
#define _INTEGER
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c
index 85b88e6e1..cfc050f76 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.c
@@ -400,7 +400,7 @@ FRESULT follow_path ( /* FR_OK(0): successful, !=0: error code */
}
dj->sclust =
#if _FS_FAT32
- ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
+ ((DWORD)LD_WORD(dir+DIR_FstClusHI) << 16) |
#endif
LD_WORD(dir+DIR_FstClusLO);
}
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h
index bdf1f9485..87ac2dff2 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/PetiteFATFs/pff.h
@@ -235,3 +235,4 @@ FRESULT pf_readdir (DIR*, FILINFO*); /* Read a directory item */
#endif /* _FATFS */
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c
index 63beb1d21..47dd02fab 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@ struct
{
uint16_t SigBytes[4];
bool EnforceSigBytes;
-
+
uint32_t ProgrammingSpeed;
} ProgrammerConfig;
@@ -47,14 +47,14 @@ bool ProgrammerConfig_ProcessConfiguration(void)
puts(" >> ERROR: CONF.txt File Not Found.\r\n");
return false;
}
-
+
char LineBuff[100];
char* CurrentLine;
-
+
do
{
CurrentLine = fgets(LineBuff, sizeof(LineBuff), &DiskStream);
-
+
if (CurrentLine)
{
sscanf(CurrentLine, "SIGNATURE = %02x %02x %02x %02x", &ProgrammerConfig.SigBytes[0],
@@ -65,13 +65,14 @@ bool ProgrammerConfig_ProcessConfiguration(void)
sscanf(CurrentLine, "SPEED = %lu", &ProgrammerConfig.ProgrammingSpeed);
}
} while (CurrentLine);
-
+
printf(" >> *** Configuration: ***\r\n");
printf(" >> Device Signature: 0x%02x 0x%02x 0x%02x 0x%02x\r\n", ProgrammerConfig.SigBytes[0],
ProgrammerConfig.SigBytes[1],
ProgrammerConfig.SigBytes[2],
ProgrammerConfig.SigBytes[3]);
printf(" >> Programming Speed: %lu Hz\r\n", ProgrammerConfig.ProgrammingSpeed);
-
+
return true;
}
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h
index ba6e9add6..736d0becd 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/ProgrammerConfig.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,10 +35,11 @@
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
-
+
#include "../StandaloneProgrammer.h"
/* Function Prototypes: */
bool ProgrammerConfig_ProcessConfiguration(void);
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c
index 1ca22a50e..bfc1098b3 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,7 +34,7 @@
* devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
* which wrap around standard SCSI device commands for controlling the actual storage medium.
*/
-
+
#define INCLUDE_FROM_SCSI_C
#include "SCSI.h"
@@ -42,22 +42,22 @@
/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
* features and capabilities.
*/
-SCSI_Inquiry_Response_t InquiryData =
+SCSI_Inquiry_Response_t InquiryData =
{
.DeviceType = DEVICE_TYPE_BLOCK,
.PeripheralQualifier = 0,
-
+
.Removable = true,
-
+
.Version = 0,
-
+
.ResponseDataFormat = 2,
.NormACA = false,
.TrmTsk = false,
.AERC = false,
.AdditionalLength = 0x1F,
-
+
.SoftReset = false,
.CmdQue = false,
.Linked = false,
@@ -65,7 +65,7 @@ SCSI_Inquiry_Response_t InquiryData =
.WideBus16Bit = false,
.WideBus32Bit = false,
.RelAddr = false,
-
+
.VendorID = "LUFA",
.ProductID = "Dataflash Disk",
.RevisionID = {'0','.','0','0'},
@@ -97,13 +97,13 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
{
case SCSI_CMD_INQUIRY:
- CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
break;
case SCSI_CMD_READ_CAPACITY_10:
- CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
@@ -135,7 +135,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
SCSI_ASENSEQ_NO_QUALIFIER);
-
+
return true;
}
@@ -166,11 +166,11 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
-
+
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
-
+
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
@@ -179,7 +179,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-
+
return true;
}
@@ -194,7 +194,7 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
{
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
-
+
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
@@ -222,10 +222,10 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_ClearIN();
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
-
+
return true;
}
@@ -249,21 +249,21 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
return false;
}
-
+
/* Check to see if all attached Dataflash ICs are functional */
if (!(DataflashManager_CheckDataflashOperation()))
{
/* Update SENSE key with a hardware error condition and return command fail */
SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
return false;
}
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-
+
return true;
}
@@ -281,13 +281,13 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
{
uint32_t BlockAddress;
uint16_t TotalBlocks;
-
+
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
/* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
-
+
/* Check if the block address is outside the maximum allowable value for the LUN */
if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
{
@@ -298,7 +298,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
return false;
}
-
+
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ)
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
@@ -307,7 +307,8 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
+
return true;
}
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h
index 6a90cb962..75d281414 100644
--- a/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h
+++ b/Projects/Incomplete/StandaloneProgrammer/Lib/SCSI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for SCSI.c.
*/
-
+
#ifndef _SCSI_H_
#define _SCSI_H_
@@ -46,7 +46,7 @@
#include "StandaloneProgrammer.h"
#include "Descriptors.h"
#include "DataflashManager.h"
-
+
/* Macros: */
/** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
* is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
@@ -68,14 +68,14 @@
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
#define DEVICE_TYPE_BLOCK 0x00
-
+
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
#define DEVICE_TYPE_CDROM 0x05
-
+
/* Function Prototypes: */
#if defined(USB_CAN_BE_DEVICE)
bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
-
+
#if defined(INCLUDE_FROM_SCSI_C)
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
@@ -85,5 +85,6 @@
const bool IsDataRead);
#endif
#endif
-
+
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
index 4b019bd37..9627d1b04 100644
--- a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
+++ b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -67,7 +67,7 @@ void EVENT_USB_UIDChange(void)
}
#endif
-/** Task to determine if the user is wishes to start the programming sequence, and if so executes the
+/** Task to determine if the user is wishes to start the programming sequence, and if so executes the
* required functions to program the attached target (if any) with the files loaded to the Dataflash.
*/
void Programmer_Task(void)
@@ -80,7 +80,7 @@ void Programmer_Task(void)
HasAttempted = true;
else
return;
-
+
puts("==== PROGRAMMING CYCLE STARTED ====\r\n");
#if defined(USB_CAN_BE_BOTH)
@@ -113,7 +113,7 @@ int main(void)
for (;;)
{
Programmer_Task();
-
+
if (USB_CurrentMode == USB_MODE_HOST)
{
#if defined(USB_CAN_BE_HOST)
@@ -126,7 +126,7 @@ int main(void)
DiskDevice_USBTask();
#endif
}
-
+
USB_USBTask();
}
}
@@ -159,3 +159,4 @@ void SetupHardware(void)
DataflashManager_ResetDataflashProtections();
#endif
}
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
index dfb8a9f3a..c0edc5166 100644
--- a/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
+++ b/Projects/Incomplete/StandaloneProgrammer/StandaloneProgrammer.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -70,19 +70,20 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/* External Variables: */
extern FILE DiskStream;
extern FATFS DiskFATState;
-
+
/* Function Prototypes: */
#if defined(INCLUDE_FROM_STANDALONEPROG_C)
static int Disk_getchar(FILE* Stream);
#endif
-
+
void EVENT_USB_UIDChange(void);
-
+
void SetupHardware(void);
void Programmer_Task(void);
-
+
#endif
+
diff --git a/Projects/Incomplete/StandaloneProgrammer/makefile b/Projects/Incomplete/StandaloneProgrammer/makefile
index 022cbd259..aecad74e6 100644
--- a/Projects/Incomplete/StandaloneProgrammer/makefile
+++ b/Projects/Incomplete/StandaloneProgrammer/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -144,7 +144,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -157,7 +157,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -271,7 +271,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -284,7 +284,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -296,7 +296,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -308,7 +308,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -331,7 +331,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -365,7 +365,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -399,7 +399,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -428,7 +428,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -447,10 +447,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -515,11 +515,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -546,9 +546,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -646,14 +646,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -675,7 +675,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -719,3 +719,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/LEDNotifier/Descriptors.c b/Projects/LEDNotifier/Descriptors.c
index 38f6e34ac..f31f42828 100644
--- a/Projects/LEDNotifier/Descriptors.c
+++ b/Projects/LEDNotifier/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -83,102 +83,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_DataOutEndpoint =
+ .CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC_DataInEndpoint =
+
+ .CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -241,30 +241,31 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/LEDNotifier/Descriptors.h b/Projects/LEDNotifier/Descriptors.h
index 159d8d265..ddd9495ea 100644
--- a/Projects/LEDNotifier/Descriptors.h
+++ b/Projects/LEDNotifier/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -83,3 +83,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/LEDNotifier/LEDNotifier.c b/Projects/LEDNotifier/LEDNotifier.c
index d1f4451e7..591d1e3e6 100644
--- a/Projects/LEDNotifier/LEDNotifier.c
+++ b/Projects/LEDNotifier/LEDNotifier.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the LEDNotfier project. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
-
+
#include "LEDNotifier.h"
/** LUFA CDC Class driver interface configuration and state information. This structure is
@@ -89,7 +89,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
if (SoftPWM_Count >= SoftPWM_Channel3_Duty)
LEDMask &= ~LEDS_LED3;
-
+
LEDs_SetAllLEDs(LEDMask);
}
@@ -104,24 +104,24 @@ static FILE USBSerialStream;
int main(void)
{
SetupHardware();
-
+
/* Create a regular blocking character stream for the interface so that it can be used with the stdio.h functions */
CDC_Device_CreateBlockingStream(&VirtualSerial_CDC_Interface, &USBSerialStream);
-
+
sei();
for (;;)
{
/* Read in next LED colour command from the host */
uint8_t ColourUpdate = fgetc(&USBSerialStream);
-
+
/* Top 3 bits select the LED, bottom 5 control the brightness */
uint8_t Channel = (ColourUpdate & 0b11100000);
uint8_t Duty = (ColourUpdate & 0b00011111);
-
+
if (Channel & (1 << 5))
SoftPWM_Channel1_Duty = Duty;
-
+
if (Channel & (1 << 6))
SoftPWM_Channel2_Duty = Duty;
@@ -146,7 +146,7 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
USB_Init();
-
+
/* Timer Initialization */
OCR0A = 100;
TCCR0A = (1 << WGM01);
@@ -165,3 +165,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
{
CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface);
}
+
diff --git a/Projects/LEDNotifier/LEDNotifier.h b/Projects/LEDNotifier/LEDNotifier.h
index 3565e8bed..f91fa6e95 100644
--- a/Projects/LEDNotifier/LEDNotifier.h
+++ b/Projects/LEDNotifier/LEDNotifier.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,11 +50,12 @@
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/CDC.h>
-
+
/* Function Prototypes: */
void SetupHardware(void);
-
+
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Projects/LEDNotifier/LEDNotifier.txt b/Projects/LEDNotifier/LEDNotifier.txt
index dae6b6f2f..b5eadbabb 100644
--- a/Projects/LEDNotifier/LEDNotifier.txt
+++ b/Projects/LEDNotifier/LEDNotifier.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage USB LED Notifier Project
*
* \section SSec_Compat Demo Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -39,7 +39,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* USB LED Notifier Project. This project is designed for the Busware BUI board, however it can run easily on any
* USB AVR. It is a generic RGB LED controller (via a three channel software PWM) which listens for commands from the
@@ -60,3 +60,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/LEDNotifier/makefile b/Projects/LEDNotifier/makefile
index d07dfec72..3292e5ad1 100644
--- a/Projects/LEDNotifier/makefile
+++ b/Projects/LEDNotifier/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = BUI
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/Magstripe/Descriptors.c b/Projects/Magstripe/Descriptors.c
index 46ee69fee..2a04e5f26 100644
--- a/Projects/Magstripe/Descriptors.c
+++ b/Projects/Magstripe/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -31,11 +31,11 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
-
+
#include "Descriptors.h"
/** HID report descriptor. This is a HID class specific descriptor, which defines the structure of the
@@ -79,22 +79,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM KeyboardReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2042,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -105,49 +105,49 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x01,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_KeyboardHID =
- {
+ .HID_KeyboardHID =
+ {
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(KeyboardReport)
},
-
- .HID_ReportINEndpoint =
+
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -160,11 +160,11 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
* the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate
- * via the language ID table available at USB.org what languages the device supports for its string descriptors. */
+ * via the language ID table available at USB.org what languages the device supports for its string descriptors. */
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -175,7 +175,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(32), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera and Denver Gingerich"
};
@@ -186,7 +186,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(20), .Type = DTYPE_String},
-
+
.UnicodeString = L"Magnetic Card Reader"
};
@@ -232,7 +232,7 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_KeyboardHID;
@@ -243,7 +243,8 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
Size = sizeof(KeyboardReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/Magstripe/Descriptors.h b/Projects/Magstripe/Descriptors.h
index 7180bf3e7..963aaac09 100644
--- a/Projects/Magstripe/Descriptors.h
+++ b/Projects/Magstripe/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -55,11 +55,11 @@
USB_HID_Descriptor_HID_t HID_KeyboardHID; /**< Keyboard HID descriptor */
USB_Descriptor_Endpoint_t HID_ReportINEndpoint; /**< Keyboard key report endpoint descriptor */
} USB_Descriptor_Configuration_t;
-
+
/* Macros: */
/** Endpoint number of the keyboard key press reporting endpoint. */
#define KEYBOARD_EPNUM 1
-
+
/** Size of the keyboard report endpoints, in bytes. */
#define KEYBOARD_EPSIZE 8
@@ -70,3 +70,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/Magstripe/Lib/CircularBitBuffer.c b/Projects/Magstripe/Lib/CircularBitBuffer.c
index c1b21039c..3b0ca6cd5 100644
--- a/Projects/Magstripe/Lib/CircularBitBuffer.c
+++ b/Projects/Magstripe/Lib/CircularBitBuffer.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -41,7 +41,7 @@ void BitBuffer_Init(BitBuffer_t* const Buffer)
{
/* Reset the number of stored bits in the buffer */
Buffer->Elements = 0;
-
+
/* Reset the data in and out pointer structures in the buffer to the first buffer bit */
Buffer->In.CurrentByte = Buffer->Data;
Buffer->In.ByteMask = (1 << 0);
@@ -56,10 +56,10 @@ void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer,
/* If the bit to store is true, set the next bit in the buffer */
if (Bit)
*Buffer->In.CurrentByte |= Buffer->In.ByteMask;
-
+
/* Increment the number of stored bits in the buffer counter */
Buffer->Elements++;
-
+
/* Check if the current buffer byte is full of stored bits */
if (Buffer->In.ByteMask == (1 << 7))
{
@@ -68,8 +68,8 @@ void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer,
Buffer->In.CurrentByte++;
else
Buffer->In.CurrentByte = Buffer->Data;
-
- /* Reset the storage bit mask in the current buffer byte to the first bit */
+
+ /* Reset the storage bit mask in the current buffer byte to the first bit */
Buffer->In.ByteMask = (1 << 0);
}
else
@@ -81,7 +81,7 @@ void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer,
/** Function to retrieve the next bit stored in the given bit buffer. */
bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer)
-{
+{
/* Retrieve the value of the next bit stored in the buffer */
bool Bit = ((*Buffer->Out.CurrentByte & Buffer->Out.ByteMask) != 0);
@@ -90,17 +90,17 @@ bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer)
/* Decrement the number of stored bits in the buffer counter */
Buffer->Elements--;
-
- /* Check if the current buffer byte is empty of stored bits */
+
+ /* Check if the current buffer byte is empty of stored bits */
if (Buffer->Out.ByteMask == (1 << 7))
{
/* Check if the end of the buffer has been reached, if so reset to start of buffer, otherwise advance to next bit */
if (Buffer->Out.CurrentByte != &Buffer->Data[sizeof(Buffer->Data) - 1])
Buffer->Out.CurrentByte++;
else
- Buffer->Out.CurrentByte = Buffer->Data;
-
- /* Reset the retrieval bit mask in the current buffer byte to the first bit */
+ Buffer->Out.CurrentByte = Buffer->Data;
+
+ /* Reset the retrieval bit mask in the current buffer byte to the first bit */
Buffer->Out.ByteMask = (1 << 0);
}
else
@@ -112,3 +112,4 @@ bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer)
/* Return the retrieved bit from the buffer */
return Bit;
}
+
diff --git a/Projects/Magstripe/Lib/CircularBitBuffer.h b/Projects/Magstripe/Lib/CircularBitBuffer.h
index 04322fbe9..7a04694db 100644
--- a/Projects/Magstripe/Lib/CircularBitBuffer.h
+++ b/Projects/Magstripe/Lib/CircularBitBuffer.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,7 +40,7 @@
/* Includes: */
#include <avr/io.h>
#include <stdbool.h>
-
+
#include <LUFA/Common/Common.h>
/* Macros: */
@@ -51,7 +51,7 @@
#else
#define MAX_BITS 1024
#endif
-
+
/* Type Defines: */
/** Type define for a pointer to a bit in a bit buffer. */
typedef struct
@@ -65,18 +65,18 @@
{
uint8_t Data[MAX_BITS / 8]; /**< Buffer to hold the stored bits in packed form */
uint16_t Elements; /**< Number of stored bits in the bit buffer */
-
+
BitBufferPointer_t In; /**< Bit pointer to the next storage location in the buffer */
BitBufferPointer_t Out; /**< Bit pointer to the next retrieval location in the buffer */
} BitBuffer_t;
-
- /* Function Prototypes: */
+
+ /* Function Prototypes: */
/** Initialises or resets a given bit buffer, ready to store new bits.
- *
+ *
* \param[in,out] Buffer Bit buffer to initialize
*/
void BitBuffer_Init(BitBuffer_t* const Buffer) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Stores a bit into the next location inside a given bit buffer.
*
* \param[in,out] Buffer Bit buffer to store a bit into
@@ -84,7 +84,7 @@
*/
void BitBuffer_StoreNextBit(BitBuffer_t* const Buffer,
const bool Bit) ATTR_NON_NULL_PTR_ARG(1);
-
+
/** Retrieves a bit from the next location inside a given bit buffer.
*
* \param[in,out] Buffer Bit buffer to store a bit into
@@ -92,5 +92,6 @@
* \return Next bit from the buffer
*/
bool BitBuffer_GetNextBit(BitBuffer_t* const Buffer) ATTR_NON_NULL_PTR_ARG(1);
-
+
#endif
+
diff --git a/Projects/Magstripe/Lib/MagstripeHW.h b/Projects/Magstripe/Lib/MagstripeHW.h
index 5b20fc433..5b709a89e 100644
--- a/Projects/Magstripe/Lib/MagstripeHW.h
+++ b/Projects/Magstripe/Lib/MagstripeHW.h
@@ -2,13 +2,13 @@
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -98,3 +98,4 @@
}
#endif
+
diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c
index 9a551a18a..50ca3cab3 100644
--- a/Projects/Magstripe/Magstripe.c
+++ b/Projects/Magstripe/Magstripe.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -28,13 +28,13 @@
arising out of or in connection with the use or performance of
this software.
*/
-
+
/** \file
*
* Main source file for the MagStripe reader program. This file contains the main tasks of
* the project and is responsible for the initial application hardware configuration.
*/
-
+
#include "Magstripe.h"
/** Bit buffers to hold the read bits for each of the three magnetic card tracks before they are transmitted
@@ -73,10 +73,10 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
int main(void)
{
SetupHardware();
-
+
for (uint8_t Buffer = 0; Buffer < TOTAL_TRACKS; Buffer++)
BitBuffer_Init(&TrackDataBuffers[Buffer]);
-
+
sei();
for (;;)
@@ -113,7 +113,7 @@ void ReadMagstripeData(void)
const struct
{
uint8_t ClockMask;
- uint8_t DataMask;
+ uint8_t DataMask;
} TrackInfo[] = {{MAG_T1_CLOCK, MAG_T1_DATA},
{MAG_T2_CLOCK, MAG_T2_DATA},
{MAG_T3_CLOCK, MAG_T3_DATA}};
@@ -128,7 +128,7 @@ void ReadMagstripeData(void)
bool DataPinLevel = ((Magstripe_LCL & TrackInfo[Track].DataMask) != 0);
bool ClockPinLevel = ((Magstripe_LCL & TrackInfo[Track].ClockMask) != 0);
bool ClockLevelChanged = (((Magstripe_LCL ^ Magstripe_Prev) & TrackInfo[Track].ClockMask) != 0);
-
+
/* Sample data on rising clock edges from the card reader */
if (ClockPinLevel && ClockLevelChanged)
BitBuffer_StoreNextBit(&TrackDataBuffers[Track], DataPinLevel);
@@ -137,7 +137,7 @@ void ReadMagstripeData(void)
Magstripe_Prev = Magstripe_LCL;
Magstripe_LCL = Magstripe_GetStatus();
}
-
+
CurrentTrackBuffer = &TrackDataBuffers[0];
}
@@ -200,7 +200,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
/* Still data in the current track; convert next bit to a 1 or 0 keypress */
KeyboardReport->KeyCode[0] = BitBuffer_GetNextBit(CurrentTrackBuffer) ? KEY_1 : KEY_0;
}
-
+
*ReportSize = sizeof(USB_KeyboardReport_Data_t);
return false;
}
@@ -221,3 +221,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
{
// Unused (but mandatory for the HID class driver) in this demo, since there are no Host->Device reports
}
+
diff --git a/Projects/Magstripe/Magstripe.h b/Projects/Magstripe/Magstripe.h
index 946ef2ebf..58f3f2373 100644
--- a/Projects/Magstripe/Magstripe.h
+++ b/Projects/Magstripe/Magstripe.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -10,13 +10,13 @@
Copyright 2010 Denver Gingerich (denver [at] ossguy [dot] com)
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,10 +54,10 @@
/* Macros: */
/** Total number of tracks which can be read from the card, between 1 and 3. */
#define TOTAL_TRACKS 3
-
+
/** HID keyboard keycode to indicate that no is currently pressed. */
#define KEY_NONE 0
-
+
/** HID keyboard keycode to indicate that the "1" key is currently pressed. */
#define KEY_1 30
@@ -66,11 +66,11 @@
/** HID keyboard keycode to indicate that the enter key is currently pressed. */
#define KEY_ENTER 40
-
+
/* Function Prototypes: */
void SetupHardware(void);
void ReadMagstripeData(void);
-
+
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
void EVENT_USB_Device_StartOfFrame(void);
@@ -81,9 +81,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
-
+
#endif
+
diff --git a/Projects/Magstripe/Magstripe.txt b/Projects/Magstripe/Magstripe.txt
index 29258ed49..54715b042 100644
--- a/Projects/Magstripe/Magstripe.txt
+++ b/Projects/Magstripe/Magstripe.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Denver Gingerich's USBSnoop Magnetic Card Reader Project
*
* \section SSec_Compat Project Compatibility:
@@ -26,7 +26,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Keyboard</td>
* </tr>
@@ -40,18 +40,18 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Firmware for a USB AVR powered USB TTL magnetic stripe reader (using a card
* reader such as the Omron V3B-4K) by Denver Gingerich. This project is designed
* to be used with the open source Stripe Snoop project at <a>http://stripesnoop.sourceforge.net/</a>.
- *
+ *
* See <a>http://ossguy.com/ss_usb/</a> for the USB reader hardware project website,
* including construction and support details.
- *
+ *
* To use, connect your magnetic card reader device to the USB AVR as follows (pin and port mapping may be adjusted
* from the project makefile):
- *
+ *
* <table>
* <tr>
* <td><b>Signal:</b></td>
@@ -162,3 +162,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/Magstripe/makefile b/Projects/Magstripe/makefile
index aed7a1938..2eea2cbd6 100644
--- a/Projects/Magstripe/makefile
+++ b/Projects/Magstripe/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = NONE
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 16000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -147,7 +147,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -160,7 +160,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -274,7 +274,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -287,7 +287,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -299,7 +299,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -311,7 +311,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -334,7 +334,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -368,7 +368,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -402,7 +402,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -431,7 +431,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -450,10 +450,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -518,11 +518,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -549,9 +549,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -649,14 +649,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -678,7 +678,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -722,3 +722,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/MissileLauncher/ConfigDescriptor.c b/Projects/MissileLauncher/ConfigDescriptor.c
index 7ee2449c2..c7ddbcbd5 100644
--- a/Projects/MissileLauncher/ConfigDescriptor.c
+++ b/Projects/MissileLauncher/ConfigDescriptor.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,7 +50,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint8_t ConfigDescriptorData[512];
void* CurrConfigLocation = ConfigDescriptorData;
uint16_t CurrConfigBytesRem;
-
+
USB_Descriptor_Interface_t* HIDInterface = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
USB_Descriptor_Endpoint_t* DataOUTEndpoint = NULL;
@@ -79,7 +79,7 @@ uint8_t ProcessConfigurationDescriptor(void)
* but only found the mandatory IN endpoint, it's safe to continue with the device enumeration */
if (DataINEndpoint)
break;
-
+
/* Get the next HID interface from the configuration descriptor */
if (USB_GetNextDescriptorComp(&CurrConfigBytesRem, &CurrConfigLocation,
DComp_NextHIDInterface) != DESCRIPTOR_SEARCH_COMP_Found)
@@ -87,7 +87,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Descriptor not found, error out */
return NoCompatibleInterfaceFound;
}
-
+
/* Save the interface in case we need to refer back to it later */
HIDInterface = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Interface_t);
@@ -97,7 +97,7 @@ uint8_t ProcessConfigurationDescriptor(void)
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
}
-
+
/* Retrieve the endpoint address from the endpoint descriptor */
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_Endpoint_t);
@@ -107,20 +107,20 @@ uint8_t ProcessConfigurationDescriptor(void)
else
DataOUTEndpoint = EndpointData;
}
-
+
/* Configure the HID data IN pipe */
Pipe_ConfigurePipe(HID_DATA_IN_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_IN,
DataINEndpoint->EndpointAddress, DataINEndpoint->EndpointSize, PIPE_BANK_SINGLE);
Pipe_SetInterruptPeriod(DataINEndpoint->PollingIntervalMS);
-
+
/* Check if the HID interface contained an optional OUT data endpoint */
if (DataOUTEndpoint)
{
/* Configure the HID data OUT pipe */
Pipe_ConfigurePipe(HID_DATA_OUT_PIPE, EP_TYPE_INTERRUPT, PIPE_TOKEN_OUT,
DataOUTEndpoint->EndpointAddress, DataOUTEndpoint->EndpointSize, PIPE_BANK_SINGLE);
- }
-
+ }
+
/* Valid data found, return success */
return SuccessfulConfigRead;
}
@@ -145,7 +145,7 @@ uint8_t DComp_NextHIDInterface(void* CurrentDescriptor)
return DESCRIPTOR_SEARCH_Found;
}
}
-
+
/* Current descriptor does not match what this comparator is looking for */
return DESCRIPTOR_SEARCH_NotFound;
}
@@ -176,3 +176,4 @@ uint8_t DComp_NextHIDInterfaceDataEndpoint(void* CurrentDescriptor)
/* Current descriptor does not match what this comparator is looking for */
return DESCRIPTOR_SEARCH_NotFound;
}
+
diff --git a/Projects/MissileLauncher/ConfigDescriptor.h b/Projects/MissileLauncher/ConfigDescriptor.h
index 5cddada1d..3a745e3b2 100644
--- a/Projects/MissileLauncher/ConfigDescriptor.h
+++ b/Projects/MissileLauncher/ConfigDescriptor.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,16 +38,16 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "MissileLauncher.h"
-
+
/* Macros: */
/** Interface Class value for the Human Interface Device class. */
#define HID_CLASS 0x03
/** Pipe number for the HID data IN pipe. */
#define HID_DATA_IN_PIPE 1
-
+
/** Pipe number for the HID data OUT pipe. */
#define HID_DATA_OUT_PIPE 2
@@ -60,7 +60,7 @@
DescriptorTooLarge = 2, /**< The device's Configuration Descriptor is too large to process */
InvalidConfigDataReturned = 3, /**< The device returned an invalid Configuration Descriptor */
NoCompatibleInterfaceFound = 4, /**< A compatible interface with the required endpoints was not found */
- };
+ };
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
@@ -69,3 +69,4 @@
uint8_t DComp_NextHIDInterfaceDataEndpoint(void* CurrentDescriptor);
#endif
+
diff --git a/Projects/MissileLauncher/MissileLauncher.c b/Projects/MissileLauncher/MissileLauncher.c
index c76dc52f4..6b22df82e 100644
--- a/Projects/MissileLauncher/MissileLauncher.c
+++ b/Projects/MissileLauncher/MissileLauncher.c
@@ -2,7 +2,7 @@
USB Missile Launcher Demo
Copyright (C) Dave Fletcher, 2010.
fletch at fletchtronics dot net
-
+
Based on research by Scott Weston at
http://code.google.com/p/pymissile
*/
@@ -11,13 +11,13 @@
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2010 Dave Fletcher (fletch [at] fletchtronics [dot] net)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
* the application and is responsible for the initial application hardware configuration as well
* as the sending of commands to the attached launcher toy.
*/
-
+
#include "MissileLauncher.h"
/** Launcher first init command report data sequence */
@@ -103,7 +103,7 @@ int main(void)
for (;;)
{
Read_Joystick_Status();
-
+
HID_Host_Task();
USB_USBTask();
}
@@ -173,7 +173,7 @@ void Send_Command(uint8_t* const Command)
Send_Command_Report(CMD_INITB, 8);
Send_Command_Report(Command, LAUNCHER_CMD_BUFFER_SIZE);
}
-
+
CmdState = Command;
}
@@ -231,13 +231,13 @@ void DiscardNextReport(void)
{
/* Refreeze HID data IN pipe */
Pipe_Freeze();
-
+
return;
}
-
+
/* Clear the IN endpoint, ready for next data packet */
Pipe_ClearIN();
-
+
/* Refreeze HID data IN pipe */
Pipe_Freeze();
}
@@ -252,7 +252,7 @@ void WriteNextReport(uint8_t* const ReportOUTData,
{
/* Select and unfreeze HID data OUT pipe */
Pipe_SelectPipe(HID_DATA_OUT_PIPE);
-
+
/* Not all HID devices have an OUT endpoint (some require OUT reports to be sent over the
* control endpoint instead) - check to see if the OUT endpoint has been initialized */
if (Pipe_IsConfigured())
@@ -264,13 +264,13 @@ void WriteNextReport(uint8_t* const ReportOUTData,
{
/* Refreeze the data OUT pipe */
Pipe_Freeze();
-
+
return;
}
-
+
/* Write out HID report data */
- Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
-
+ Pipe_Write_Stream_LE(ReportOUTData, ReportLength);
+
/* Clear the OUT endpoint, send last data packet */
Pipe_ClearOUT();
@@ -324,12 +324,12 @@ void HID_Host_Task(void)
{
/* Indicate error status */
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
-
+
/* Wait until USB device disconnected */
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
@@ -338,3 +338,4 @@ void HID_Host_Task(void)
break;
}
}
+
diff --git a/Projects/MissileLauncher/MissileLauncher.h b/Projects/MissileLauncher/MissileLauncher.h
index 6bff6af8b..080d568f9 100644
--- a/Projects/MissileLauncher/MissileLauncher.h
+++ b/Projects/MissileLauncher/MissileLauncher.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -50,9 +50,9 @@
#include <LUFA/Drivers/Board/Buttons.h>
#include <LUFA/Drivers/Board/Joystick.h>
#include <LUFA/Drivers/Board/LEDs.h>
-
+
#include "ConfigDescriptor.h"
-
+
/* Macros: */
/** HID Class specific request to send a HID report to the device. */
#define REQ_SetReport 0x09
@@ -68,10 +68,10 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** Size of the Launcher report command buffer. */
#define LAUNCHER_CMD_BUFFER_SIZE 64
-
+
/* Function Prototypes: */
void SetupHardware(void);
@@ -92,5 +92,6 @@
void DiscardNextReport(void);
void WriteNextReport(uint8_t* const ReportOUTData,
const uint16_t ReportLength);
-
+
#endif
+
diff --git a/Projects/MissileLauncher/MissileLauncher.txt b/Projects/MissileLauncher/MissileLauncher.txt
index 3b344281a..49918d411 100644
--- a/Projects/MissileLauncher/MissileLauncher.txt
+++ b/Projects/MissileLauncher/MissileLauncher.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage David Fletcher's Missile Launcher
*
* \section SSec_Compat Project Compatibility:
@@ -25,7 +25,7 @@
* <td><b>USB Class:</b></td>
* <td>Human Interface Device (HID)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
@@ -39,7 +39,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Missile Launcher host. This is a host driver for the popular USB-controller table top toy missile launchers,
* which can typically aim and fire small foam "missiles" from a spring-loaded turret. This project controls the
@@ -57,3 +57,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/MissileLauncher/makefile b/Projects/MissileLauncher/makefile
index 0bdb51c1e..6a811e864 100644
--- a/Projects/MissileLauncher/makefile
+++ b/Projects/MissileLauncher/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -132,7 +132,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -145,7 +145,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -259,7 +259,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -272,7 +272,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -284,7 +284,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -296,7 +296,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -319,7 +319,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -353,7 +353,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -387,7 +387,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -416,7 +416,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -435,10 +435,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -503,11 +503,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -534,9 +534,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -634,14 +634,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -663,7 +663,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -707,3 +707,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/RelayBoard/Descriptors.c b/Projects/RelayBoard/Descriptors.c
index d05de457e..2fa95bde8 100644
--- a/Projects/RelayBoard/Descriptors.c
+++ b/Projects/RelayBoard/Descriptors.c
@@ -200,3 +200,4 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/RelayBoard/Descriptors.h b/Projects/RelayBoard/Descriptors.h
index 2cf2e8d69..554c361e9 100644
--- a/Projects/RelayBoard/Descriptors.h
+++ b/Projects/RelayBoard/Descriptors.h
@@ -58,3 +58,4 @@
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/RelayBoard/RelayBoard.c b/Projects/RelayBoard/RelayBoard.c
index 7bba1bad4..b71b3535a 100644
--- a/Projects/RelayBoard/RelayBoard.c
+++ b/Projects/RelayBoard/RelayBoard.c
@@ -44,7 +44,7 @@
int main(void)
{
SetupHardware();
-
+
sei();
for (;;)
@@ -103,7 +103,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
break;
}
}
-
+
break;
case 0x01:
if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
@@ -130,7 +130,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
ControlData[1] = (PORTC & RELAY4) ? 2 : 3;
break;
}
-
+
if (ControlData[1])
Endpoint_Write_Control_Stream_LE(ControlData, sizeof(ControlData));
@@ -140,3 +140,4 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
break;
}
}
+
diff --git a/Projects/RelayBoard/RelayBoard.h b/Projects/RelayBoard/RelayBoard.h
index cfd75794d..f3814b299 100644
--- a/Projects/RelayBoard/RelayBoard.h
+++ b/Projects/RelayBoard/RelayBoard.h
@@ -62,3 +62,4 @@
void EVENT_USB_Device_UnhandledControlRequest(void);
#endif
+
diff --git a/Projects/RelayBoard/RelayBoard.txt b/Projects/RelayBoard/RelayBoard.txt
index bb484be7e..357f780b3 100644
--- a/Projects/RelayBoard/RelayBoard.txt
+++ b/Projects/RelayBoard/RelayBoard.txt
@@ -92,4 +92,4 @@
* </tr>
* </table>
*
- */ \ No newline at end of file
+ */
diff --git a/Projects/RelayBoard/makefile b/Projects/RelayBoard/makefile
index d4434bc4b..ec4c68292 100644
--- a/Projects/RelayBoard/makefile
+++ b/Projects/RelayBoard/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -135,7 +135,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -148,7 +148,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -262,7 +262,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -275,7 +275,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -287,7 +287,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -299,7 +299,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -322,7 +322,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -356,7 +356,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -390,7 +390,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -419,7 +419,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -438,10 +438,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -506,11 +506,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -537,9 +537,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -637,14 +637,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -666,7 +666,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -710,3 +710,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/TempDataLogger/Descriptors.c b/Projects/TempDataLogger/Descriptors.c
index 16a6581d2..5dde04c19 100644
--- a/Projects/TempDataLogger/Descriptors.c
+++ b/Projects/TempDataLogger/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -83,22 +83,22 @@ USB_Descriptor_HIDReport_Datatype_t PROGMEM GenericReport[] =
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2063,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -109,38 +109,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .MS_Interface =
+
+ .MS_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x08,
.SubClass = 0x06,
.Protocol = 0x50,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .MS_DataInEndpoint =
+ .MS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -150,7 +150,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .MS_DataOutEndpoint =
+ .MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -159,27 +159,27 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.EndpointSize = MASS_STORAGE_IO_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x03,
.SubClass = 0x00,
.Protocol = HID_BOOTP_NonBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_GenericHID =
+ .HID_GenericHID =
{
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
@@ -187,15 +187,15 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.HIDReportLength = sizeof(GenericReport)
},
- .HID_ReportINEndpoint =
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | GENERIC_IN_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = GENERIC_EPSIZE,
.PollingIntervalMS = 0x0A
- },
+ },
};
/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests
@@ -205,7 +205,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -216,7 +216,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -227,7 +227,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
+
.UnicodeString = L"Temperature Datalogger"
};
@@ -249,42 +249,43 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
- case HID_DTYPE_HID:
+ case HID_DTYPE_HID:
Address = &ConfigurationDescriptor.HID_GenericHID;
Size = sizeof(USB_HID_Descriptor_HID_t);
break;
- case HID_DTYPE_Report:
+ case HID_DTYPE_Report:
Address = &GenericReport;
Size = sizeof(GenericReport);
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/TempDataLogger/Descriptors.h b/Projects/TempDataLogger/Descriptors.h
index a4916ace1..3b5e78ea3 100644
--- a/Projects/TempDataLogger/Descriptors.h
+++ b/Projects/TempDataLogger/Descriptors.h
@@ -1,11 +1,11 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -15,15 +15,15 @@
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
#include <LUFA/Drivers/USB/Class/HID.h>
-
+
#include "TempDataLogger.h"
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
+ #define MASS_STORAGE_IN_EPNUM 3
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
+ #define MASS_STORAGE_OUT_EPNUM 4
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
@@ -33,11 +33,11 @@
/** Size in bytes of the Generic HID reporting endpoint. */
#define GENERIC_EPSIZE 16
-
+
/** Size in bytes of the Generic HID reports (including report ID byte). */
#define GENERIC_REPORT_SIZE sizeof(Device_Report_t)
-
- /* Type Defines: */
+
+ /* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@@ -52,7 +52,7 @@
USB_HID_Descriptor_HID_t HID_GenericHID;
USB_Descriptor_Endpoint_t HID_ReportINEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -60,3 +60,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/TempDataLogger/Lib/DS1307.c b/Projects/TempDataLogger/Lib/DS1307.c
index a85aa6176..270dbbaa9 100644
--- a/Projects/TempDataLogger/Lib/DS1307.c
+++ b/Projects/TempDataLogger/Lib/DS1307.c
@@ -1,6 +1,6 @@
/*
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -15,7 +15,7 @@ void DS1307_SetDate(const uint8_t Day,
return;
#endif
- DS1307_DateRegs_t CurrentRTCDate;
+ DS1307_DateRegs_t CurrentRTCDate;
CurrentRTCDate.Byte1.Fields.TenDay = (Day / 10);
CurrentRTCDate.Byte1.Fields.Day = (Day % 10);
CurrentRTCDate.Byte2.Fields.TenMonth = (Month / 10);
@@ -29,7 +29,7 @@ void DS1307_SetDate(const uint8_t Day,
TWI_SendByte(CurrentRTCDate.Byte1.IntVal);
TWI_SendByte(CurrentRTCDate.Byte2.IntVal);
TWI_SendByte(CurrentRTCDate.Byte3.IntVal);
-
+
TWI_StopTransmission();
}
}
@@ -51,18 +51,18 @@ void DS1307_SetTime(const uint8_t Hour,
CurrentRTCTime.Byte3.Fields.TenHour = (Hour / 10);
CurrentRTCTime.Byte3.Fields.Hour = (Hour % 10);
CurrentRTCTime.Byte3.Fields.TwelveHourMode = false;
-
+
if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
{
TWI_SendByte(DS1307_TIMEREG_START);
TWI_SendByte(CurrentRTCTime.Byte1.IntVal);
TWI_SendByte(CurrentRTCTime.Byte2.IntVal);
TWI_SendByte(CurrentRTCTime.Byte3.IntVal);
-
+
TWI_StopTransmission();
}
}
-
+
void DS1307_GetDate(uint8_t* const Day,
uint8_t* const Month,
uint8_t* const Year)
@@ -77,7 +77,7 @@ void DS1307_GetDate(uint8_t* const Day,
if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
{
TWI_SendByte(DS1307_DATEREG_START);
-
+
TWI_StopTransmission();
}
@@ -88,7 +88,7 @@ void DS1307_GetDate(uint8_t* const Day,
TWI_ReceiveByte(&CurrentRTCDate.Byte1.IntVal, false);
TWI_ReceiveByte(&CurrentRTCDate.Byte2.IntVal, false);
TWI_ReceiveByte(&CurrentRTCDate.Byte3.IntVal, true);
-
+
TWI_StopTransmission();
}
@@ -111,10 +111,10 @@ void DS1307_GetTime(uint8_t* const Hour,
if (TWI_StartTransmission(DS1307_ADDRESS_WRITE, 10))
{
TWI_SendByte(DS1307_TIMEREG_START);
-
+
TWI_StopTransmission();
}
-
+
DS1307_TimeRegs_t CurrentRTCTime;
if (TWI_StartTransmission(DS1307_ADDRESS_READ, 10))
@@ -122,7 +122,7 @@ void DS1307_GetTime(uint8_t* const Hour,
TWI_ReceiveByte(&CurrentRTCTime.Byte1.IntVal, false);
TWI_ReceiveByte(&CurrentRTCTime.Byte2.IntVal, false);
TWI_ReceiveByte(&CurrentRTCTime.Byte3.IntVal, true);
-
+
TWI_StopTransmission();
}
@@ -130,3 +130,4 @@ void DS1307_GetTime(uint8_t* const Hour,
*Minute = (CurrentRTCTime.Byte2.Fields.TenMin * 10) + CurrentRTCTime.Byte2.Fields.Min;
*Hour = (CurrentRTCTime.Byte3.Fields.TenHour * 10) + CurrentRTCTime.Byte3.Fields.Hour;
}
+
diff --git a/Projects/TempDataLogger/Lib/DS1307.h b/Projects/TempDataLogger/Lib/DS1307.h
index c9fe43c3d..3212dd3c9 100644
--- a/Projects/TempDataLogger/Lib/DS1307.h
+++ b/Projects/TempDataLogger/Lib/DS1307.h
@@ -1,6 +1,6 @@
/*
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -24,10 +24,10 @@
unsigned int TenSec : 3;
unsigned int CH : 1;
} Fields;
-
+
uint8_t IntVal;
} Byte1;
-
+
union
{
struct
@@ -36,10 +36,10 @@
unsigned int TenMin : 3;
unsigned int Reserved : 1;
} Fields;
-
+
uint8_t IntVal;
} Byte2;
-
+
union
{
struct
@@ -49,7 +49,7 @@
unsigned int TwelveHourMode : 1;
unsigned int Reserved : 1;
} Fields;
-
+
uint8_t IntVal;
} Byte3;
} DS1307_TimeRegs_t;
@@ -64,7 +64,7 @@
unsigned int TenDay : 2;
unsigned int Reserved : 2;
} Fields;
-
+
uint8_t IntVal;
} Byte1;
@@ -76,10 +76,10 @@
unsigned int TenMonth : 1;
unsigned int Reserved : 3;
} Fields;
-
+
uint8_t IntVal;
} Byte2;
-
+
union
{
struct
@@ -87,7 +87,7 @@
unsigned int Year : 4;
unsigned int TenYear : 4;
} Fields;
-
+
uint8_t IntVal;
} Byte3;
} DS1307_DateRegs_t;
@@ -95,7 +95,7 @@
/* Macros: */
#define DS1307_TIMEREG_START 0x00
#define DS1307_DATEREG_START 0x04
-
+
#define DS1307_ADDRESS_READ 0b11010001
#define DS1307_ADDRESS_WRITE 0b11010000
@@ -114,3 +114,4 @@
uint8_t* const Second);
#endif
+
diff --git a/Projects/TempDataLogger/Lib/DataflashManager.c b/Projects/TempDataLogger/Lib/DataflashManager.c
index 3cabda776..b7bc2f41c 100644
--- a/Projects/TempDataLogger/Lib/DataflashManager.c
+++ b/Projects/TempDataLogger/Lib/DataflashManager.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -77,7 +77,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -86,7 +86,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
/* Clear the current endpoint bank */
Endpoint_ClearOUT();
-
+
/* Wait until the host has sent another packet */
if (Endpoint_WaitUntilReady())
return;
@@ -125,7 +125,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Send the Dataflash buffer write command */
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
+ Dataflash_SendAddressBytes(0, 0);
}
/* Write one 16-byte chunk of data to the Dataflash */
@@ -145,7 +145,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
@@ -154,9 +154,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Check if the current command is being aborted by the host */
if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
+ return;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -201,15 +201,15 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
-
+
/* Wait until endpoint is ready before continuing */
if (Endpoint_WaitUntilReady())
return;
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -218,12 +218,12 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
{
/* Clear the endpoint bank to send its contents to the host */
Endpoint_ClearIN();
-
+
/* Wait until the endpoint is ready for more data */
if (Endpoint_WaitUntilReady())
return;
}
-
+
/* Check if end of Dataflash page reached */
if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
{
@@ -233,7 +233,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -241,7 +241,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
Endpoint_Write_Byte(Dataflash_ReceiveByte());
@@ -260,10 +260,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
@@ -271,11 +271,11 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
-
+
/* If the endpoint is full, send its contents to the host */
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearIN();
@@ -315,11 +315,11 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
/* Send the Dataflash buffer write command */
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -359,18 +359,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, 0);
}
-
+
/* Write one 16-byte chunk of data to the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
Dataflash_SendByte(*(BufferPtr++));
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
/* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
+ BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -416,7 +416,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -429,7 +429,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -437,19 +437,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
*(BufferPtr++) = Dataflash_ReceiveByte();
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
@@ -464,7 +464,7 @@ void DataflashManager_ResetDataflashProtections(void)
/* Select first Dataflash chip, send the read status register command */
Dataflash_SelectChip(DATAFLASH_CHIP1);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -476,12 +476,12 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
-
+
/* Select second Dataflash chip (if present on selected board), send read status register command */
#if (DATAFLASH_TOTALCHIPS == 2)
Dataflash_SelectChip(DATAFLASH_CHIP2);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -494,7 +494,7 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
#endif
-
+
/* Deselect current Dataflash chip */
Dataflash_DeselectChip();
}
@@ -528,6 +528,7 @@ bool DataflashManager_CheckDataflashOperation(void)
if (ReturnByte != DF_MANUFACTURER_ATMEL)
return false;
#endif
-
+
return true;
}
+
diff --git a/Projects/TempDataLogger/Lib/DataflashManager.h b/Projects/TempDataLogger/Lib/DataflashManager.h
index 70dd88d21..cd1c460cd 100644
--- a/Projects/TempDataLogger/Lib/DataflashManager.h
+++ b/Projects/TempDataLogger/Lib/DataflashManager.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,13 +32,13 @@
*
* Header file for DataflashManager.c.
*/
-
+
#ifndef _DATAFLASH_MANAGER_H_
#define _DATAFLASH_MANAGER_H_
/* Includes: */
#include <avr/io.h>
-
+
#include "TempDataLogger.h"
#include "Descriptors.h"
@@ -60,12 +60,12 @@
* storage media (Dataflash) using a different native block size. Do not change this value.
*/
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
-
+
/** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
* change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
*/
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
-
+
/* Function Prototypes: */
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const uint32_t BlockAddress,
@@ -81,5 +81,6 @@
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
void DataflashManager_ResetDataflashProtections(void);
bool DataflashManager_CheckDataflashOperation(void);
-
+
#endif
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/00readme.txt b/Projects/TempDataLogger/Lib/FATFs/00readme.txt
index a34c951c9..97951fc3d 100644
--- a/Projects/TempDataLogger/Lib/FATFs/00readme.txt
+++ b/Projects/TempDataLogger/Lib/FATFs/00readme.txt
@@ -115,3 +115,4 @@ REVISION HISTORY
Changed some types on the API, XCHAR->TCHAR.
Changed fname member in the FILINFO structure on Unicode cfg.
String functions support UTF-8 encoding files on Unicode cfg.
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/diskio.c b/Projects/TempDataLogger/Lib/FATFs/diskio.c
index 68c2aeb97..c18151284 100644
--- a/Projects/TempDataLogger/Lib/FATFs/diskio.c
+++ b/Projects/TempDataLogger/Lib/FATFs/diskio.c
@@ -97,3 +97,4 @@ DWORD get_fattime (void)
((DWORD)Minute << 5) |
(((DWORD)Second >> 1) << 0);
}
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/diskio.h b/Projects/TempDataLogger/Lib/FATFs/diskio.h
index 5feb82f83..3459da351 100644
--- a/Projects/TempDataLogger/Lib/FATFs/diskio.h
+++ b/Projects/TempDataLogger/Lib/FATFs/diskio.h
@@ -69,3 +69,4 @@ DRESULT disk_ioctl (BYTE, BYTE, void*);
#define _DISKIO
#endif
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/ff.c b/Projects/TempDataLogger/Lib/FATFs/ff.c
index 3da658e97..ab53ea598 100644
--- a/Projects/TempDataLogger/Lib/FATFs/ff.c
+++ b/Projects/TempDataLogger/Lib/FATFs/ff.c
@@ -2289,7 +2289,7 @@ FRESULT f_close (
#if _FS_REENTRANT
res = validate(fp->fs, fp->id);
if (res == FR_OK) {
- res = dec_lock(fp->fs, fp->lockid);
+ res = dec_lock(fp->fs, fp->lockid);
unlock_fs(fp->fs, FR_OK);
}
#else
@@ -3539,7 +3539,7 @@ int f_printf (
res++;
}
do {
- cc = f_putc(s[--i], fil);
+ cc = f_putc(s[--i], fil);
res++;
} while (i && cc != EOF);
if (cc != EOF) cc = 0;
@@ -3551,3 +3551,4 @@ int f_printf (
#endif /* !_FS_READONLY */
#endif /* _USE_STRFUNC */
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/ff.h b/Projects/TempDataLogger/Lib/FATFs/ff.h
index 19b6a15b6..c5a6a0b5e 100644
--- a/Projects/TempDataLogger/Lib/FATFs/ff.h
+++ b/Projects/TempDataLogger/Lib/FATFs/ff.h
@@ -611,3 +611,4 @@ void ff_rel_grant (_SYNC_t); /* Unlock sync object */
#endif
#endif /* _FATFS */
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/ffconf.h b/Projects/TempDataLogger/Lib/FATFs/ffconf.h
index a217b0bf8..48edc4aed 100644
--- a/Projects/TempDataLogger/Lib/FATFs/ffconf.h
+++ b/Projects/TempDataLogger/Lib/FATFs/ffconf.h
@@ -179,3 +179,4 @@
#endif /* _FFCONFIG */
+
diff --git a/Projects/TempDataLogger/Lib/FATFs/integer.h b/Projects/TempDataLogger/Lib/FATFs/integer.h
index 1bc381cc0..c27d79d35 100644
--- a/Projects/TempDataLogger/Lib/FATFs/integer.h
+++ b/Projects/TempDataLogger/Lib/FATFs/integer.h
@@ -37,3 +37,4 @@ typedef unsigned char BOOL;
#endif
#endif
+
diff --git a/Projects/TempDataLogger/Lib/SCSI.c b/Projects/TempDataLogger/Lib/SCSI.c
index a98731957..5e2eec5d7 100644
--- a/Projects/TempDataLogger/Lib/SCSI.c
+++ b/Projects/TempDataLogger/Lib/SCSI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,29 +34,29 @@
* devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
* which wrap around standard SCSI device commands for controlling the actual storage medium.
*/
-
+
#define INCLUDE_FROM_SCSI_C
#include "SCSI.h"
/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
* features and capabilities.
*/
-SCSI_Inquiry_Response_t InquiryData =
+SCSI_Inquiry_Response_t InquiryData =
{
.DeviceType = DEVICE_TYPE_BLOCK,
.PeripheralQualifier = 0,
-
+
.Removable = true,
-
+
.Version = 0,
-
+
.ResponseDataFormat = 2,
.NormACA = false,
.TrmTsk = false,
.AERC = false,
.AdditionalLength = 0x1F,
-
+
.SoftReset = false,
.CmdQue = false,
.Linked = false,
@@ -64,7 +64,7 @@ SCSI_Inquiry_Response_t InquiryData =
.WideBus16Bit = false,
.WideBus32Bit = false,
.RelAddr = false,
-
+
.VendorID = "LUFA",
.ProductID = "Dataflash Disk",
.RevisionID = {'0','.','0','0'},
@@ -96,13 +96,13 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
{
case SCSI_CMD_INQUIRY:
- CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
break;
case SCSI_CMD_READ_CAPACITY_10:
- CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
@@ -134,7 +134,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
SCSI_ASENSEQ_NO_QUALIFIER);
-
+
return true;
}
@@ -165,11 +165,11 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
-
+
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
-
+
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
@@ -178,7 +178,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-
+
return true;
}
@@ -193,7 +193,7 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
{
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
-
+
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
@@ -221,10 +221,10 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_ClearIN();
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
-
+
return true;
}
@@ -248,21 +248,21 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
return false;
}
-
+
/* Check to see if all attached Dataflash ICs are functional */
if (!(DataflashManager_CheckDataflashOperation()))
{
/* Update SENSE key with a hardware error condition and return command fail */
SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
return false;
}
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-
+
return true;
}
@@ -280,13 +280,13 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
{
uint32_t BlockAddress;
uint16_t TotalBlocks;
-
+
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
/* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
-
+
/* Check if the block address is outside the maximum allowable value for the LUN */
if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
{
@@ -297,7 +297,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
return false;
}
-
+
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ)
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
@@ -306,6 +306,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
+
return true;
}
+
diff --git a/Projects/TempDataLogger/Lib/SCSI.h b/Projects/TempDataLogger/Lib/SCSI.h
index f3aea7222..39c9aee46 100644
--- a/Projects/TempDataLogger/Lib/SCSI.h
+++ b/Projects/TempDataLogger/Lib/SCSI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for SCSI.c.
*/
-
+
#ifndef _SCSI_H_
#define _SCSI_H_
@@ -46,7 +46,7 @@
#include "../TempDataLogger.h"
#include "../Descriptors.h"
#include "DataflashManager.h"
-
+
/* Macros: */
/** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
* is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
@@ -68,13 +68,13 @@
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
#define DEVICE_TYPE_BLOCK 0x00
-
+
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
#define DEVICE_TYPE_CDROM 0x05
-
+
/* Function Prototypes: */
bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
-
+
#if defined(INCLUDE_FROM_SCSI_C)
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
@@ -83,5 +83,6 @@
static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const bool IsDataRead);
#endif
-
+
#endif
+
diff --git a/Projects/TempDataLogger/TempDataLogger.c b/Projects/TempDataLogger/TempDataLogger.c
index bf5fd3940..3d6a9e933 100644
--- a/Projects/TempDataLogger/TempDataLogger.c
+++ b/Projects/TempDataLogger/TempDataLogger.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -74,7 +74,7 @@ USB_ClassInfo_HID_Device_t Generic_HID_Interface =
.ReportINEndpointNumber = GENERIC_IN_EPNUM,
.ReportINEndpointSize = GENERIC_EPSIZE,
.ReportINEndpointDoubleBank = false,
-
+
.PrevReportINBuffer = PrevHIDReportBuffer,
.PrevReportINBufferSize = sizeof(PrevHIDReportBuffer),
},
@@ -104,12 +104,12 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
/* Check to see if the logging interval has expired */
if (CurrentLoggingTicks++ < LoggingInterval500MS_SRAM)
return;
-
+
/* Reset log tick counter to prepare for next logging interval */
CurrentLoggingTicks = 0;
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
/* Only log when not connected to a USB host */
if (USB_DeviceState == DEVICE_STATE_Unattached)
{
@@ -128,7 +128,7 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
f_write(&TempLogFile, LineBuffer, BytesWritten, &BytesWritten);
f_sync(&TempLogFile);
}
-
+
LEDs_SetAllLEDs(LEDMask);
}
@@ -141,7 +141,7 @@ int main(void)
/* Fetch logging interval from EEPROM */
LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM);
-
+
/* Check if the logging interval is invalid (0xFF) indicating that the EEPROM is blank */
if (LoggingInterval500MS_SRAM == 0xFF)
LoggingInterval500MS_SRAM = DEFAULT_LOG_INTERVAL;
@@ -155,7 +155,7 @@ int main(void)
/* Discard the first sample from the temperature sensor, as it is generally incorrect */
volatile uint8_t Dummy = Temperature_GetTemperature();
(void)Dummy;
-
+
for (;;)
{
MS_Device_USBTask(&Disk_MS_Interface);
@@ -206,7 +206,7 @@ void SetupHardware(void)
Dataflash_Init();
USB_Init();
TWI_Init();
-
+
/* 500ms logging interval timer configuration */
OCR1A = ((F_CPU / 1024) / 2);
TCCR1B = (1 << WGM12) | (1 << CS12) | (1 << CS10);
@@ -229,7 +229,7 @@ void EVENT_USB_Device_Connect(void)
void EVENT_USB_Device_Disconnect(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-
+
/* Mount and open the log file on the Dataflash FAT partition */
OpenLogFile();
}
@@ -259,18 +259,18 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
bool CommandSuccess;
-
+
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
+
return CommandSuccess;
}
/** HID class driver callback function for the creation of HID reports to the host.
*
* \param[in] HIDInterfaceInfo Pointer to the HID class interface configuration structure being referenced
- * \param[in,out] ReportID Report ID requested by the host if non-zero, otherwise callback should set to the
+ * \param[in,out] ReportID Report ID requested by the host if non-zero, otherwise callback should set to the
* generated report ID
* \param[in] ReportType Type of the report to create, either HID_REPORT_ITEM_In or HID_REPORT_ITEM_Feature
* \param[out] ReportData Pointer to a buffer where the created report should be stored
@@ -288,7 +288,7 @@ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDIn
DS1307_GetDate(&ReportParams->Day, &ReportParams->Month, &ReportParams->Year);
DS1307_GetTime(&ReportParams->Hour, &ReportParams->Minute, &ReportParams->Second);
-
+
ReportParams->LogInterval500MS = LoggingInterval500MS_SRAM;
*ReportSize = sizeof(Device_Report_t);
@@ -310,10 +310,10 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
const uint16_t ReportSize)
{
Device_Report_t* ReportParams = (Device_Report_t*)ReportData;
-
+
DS1307_SetDate(ReportParams->Day, ReportParams->Month, ReportParams->Year);
DS1307_SetTime(ReportParams->Hour, ReportParams->Minute, ReportParams->Second);
-
+
/* If the logging interval has changed from its current value, write it to EEPROM */
if (LoggingInterval500MS_SRAM != ReportParams->LogInterval500MS)
{
@@ -321,3 +321,4 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
eeprom_update_byte(&LoggingInterval500MS_EEPROM, LoggingInterval500MS_SRAM);
}
}
+
diff --git a/Projects/TempDataLogger/TempDataLogger.h b/Projects/TempDataLogger/TempDataLogger.h
index 45cb3bec1..ce79670a2 100644
--- a/Projects/TempDataLogger/TempDataLogger.h
+++ b/Projects/TempDataLogger/TempDataLogger.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
#include <avr/power.h>
#include <avr/interrupt.h>
#include <stdio.h>
-
+
#include "Descriptors.h"
#include "Lib/SCSI.h"
@@ -73,13 +73,13 @@
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY LEDS_LED2
-
+
/** Filename for the log data when written to the dataflash FAT filesystem. */
#define LOG_FILENAME "TEMPLOG.txt"
-
+
/** Default log interval when the EEPROM is blank, in 500ms ticks. */
#define DEFAULT_LOG_INTERVAL 20
-
+
/* Type Defines: */
typedef struct
{
@@ -90,7 +90,7 @@
uint8_t Hour;
uint8_t Minute;
uint8_t Second;
-
+
uint8_t LogInterval500MS;
} Device_Report_t;
@@ -111,9 +111,10 @@
void* ReportData,
uint16_t* const ReportSize);
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
- const uint8_t ReportID,
+ const uint8_t ReportID,
const uint8_t ReportType,
const void* ReportData,
const uint16_t ReportSize);
#endif
+
diff --git a/Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt b/Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt
index fc8a5de7e..bdf8db0ee 100644
--- a/Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt
+++ b/Projects/TempDataLogger/TempLogHostApp/COPYING.LESSER.txt
@@ -10,7 +10,7 @@
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
- 0. Additional Definitions.
+ 0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
@@ -111,7 +111,7 @@ the following:
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
- Version.
+ Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
@@ -163,3 +163,4 @@ whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
+
diff --git a/Projects/TempDataLogger/TempLogHostApp/COPYING.txt b/Projects/TempDataLogger/TempLogHostApp/COPYING.txt
index 94a9ed024..10926e87f 100644
--- a/Projects/TempDataLogger/TempLogHostApp/COPYING.txt
+++ b/Projects/TempDataLogger/TempLogHostApp/COPYING.txt
@@ -672,3 +672,4 @@ may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
diff --git a/Projects/TempDataLogger/TempLogHostApp/README.txt b/Projects/TempDataLogger/TempLogHostApp/README.txt
index 34f85533e..60387afe7 100644
--- a/Projects/TempDataLogger/TempLogHostApp/README.txt
+++ b/Projects/TempDataLogger/TempLogHostApp/README.txt
@@ -19,3 +19,4 @@ methods.
LogitechMX5000.cs is a simple example of how the library can be used. Other
examples on common devices are welcomed.
+
diff --git a/Projects/TempDataLogger/TemperatureDataLogger.txt b/Projects/TempDataLogger/TemperatureDataLogger.txt
index 1bf38dc7e..41fb2c320 100644
--- a/Projects/TempDataLogger/TemperatureDataLogger.txt
+++ b/Projects/TempDataLogger/TemperatureDataLogger.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage Temperature Datalogger Project
*
* \section SSec_Compat Demo Compatibility:
@@ -28,7 +28,7 @@
* <td>Mass Storage Device \n
* Human Interface Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclasses:</b></td>
* <td>Bulk-Only Transport \n
* Keyboard Subclass</td>
@@ -47,7 +47,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Temperature Data Logger project. This project is a very basic USB data logger for the current temperature as reported by
* the board's temperature sensor, writing the temperature to a file stored on the board's Dataflash in a FAT filesystem
@@ -83,3 +83,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/TempDataLogger/makefile b/Projects/TempDataLogger/makefile
index 9f4942251..ec0153f5f 100644
--- a/Projects/TempDataLogger/makefile
+++ b/Projects/TempDataLogger/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -146,7 +146,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -159,7 +159,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -273,7 +273,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -286,7 +286,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -298,7 +298,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -310,7 +310,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -333,7 +333,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -367,7 +367,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -401,7 +401,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -430,7 +430,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -449,10 +449,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -517,11 +517,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -548,9 +548,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -648,14 +648,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -677,7 +677,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -721,3 +721,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/USBtoSerial/Descriptors.c b/Projects/USBtoSerial/Descriptors.c
index d42235dd4..630a5aa0e 100644
--- a/Projects/USBtoSerial/Descriptors.c
+++ b/Projects/USBtoSerial/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -57,22 +57,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x02,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204B,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,102 +83,102 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED),
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_DataOutEndpoint =
+ .CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC_DataInEndpoint =
+
+ .CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -193,7 +193,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -204,7 +204,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -215,7 +215,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(23), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA USB-RS232 Adapter"
};
@@ -237,34 +237,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/USBtoSerial/Descriptors.h b/Projects/USBtoSerial/Descriptors.h
index 787796bc8..ddd9495ea 100644
--- a/Projects/USBtoSerial/Descriptors.h
+++ b/Projects/USBtoSerial/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -47,16 +47,16 @@
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
+ #define CDC_TX_EPNUM 3
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
+ #define CDC_RX_EPNUM 4
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
- #define CDC_TXRX_EPSIZE 16
+ #define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
@@ -83,3 +83,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/USBtoSerial/Lib/LightweightRingBuff.h b/Projects/USBtoSerial/Lib/LightweightRingBuff.h
index 768e49a50..2fbc164cb 100644
--- a/Projects/USBtoSerial/Lib/LightweightRingBuff.h
+++ b/Projects/USBtoSerial/Lib/LightweightRingBuff.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,20 +39,20 @@
* or deletions) must not overlap. If there is possibility of two or more of the same kind of
* operating occuring at the same point in time, atomic (mutex) locking should be used.
*/
-
+
#ifndef _ULW_RING_BUFF_H_
#define _ULW_RING_BUFF_H_
/* Includes: */
#include <util/atomic.h>
-
+
#include <stdint.h>
#include <stdbool.h>
/* Defines: */
/** Size of each ring buffer, in data elements - must be between 1 and 255. */
#define BUFFER_SIZE 255
-
+
/** Type of data to store into the buffer. */
#define RingBuff_Data_t uint8_t
@@ -76,7 +76,7 @@
RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */
RingBuff_Count_t Count;
} RingBuff_t;
-
+
/* Inline Functions: */
/** Initializes a ring buffer ready for use. Buffers must be initialized via this function
* before any operations are called upon them. Already initialized buffers may be reset
@@ -92,7 +92,7 @@
Buffer->Out = Buffer->Buffer;
}
}
-
+
/** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed
* by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that
* the buffer cannot be modified while the computation takes place. This value should be cached
@@ -109,15 +109,15 @@
static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer)
{
RingBuff_Count_t Count;
-
+
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Count = Buffer->Count;
}
-
+
return Count;
}
-
+
/** Atomically determines if the specified ring buffer contains any free space. This should
* be tested before storing data to the buffer, to ensure that no data is lost due to a
* buffer overrun.
@@ -125,7 +125,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE);
@@ -142,7 +142,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == 0);
@@ -161,7 +161,7 @@
const RingBuff_Data_t Data)
{
*Buffer->In = Data;
-
+
if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE])
Buffer->In = Buffer->Buffer;
@@ -184,7 +184,7 @@
static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer)
{
RingBuff_Data_t Data = *Buffer->Out;
-
+
if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE])
Buffer->Out = Buffer->Buffer;
@@ -192,8 +192,9 @@
{
Buffer->Count--;
}
-
+
return Data;
}
#endif
+
diff --git a/Projects/USBtoSerial/USBtoSerial.c b/Projects/USBtoSerial/USBtoSerial.c
index 845c2a51c..05b4f8aff 100644
--- a/Projects/USBtoSerial/USBtoSerial.c
+++ b/Projects/USBtoSerial/USBtoSerial.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,7 +48,7 @@ RingBuff_t USARTtoUSB_Buffer;
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
- .Config =
+ .Config =
{
.ControlInterfaceNumber = 0,
@@ -72,7 +72,7 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
int main(void)
{
SetupHardware();
-
+
RingBuffer_InitBuffer(&USBtoUSART_Buffer);
RingBuffer_InitBuffer(&USARTtoUSB_Buffer);
@@ -84,8 +84,8 @@ int main(void)
/* Read bytes from the USB OUT endpoint into the USART transmit buffer */
int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
if (!(ReceivedByte < 0) && !(RingBuffer_IsFull(&USBtoUSART_Buffer)))
- RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte);
-
+ RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte);
+
/* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */
RingBuff_Count_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer);
if ((TIFR0 & (1 << TOV0)) || (BufferCount > 200))
@@ -96,11 +96,11 @@ int main(void)
while (BufferCount--)
CDC_Device_SendByte(&VirtualSerial_CDC_Interface, RingBuffer_Remove(&USARTtoUSB_Buffer));
}
-
+
/* Load the next byte from the USART transmit buffer into the USART */
if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer)))
Serial_TxByte(RingBuffer_Remove(&USBtoUSART_Buffer));
-
+
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);
USB_USBTask();
}
@@ -174,10 +174,10 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
switch (CDCInterfaceInfo->State.LineEncoding.ParityType)
{
case CDC_PARITY_Odd:
- ConfigMask = ((1 << UPM11) | (1 << UPM10));
+ ConfigMask = ((1 << UPM11) | (1 << UPM10));
break;
case CDC_PARITY_Even:
- ConfigMask = (1 << UPM11);
+ ConfigMask = (1 << UPM11);
break;
}
@@ -204,9 +204,10 @@ void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCI
/* Set the new baud rate before configuring the USART */
UBRR1 = SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS);
-
+
/* Reconfigure the USART in double speed mode for a wider baud rate range at the expense of accuracy */
UCSR1C = ConfigMask;
UCSR1A = (1 << U2X1);
UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1));
}
+
diff --git a/Projects/USBtoSerial/USBtoSerial.h b/Projects/USBtoSerial/USBtoSerial.h
index b3c3e9846..9233ba203 100644
--- a/Projects/USBtoSerial/USBtoSerial.h
+++ b/Projects/USBtoSerial/USBtoSerial.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -64,7 +64,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/* Function Prototypes: */
void SetupHardware(void);
@@ -72,7 +72,8 @@
void EVENT_USB_Device_Disconnect(void);
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
-
+
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
#endif
+
diff --git a/Projects/USBtoSerial/USBtoSerial.txt b/Projects/USBtoSerial/USBtoSerial.txt
index 7f5644296..30a2833a5 100644
--- a/Projects/USBtoSerial/USBtoSerial.txt
+++ b/Projects/USBtoSerial/USBtoSerial.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage USB to Serial Converter Project
*
* \section SSec_Compat Project Compatibility:
@@ -28,7 +28,7 @@
* <td><b>USB Class:</b></td>
* <td>Communications Device Class (CDC)</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Abstract Control Model (ACM)</td>
* </tr>
@@ -42,7 +42,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* USB to Serial bridge project. This project allows a USB AVR to serve
* as a USB to USART bridge between a USB host and a device lacking a
@@ -54,7 +54,7 @@
* limitations, some options may not be supported (baud rates with unacceptable
* error rates at the AVR's clock speed, data lengths other than 6, 7 or 8 bits,
* 1.5 stop bits, parity other than none, even or odd).
- *
+ *
* After running this project for the first time on a new computer,
* you will need to supply the .INF file located in this project
* project's directory as the device's driver when running under
@@ -80,3 +80,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/USBtoSerial/makefile b/Projects/USBtoSerial/makefile
index a30b0fc1e..7fb678d05 100644
--- a/Projects/USBtoSerial/makefile
+++ b/Projects/USBtoSerial/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -133,10 +133,10 @@ SRC = $(TARGET).c \
Descriptors.c \
$(LUFA_SRC_USB) \
$(LUFA_SRC_USBCLASS)
-
+
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -149,7 +149,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -263,7 +263,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -276,7 +276,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -288,7 +288,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -300,7 +300,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -323,7 +323,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -357,7 +357,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -391,7 +391,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -420,7 +420,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -439,10 +439,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -507,11 +507,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -538,9 +538,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -638,14 +638,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -667,7 +667,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -711,3 +711,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/Webserver/Descriptors.c b/Projects/Webserver/Descriptors.c
index 7578a598b..e92596139 100644
--- a/Projects/Webserver/Descriptors.c
+++ b/Projects/Webserver/Descriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "Descriptors.h"
@@ -57,22 +57,22 @@
USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x00,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2045,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,38 +83,38 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
*/
USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .MS_Interface =
+
+ .MS_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x08,
.SubClass = 0x06,
.Protocol = 0x50,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .MS_DataInEndpoint =
+ .MS_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -124,7 +124,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
.PollingIntervalMS = 0x00
},
- .MS_DataOutEndpoint =
+ .MS_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
@@ -142,7 +142,7 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -153,7 +153,7 @@ USB_Descriptor_String_t PROGMEM LanguageString =
USB_Descriptor_String_t PROGMEM ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -164,7 +164,7 @@ USB_Descriptor_String_t PROGMEM ManufacturerString =
USB_Descriptor_String_t PROGMEM ProductString =
{
.Header = {.Size = USB_STRING_LEN(14), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA Webserver"
};
@@ -186,34 +186,35 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &ConfigurationDescriptor;
Size = sizeof(USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &LanguageString;
Size = pgm_read_byte(&LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &ManufacturerString;
Size = pgm_read_byte(&ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &ProductString;
Size = pgm_read_byte(&ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/Webserver/Descriptors.h b/Projects/Webserver/Descriptors.h
index 1b40df159..c816e2383 100644
--- a/Projects/Webserver/Descriptors.h
+++ b/Projects/Webserver/Descriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for Descriptors.c.
*/
-
+
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
@@ -44,15 +44,15 @@
/* Macros: */
/** Endpoint number of the Mass Storage device-to-host data IN endpoint. */
- #define MASS_STORAGE_IN_EPNUM 3
+ #define MASS_STORAGE_IN_EPNUM 3
/** Endpoint number of the Mass Storage host-to-device data OUT endpoint. */
- #define MASS_STORAGE_OUT_EPNUM 4
+ #define MASS_STORAGE_OUT_EPNUM 4
/** Size in bytes of the Mass Storage data endpoints. */
#define MASS_STORAGE_IO_EPSIZE 64
-
- /* Type Defines: */
+
+ /* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
@@ -64,7 +64,7 @@
USB_Descriptor_Endpoint_t MS_DataInEndpoint;
USB_Descriptor_Endpoint_t MS_DataOutEndpoint;
} USB_Descriptor_Configuration_t;
-
+
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint8_t wIndex,
@@ -72,3 +72,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/Webserver/Lib/DHCPClientApp.c b/Projects/Webserver/Lib/DHCPClientApp.c
index 2260b5089..da11fa6b8 100644
--- a/Projects/Webserver/Lib/DHCPClientApp.c
+++ b/Projects/Webserver/Lib/DHCPClientApp.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -44,13 +44,13 @@ void DHCPClientApp_Init(void)
{
/* Create a new UDP connection to the DHCP server port for the DHCP solicitation */
struct uip_udp_conn* Connection = uip_udp_new(&uip_broadcast_addr, HTONS(DHCPC_SERVER_PORT));
-
+
/* If the connection was successfully created, bind it to the local DHCP client port */
if (Connection != NULL)
{
uip_udp_appstate_t* const AppState = &Connection->appstate;
uip_udp_bind(Connection, HTONS(DHCPC_CLIENT_PORT));
-
+
/* Set the initial client state */
AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
@@ -58,8 +58,8 @@ void DHCPClientApp_Init(void)
timer_set(&AppState->DHCPClient.Timeout, CLOCK_SECOND / 2);
}
}
-
-/** uIP stack application callback for the DHCP client. This function must be called each time the TCP/IP stack
+
+/** uIP stack application callback for the DHCP client. This function must be called each time the TCP/IP stack
* needs a UDP packet to be processed.
*/
void DHCPClientApp_Callback(void)
@@ -67,7 +67,7 @@ void DHCPClientApp_Callback(void)
uip_udp_appstate_t* const AppState = &uip_udp_conn->appstate;
DHCP_Header_t* const AppData = (DHCP_Header_t*)uip_appdata;
uint16_t AppDataSize = 0;
-
+
switch (AppState->DHCPClient.CurrentState)
{
case DHCP_STATE_SendDiscover:
@@ -77,19 +77,19 @@ void DHCPClientApp_Callback(void)
/* Fill out the DHCP response header */
AppDataSize += DHCPClientApp_FillDHCPHeader(AppData, DHCP_DISCOVER, AppState);
-
+
/* Add the required DHCP options list to the packet */
uint8_t RequiredOptionList[] = {DHCP_OPTION_SUBNET_MASK, DHCP_OPTION_ROUTER, DHCP_OPTION_DNS_SERVER};
AppDataSize += DHCPClientApp_SetOption(AppData->Options, DHCP_OPTION_REQ_LIST, sizeof(RequiredOptionList),
- RequiredOptionList);
-
+ RequiredOptionList);
+
/* Send the DHCP DISCOVER packet */
uip_udp_send(AppDataSize);
/* Reset the timeout timer, progress to next state */
timer_reset(&AppState->DHCPClient.Timeout);
- AppState->DHCPClient.CurrentState = DHCP_STATE_WaitForOffer;
-
+ AppState->DHCPClient.CurrentState = DHCP_STATE_WaitForOffer;
+
break;
case DHCP_STATE_WaitForOffer:
if (!(uip_newdata()))
@@ -97,10 +97,10 @@ void DHCPClientApp_Callback(void)
/* Check if the DHCP timeout period has expired while waiting for a response */
if (timer_expired(&AppState->DHCPClient.Timeout))
AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
-
+
break;
}
-
+
uint8_t OfferResponse_MessageType;
if ((AppData->TransactionID == DHCP_TRANSACTION_ID) &&
DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_MSG_TYPE, &OfferResponse_MessageType) &&
@@ -111,7 +111,7 @@ void DHCPClientApp_Callback(void)
DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_SUBNET_MASK, &AppState->DHCPClient.DHCPOffer_Data.Netmask);
DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_ROUTER, &AppState->DHCPClient.DHCPOffer_Data.GatewayIP);
DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_SERVER_ID, &AppState->DHCPClient.DHCPOffer_Data.ServerIP);
-
+
timer_reset(&AppState->DHCPClient.Timeout);
AppState->DHCPClient.CurrentState = DHCP_STATE_SendRequest;
}
@@ -131,7 +131,7 @@ void DHCPClientApp_Callback(void)
/* Send the DHCP REQUEST packet */
uip_udp_send(AppDataSize);
-
+
/* Reset the timeout timer, progress to next state */
timer_reset(&AppState->DHCPClient.Timeout);
AppState->DHCPClient.CurrentState = DHCP_STATE_WaitForACK;
@@ -143,10 +143,10 @@ void DHCPClientApp_Callback(void)
/* Check if the DHCP timeout period has expired while waiting for a response */
if (timer_expired(&AppState->DHCPClient.Timeout))
AppState->DHCPClient.CurrentState = DHCP_STATE_SendDiscover;
-
+
break;
}
-
+
uint8_t RequestResponse_MessageType;
if ((AppData->TransactionID == DHCP_TRANSACTION_ID) &&
DHCPClientApp_GetOption(AppData->Options, DHCP_OPTION_MSG_TYPE, &RequestResponse_MessageType) &&
@@ -156,13 +156,13 @@ void DHCPClientApp_Callback(void)
uip_sethostaddr((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.AllocatedIP);
uip_setnetmask((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.Netmask);
uip_setdraddr((uip_ipaddr_t*)&AppState->DHCPClient.DHCPOffer_Data.GatewayIP);
-
+
/* Indicate to the user that we now have a valid IP configuration */
HaveIPConfiguration = true;
- AppState->DHCPClient.CurrentState = DHCP_STATE_AddressLeased;
+ AppState->DHCPClient.CurrentState = DHCP_STATE_AddressLeased;
}
-
+
break;
}
}
@@ -196,13 +196,13 @@ static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader,
memcpy(&DHCPHeader->NextServerIP, &AppState->DHCPClient.DHCPOffer_Data.ServerIP, sizeof(uip_ipaddr_t));
memcpy(&DHCPHeader->ClientHardwareAddress, &MACAddress, sizeof(struct uip_eth_addr));
DHCPHeader->Cookie = DHCP_MAGIC_COOKIE;
-
+
/* Add a DHCP message type and terminator options to the start of the DHCP options field */
DHCPHeader->Options[0] = DHCP_OPTION_MSG_TYPE;
DHCPHeader->Options[1] = 1;
DHCPHeader->Options[2] = DHCPMessageType;
DHCPHeader->Options[3] = DHCP_OPTION_END;
-
+
/* Calculate the total number of bytes added to the outgoing packet */
return (sizeof(DHCP_Header_t) + 4);
}
@@ -231,7 +231,7 @@ static uint8_t DHCPClientApp_SetOption(uint8_t* DHCPOptionList,
DHCPOptionList[1] = DataLen;
memcpy(&DHCPOptionList[2], OptionData, DataLen);
DHCPOptionList[2 + DataLen] = DHCP_OPTION_END;
-
+
/* Calculate the total number of bytes added to the outgoing packet */
return (2 + DataLen);
}
@@ -256,16 +256,17 @@ static bool DHCPClientApp_GetOption(const uint8_t* DHCPOptionList,
{
/* Copy request option's data to the destination buffer */
memcpy(Destination, &DHCPOptionList[2], DHCPOptionList[1]);
-
+
/* Indicate that the requested option data was successfully retrieved */
return true;
}
-
+
/* Skip to next DHCP option in the options list */
DHCPOptionList += (DHCPOptionList[1] + 2);
}
-
+
/* Requested option not found in the incoming packet's DHCP options list */
return false;
}
#endif
+
diff --git a/Projects/Webserver/Lib/DHCPClientApp.h b/Projects/Webserver/Lib/DHCPClientApp.h
index 710f4b61a..e305f932a 100644
--- a/Projects/Webserver/Lib/DHCPClientApp.h
+++ b/Projects/Webserver/Lib/DHCPClientApp.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -38,11 +38,11 @@
/* Includes: */
#include <stdio.h>
-
+
#include <uip.h>
-
+
#include "../Webserver.h"
-
+
/* Macros: */
/** UDP listen port for a BOOTP server. */
#define DHCPC_SERVER_PORT 67
@@ -58,10 +58,10 @@
/** BOOTP flag for a BOOTP broadcast message. */
#define BOOTP_BROADCAST 0x8000
-
+
/** Magic DHCP cookie for a BOOTP message to identify it as a DHCP message. */
#define DHCP_MAGIC_COOKIE 0x63538263
-
+
/** Unique transaction ID used to identify DHCP responses to the client. */
#define DHCP_TRANSACTION_ID 0x13245466
@@ -106,8 +106,8 @@
/** DHCP message option for the DHCP message type. */
#define DHCP_OPTION_MSG_TYPE 53
-
- /** DHCP message option for the DHCP server IP. */
+
+ /** DHCP message option for the DHCP server IP. */
#define DHCP_OPTION_SERVER_ID 54
/** DHCP message option for the list of required options from the server. */
@@ -129,18 +129,18 @@
uint16_t ElapsedSeconds; /**< Elapsed seconds since the request was made */
uint16_t Flags; /**< BOOTP packet flags */
-
+
uip_ipaddr_t ClientIP; /**< Client IP address, if already leased an IP */
uip_ipaddr_t YourIP; /**< Client IP address */
uip_ipaddr_t NextServerIP; /**< Legacy BOOTP protocol field, unused for DHCP */
uip_ipaddr_t RelayAgentIP; /**< Legacy BOOTP protocol field, unused for DHCP */
-
+
uint8_t ClientHardwareAddress[16]; /**< Hardware (MAC) address of the client making a request to the DHCP server */
uint8_t ServerHostnameString[64]; /**< Legacy BOOTP protocol field, unused for DHCP */
uint8_t BootFileName[128]; /**< Legacy BOOTP protocol field, unused for DHCP */
-
+
uint32_t Cookie; /**< Magic BOOTP protocol cookie to indicate a valid packet */
-
+
uint8_t Options[]; /**< DHCP message options */
} DHCP_Header_t;
@@ -158,7 +158,7 @@
/* Function Prototypes: */
void DHCPClientApp_Init(void);
void DHCPClientApp_Callback(void);
-
+
#if defined(INCLUDE_FROM_DHCPCLIENTAPP_C)
static uint16_t DHCPClientApp_FillDHCPHeader(DHCP_Header_t* const DHCPHeader,
const uint8_t DHCPMessageType,
@@ -172,3 +172,4 @@
void* const Destination);
#endif
#endif
+
diff --git a/Projects/Webserver/Lib/DataflashManager.c b/Projects/Webserver/Lib/DataflashManager.c
index 3cabda776..b7bc2f41c 100644
--- a/Projects/Webserver/Lib/DataflashManager.c
+++ b/Projects/Webserver/Lib/DataflashManager.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -77,7 +77,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -86,7 +86,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
{
/* Clear the current endpoint bank */
Endpoint_ClearOUT();
-
+
/* Wait until the host has sent another packet */
if (Endpoint_WaitUntilReady())
return;
@@ -125,7 +125,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Send the Dataflash buffer write command */
Dataflash_SendByte(UsingSecondBuffer ? DF_CMD_BUFF2WRITE : DF_CMD_BUFF1WRITE);
- Dataflash_SendAddressBytes(0, 0);
+ Dataflash_SendAddressBytes(0, 0);
}
/* Write one 16-byte chunk of data to the Dataflash */
@@ -145,7 +145,7 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
Dataflash_SendByte(Endpoint_Read_Byte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
@@ -154,9 +154,9 @@ void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceIn
/* Check if the current command is being aborted by the host */
if (MSInterfaceInfo->State.IsMassStoreReset)
- return;
+ return;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -201,15 +201,15 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
-
+
/* Wait until endpoint is ready before continuing */
if (Endpoint_WaitUntilReady())
return;
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -218,12 +218,12 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
{
/* Clear the endpoint bank to send its contents to the host */
Endpoint_ClearIN();
-
+
/* Wait until the endpoint is ready for more data */
if (Endpoint_WaitUntilReady())
return;
}
-
+
/* Check if end of Dataflash page reached */
if (CurrDFPageByteDiv16 == (DATAFLASH_PAGE_SIZE >> 4))
{
@@ -233,7 +233,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -241,7 +241,7 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
Endpoint_Write_Byte(Dataflash_ReceiveByte());
@@ -260,10 +260,10 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
Endpoint_Write_Byte(Dataflash_ReceiveByte());
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
@@ -271,11 +271,11 @@ void DataflashManager_ReadBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
if (MSInterfaceInfo->State.IsMassStoreReset)
return;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
-
+
/* If the endpoint is full, send its contents to the host */
if (!(Endpoint_IsReadWriteAllowed()))
Endpoint_ClearIN();
@@ -315,11 +315,11 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
/* Send the Dataflash buffer write command */
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, CurrDFPageByte);
-
+
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -359,18 +359,18 @@ void DataflashManager_WriteBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(DF_CMD_BUFF1WRITE);
Dataflash_SendAddressBytes(0, 0);
}
-
+
/* Write one 16-byte chunk of data to the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
Dataflash_SendByte(*(BufferPtr++));
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
/* Increment the block 16 byte block counter */
- BytesInBlockDiv16++;
+ BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter and reset the sub block counter */
TotalBlocks--;
}
@@ -416,7 +416,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
while (TotalBlocks)
{
uint8_t BytesInBlockDiv16 = 0;
-
+
/* Write an endpoint packet sized data block to the Dataflash */
while (BytesInBlockDiv16 < (VIRTUAL_MEMORY_BLOCK_SIZE >> 4))
{
@@ -429,7 +429,7 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
/* Select the next Dataflash chip based on the new Dataflash page index */
Dataflash_SelectChipFromPage(CurrDFPage);
-
+
/* Send the Dataflash main memory page read command */
Dataflash_SendByte(DF_CMD_MAINMEMPAGEREAD);
Dataflash_SendAddressBytes(CurrDFPage, 0);
@@ -437,19 +437,19 @@ void DataflashManager_ReadBlocks_RAM(const uint32_t BlockAddress,
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
Dataflash_SendByte(0x00);
- }
+ }
/* Read one 16-byte chunk of data from the Dataflash */
for (uint8_t ByteNum = 0; ByteNum < 16; ByteNum++)
*(BufferPtr++) = Dataflash_ReceiveByte();
-
+
/* Increment the Dataflash page 16 byte block counter */
CurrDFPageByteDiv16++;
-
+
/* Increment the block 16 byte block counter */
BytesInBlockDiv16++;
}
-
+
/* Decrement the blocks remaining counter */
TotalBlocks--;
}
@@ -464,7 +464,7 @@ void DataflashManager_ResetDataflashProtections(void)
/* Select first Dataflash chip, send the read status register command */
Dataflash_SelectChip(DATAFLASH_CHIP1);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -476,12 +476,12 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[2]);
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
-
+
/* Select second Dataflash chip (if present on selected board), send read status register command */
#if (DATAFLASH_TOTALCHIPS == 2)
Dataflash_SelectChip(DATAFLASH_CHIP2);
Dataflash_SendByte(DF_CMD_GETSTATUS);
-
+
/* Check if sector protection is enabled */
if (Dataflash_ReceiveByte() & DF_STATUS_SECTORPROTECTION_ON)
{
@@ -494,7 +494,7 @@ void DataflashManager_ResetDataflashProtections(void)
Dataflash_SendByte(DF_CMD_SECTORPROTECTIONOFF[3]);
}
#endif
-
+
/* Deselect current Dataflash chip */
Dataflash_DeselectChip();
}
@@ -528,6 +528,7 @@ bool DataflashManager_CheckDataflashOperation(void)
if (ReturnByte != DF_MANUFACTURER_ATMEL)
return false;
#endif
-
+
return true;
}
+
diff --git a/Projects/Webserver/Lib/DataflashManager.h b/Projects/Webserver/Lib/DataflashManager.h
index 20f21c65d..3351922ab 100644
--- a/Projects/Webserver/Lib/DataflashManager.h
+++ b/Projects/Webserver/Lib/DataflashManager.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,13 +32,13 @@
*
* Header file for DataflashManager.c.
*/
-
+
#ifndef _DATAFLASH_MANAGER_H_
#define _DATAFLASH_MANAGER_H_
/* Includes: */
#include <avr/io.h>
-
+
#include "Descriptors.h"
#include <LUFA/Common/Common.h>
@@ -59,12 +59,12 @@
* storage media (Dataflash) using a different native block size. Do not change this value.
*/
#define VIRTUAL_MEMORY_BLOCK_SIZE 512
-
+
/** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not
* change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.
*/
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)
-
+
/* Function Prototypes: */
void DataflashManager_WriteBlocks(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const uint32_t BlockAddress,
@@ -80,5 +80,6 @@
uint8_t* BufferPtr) ATTR_NON_NULL_PTR_ARG(3);
void DataflashManager_ResetDataflashProtections(void);
bool DataflashManager_CheckDataflashOperation(void);
-
+
#endif
+
diff --git a/Projects/Webserver/Lib/FATFs/00readme.txt b/Projects/Webserver/Lib/FATFs/00readme.txt
index a34c951c9..97951fc3d 100644
--- a/Projects/Webserver/Lib/FATFs/00readme.txt
+++ b/Projects/Webserver/Lib/FATFs/00readme.txt
@@ -115,3 +115,4 @@ REVISION HISTORY
Changed some types on the API, XCHAR->TCHAR.
Changed fname member in the FILINFO structure on Unicode cfg.
String functions support UTF-8 encoding files on Unicode cfg.
+
diff --git a/Projects/Webserver/Lib/FATFs/diskio.c b/Projects/Webserver/Lib/FATFs/diskio.c
index 59ec70765..64daad9cd 100644
--- a/Projects/Webserver/Lib/FATFs/diskio.c
+++ b/Projects/Webserver/Lib/FATFs/diskio.c
@@ -62,3 +62,4 @@ DRESULT disk_write (
return RES_OK;
}
#endif /* _READONLY */
+
diff --git a/Projects/Webserver/Lib/FATFs/diskio.h b/Projects/Webserver/Lib/FATFs/diskio.h
index 81044d12e..fc18b9a50 100644
--- a/Projects/Webserver/Lib/FATFs/diskio.h
+++ b/Projects/Webserver/Lib/FATFs/diskio.h
@@ -70,3 +70,4 @@ DRESULT disk_ioctl (BYTE, BYTE, void*);
#define _DISKIO
#endif
+
diff --git a/Projects/Webserver/Lib/FATFs/ff.c b/Projects/Webserver/Lib/FATFs/ff.c
index 31340df89..cb2b42508 100644
--- a/Projects/Webserver/Lib/FATFs/ff.c
+++ b/Projects/Webserver/Lib/FATFs/ff.c
@@ -2289,7 +2289,7 @@ FRESULT f_close (
#if _FS_REENTRANT
res = validate(fp->fs, fp->id);
if (res == FR_OK) {
- res = dec_lock(fp->fs, fp->lockid);
+ res = dec_lock(fp->fs, fp->lockid);
unlock_fs(fp->fs, FR_OK);
}
#else
@@ -3539,7 +3539,7 @@ int f_printf (
res++;
}
do {
- cc = f_putc(s[--i], fil);
+ cc = f_putc(s[--i], fil);
res++;
} while (i && cc != EOF);
if (cc != EOF) cc = 0;
@@ -3551,3 +3551,4 @@ int f_printf (
#endif /* !_FS_READONLY */
#endif /* _USE_STRFUNC */
+
diff --git a/Projects/Webserver/Lib/FATFs/ff.h b/Projects/Webserver/Lib/FATFs/ff.h
index 19b6a15b6..c5a6a0b5e 100644
--- a/Projects/Webserver/Lib/FATFs/ff.h
+++ b/Projects/Webserver/Lib/FATFs/ff.h
@@ -611,3 +611,4 @@ void ff_rel_grant (_SYNC_t); /* Unlock sync object */
#endif
#endif /* _FATFS */
+
diff --git a/Projects/Webserver/Lib/FATFs/ffconf.h b/Projects/Webserver/Lib/FATFs/ffconf.h
index c28694af1..491a97b1e 100644
--- a/Projects/Webserver/Lib/FATFs/ffconf.h
+++ b/Projects/Webserver/Lib/FATFs/ffconf.h
@@ -179,3 +179,4 @@
#endif /* _FFCONFIG */
+
diff --git a/Projects/Webserver/Lib/FATFs/integer.h b/Projects/Webserver/Lib/FATFs/integer.h
index 1bc381cc0..c27d79d35 100644
--- a/Projects/Webserver/Lib/FATFs/integer.h
+++ b/Projects/Webserver/Lib/FATFs/integer.h
@@ -37,3 +37,4 @@ typedef unsigned char BOOL;
#endif
#endif
+
diff --git a/Projects/Webserver/Lib/HTTPServerApp.c b/Projects/Webserver/Lib/HTTPServerApp.c
index 6378ebe44..3ab3003d0 100644
--- a/Projects/Webserver/Lib/HTTPServerApp.c
+++ b/Projects/Webserver/Lib/HTTPServerApp.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Simple HTTP Webserver Application. When connected to the uIP stack,
* this will serve out files to HTTP clients on port 80.
*/
-
+
#define INCLUDE_FROM_HTTPSERVERAPP_C
#include "HTTPServerApp.h"
@@ -86,7 +86,7 @@ void HTTPServerApp_Init(void)
{
/* Listen on port 80 for HTTP connections from hosts */
uip_listen(HTONS(HTTP_SERVER_PORT));
-
+
/* Mount the Dataflash disk via FatFS */
f_mount(0, &DiskFATState);
}
@@ -127,7 +127,7 @@ void HTTPServerApp_Callback(void)
if (uip_rexmit())
{
/* Return file pointer to the last ACKed position */
- f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);
+ f_lseek(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.ACKedFilePos);
}
if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())
@@ -147,15 +147,15 @@ void HTTPServerApp_Callback(void)
/* Connection is being terminated for some reason - close file handle */
f_close(&AppState->HTTPServer.FileHandle);
AppState->HTTPServer.FileOpen = false;
-
+
/* If connection is not already closed, close it */
uip_close();
-
+
AppState->HTTPServer.CurrentState = WEBSERVER_STATE_Closed;
AppState->HTTPServer.NextState = WEBSERVER_STATE_Closed;
break;
- }
- }
+ }
+ }
}
/** HTTP Server State handler for the Request Process state. This state manages the processing of incoming HTTP
@@ -165,27 +165,27 @@ static void HTTPServerApp_OpenRequestedFile(void)
{
uip_tcp_appstate_t* const AppState = &uip_conn->appstate;
char* const AppData = (char*)uip_appdata;
-
+
/* No HTTP header received from the client, abort processing */
if (!(uip_newdata()))
return;
-
+
char* RequestToken = strtok(AppData, " ");
char* RequestedFileName = strtok(NULL, " ");
-
+
/* Must be a GET request, abort otherwise */
if (strcmp_P(RequestToken, PSTR("GET")) != 0)
{
uip_abort();
return;
}
-
+
/* Copy over the requested filename */
strncpy(AppState->HTTPServer.FileName, &RequestedFileName[1], (sizeof(AppState->HTTPServer.FileName) - 1));
-
+
/* Ensure filename is null-terminated */
AppState->HTTPServer.FileName[sizeof(AppState->HTTPServer.FileName) - 1] = 0x00;
-
+
/* Determine the length of the URI so that it can be checked to see if it is a directory */
uint8_t FileNameLen = strlen(AppState->HTTPServer.FileName);
@@ -198,7 +198,7 @@ static void HTTPServerApp_OpenRequestedFile(void)
/* Ensure altered filename is still null-terminated */
AppState->HTTPServer.FileName[sizeof(AppState->HTTPServer.FileName) - 1] = 0x00;
}
-
+
/* Try to open the file from the Dataflash disk */
AppState->HTTPServer.FileOpen = (f_open(&AppState->HTTPServer.FileHandle, AppState->HTTPServer.FileName,
(FA_OPEN_EXISTING | FA_READ)) == FR_OK);
@@ -224,13 +224,13 @@ static void HTTPServerApp_SendResponseHeader(void)
{
/* Copy over the HTTP 404 response header and send it to the receiving client */
strcpy_P(AppData, HTTP404Header);
- strcpy(&AppData[strlen(AppData)], AppState->HTTPServer.FileName);
+ strcpy(&AppData[strlen(AppData)], AppState->HTTPServer.FileName);
uip_send(AppData, strlen(AppData));
-
+
AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
return;
}
-
+
/* Copy over the HTTP 200 response header and send it to the receiving client */
strcpy_P(AppData, HTTP200Header);
@@ -242,11 +242,11 @@ static void HTTPServerApp_SendResponseHeader(void)
{
if (strcmp(&Extension[1], MIMETypes[i].Extension) == 0)
{
- strcpy(&AppData[strlen(AppData)], MIMETypes[i].MIMEType);
+ strcpy(&AppData[strlen(AppData)], MIMETypes[i].MIMEType);
FoundMIMEType = true;
break;
}
- }
+ }
}
/* Check if a MIME type was found and copied to the output buffer */
@@ -255,13 +255,13 @@ static void HTTPServerApp_SendResponseHeader(void)
/* MIME type not found - copy over the default MIME type */
strcpy_P(&AppData[strlen(AppData)], DefaultMIMEType);
}
-
+
/* Add the end-of-line terminator and end-of-headers terminator after the MIME type */
strcpy_P(&AppData[strlen(AppData)], PSTR("\r\n\r\n"));
-
+
/* Send the MIME header to the receiving client */
uip_send(AppData, strlen(AppData));
-
+
/* When the MIME header is ACKed, progress to the data send stage */
AppState->HTTPServer.NextState = WEBSERVER_STATE_SendData;
}
@@ -279,11 +279,12 @@ static void HTTPServerApp_SendData(void)
/* Read the next chunk of data from the open file */
f_read(&AppState->HTTPServer.FileHandle, AppData, MaxChunkSize, &AppState->HTTPServer.SentChunkSize);
-
+
/* Send the next file chunk to the receiving client */
uip_send(AppData, AppState->HTTPServer.SentChunkSize);
-
+
/* Check if we are at the last chunk of the file, if so next ACK should close the connection */
if (MaxChunkSize != AppState->HTTPServer.SentChunkSize)
AppState->HTTPServer.NextState = WEBSERVER_STATE_Closing;
}
+
diff --git a/Projects/Webserver/Lib/HTTPServerApp.h b/Projects/Webserver/Lib/HTTPServerApp.h
index b30922a76..8991b9445 100644
--- a/Projects/Webserver/Lib/HTTPServerApp.h
+++ b/Projects/Webserver/Lib/HTTPServerApp.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,12 +39,12 @@
/* Includes: */
#include <avr/pgmspace.h>
#include <string.h>
-
+
#include <LUFA/Version.h>
#include <uip.h>
#include <ff.h>
-
+
/* Enums: */
/** States for each HTTP connection to the webserver. */
enum Webserver_States_t
@@ -55,7 +55,7 @@
WEBSERVER_STATE_Closing, /**< Ready to close the connection to the client */
WEBSERVER_STATE_Closed, /**< Connection closed after all data sent */
};
-
+
/* Type Defines: */
/** Type define for a MIME type handler. */
typedef struct
@@ -63,7 +63,7 @@
char* Extension; /**< File extension (no leading '.' character) */
char* MIMEType; /**< Appropriate MIME type to send when the extension is encountered */
} MIME_Type_t;
-
+
/* Macros: */
/** TCP listen port for incoming HTTP traffic. */
#define HTTP_SERVER_PORT 80
@@ -71,11 +71,12 @@
/* Function Prototypes: */
void HTTPServerApp_Init(void);
void HTTPServerApp_Callback(void);
-
+
#if defined(INCLUDE_FROM_HTTPSERVERAPP_C)
static void HTTPServerApp_OpenRequestedFile(void);
static void HTTPServerApp_SendResponseHeader(void);
static void HTTPServerApp_SendData(void);
#endif
-
+
#endif
+
diff --git a/Projects/Webserver/Lib/SCSI.c b/Projects/Webserver/Lib/SCSI.c
index a98731957..5e2eec5d7 100644
--- a/Projects/Webserver/Lib/SCSI.c
+++ b/Projects/Webserver/Lib/SCSI.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -34,29 +34,29 @@
* devices use a thin "Bulk-Only Transport" protocol for issuing commands and status information,
* which wrap around standard SCSI device commands for controlling the actual storage medium.
*/
-
+
#define INCLUDE_FROM_SCSI_C
#include "SCSI.h"
/** Structure to hold the SCSI response data to a SCSI INQUIRY command. This gives information about the device's
* features and capabilities.
*/
-SCSI_Inquiry_Response_t InquiryData =
+SCSI_Inquiry_Response_t InquiryData =
{
.DeviceType = DEVICE_TYPE_BLOCK,
.PeripheralQualifier = 0,
-
+
.Removable = true,
-
+
.Version = 0,
-
+
.ResponseDataFormat = 2,
.NormACA = false,
.TrmTsk = false,
.AERC = false,
.AdditionalLength = 0x1F,
-
+
.SoftReset = false,
.CmdQue = false,
.Linked = false,
@@ -64,7 +64,7 @@ SCSI_Inquiry_Response_t InquiryData =
.WideBus16Bit = false,
.WideBus32Bit = false,
.RelAddr = false,
-
+
.VendorID = "LUFA",
.ProductID = "Dataflash Disk",
.RevisionID = {'0','.','0','0'},
@@ -96,13 +96,13 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
switch (MSInterfaceInfo->State.CommandBlock.SCSICommandData[0])
{
case SCSI_CMD_INQUIRY:
- CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Inquiry(MSInterfaceInfo);
break;
case SCSI_CMD_REQUEST_SENSE:
CommandSuccess = SCSI_Command_Request_Sense(MSInterfaceInfo);
break;
case SCSI_CMD_READ_CAPACITY_10:
- CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
+ CommandSuccess = SCSI_Command_Read_Capacity_10(MSInterfaceInfo);
break;
case SCSI_CMD_SEND_DIAGNOSTIC:
CommandSuccess = SCSI_Command_Send_Diagnostic(MSInterfaceInfo);
@@ -134,7 +134,7 @@ bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
SCSI_SET_SENSE(SCSI_SENSE_KEY_GOOD,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
SCSI_ASENSEQ_NO_QUALIFIER);
-
+
return true;
}
@@ -165,11 +165,11 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
return false;
}
-
+
Endpoint_Write_Stream_LE(&InquiryData, BytesTransferred, NO_STREAM_CALLBACK);
uint8_t PadBytes[AllocationLength - BytesTransferred];
-
+
/* Pad out remaining bytes with 0x00 */
Endpoint_Write_Stream_LE(&PadBytes, sizeof(PadBytes), NO_STREAM_CALLBACK);
@@ -178,7 +178,7 @@ static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInf
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= BytesTransferred;
-
+
return true;
}
@@ -193,7 +193,7 @@ static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterf
{
uint8_t AllocationLength = MSInterfaceInfo->State.CommandBlock.SCSICommandData[4];
uint8_t BytesTransferred = (AllocationLength < sizeof(SenseData))? AllocationLength : sizeof(SenseData);
-
+
uint8_t PadBytes[AllocationLength - BytesTransferred];
Endpoint_Write_Stream_LE(&SenseData, BytesTransferred, NO_STREAM_CALLBACK);
@@ -221,10 +221,10 @@ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInt
Endpoint_Write_Stream_BE(&LastBlockAddressInLUN, sizeof(LastBlockAddressInLUN), NO_STREAM_CALLBACK);
Endpoint_Write_Stream_BE(&MediaBlockSize, sizeof(MediaBlockSize), NO_STREAM_CALLBACK);
Endpoint_ClearIN();
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8;
-
+
return true;
}
@@ -248,21 +248,21 @@ static bool SCSI_Command_Send_Diagnostic(USB_ClassInfo_MS_Device_t* const MSInte
return false;
}
-
+
/* Check to see if all attached Dataflash ICs are functional */
if (!(DataflashManager_CheckDataflashOperation()))
{
/* Update SENSE key with a hardware error condition and return command fail */
SCSI_SET_SENSE(SCSI_SENSE_KEY_HARDWARE_ERROR,
SCSI_ASENSE_NO_ADDITIONAL_INFORMATION,
- SCSI_ASENSEQ_NO_QUALIFIER);
-
+ SCSI_ASENSEQ_NO_QUALIFIER);
+
return false;
}
-
+
/* Succeed the command and update the bytes transferred counter */
MSInterfaceInfo->State.CommandBlock.DataTransferLength = 0;
-
+
return true;
}
@@ -280,13 +280,13 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
{
uint32_t BlockAddress;
uint16_t TotalBlocks;
-
+
/* Load in the 32-bit block address (SCSI uses big-endian, so have to reverse the byte order) */
BlockAddress = SwapEndian_32(*(uint32_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[2]);
/* Load in the 16-bit total blocks (SCSI uses big-endian, so have to reverse the byte order) */
TotalBlocks = SwapEndian_16(*(uint16_t*)&MSInterfaceInfo->State.CommandBlock.SCSICommandData[7]);
-
+
/* Check if the block address is outside the maximum allowable value for the LUN */
if (BlockAddress >= VIRTUAL_MEMORY_BLOCKS)
{
@@ -297,7 +297,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
return false;
}
-
+
/* Determine if the packet is a READ (10) or WRITE (10) command, call appropriate function */
if (IsDataRead == DATA_READ)
DataflashManager_ReadBlocks(MSInterfaceInfo, BlockAddress, TotalBlocks);
@@ -306,6 +306,7 @@ static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfa
/* Update the bytes transferred counter and succeed the command */
MSInterfaceInfo->State.CommandBlock.DataTransferLength -= ((uint32_t)TotalBlocks * VIRTUAL_MEMORY_BLOCK_SIZE);
-
+
return true;
}
+
diff --git a/Projects/Webserver/Lib/SCSI.h b/Projects/Webserver/Lib/SCSI.h
index 01afd373e..2ff6d05dc 100644
--- a/Projects/Webserver/Lib/SCSI.h
+++ b/Projects/Webserver/Lib/SCSI.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for SCSI.c.
*/
-
+
#ifndef _SCSI_H_
#define _SCSI_H_
@@ -45,7 +45,7 @@
#include "../Descriptors.h"
#include "DataflashManager.h"
-
+
/* Macros: */
/** Macro to set the current SCSI sense data to the given key, additional sense code and additional sense qualifier. This
* is for convenience, as it allows for all three sense values (returned upon request to the host to give information about
@@ -67,13 +67,13 @@
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a Block Media device. */
#define DEVICE_TYPE_BLOCK 0x00
-
+
/** Value for the DeviceType entry in the SCSI_Inquiry_Response_t enum, indicating a CD-ROM device. */
#define DEVICE_TYPE_CDROM 0x05
-
+
/* Function Prototypes: */
bool SCSI_DecodeSCSICommand(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
-
+
#if defined(INCLUDE_FROM_SCSI_C)
static bool SCSI_Command_Inquiry(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
static bool SCSI_Command_Request_Sense(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
@@ -82,5 +82,6 @@
static bool SCSI_Command_ReadWrite_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo,
const bool IsDataRead);
#endif
-
+
#endif
+
diff --git a/Projects/Webserver/Lib/TELNETServerApp.c b/Projects/Webserver/Lib/TELNETServerApp.c
index da9108676..eed24c801 100644
--- a/Projects/Webserver/Lib/TELNETServerApp.c
+++ b/Projects/Webserver/Lib/TELNETServerApp.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -35,7 +35,7 @@
* TELNET Webserver Application. When connected to the uIP stack,
* this will serve out raw TELNET to the client on port 23.
*/
-
+
#define INCLUDE_FROM_TELNETSERVERAPP_C
#include "TELNETServerApp.h"
@@ -50,7 +50,7 @@ const char PROGMEM TELNETMenu[] = "\r\n"
" c) List Active TCP Connections\r\n"
" =========================\r\n"
"\r\n>";
-
+
/** Header to print before the current connections are printed to the client */
const char PROGMEM CurrentConnectionsHeader[] = "\r\n* Current TCP Connections: *\r\n";
@@ -78,7 +78,7 @@ void TELNETServerApp_Callback(void)
if (uip_acked())
{
/* Progress to the next state once the current state's data has been ACKed */
- AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState;
+ AppState->TELNETServer.CurrentState = AppState->TELNETServer.NextState;
}
if (uip_rexmit() || uip_acked() || uip_newdata() || uip_connected() || uip_poll())
@@ -89,14 +89,14 @@ void TELNETServerApp_Callback(void)
/* Copy over and send the TELNET welcome message upon first connection */
strcpy_P(AppData, WelcomeHeader);
uip_send(AppData, strlen(AppData));
-
+
AppState->TELNETServer.NextState = TELNET_STATE_SendMenu;
break;
case TELNET_STATE_SendMenu:
/* Copy over and send the TELNET menu to the client */
strcpy_P(AppData, TELNETMenu);
uip_send(AppData, strlen(AppData));
-
+
AppState->TELNETServer.NextState = TELNET_STATE_GetCommand;
break;
case TELNET_STATE_GetCommand:
@@ -105,7 +105,7 @@ void TELNETServerApp_Callback(void)
/* Save the issued command for later processing */
AppState->TELNETServer.IssuedCommand = AppData[0];
-
+
AppState->TELNETServer.CurrentState = TELNET_STATE_SendResponse;
break;
case TELNET_STATE_SendResponse:
@@ -124,7 +124,7 @@ void TELNETServerApp_Callback(void)
AppState->TELNETServer.NextState = TELNET_STATE_SendMenu;
break;
}
- }
+ }
}
/** Sends a list of active TCP connections to the TELNET client. */
@@ -133,7 +133,7 @@ static void TELNETServerApp_DisplayTCPConnections(void)
char* const AppData = (char*)uip_appdata;
strcpy_P(AppData, CurrentConnectionsHeader);
-
+
uint16_t ResponseLen = strlen(AppData);
uint8_t ActiveConnCount = 0;
@@ -141,7 +141,7 @@ static void TELNETServerApp_DisplayTCPConnections(void)
for (uint8_t i = 0; i < UIP_CONNS; i++)
{
struct uip_conn* CurrConnection = &uip_conns[i];
-
+
/* If the connection is not closed, it is active and must be added to the out buffer */
if (CurrConnection->tcpstateflags != UIP_CLOSED)
{
@@ -160,3 +160,4 @@ static void TELNETServerApp_DisplayTCPConnections(void)
}
#endif
+
diff --git a/Projects/Webserver/Lib/TELNETServerApp.h b/Projects/Webserver/Lib/TELNETServerApp.h
index 80d48af3b..abd90fbba 100644
--- a/Projects/Webserver/Lib/TELNETServerApp.h
+++ b/Projects/Webserver/Lib/TELNETServerApp.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -40,13 +40,13 @@
#include <avr/pgmspace.h>
#include <string.h>
#include <stdio.h>
-
+
#include <uip.h>
-
+
/* Macros: */
/** TCP listen port for incoming TELNET traffic. */
#define TELNET_SERVER_PORT 23
-
+
/* Enums: */
/** States for each TELNET connection to the server. */
enum TELNET_States_t
@@ -55,14 +55,15 @@
TELNET_STATE_SendMenu, /**< Currently sending the command list menu to the client */
TELNET_STATE_GetCommand, /**< Currently waiting for a command from the client */
TELNET_STATE_SendResponse, /**< Processing the issued command and sending a response */
- };
+ };
/* Function Prototypes: */
void TELNETServerApp_Init(void);
void TELNETServerApp_Callback(void);
-
+
#if defined(INCLUDE_FROM_TELNETSERVERAPP_C)
static void TELNETServerApp_DisplayTCPConnections(void);
#endif
-
+
#endif
+
diff --git a/Projects/Webserver/Lib/uIPManagement.c b/Projects/Webserver/Lib/uIPManagement.c
index 1270e18df..2c60d74e6 100644
--- a/Projects/Webserver/Lib/uIPManagement.c
+++ b/Projects/Webserver/Lib/uIPManagement.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -54,7 +54,7 @@ void uIPManagement_Init(void)
/* uIP Timing Initialization */
clock_init();
timer_set(&ConnectionTimer, CLOCK_SECOND / 2);
- timer_set(&ARPTimer, CLOCK_SECOND * 10);
+ timer_set(&ARPTimer, CLOCK_SECOND * 10);
/* uIP Stack Initialization */
uip_init();
@@ -75,10 +75,10 @@ void uIPManagement_Init(void)
uip_setnetmask(&Netmask);
uip_setdraddr(&GatewayIPAddress);
#endif
-
+
/* HTTP Webserver Initialization */
HTTPServerApp_Init();
-
+
/* TELNET Server Initialization */
#if defined(ENABLE_TELNET_SERVER)
TELNETServerApp_Init();
@@ -136,7 +136,7 @@ static void uIPManagement_ProcessIncomingPacket(void)
/* If no packet received, exit processing routine */
if (!(RNDIS_Host_IsPacketReceived(&Ethernet_RNDIS_Interface)))
return;
-
+
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
/* Read the Incoming packet straight into the UIP packet buffer */
@@ -162,16 +162,16 @@ static void uIPManagement_ProcessIncomingPacket(void)
uip_split_output();
}
-
+
break;
case HTONS(UIP_ETHTYPE_ARP):
/* Process ARP packet */
uip_arp_arpin();
-
+
/* If a response was generated, send it */
if (uip_len > 0)
uip_split_output();
-
+
break;
}
}
@@ -204,7 +204,7 @@ static void uIPManagement_ManageConnections(void)
timer_reset(&ConnectionTimer);
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
-
+
for (uint8_t i = 0; i < UIP_CONNS; i++)
{
/* Run periodic connection management for each TCP connection */
@@ -220,7 +220,7 @@ static void uIPManagement_ManageConnections(void)
uip_split_output();
}
}
-
+
#if defined(ENABLE_DHCP_CLIENT)
for (uint8_t i = 0; i < UIP_UDP_CONNS; i++)
{
@@ -249,3 +249,4 @@ static void uIPManagement_ManageConnections(void)
uip_arp_timer();
}
}
+
diff --git a/Projects/Webserver/Lib/uIPManagement.h b/Projects/Webserver/Lib/uIPManagement.h
index 37c54e9ad..f5ac26e55 100644
--- a/Projects/Webserver/Lib/uIPManagement.h
+++ b/Projects/Webserver/Lib/uIPManagement.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -43,18 +43,18 @@
#include <uip_arp.h>
#include <uip-split.h>
#include <timer.h>
-
+
#include "Lib/DHCPClientApp.h"
#include "Lib/HTTPServerApp.h"
#include "Lib/TELNETServerApp.h"
-
+
/* Macros: */
/** IP address that the webserver should use once connected to a RNDIS device (when DHCP is disabled). */
#define DEVICE_IP_ADDRESS (uint8_t[]){192, 168, 1, 10}
-
+
/** Netmask that the webserver should once connected to a RNDIS device (when DHCP is disabled). */
#define DEVICE_NETMASK (uint8_t[]){255, 255, 255, 0}
-
+
/** IP address of the default gateway the webserver should use when routing outside the local subnet
* (when DHCP is disabled).
*/
@@ -62,18 +62,19 @@
/* External Variables: */
extern struct uip_eth_addr MACAddress;
-
+
extern bool HaveIPConfiguration;
-
+
/* Function Prototypes: */
void uIPManagement_Init(void);
void uIPManagement_ManageNetwork(void);
void uIPManagement_TCPCallback(void);
void uIPManagement_UDPCallback(void);
-
+
#if defined(INCLUDE_FROM_UIPMANAGEMENT_C)
static void uIPManagement_ProcessIncomingPacket(void);
static void uIPManagement_ManageConnections(void);
#endif
-
+
#endif
+
diff --git a/Projects/Webserver/Lib/uip/clock.c b/Projects/Webserver/Lib/uip/clock.c
index 046b6e344..86322966e 100644
--- a/Projects/Webserver/Lib/uip/clock.c
+++ b/Projects/Webserver/Lib/uip/clock.c
@@ -36,3 +36,4 @@ clock_time_t clock_time()
return time;
}
+
diff --git a/Projects/Webserver/Lib/uip/clock.h b/Projects/Webserver/Lib/uip/clock.h
index 05d30386b..bbfa4ac0e 100644
--- a/Projects/Webserver/Lib/uip/clock.h
+++ b/Projects/Webserver/Lib/uip/clock.h
@@ -10,3 +10,4 @@ void clock_init(void);
clock_time_t clock_time(void);
#endif /* __CLOCK_ARCH_H__ */
+
diff --git a/Projects/Webserver/Lib/uip/timer.c b/Projects/Webserver/Lib/uip/timer.c
index 3c5fd202e..0e5e59147 100644
--- a/Projects/Webserver/Lib/uip/timer.c
+++ b/Projects/Webserver/Lib/uip/timer.c
@@ -125,3 +125,4 @@ timer_expired(struct timer *t)
/*---------------------------------------------------------------------------*/
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/timer.h b/Projects/Webserver/Lib/uip/timer.h
index 057bea49c..04917e4c5 100644
--- a/Projects/Webserver/Lib/uip/timer.h
+++ b/Projects/Webserver/Lib/uip/timer.h
@@ -84,3 +84,4 @@ int timer_expired(struct timer *t);
#endif /* __TIMER_H__ */
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/uip-split.c b/Projects/Webserver/Lib/uip/uip-split.c
index 5fac6d53b..87dbd7e1f 100644
--- a/Projects/Webserver/Lib/uip/uip-split.c
+++ b/Projects/Webserver/Lib/uip/uip-split.c
@@ -47,7 +47,7 @@ uip_split_output(void)
/* We only try to split maximum sized TCP segments. */
if(BUF->proto == UIP_PROTO_TCP && uip_len == UIP_BUFSIZE) {
-
+
tcplen = uip_len - UIP_TCPIP_HLEN - UIP_LLH_LEN;
/* Split the segment in two. If the original packet length was
odd, we make the second packet one byte larger. */
@@ -68,7 +68,7 @@ uip_split_output(void)
BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8;
BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
#endif /* UIP_CONF_IPV6 */
-
+
/* Recalculate the TCP checksum. */
BUF->tcpchksum = 0;
BUF->tcpchksum = ~(uip_tcpchksum());
@@ -78,14 +78,14 @@ uip_split_output(void)
BUF->ipchksum = 0;
BUF->ipchksum = ~(uip_ipchksum());
#endif /* UIP_CONF_IPV6 */
-
+
/* Transmit the first packet. */
#if UIP_CONF_IPV6
tcpip_ipv6_output();
#else
RNDIS_Host_SendPacket(&Ethernet_RNDIS_Interface, uip_buf, uip_len);
#endif /* UIP_CONF_IPV6 */
-
+
/* Now, create the second packet. To do this, it is not enough to
just alter the length field, but we must also update the TCP
sequence number and point the uip_appdata to a new place in
@@ -101,7 +101,7 @@ uip_split_output(void)
BUF->len[0] = (uip_len - UIP_LLH_LEN) >> 8;
BUF->len[1] = (uip_len - UIP_LLH_LEN) & 0xff;
#endif /* UIP_CONF_IPV6 */
-
+
memcpy(uip_appdata, (u8_t *)uip_appdata + len1, len2);
uip_add32(BUF->seqno, len1);
@@ -109,7 +109,7 @@ uip_split_output(void)
BUF->seqno[1] = uip_acc32[1];
BUF->seqno[2] = uip_acc32[2];
BUF->seqno[3] = uip_acc32[3];
-
+
/* Recalculate the TCP checksum. */
BUF->tcpchksum = 0;
BUF->tcpchksum = ~(uip_tcpchksum());
@@ -139,3 +139,4 @@ uip_split_output(void)
}
/*-----------------------------------------------------------------------------*/
+
diff --git a/Projects/Webserver/Lib/uip/uip-split.h b/Projects/Webserver/Lib/uip/uip-split.h
index c7274c36a..2243355d6 100644
--- a/Projects/Webserver/Lib/uip/uip-split.h
+++ b/Projects/Webserver/Lib/uip/uip-split.h
@@ -1,33 +1,33 @@
/*
* Copyright (c) 2004, Swedish Institute of Computer Science.
- * All rights reserved.
+ * All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
- *
+ *
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: uip-split.h,v 1.1 2006/06/17 22:41:19 adamdunkels Exp $
@@ -63,7 +63,7 @@
/**
* \file
* Module for splitting outbound TCP segments in two to avoid the
- * delayed ACK throughput degradation.
+ * delayed ACK throughput degradation.
* \author
* Adam Dunkels <adam@sics.se>
*
@@ -101,3 +101,4 @@ void uip_add32(u8_t *op32, u16_t op16);
/** @} */
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/uip.c b/Projects/Webserver/Lib/uip/uip.c
index 36053029a..afa19f750 100644
--- a/Projects/Webserver/Lib/uip/uip.c
+++ b/Projects/Webserver/Lib/uip/uip.c
@@ -245,15 +245,15 @@ uip_add32(u8_t *op32, u16_t op16)
uip_acc32[2] = op32[2] + (op16 >> 8);
uip_acc32[1] = op32[1];
uip_acc32[0] = op32[0];
-
+
if(uip_acc32[2] < (op16 >> 8)) {
++uip_acc32[1];
if(uip_acc32[1] == 0) {
++uip_acc32[0];
}
}
-
-
+
+
if(uip_acc32[3] < (op16 & 0xff)) {
++uip_acc32[2];
if(uip_acc32[2] == 0) {
@@ -278,7 +278,7 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
dataptr = data;
last_byte = data + len - 1;
-
+
while(dataptr < last_byte) { /* At least two more bytes */
t = (dataptr[0] << 8) + dataptr[1];
sum += t;
@@ -287,7 +287,7 @@ chksum(u16_t sum, const u8_t *data, u16_t len)
}
dataptr += 2;
}
-
+
if(dataptr == last_byte) {
t = (dataptr[0] << 8) + 0;
sum += t;
@@ -323,15 +323,15 @@ upper_layer_chksum(u8_t proto)
{
u16_t upper_layer_len;
u16_t sum;
-
+
#if UIP_CONF_IPV6
upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]);
#else /* UIP_CONF_IPV6 */
upper_layer_len = (((u16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN;
#endif /* UIP_CONF_IPV6 */
-
+
/* First sum pseudoheader. */
-
+
/* IP protocol and length fields. This addition cannot carry. */
sum = upper_layer_len + proto;
/* Sum IP source and destination addresses. */
@@ -340,7 +340,7 @@ upper_layer_chksum(u8_t proto)
/* Sum TCP header and data. */
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
upper_layer_len);
-
+
return (sum == 0) ? 0xffff : htons(sum);
}
/*---------------------------------------------------------------------------*/
@@ -349,7 +349,7 @@ u16_t
uip_icmp6chksum(void)
{
return upper_layer_chksum(UIP_PROTO_ICMP6);
-
+
}
#endif /* UIP_CONF_IPV6 */
/*---------------------------------------------------------------------------*/
@@ -386,7 +386,7 @@ uip_init(void)
uip_udp_conns[c].lport = 0;
}
#endif /* UIP_UDP */
-
+
/* IPv4 initialization. */
#if UIP_FIXEDADDR == 0
@@ -400,7 +400,7 @@ struct uip_conn *
uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
{
register struct uip_conn *conn, *cconn;
-
+
/* Find an unused local port. */
again:
++lastport;
@@ -437,7 +437,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
if(conn == 0) {
return 0;
}
-
+
conn->tcpstateflags = UIP_SYN_SENT;
conn->snd_nxt[0] = iss[0];
@@ -446,7 +446,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
conn->snd_nxt[3] = iss[3];
conn->initialmss = conn->mss = UIP_TCP_MSS;
-
+
conn->len = 1; /* TCP length of the SYN is one. */
conn->nrtx = 0;
conn->timer = 1; /* Send the SYN next time around. */
@@ -456,7 +456,7 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
conn->lport = htons(lastport);
conn->rport = rport;
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
-
+
return conn;
}
#endif /* UIP_ACTIVE_OPEN */
@@ -466,7 +466,7 @@ struct uip_udp_conn *
uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
{
register struct uip_udp_conn *conn;
-
+
/* Find an unused local port. */
again:
++lastport;
@@ -474,7 +474,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
if(lastport >= 32000) {
lastport = 4096;
}
-
+
for(c = 0; c < UIP_UDP_CONNS; ++c) {
if(uip_udp_conns[c].lport == htons(lastport)) {
goto again;
@@ -493,7 +493,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
if(conn == 0) {
return 0;
}
-
+
conn->lport = HTONS(lastport);
conn->rport = rport;
if(ripaddr == NULL) {
@@ -502,7 +502,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport)
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
}
conn->ttl = UIP_TTL;
-
+
return conn;
}
#endif /* UIP_UDP */
@@ -587,12 +587,12 @@ uip_reass(void)
memcpy(&uip_reassbuf[UIP_IPH_LEN + offset],
(char *)BUF + (int)((BUF->vhl & 0x0f) * 4),
len);
-
+
/* Update the bitmap. */
if(offset / (8 * 8) == (offset + len) / (8 * 8)) {
/* If the two endpoints are in the same byte, we only update
that byte. */
-
+
uip_reassbitmap[offset / (8 * 8)] |=
bitmap_bits[(offset / 8 ) & 7] &
~bitmap_bits[((offset + len) / 8 ) & 7];
@@ -608,7 +608,7 @@ uip_reass(void)
uip_reassbitmap[(offset + len) / (8 * 8)] |=
~bitmap_bits[((offset + len) / 8 ) & 7];
}
-
+
/* If this fragment has the More Fragments flag set to zero, we
know that this is the last fragment, so we can calculate the
size of the entire packet. We also set the
@@ -619,7 +619,7 @@ uip_reass(void)
uip_reassflags |= UIP_REASS_FLAG_LASTFRAG;
uip_reasslen = offset + len;
}
-
+
/* Finally, we check if we have a full packet in the buffer. We do
this by checking if we have the last fragment and if all bits
in the bitmap are set. */
@@ -681,7 +681,7 @@ uip_process(u8_t flag)
goto udp_send;
}
#endif /* UIP_UDP */
-
+
uip_sappdata = uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];
/* Check if we were invoked because of a poll request for a
@@ -695,7 +695,7 @@ uip_process(u8_t flag)
goto appsend;
}
goto drop;
-
+
/* Check if we were invoked because of the periodic timer firing. */
} else if(flag == UIP_TIMER) {
#if UIP_REASSEMBLY
@@ -754,7 +754,7 @@ uip_process(u8_t flag)
4:
uip_connr->nrtx);
++(uip_connr->nrtx);
-
+
/* Ok, so we need to retransmit. We do this differently
depending on which state we are in. In ESTABLISHED, we
call upon the application so that it may prepare the
@@ -767,14 +767,14 @@ uip_process(u8_t flag)
/* In the SYN_RCVD state, we should retransmit our
SYNACK. */
goto tcp_send_synack;
-
+
#if UIP_ACTIVE_OPEN
case UIP_SYN_SENT:
/* In the SYN_SENT state, we retransmit out SYN. */
BUF->flags = 0;
goto tcp_send_syn;
#endif /* UIP_ACTIVE_OPEN */
-
+
case UIP_ESTABLISHED:
/* In the ESTABLISHED state, we call upon the application
to do the actual retransmit after which we jump into
@@ -783,19 +783,19 @@ uip_process(u8_t flag)
uip_flags = UIP_REXMIT;
UIP_APPCALL();
goto apprexmit;
-
+
case UIP_FIN_WAIT_1:
case UIP_CLOSING:
case UIP_LAST_ACK:
/* In all these states we should retransmit a FINACK. */
goto tcp_send_finack;
-
+
}
}
} else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) {
/* If there was no need for a retransmission, we poll the
application for new data. */
- uip_len = uip_slen = 0;
+ uip_len = uip_slen = 0;
uip_flags = UIP_POLL;
UIP_APPCALL();
goto appsend;
@@ -822,7 +822,7 @@ uip_process(u8_t flag)
UIP_STAT(++uip_stat.ip.recv);
/* Start of IP input header processing code. */
-
+
#if UIP_CONF_IPV6
/* Check validity of the IP header. */
if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */
@@ -840,7 +840,7 @@ uip_process(u8_t flag)
goto drop;
}
#endif /* UIP_CONF_IPV6 */
-
+
/* Check the size of the packet. If the size reported to us in
uip_len is smaller the size reported in the IP header, we assume
that the packet has been corrupted in transit. If the size of
@@ -910,7 +910,7 @@ uip_process(u8_t flag)
goto udp_input;
}
#endif /* UIP_BROADCAST */
-
+
/* Check if the packet is destined for our IP address. */
#if !UIP_CONF_IPV6
if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr)) {
@@ -1028,14 +1028,14 @@ uip_process(u8_t flag)
/* Save the sender's address in our neighbor list. */
uip_neighbor_add(&ICMPBUF->srcipaddr, &(ICMPBUF->options[2]));
}
-
+
/* We should now send a neighbor advertisement back to where the
neighbor solicitation came from. */
ICMPBUF->type = ICMP6_NEIGHBOR_ADVERTISEMENT;
ICMPBUF->flags = ICMP6_FLAG_S; /* Solicited flag. */
-
+
ICMPBUF->reserved1 = ICMPBUF->reserved2 = ICMPBUF->reserved3 = 0;
-
+
uip_ipaddr_copy(&ICMPBUF->destipaddr, &ICMPBUF->srcipaddr);
uip_ipaddr_copy(&ICMPBUF->srcipaddr, &uip_hostaddr);
ICMPBUF->options[0] = ICMP6_OPTION_TARGET_LINK_ADDRESS;
@@ -1043,9 +1043,9 @@ uip_process(u8_t flag)
memcpy(&(ICMPBUF->options[2]), &uip_ethaddr, sizeof(uip_ethaddr));
ICMPBUF->icmpchksum = 0;
ICMPBUF->icmpchksum = ~uip_icmp6chksum();
-
+
goto send;
-
+
}
goto drop;
} else if(ICMPBUF->type == ICMP6_ECHO) {
@@ -1054,12 +1054,12 @@ uip_process(u8_t flag)
ICMP checksum before we return the packet. */
ICMPBUF->type = ICMP6_ECHO_REPLY;
-
+
uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
ICMPBUF->icmpchksum = 0;
ICMPBUF->icmpchksum = ~uip_icmp6chksum();
-
+
UIP_STAT(++uip_stat.icmp.sent);
goto send;
} else {
@@ -1071,7 +1071,7 @@ uip_process(u8_t flag)
}
/* End of IPv6 ICMP processing. */
-
+
#endif /* !UIP_CONF_IPV6 */
#if UIP_UDP
@@ -1147,7 +1147,7 @@ uip_process(u8_t flag)
#else /* UIP_CONF_ICMP_DEST_UNREACH */
goto drop;
#endif /* UIP_CONF_ICMP_DEST_UNREACH */
-
+
udp_found:
uip_conn = NULL;
uip_flags = UIP_NEWDATA;
@@ -1182,7 +1182,7 @@ uip_process(u8_t flag)
uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
uip_ipaddr_copy(&BUF->destipaddr, &uip_udp_conn->ripaddr);
-
+
uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPTCPH_LEN];
#if UIP_UDP_CHECKSUMS
@@ -1192,16 +1192,16 @@ uip_process(u8_t flag)
UDPBUF->udpchksum = 0xffff;
}
#endif /* UIP_UDP_CHECKSUMS */
-
+
goto ip_send_nolen;
#endif /* UIP_UDP */
-
+
/* TCP input processing. */
tcp_input:
UIP_STAT(++uip_stat.tcp.recv);
/* Start of TCP input header processing code. */
-
+
if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP
checksum. */
UIP_STAT(++uip_stat.tcp.drop);
@@ -1209,7 +1209,7 @@ uip_process(u8_t flag)
UIP_LOG("tcp: bad checksum.");
goto drop;
}
-
+
/* Demultiplex this segment. */
/* First check any active connections. */
for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_CONNS - 1];
@@ -1229,7 +1229,7 @@ uip_process(u8_t flag)
if((BUF->flags & TCP_CTL) != TCP_SYN) {
goto reset;
}
-
+
tmp16 = BUF->destport;
/* Next, check listening connections. */
for(c = 0; c < UIP_LISTENPORTS; ++c) {
@@ -1237,7 +1237,7 @@ uip_process(u8_t flag)
goto found_listen;
}
}
-
+
/* No matching connection found, so we send a RST packet. */
UIP_STAT(++uip_stat.tcp.synrst);
@@ -1248,7 +1248,7 @@ uip_process(u8_t flag)
}
UIP_STAT(++uip_stat.tcp.rst);
-
+
BUF->flags = TCP_RST | TCP_ACK;
uip_len = UIP_IPTCPH_LEN;
BUF->tcpoffset = 5 << 4;
@@ -1257,15 +1257,15 @@ uip_process(u8_t flag)
c = BUF->seqno[3];
BUF->seqno[3] = BUF->ackno[3];
BUF->ackno[3] = c;
-
+
c = BUF->seqno[2];
BUF->seqno[2] = BUF->ackno[2];
BUF->ackno[2] = c;
-
+
c = BUF->seqno[1];
BUF->seqno[1] = BUF->ackno[1];
BUF->ackno[1] = c;
-
+
c = BUF->seqno[0];
BUF->seqno[0] = BUF->ackno[0];
BUF->ackno[0] = c;
@@ -1280,16 +1280,16 @@ uip_process(u8_t flag)
}
}
}
-
+
/* Swap port numbers. */
tmp16 = BUF->srcport;
BUF->srcport = BUF->destport;
BUF->destport = tmp16;
-
+
/* Swap IP addresses. */
uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
-
+
/* And send out the RST packet! */
goto tcp_send_noconn;
@@ -1326,7 +1326,7 @@ uip_process(u8_t flag)
goto drop;
}
uip_conn = uip_connr;
-
+
/* Fill in the necessary fields for the new connection. */
uip_connr->rto = uip_connr->timer = UIP_RTO;
uip_connr->sa = 0;
@@ -1367,7 +1367,7 @@ uip_process(u8_t flag)
(u16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
uip_connr->initialmss = uip_connr->mss =
tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
-
+
/* And we are done processing options. */
break;
} else {
@@ -1382,19 +1382,19 @@ uip_process(u8_t flag)
}
}
}
-
+
/* Our response will be a SYNACK. */
#if UIP_ACTIVE_OPEN
tcp_send_synack:
BUF->flags = TCP_ACK;
-
+
tcp_send_syn:
BUF->flags |= TCP_SYN;
#else /* UIP_ACTIVE_OPEN */
tcp_send_synack:
BUF->flags = TCP_SYN | TCP_ACK;
#endif /* UIP_ACTIVE_OPEN */
-
+
/* We send out the TCP Maximum Segment Size option with our
SYNACK. */
BUF->optdata[0] = TCP_OPT_MSS;
@@ -1458,7 +1458,7 @@ uip_process(u8_t flag)
uip_connr->snd_nxt[1] = uip_acc32[1];
uip_connr->snd_nxt[2] = uip_acc32[2];
uip_connr->snd_nxt[3] = uip_acc32[3];
-
+
/* Do RTT estimation, unless we have done retransmissions. */
if(uip_connr->nrtx == 0) {
signed char m;
@@ -1482,7 +1482,7 @@ uip_process(u8_t flag)
/* Reset length of outstanding data. */
uip_connr->len = 0;
}
-
+
}
/* Do different things depending on in what state the connection is. */
@@ -1570,7 +1570,7 @@ uip_process(u8_t flag)
uip_conn->tcpstateflags = UIP_CLOSED;
goto reset;
#endif /* UIP_ACTIVE_OPEN */
-
+
case UIP_ESTABLISHED:
/* In the ESTABLISHED state, we call upon the application to feed
data into the uip_buf. If the UIP_ACKDATA flag is set, the
@@ -1672,7 +1672,7 @@ uip_process(u8_t flag)
UIP_APPCALL();
appsend:
-
+
if(uip_flags & UIP_ABORT) {
uip_slen = 0;
uip_connr->tcpstateflags = UIP_CLOSED;
@@ -1724,7 +1724,7 @@ uip_process(u8_t flag)
uip_connr->nrtx = 0;
apprexmit:
uip_appdata = uip_sappdata;
-
+
/* If the application has data to be sent, or if the incoming
packet had new data in it, we must send out a packet. */
if(uip_slen > 0 && uip_connr->len > 0) {
@@ -1753,7 +1753,7 @@ uip_process(u8_t flag)
UIP_APPCALL();
}
break;
-
+
case UIP_FIN_WAIT_1:
/* The application has closed the connection, but the remote host
hasn't closed its end yet. Thus we do nothing but wait for a
@@ -1782,7 +1782,7 @@ uip_process(u8_t flag)
goto tcp_send_ack;
}
goto drop;
-
+
case UIP_FIN_WAIT_2:
if(uip_len > 0) {
uip_add_rcv_nxt(uip_len);
@@ -1802,7 +1802,7 @@ uip_process(u8_t flag)
case UIP_TIME_WAIT:
goto tcp_send_ack;
-
+
case UIP_CLOSING:
if(uip_flags & UIP_ACKDATA) {
uip_connr->tcpstateflags = UIP_TIME_WAIT;
@@ -1810,7 +1810,7 @@ uip_process(u8_t flag)
}
}
goto drop;
-
+
/* We jump here when we are ready to send the packet, and just want
to set the appropriate TCP sequence numbers in the TCP header. */
tcp_send_ack:
@@ -1831,14 +1831,14 @@ uip_process(u8_t flag)
BUF->ackno[1] = uip_connr->rcv_nxt[1];
BUF->ackno[2] = uip_connr->rcv_nxt[2];
BUF->ackno[3] = uip_connr->rcv_nxt[3];
-
+
BUF->seqno[0] = uip_connr->snd_nxt[0];
BUF->seqno[1] = uip_connr->snd_nxt[1];
BUF->seqno[2] = uip_connr->snd_nxt[2];
BUF->seqno[3] = uip_connr->snd_nxt[3];
BUF->proto = UIP_PROTO_TCP;
-
+
BUF->srcport = uip_connr->lport;
BUF->destport = uip_connr->rport;
@@ -1867,7 +1867,7 @@ uip_process(u8_t flag)
#endif /* UIP_CONF_IPV6 */
BUF->urgp[0] = BUF->urgp[1] = 0;
-
+
/* Calculate TCP checksum. */
BUF->tcpchksum = 0;
BUF->tcpchksum = ~(uip_tcpchksum());
@@ -1888,14 +1888,14 @@ uip_process(u8_t flag)
BUF->ipchksum = 0;
BUF->ipchksum = ~(uip_ipchksum());
DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum());
-#endif /* UIP_CONF_IPV6 */
+#endif /* UIP_CONF_IPV6 */
UIP_STAT(++uip_stat.tcp.sent);
#if UIP_CONF_IPV6
send:
#endif /* UIP_CONF_IPV6 */
DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len,
(BUF->len[0] << 8) | BUF->len[1]);
-
+
UIP_STAT(++uip_stat.ip.sent);
/* Return and let the caller do the actual transmission. */
uip_flags = 0;
@@ -1936,3 +1936,4 @@ uip_send(const void *data, int len)
/*---------------------------------------------------------------------------*/
/** @} */
#endif /* UIP_CONF_IPV6 */
+
diff --git a/Projects/Webserver/Lib/uip/uip.h b/Projects/Webserver/Lib/uip/uip.h
index 83a08a8a0..10f20de6b 100644
--- a/Projects/Webserver/Lib/uip/uip.h
+++ b/Projects/Webserver/Lib/uip/uip.h
@@ -145,7 +145,7 @@ typedef struct uip_eth_addr uip_lladdr_t;
uip_ipaddr(&addr, 192,168,1,2);
uip_sethostaddr(&addr);
-
+
\endcode
* \param addr A pointer to an IP address of type uip_ipaddr_t;
*
@@ -805,7 +805,7 @@ void uip_send(const void *data, int len);
\code
uip_ipaddr_t addr;
struct uip_udp_conn *c;
-
+
uip_ipaddr(&addr, 192,168,2,1);
c = uip_udp_new(&addr, HTONS(12345));
if(c != NULL) {
@@ -866,7 +866,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
* These functions can be used for converting between different data
* formats used by uIP.
*/
-
+
/**
* Convert an IP address to four bytes separated by commas.
*
@@ -892,7 +892,7 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport);
\code
uip_ipaddr_t ipaddr;
struct uip_conn *c;
-
+
uip_ipaddr(&ipaddr, 192,168,1,2);
c = uip_connect(&ipaddr, HTONS(80));
\endcode
@@ -1281,11 +1281,11 @@ extern u16_t uip_urglen, uip_surglen;
*/
struct uip_conn {
uip_ipaddr_t ripaddr; /**< The IP address of the remote host. */
-
+
u16_t lport; /**< The local TCP port, in network byte order. */
u16_t rport; /**< The local remote TCP port, in network byte
order. */
-
+
u8_t rcv_nxt[4]; /**< The sequence number that we expect to
receive next. */
u8_t snd_nxt[4]; /**< The sequence number that was last sent by
@@ -1398,7 +1398,7 @@ struct uip_stats {
layer. */
uip_stats_t sent; /**< Number of sent packets at the IP
layer. */
- uip_stats_t forwarded;/**< Number of forwarded packets at the IP
+ uip_stats_t forwarded;/**< Number of forwarded packets at the IP
layer. */
uip_stats_t drop; /**< Number of dropped packets at the IP
layer. */
@@ -1527,14 +1527,14 @@ uip_ext_hdr_options_process(); */
* The actual uIP function which does all the work.
*/
void uip_process(u8_t flag);
-
+
/* The following flags are passed as an argument to the uip_process()
function. They are used to distinguish between the two cases where
uip_process() is called. It can be called either because we have
incoming data that should be processed, or because the periodic
timer has fired. These values are never used directly, but only in
the macros defined in this file. */
-
+
#define UIP_DATA 1 /* Tells uIP that there is incoming
data in the uip_buf buffer. The
length of the data is stored in the
@@ -1561,7 +1561,7 @@ void uip_process(u8_t flag);
#define UIP_TIME_WAIT 7
#define UIP_LAST_ACK 8
#define UIP_TS_MASK 15
-
+
#define UIP_STOPPED 16
/* The TCP and IP headers. */
@@ -1586,7 +1586,7 @@ struct uip_tcpip_hdr {
u16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
-
+
/* TCP header. */
u16_t srcport,
destport;
@@ -1622,7 +1622,7 @@ struct uip_icmpip_hdr {
u16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
-
+
/* ICMP header. */
u8_t type, icode;
u16_t icmpchksum;
@@ -1655,7 +1655,7 @@ struct uip_udpip_hdr {
u16_t ipchksum;
uip_ipaddr_t srcipaddr, destipaddr;
#endif /* UIP_CONF_IPV6 */
-
+
/* UDP header. */
u16_t srcport,
destport;
@@ -2023,7 +2023,7 @@ extern uip_lladdr_t uip_lladdr;
(((a)->u8[13]) == (m)->addr[3]) && \
(((a)->u8[14]) == (m)->addr[4]) && \
(((a)->u8[15]) == (m)->addr[5]))
-
+
#endif /*UIP_CONF_LL_802154*/
/**
@@ -2127,3 +2127,4 @@ u16_t uip_icmp6chksum(void);
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/uip_arp.c b/Projects/Webserver/Lib/uip/uip_arp.c
index b7e3b7342..fcb783b14 100644
--- a/Projects/Webserver/Lib/uip/uip_arp.c
+++ b/Projects/Webserver/Lib/uip/uip_arp.c
@@ -16,7 +16,7 @@
*
* \note This ARP implementation only supports Ethernet.
*/
-
+
/**
* \file
* Implementation of the ARP Address Resolution Protocol.
@@ -150,7 +150,7 @@ void
uip_arp_timer(void)
{
struct arp_entry *tabptr = NULL;
-
+
++arptime;
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
tabptr = &arp_table[i];
@@ -178,7 +178,7 @@ uip_arp_update(uip_ipaddr_t *ipaddr, struct uip_eth_addr *ethaddr)
/* Check if the source IP address of the incoming packet matches
the IP address in this ARP table entry. */
if(uip_ipaddr_cmp(ipaddr, &tabptr->ipaddr)) {
-
+
/* An old entry found, update this and return. */
memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);
tabptr->time = arptime;
@@ -240,7 +240,7 @@ void
uip_arp_ipin(void)
{
uip_len -= sizeof(struct uip_eth_hdr);
-
+
/* Only insert/update an entry if the source IP address of the
incoming IP packet comes from a host on the local network. */
if((IPBUF->srcipaddr[0] & uip_netmask[0]) !=
@@ -252,7 +252,7 @@ uip_arp_ipin(void)
return;
}
uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src));
-
+
return;
}
#endif /* 0 */
@@ -287,7 +287,7 @@ uip_arp_arpin(void)
return;
}
uip_len = 0;
-
+
switch(BUF->opcode) {
case HTONS(ARP_REQUEST):
/* ARP request. If it asked for our address, we send out a
@@ -304,14 +304,14 @@ uip_arp_arpin(void)
table, since it is likely that we will do more communication
with this host in the future. */
uip_arp_update(&BUF->sipaddr, &BUF->shwaddr);
-
+
BUF->opcode = HTONS(ARP_REPLY);
memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);
-
+
uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr);
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
@@ -362,7 +362,7 @@ void
uip_arp_out(void)
{
struct arp_entry *tabptr = NULL;
-
+
/* Find the destination IP address in the ARP table and construct
the Ethernet header. If the destination IP address isn't on the
local network, we use the default router's IP address instead.
@@ -384,7 +384,7 @@ uip_arp_out(void)
/* Else, we use the destination IP address. */
uip_ipaddr_copy(&ipaddr, &IPBUF->destipaddr);
}
-
+
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
tabptr = &arp_table[i];
if(uip_ipaddr_cmp(&ipaddr, &tabptr->ipaddr)) {
@@ -400,7 +400,7 @@ uip_arp_out(void)
memset(BUF->dhwaddr.addr, 0x00, 6);
memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
-
+
uip_ipaddr_copy(&BUF->dipaddr, &ipaddr);
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */
@@ -411,7 +411,7 @@ uip_arp_out(void)
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
-
+
uip_len = sizeof(struct arp_hdr);
return;
}
@@ -420,7 +420,7 @@ uip_arp_out(void)
memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);
}
memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
-
+
IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);
uip_len += sizeof(struct uip_eth_hdr);
@@ -429,3 +429,4 @@ uip_arp_out(void)
/** @} */
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/uip_arp.h b/Projects/Webserver/Lib/uip/uip_arp.h
index 114d4310c..4e78ce7b7 100644
--- a/Projects/Webserver/Lib/uip/uip_arp.h
+++ b/Projects/Webserver/Lib/uip/uip_arp.h
@@ -7,13 +7,13 @@
* \addtogroup uiparp
* @{
*/
-
+
/**
* \file
* Macros and definitions for the ARP module.
* \author Adam Dunkels <adam@dunkels.com>
*/
-
+
/*
* Copyright (c) 2001-2003, Adam Dunkels.
@@ -143,3 +143,4 @@ void uip_arp_timer(void);
#endif /* __UIP_ARP_H__ */
/** @} */
+
diff --git a/Projects/Webserver/Lib/uip/uipopt.h b/Projects/Webserver/Lib/uip/uipopt.h
index 244ce1df1..b61a7b4a8 100644
--- a/Projects/Webserver/Lib/uip/uipopt.h
+++ b/Projects/Webserver/Lib/uip/uipopt.h
@@ -189,12 +189,12 @@
#define UIP_CONF_IPV6_QUEUE_PKT 0
#endif
-#ifndef UIP_CONF_IPV6_CHECKS
+#ifndef UIP_CONF_IPV6_CHECKS
/** Do we do IPv6 consistency checks (highly recommended, default: yes) */
#define UIP_CONF_IPV6_CHECKS 1
#endif
-#ifndef UIP_CONF_IPV6_REASSEMBLY
+#ifndef UIP_CONF_IPV6_REASSEMBLY
/** Do we do IPv6 fragmentation (default: no) */
#define UIP_CONF_IPV6_REASSEMBLY 0
#endif
@@ -204,14 +204,14 @@
#define UIP_CONF_NETIF_MAX_ADDRESSES 3
#endif
-#ifndef UIP_CONF_ND6_MAX_PREFIXES
+#ifndef UIP_CONF_ND6_MAX_PREFIXES
/** Default number of IPv6 prefixes associated to the node's interface */
#define UIP_CONF_ND6_MAX_PREFIXES 3
#endif
-#ifndef UIP_CONF_ND6_MAX_NEIGHBORS
+#ifndef UIP_CONF_ND6_MAX_NEIGHBORS
/** Default number of neighbors that can be stored in the %neighbor cache */
-#define UIP_CONF_ND6_MAX_NEIGHBORS 4
+#define UIP_CONF_ND6_MAX_NEIGHBORS 4
#endif
#ifndef UIP_CONF_ND6_MAX_DEFROUTERS
@@ -485,14 +485,14 @@
/**
* If we use IPHC compression, how many address contexts do we support
*/
-#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS
+#ifndef SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
#endif
/**
* Do we support 6lowpan fragmentation
*/
-#ifndef SICSLOWPAN_CONF_FRAG
+#ifndef SICSLOWPAN_CONF_FRAG
#define SICSLOWPAN_CONF_FRAG 0
#endif
@@ -690,19 +690,19 @@ typedef union
{
uint8_t CurrentState;
uint8_t NextState;
-
+
char FileName[MAX_URI_LENGTH];
FIL FileHandle;
bool FileOpen;
uint32_t ACKedFilePos;
uint16_t SentChunkSize;
} HTTPServer;
-
+
struct
{
uint8_t CurrentState;
uint8_t NextState;
-
+
uint8_t IssuedCommand;
} TELNETServer;
} uip_tcp_appstate_t;
@@ -720,7 +720,7 @@ typedef union
{
uint8_t CurrentState;
struct timer Timeout;
-
+
struct
{
uint8_t AllocatedIP[4];
@@ -735,3 +735,4 @@ typedef union
#endif /* __UIPOPT_H__ */
/** @} */
/** @} */
+
diff --git a/Projects/Webserver/USBDeviceMode.c b/Projects/Webserver/USBDeviceMode.c
index 43b5b5dc4..eed6a4ffe 100644
--- a/Projects/Webserver/USBDeviceMode.c
+++ b/Projects/Webserver/USBDeviceMode.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* USB Device Mode management functions and variables. This file contains the LUFA code required to
* manage the USB Mass Storage device mode.
*/
-
+
#include "USBDeviceMode.h"
/** LUFA Mass Storage Class driver interface configuration and state information. This structure is
@@ -105,10 +105,11 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
{
bool CommandSuccess;
-
+
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
CommandSuccess = SCSI_DecodeSCSICommand(MSInterfaceInfo);
LEDs_SetAllLEDs(LEDMASK_USB_READY);
-
+
return CommandSuccess;
}
+
diff --git a/Projects/Webserver/USBDeviceMode.h b/Projects/Webserver/USBDeviceMode.h
index 2bd7c3818..ec3e71390 100644
--- a/Projects/Webserver/USBDeviceMode.h
+++ b/Projects/Webserver/USBDeviceMode.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,7 +39,7 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/MassStorage.h>
-
+
#include "Webserver.h"
#include "Descriptors.h"
#include "Lib/SCSI.h"
@@ -53,5 +53,6 @@
void EVENT_USB_Device_UnhandledControlRequest(void);
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo);
-
+
#endif
+
diff --git a/Projects/Webserver/USBHostMode.c b/Projects/Webserver/USBHostMode.c
index d3caa4078..02be2b8f6 100644
--- a/Projects/Webserver/USBHostMode.c
+++ b/Projects/Webserver/USBHostMode.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* USB Host Mode management functions and variables. This file contains the LUFA code required to
* manage the USB RNDIS host mode.
*/
-
+
#include "USBHostMode.h"
/** LUFA RNDIS Class driver interface configuration and state information. This structure is
@@ -52,7 +52,7 @@ USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface =
.NotificationPipeNumber = 3,
.NotificationPipeDoubleBank = false,
-
+
.HostMaxPacketSize = UIP_CONF_BUFFER_SIZE,
},
};
@@ -70,7 +70,7 @@ void USBHostMode_USBTask(void)
{
case HOST_STATE_Addressed:
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
-
+
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
@@ -89,21 +89,21 @@ void USBHostMode_USBTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (RNDIS_Host_InitializeDevice(&Ethernet_RNDIS_Interface) != HOST_SENDCONTROL_Successful)
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
- break;
+ break;
}
-
+
uint32_t PacketFilter = (REMOTE_NDIS_PACKET_DIRECTED | REMOTE_NDIS_PACKET_BROADCAST);
if (RNDIS_Host_SetRNDISProperty(&Ethernet_RNDIS_Interface, OID_GEN_CURRENT_PACKET_FILTER,
&PacketFilter, sizeof(PacketFilter)) != HOST_SENDCONTROL_Successful)
@@ -112,7 +112,7 @@ void USBHostMode_USBTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
if (RNDIS_Host_QueryRNDISProperty(&Ethernet_RNDIS_Interface, OID_802_3_CURRENT_ADDRESS,
&MACAddress, sizeof(MACAddress)) != HOST_SENDCONTROL_Successful)
{
@@ -120,16 +120,16 @@ void USBHostMode_USBTask(void)
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
-
+
/* Initialize uIP stack */
uIPManagement_Init();
-
+
LEDs_SetAllLEDs(LEDMASK_USB_READY);
USB_HostState = HOST_STATE_Configured;
break;
case HOST_STATE_Configured:
uIPManagement_ManageNetwork();
-
+
break;
}
@@ -176,3 +176,4 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8
{
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
+
diff --git a/Projects/Webserver/USBHostMode.h b/Projects/Webserver/USBHostMode.h
index ab2be1217..e05c600f2 100644
--- a/Projects/Webserver/USBHostMode.h
+++ b/Projects/Webserver/USBHostMode.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,21 +39,22 @@
/* Includes: */
#include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/USB/Class/RNDIS.h>
-
+
#include "Webserver.h"
#include "Lib/uIPManagement.h"
-
+
/* External Variables: */
extern USB_ClassInfo_RNDIS_Host_t Ethernet_RNDIS_Interface;
/* Function Prototypes: */
void USBHostMode_USBTask(void);
-
+
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
-
+
#endif
+
diff --git a/Projects/Webserver/Webserver.c b/Projects/Webserver/Webserver.c
index b76d687e9..7c6ab22e9 100644
--- a/Projects/Webserver/Webserver.c
+++ b/Projects/Webserver/Webserver.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -33,7 +33,7 @@
* Main source file for the Webserver project. This file contains the main tasks of
* the project and is responsible for the initial application hardware configuration.
*/
-
+
#include "Webserver.h"
/** Main program entry point. This routine configures the hardware required by the application, then
@@ -73,3 +73,4 @@ void SetupHardware(void)
LEDs_Init();
USB_Init(USB_MODE_UID);
}
+
diff --git a/Projects/Webserver/Webserver.h b/Projects/Webserver/Webserver.h
index 970efa26f..c34279187 100644
--- a/Projects/Webserver/Webserver.h
+++ b/Projects/Webserver/Webserver.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -48,10 +48,10 @@
#include <LUFA/Drivers/Board/Dataflash.h>
#include <LUFA/Drivers/Peripheral/SPI.h>
#include <LUFA/Drivers/USB/USB.h>
-
+
#include "USBDeviceMode.h"
#include "USBHostMode.h"
-
+
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
@@ -64,7 +64,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_USB_BUSY (LEDS_LED1 | LEDS_LED3 | LEDS_LED4)
@@ -76,5 +76,6 @@
/* Function Prototypes: */
void SetupHardware(void);
-
+
#endif
+
diff --git a/Projects/Webserver/Webserver.txt b/Projects/Webserver/Webserver.txt
index 34b542e23..3fae431c2 100644
--- a/Projects/Webserver/Webserver.txt
+++ b/Projects/Webserver/Webserver.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage uIP Powered Webserver Project
*
* \section SSec_Compat Project Compatibility:
@@ -26,7 +26,7 @@
* <td>Communications Device Class (CDC) \n
* Mass Storage Device</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>Remote NDIS (Microsoft Proprietary CDC Class Networking Standard) \n
* Bulk-Only Transport</td>
@@ -45,7 +45,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* Simple HTTP webserver project. This project combines the LUFA library with the uIP TCP/IP full network stack and FatFS
* library to create a RNDIS host capable of serving out HTTP web pages to multiple hosts simultaneously. This project
@@ -111,3 +111,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/Webserver/makefile b/Projects/Webserver/makefile
index ac9d8ffcf..fe14e8c5f 100644
--- a/Projects/Webserver/makefile
+++ b/Projects/Webserver/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = USBKEY
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -131,9 +131,9 @@ LUFA_OPTS += -D UIP_CONF_TCP=1
LUFA_OPTS += -D UIP_CONF_UDP_CONNS=1
LUFA_OPTS += -D UIP_CONF_MAX_CONNECTIONS=3
LUFA_OPTS += -D UIP_CONF_MAX_LISTENPORTS=5
-LUFA_OPTS += -D UIP_URGDATA=0
+LUFA_OPTS += -D UIP_URGDATA=0
LUFA_OPTS += -D UIP_CONF_BUFFER_SIZE=1514
-LUFA_OPTS += -D UIP_ARCH_CHKSUM=0
+LUFA_OPTS += -D UIP_ARCH_CHKSUM=0
LUFA_OPTS += -D UIP_CONF_LL_802154=0
LUFA_OPTS += -D UIP_CONF_LL_80211=0
LUFA_OPTS += -D UIP_CONF_ROUTER=0
@@ -170,7 +170,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -183,7 +183,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -297,7 +297,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -310,7 +310,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -322,7 +322,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -334,7 +334,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -357,7 +357,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -391,7 +391,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -425,7 +425,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -454,7 +454,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -473,10 +473,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -541,11 +541,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -572,9 +572,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -672,14 +672,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -701,7 +701,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -745,3 +745,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/XPLAINBridge/AVRISPDescriptors.c b/Projects/XPLAINBridge/AVRISPDescriptors.c
index e8f9f8d88..7c4d1a82a 100644
--- a/Projects/XPLAINBridge/AVRISPDescriptors.c
+++ b/Projects/XPLAINBridge/AVRISPDescriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "AVRISPDescriptors.h"
@@ -45,22 +45,22 @@
USB_Descriptor_Device_t PROGMEM AVRISP_DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0xFF,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x2104,
.ReleaseNumber = VERSION_BCD(02.00),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = 0x03,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -71,41 +71,41 @@ USB_Descriptor_Device_t PROGMEM AVRISP_DeviceDescriptor =
*/
AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(AVRISP_USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
- .AVRISP_Interface =
+ .AVRISP_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0xFF,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .AVRISP_DataInEndpoint =
+ .AVRISP_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | AVRISP_DATA_IN_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AVRISP_DATA_EPSIZE,
@@ -115,7 +115,7 @@ AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
.AVRISP_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | AVRISP_DATA_OUT_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = AVRISP_DATA_EPSIZE,
@@ -130,7 +130,7 @@ AVRISP_USB_Descriptor_Configuration_t PROGMEM AVRISP_ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM AVRISP_LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -141,7 +141,7 @@ USB_Descriptor_String_t PROGMEM AVRISP_LanguageString =
USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -152,7 +152,7 @@ USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString =
USB_Descriptor_String_t PROGMEM AVRISP_ProductString =
{
.Header = {.Size = USB_STRING_LEN(22), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA AVRISP MkII Clone"
};
@@ -162,7 +162,7 @@ USB_Descriptor_String_t PROGMEM AVRISP_ProductString =
USB_Descriptor_String_t PROGMEM AVRISP_SerialString =
{
.Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String},
-
+
.UnicodeString = L"0000A00128255"
};
@@ -181,41 +181,42 @@ uint16_t AVRISP_GetDescriptor(const uint16_t wValue,
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
-
+
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &AVRISP_DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &AVRISP_ConfigurationDescriptor;
Size = sizeof(AVRISP_USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &AVRISP_LanguageString;
Size = pgm_read_byte(&AVRISP_LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &AVRISP_ManufacturerString;
Size = pgm_read_byte(&AVRISP_ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &AVRISP_ProductString;
Size = pgm_read_byte(&AVRISP_ProductString.Header.Size);
break;
case 0x03:
Address = &AVRISP_SerialString;
Size = pgm_read_byte(&AVRISP_SerialString.Header.Size);
- break;
+ break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/XPLAINBridge/AVRISPDescriptors.h b/Projects/XPLAINBridge/AVRISPDescriptors.h
index edfb37dbe..8c9bc29eb 100644
--- a/Projects/XPLAINBridge/AVRISPDescriptors.h
+++ b/Projects/XPLAINBridge/AVRISPDescriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for AVRISPDescriptors.c.
*/
-
+
#ifndef _AVRISP_DESCRIPTORS_H_
#define _AVRISP_DESCRIPTORS_H_
@@ -55,9 +55,9 @@
/** Endpoint number of the AVRISP data IN endpoint. */
#define AVRISP_DATA_IN_EPNUM 3
#endif
-
+
/** Size in bytes of the AVRISP data endpoint. */
- #define AVRISP_DATA_EPSIZE 64
+ #define AVRISP_DATA_EPSIZE 64
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
@@ -78,3 +78,4 @@
const void** const DescriptorAddress);
#endif
+
diff --git a/Projects/XPLAINBridge/Lib/LightweightRingBuff.h b/Projects/XPLAINBridge/Lib/LightweightRingBuff.h
index 768e49a50..2fbc164cb 100644
--- a/Projects/XPLAINBridge/Lib/LightweightRingBuff.h
+++ b/Projects/XPLAINBridge/Lib/LightweightRingBuff.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -39,20 +39,20 @@
* or deletions) must not overlap. If there is possibility of two or more of the same kind of
* operating occuring at the same point in time, atomic (mutex) locking should be used.
*/
-
+
#ifndef _ULW_RING_BUFF_H_
#define _ULW_RING_BUFF_H_
/* Includes: */
#include <util/atomic.h>
-
+
#include <stdint.h>
#include <stdbool.h>
/* Defines: */
/** Size of each ring buffer, in data elements - must be between 1 and 255. */
#define BUFFER_SIZE 255
-
+
/** Type of data to store into the buffer. */
#define RingBuff_Data_t uint8_t
@@ -76,7 +76,7 @@
RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */
RingBuff_Count_t Count;
} RingBuff_t;
-
+
/* Inline Functions: */
/** Initializes a ring buffer ready for use. Buffers must be initialized via this function
* before any operations are called upon them. Already initialized buffers may be reset
@@ -92,7 +92,7 @@
Buffer->Out = Buffer->Buffer;
}
}
-
+
/** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed
* by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that
* the buffer cannot be modified while the computation takes place. This value should be cached
@@ -109,15 +109,15 @@
static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer)
{
RingBuff_Count_t Count;
-
+
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
Count = Buffer->Count;
}
-
+
return Count;
}
-
+
/** Atomically determines if the specified ring buffer contains any free space. This should
* be tested before storing data to the buffer, to ensure that no data is lost due to a
* buffer overrun.
@@ -125,7 +125,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE);
@@ -142,7 +142,7 @@
* \param[in,out] Buffer Pointer to a ring buffer structure to insert into
*
* \return Boolean true if the buffer contains no free space, false otherwise
- */
+ */
static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == 0);
@@ -161,7 +161,7 @@
const RingBuff_Data_t Data)
{
*Buffer->In = Data;
-
+
if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE])
Buffer->In = Buffer->Buffer;
@@ -184,7 +184,7 @@
static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer)
{
RingBuff_Data_t Data = *Buffer->Out;
-
+
if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE])
Buffer->Out = Buffer->Buffer;
@@ -192,8 +192,9 @@
{
Buffer->Count--;
}
-
+
return Data;
}
#endif
+
diff --git a/Projects/XPLAINBridge/Lib/SoftUART.c b/Projects/XPLAINBridge/Lib/SoftUART.c
index 12fdf96bc..00bb38320 100644
--- a/Projects/XPLAINBridge/Lib/SoftUART.c
+++ b/Projects/XPLAINBridge/Lib/SoftUART.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -11,13 +11,13 @@
Copyright 2010 Peter Danneger
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -79,7 +79,7 @@ ISR(INT0_vect, ISR_BLOCK)
{
/* Reset the number of reception bits remaining counter */
RX_BitsRemaining = 8;
-
+
/* Reset the bit reception timer */
TCNT1 = 0;
@@ -120,7 +120,7 @@ ISR(TIMER1_CAPT_vect, ISR_BLOCK)
/* Reception complete, store the received byte if stop bit valid */
if (SRX_Cached)
- RingBuffer_Insert(&XMEGAtoUSB_Buffer, RX_Data);
+ RingBuffer_Insert(&XMEGAtoUSB_Buffer, RX_Data);
}
}
@@ -150,3 +150,4 @@ ISR(TIMER3_CAPT_vect, ISR_BLOCK)
TX_BitsRemaining = 9;
}
}
+
diff --git a/Projects/XPLAINBridge/Lib/SoftUART.h b/Projects/XPLAINBridge/Lib/SoftUART.h
index 923631b50..9dd81ad35 100644
--- a/Projects/XPLAINBridge/Lib/SoftUART.h
+++ b/Projects/XPLAINBridge/Lib/SoftUART.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -11,13 +11,13 @@
Copyright 2010 Peter Danneger
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -42,7 +42,7 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdbool.h>
-
+
#include "../XPLAINBridge.h"
#include "LightweightRingBuff.h"
@@ -55,11 +55,11 @@
#define STXPORT PORTD
#define STXDDR DDRD
- /* Inline Functions: */
+ /* Inline Functions: */
static inline void SoftUART_SetBaud(const uint32_t Baud)
{
uint16_t BitTime = ((F_CPU / Baud) - 1);
-
+
ICR1 = BitTime;
ICR3 = BitTime;
}
@@ -67,4 +67,4 @@
/* Function Prototypes: */
void SoftUART_Init(void);
-#endif \ No newline at end of file
+#endif
diff --git a/Projects/XPLAINBridge/USARTDescriptors.c b/Projects/XPLAINBridge/USARTDescriptors.c
index 266c8f3c2..2b1fc6293 100644
--- a/Projects/XPLAINBridge/USARTDescriptors.c
+++ b/Projects/XPLAINBridge/USARTDescriptors.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -30,9 +30,9 @@
/** \file
*
- * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
+ * USB Device Descriptors, for library use when in USB device mode. Descriptors are special
* computer-readable structures which the host requests upon device enumeration, to determine
- * the device's capabilities and functions.
+ * the device's capabilities and functions.
*/
#include "USARTDescriptors.h"
@@ -57,22 +57,22 @@
USB_Descriptor_Device_t PROGMEM USART_DeviceDescriptor =
{
.Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device},
-
+
.USBSpecification = VERSION_BCD(01.10),
.Class = 0x02,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE,
-
+
.VendorID = 0x03EB,
.ProductID = 0x204B,
.ReleaseNumber = VERSION_BCD(00.01),
-
+
.ManufacturerStrIndex = 0x01,
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
-
+
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
@@ -83,102 +83,102 @@ USB_Descriptor_Device_t PROGMEM USART_DeviceDescriptor =
*/
USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USART_USB_Descriptor_Configuration_t),
.TotalInterfaces = 2,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
+
.ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED,
-
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .CDC_CCI_Interface =
+
+ .CDC_CCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 1,
-
+
.Class = 0x02,
.SubClass = 0x02,
.Protocol = 0x01,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_Functional_Header =
+ .CDC_Functional_Header =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Header,
-
+
.CDCSpecification = VERSION_BCD(01.10),
},
- .CDC_Functional_ACM =
+ .CDC_Functional_ACM =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_ACM,
-
+
.Capabilities = 0x06,
},
-
- .CDC_Functional_Union =
+
+ .CDC_Functional_Union =
{
.Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
.Subtype = CDC_DSUBTYPE_CSInterface_Union,
-
+
.MasterInterfaceNumber = 0,
.SlaveInterfaceNumber = 1,
},
- .CDC_NotificationEndpoint =
+ .CDC_NotificationEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM),
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_NOTIFICATION_EPSIZE,
.PollingIntervalMS = 0xFF
},
- .CDC_DCI_Interface =
+ .CDC_DCI_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 1,
.AlternateSetting = 0,
-
+
.TotalEndpoints = 2,
-
+
.Class = 0x0A,
.SubClass = 0x00,
.Protocol = 0x00,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .CDC_DataOutEndpoint =
+ .CDC_DataOutEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
.PollingIntervalMS = 0x00
},
-
- .CDC_DataInEndpoint =
+
+ .CDC_DataInEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
-
+
.EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM),
.Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = CDC_TXRX_EPSIZE,
@@ -193,7 +193,7 @@ USART_USB_Descriptor_Configuration_t PROGMEM USART_ConfigurationDescriptor =
USB_Descriptor_String_t PROGMEM USART_LanguageString =
{
.Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String},
-
+
.UnicodeString = {LANGUAGE_ID_ENG}
};
@@ -204,7 +204,7 @@ USB_Descriptor_String_t PROGMEM USART_LanguageString =
USB_Descriptor_String_t PROGMEM USART_ManufacturerString =
{
.Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String},
-
+
.UnicodeString = L"Dean Camera"
};
@@ -215,7 +215,7 @@ USB_Descriptor_String_t PROGMEM USART_ManufacturerString =
USB_Descriptor_String_t PROGMEM USART_ProductString =
{
.Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String},
-
+
.UnicodeString = L"LUFA XPLAIN Bridge"
};
@@ -234,34 +234,35 @@ uint16_t USART_GetDescriptor(const uint16_t wValue,
switch (DescriptorType)
{
- case DTYPE_Device:
+ case DTYPE_Device:
Address = &USART_DeviceDescriptor;
Size = sizeof(USB_Descriptor_Device_t);
break;
- case DTYPE_Configuration:
+ case DTYPE_Configuration:
Address = &USART_ConfigurationDescriptor;
Size = sizeof(USART_USB_Descriptor_Configuration_t);
break;
- case DTYPE_String:
+ case DTYPE_String:
switch (DescriptorNumber)
{
- case 0x00:
+ case 0x00:
Address = &USART_LanguageString;
Size = pgm_read_byte(&USART_LanguageString.Header.Size);
break;
- case 0x01:
+ case 0x01:
Address = &USART_ManufacturerString;
Size = pgm_read_byte(&USART_ManufacturerString.Header.Size);
break;
- case 0x02:
+ case 0x02:
Address = &USART_ProductString;
Size = pgm_read_byte(&USART_ProductString.Header.Size);
break;
}
-
+
break;
}
-
+
*DescriptorAddress = Address;
return Size;
}
+
diff --git a/Projects/XPLAINBridge/USARTDescriptors.h b/Projects/XPLAINBridge/USARTDescriptors.h
index cac0a987d..0287e81ae 100644
--- a/Projects/XPLAINBridge/USARTDescriptors.h
+++ b/Projects/XPLAINBridge/USARTDescriptors.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -32,7 +32,7 @@
*
* Header file for USARTDescriptors.c.
*/
-
+
#ifndef _USART_DESCRIPTORS_H_
#define _USART_DESCRIPTORS_H_
@@ -47,17 +47,17 @@
#define CDC_NOTIFICATION_EPNUM 2
/** Endpoint number of the CDC device-to-host data IN endpoint. */
- #define CDC_TX_EPNUM 3
+ #define CDC_TX_EPNUM 3
/** Endpoint number of the CDC host-to-device data OUT endpoint. */
- #define CDC_RX_EPNUM 4
+ #define CDC_RX_EPNUM 4
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
-
+
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
@@ -82,3 +82,4 @@
const void** const DescriptorAddress);
#endif
+
diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c
index 0764bb9a8..24aa383db 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.c
+++ b/Projects/XPLAINBridge/XPLAINBridge.c
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -45,7 +45,7 @@ bool CurrentFirmwareMode = MODE_USART_BRIDGE;
*/
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
- .Config =
+ .Config =
{
.ControlInterfaceNumber = 0,
@@ -100,7 +100,7 @@ void AVRISP_Task(void)
V2Params_UpdateParamValues();
Endpoint_SelectEndpoint(AVRISP_DATA_OUT_EPNUM);
-
+
/* Check to see if a V2 Protocol command has been received */
if (Endpoint_IsOUTReceived())
{
@@ -123,7 +123,7 @@ void UARTBridge_Task(void)
int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
if (!(ReceivedByte < 0) && !(RingBuffer_IsFull(&USBtoUART_Buffer)))
RingBuffer_Insert(&USBtoUART_Buffer, ReceivedByte);
-
+
/* Check if the UART receive buffer flush timer has expired or buffer is nearly full */
RingBuff_Count_t BufferCount = RingBuffer_GetCount(&UARTtoUSB_Buffer);
if ((TIFR0 & (1 << TOV0)) || (BufferCount > 200))
@@ -185,7 +185,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
/* Initialize ring buffers used to hold serial data between USB and software UART interfaces */
RingBuffer_InitBuffer(&USBtoUART_Buffer);
RingBuffer_InitBuffer(&UARTtoUSB_Buffer);
-
+
/* Start the software USART */
SoftUART_Init();
}
@@ -198,7 +198,7 @@ void EVENT_USB_Device_ConfigurationChanged(void)
ConfigSuccess &= Endpoint_ConfigureEndpoint(AVRISP_DATA_IN_EPNUM, EP_TYPE_BULK, ENDPOINT_DIR_IN,
AVRISP_DATA_EPSIZE, ENDPOINT_BANK_SINGLE);
#endif
-
+
/* Configure the V2 protocol packet handler */
V2Protocol_Init();
}
@@ -257,3 +257,4 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
else
return AVRISP_GetDescriptor(wValue, wIndex, DescriptorAddress);
}
+
diff --git a/Projects/XPLAINBridge/XPLAINBridge.h b/Projects/XPLAINBridge/XPLAINBridge.h
index 74fa4458d..ac4378dc7 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.h
+++ b/Projects/XPLAINBridge/XPLAINBridge.h
@@ -1,7 +1,7 @@
/*
LUFA Library
Copyright (C) Dean Camera, 2010.
-
+
dean [at] fourwalledcubicle [dot] com
www.fourwalledcubicle.com
*/
@@ -9,13 +9,13 @@
/*
Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
- Permission to use, copy, modify, distribute, and sell this
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
+ without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
+ permission notice and warranty disclaimer appear in supporting
+ documentation, and that the name of the author not be used in
+ advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
@@ -66,7 +66,7 @@
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR LEDS_LED1
-
+
/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
#define LEDMASK_BUSY LEDS_LED1
@@ -80,7 +80,7 @@
extern bool CurrentFirmwareMode;
extern RingBuff_t UARTtoUSB_Buffer;
extern RingBuff_t USBtoUART_Buffer;
-
+
/* Function Prototypes: */
void SetupHardware(void);
void AVRISP_Task(void);
@@ -89,7 +89,7 @@
void EVENT_USB_Device_ConfigurationChanged(void);
void EVENT_USB_Device_UnhandledControlRequest(void);
void EVENT_USB_Device_Connect(void);
- void EVENT_USB_Device_Disconnect(void);
+ void EVENT_USB_Device_Disconnect(void);
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo);
@@ -99,3 +99,4 @@
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif
+
diff --git a/Projects/XPLAINBridge/XPLAINBridge.txt b/Projects/XPLAINBridge/XPLAINBridge.txt
index fe7e739f1..42943101f 100644
--- a/Projects/XPLAINBridge/XPLAINBridge.txt
+++ b/Projects/XPLAINBridge/XPLAINBridge.txt
@@ -3,7 +3,7 @@
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
-
+
/** \mainpage XPLAIN UART Bridge/PDI Programmer Project
*
* \section SSec_Compat Project Compatibility:
@@ -27,7 +27,7 @@
* <td>1) Communications Device Class (CDC)</td>
* <td>2) Vendor Specific Class</td>
* </tr>
- * <tr>
+ * <tr>
* <td><b>USB Subclass:</b></td>
* <td>1) Abstract Control Model (ACM)</td>
* <td>2) N/A</td>
@@ -44,7 +44,7 @@
* </tr>
* </table>
*
- * \section SSec_Description Project Description:
+ * \section SSec_Description Project Description:
*
* This project serves a dual purpose. When loaded into the USB AVR on the XPLAIN board, it will act as either a USB to Serial
* converter for the XPLAIN's hardware USART (at a speed of 9600 baud), or an AVRStudio compatible PDI programmer for the XMEGA.
@@ -91,3 +91,4 @@
* </tr>
* </table>
*/
+
diff --git a/Projects/XPLAINBridge/makefile b/Projects/XPLAINBridge/makefile
index 542b928e4..1416f8133 100644
--- a/Projects/XPLAINBridge/makefile
+++ b/Projects/XPLAINBridge/makefile
@@ -47,7 +47,7 @@
# make doxygen = Generate DoxyGen documentation for the project (must have
# DoxyGen installed)
#
-# make debug = Start either simulavr or avarice as specified for debugging,
+# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
@@ -64,14 +64,14 @@ MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
-# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
+# LUFA board drivers). If USER is selected, put custom board drivers in a directory called
# "Board" inside the application directory.
BOARD = XPLAIN
# Processor frequency.
-# This will define a symbol, F_CPU, in all source code files equal to the
-# processor frequency in Hz. You can then use this symbol in your source code to
+# This will define a symbol, F_CPU, in all source code files equal to the
+# processor frequency in Hz. You can then use this symbol in your source code to
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
# automatically to create a 32-bit value in your source code.
#
@@ -84,7 +84,7 @@ F_CPU = 8000000
# Input clock frequency.
-# This will define a symbol, F_CLOCK, in all source code files equal to the
+# This will define a symbol, F_CLOCK, in all source code files equal to the
# input clock frequency (before any prescaling is performed) in Hz. This value may
# differ from F_CPU if prescaling is used on the latter, and is required as the
# raw input clock is fed directly to the PLL sections of the AVR for high speed
@@ -161,7 +161,7 @@ SRC = $(TARGET).c \
# List C++ source files here. (C dependencies are automatically generated.)
-CPPSRC =
+CPPSRC =
# List Assembler source files here.
@@ -174,7 +174,7 @@ CPPSRC =
ASRC =
-# Optimization level, can be [0, 1, 2, 3, s].
+# Optimization level, can be [0, 1, 2, 3, s].
# 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s
@@ -288,7 +288,7 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
# for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there]
-# -listing-cont-lines: Sets the maximum number of continuation lines of hex
+# -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input.
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100
@@ -301,7 +301,7 @@ PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt
# If this is left blank, then it will use the Standard printf version.
-PRINTF_LIB =
+PRINTF_LIB =
#PRINTF_LIB = $(PRINTF_LIB_MIN)
#PRINTF_LIB = $(PRINTF_LIB_FLOAT)
@@ -313,7 +313,7 @@ SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt
# If this is left blank, then it will use the Standard scanf version.
-SCANF_LIB =
+SCANF_LIB =
#SCANF_LIB = $(SCANF_LIB_MIN)
#SCANF_LIB = $(SCANF_LIB_FLOAT)
@@ -325,7 +325,7 @@ MATH_LIB = -lm
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRALIBDIRS =
+EXTRALIBDIRS =
@@ -348,7 +348,7 @@ EXTMEMOPTS =
# -Map: create map file
# --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
-LDFLAGS += -Wl,--relax
+LDFLAGS += -Wl,--relax
LDFLAGS += -Wl,--gc-sections
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -382,7 +382,7 @@ AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_NO_VERIFY = -V
# Increase verbosity level. Please use this when submitting bug
-# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
+# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude>
# to submit bug reports.
#AVRDUDE_VERBOSE = -v -v
@@ -416,7 +416,7 @@ JTAG_DEV = /dev/com1
DEBUG_PORT = 4242
# Debugging host used to communicate between GDB / avarice / simulavr, normally
-# just set to localhost unless doing some sort of crazy debugging when
+# just set to localhost unless doing some sort of crazy debugging when
# avarice is running on a different computer.
DEBUG_HOST = localhost
@@ -445,7 +445,7 @@ WINSHELL = cmd
MSG_ERRORS_NONE = Errors: none
MSG_BEGIN = -------- begin --------
MSG_END = -------- end --------
-MSG_SIZE_BEFORE = Size before:
+MSG_SIZE_BEFORE = Size before:
MSG_SIZE_AFTER = Size after:
MSG_COFF = Converting to AVR COFF:
MSG_EXTENDED_COFF = Converting to AVR Extended COFF:
@@ -464,10 +464,10 @@ MSG_CREATING_LIBRARY = Creating library:
# Define all object files.
-OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o)
# Define all listing files.
-LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
+LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst)
# Compiler flags to generate dependency files.
@@ -532,11 +532,11 @@ sizeafter:
# Display compiler version information.
-gccversion :
+gccversion :
@$(CC) --version
-# Program the device.
+# Program the device.
program: $(TARGET).hex $(TARGET).eep
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
@@ -563,9 +563,9 @@ dfu-ee: $(TARGET).hex $(TARGET).eep
# Generate avr-gdb config/init file which does the following:
-# define the reset signal, load the target file, connect to target, and set
+# define the reset signal, load the target file, connect to target, and set
# a breakpoint at main().
-gdb-config:
+gdb-config:
@$(REMOVE) $(GDBINIT_FILE)
@echo define reset >> $(GDBINIT_FILE)
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE)
@@ -663,14 +663,14 @@ extcoff: $(TARGET).elf
$(OBJDIR)/%.o : %.c
@echo
@echo $(MSG_COMPILING) $<
- $(CC) -c $(ALL_CFLAGS) $< -o $@
+ $(CC) -c $(ALL_CFLAGS) $< -o $@
# Compile: create object files from C++ source files.
$(OBJDIR)/%.o : %.cpp
@echo
@echo $(MSG_COMPILING_CPP) $<
- $(CC) -c $(ALL_CPPFLAGS) $< -o $@
+ $(CC) -c $(ALL_CPPFLAGS) $< -o $@
# Compile: create assembler files from C source files.
@@ -692,7 +692,7 @@ $(OBJDIR)/%.o : %.S
# Create preprocessed source for use in sending a bug report.
%.i : %.c
- $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
+ $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@
# Target: clean project.
@@ -736,3 +736,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
build elf hex eep lss sym coff extcoff doxygen clean \
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \
debug gdb-config
+
diff --git a/Projects/makefile b/Projects/makefile
index 321086428..19e3d3e99 100644
--- a/Projects/makefile
+++ b/Projects/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -37,7 +37,7 @@ all:
$(MAKE) -C USBtoSerial clean
$(MAKE) -C USBtoSerial all
-
+
$(MAKE) -C Webserver clean
$(MAKE) -C Webserver all
@@ -47,7 +47,7 @@ all:
%:
$(MAKE) -C AVRISP-MKII $@
$(MAKE) -C Benito $@
- $(MAKE) -C LEDNotifier $@
+ $(MAKE) -C LEDNotifier $@
$(MAKE) -C Magstripe $@
$(MAKE) -C MissileLauncher $@
$(MAKE) -C RelayBoard $@
@@ -55,3 +55,4 @@ all:
$(MAKE) -C USBtoSerial $@
$(MAKE) -C Webserver $@
$(MAKE) -C XPLAINBridge $@
+
diff --git a/README.txt b/README.txt
index 44cceaf07..fd4b79666 100644
--- a/README.txt
+++ b/README.txt
@@ -1,6 +1,6 @@
- _ _ _ ___ _
- | | | | | __/ \
+ _ _ _ ___ _
+ | | | | | __/ \
| |_| U | _| o | - The Lightweight USB
|___|___|_||_n_| Framework for AVRs
=========================================
@@ -10,7 +10,7 @@
http://www.fourwalledcubicle.com/LUFA.php
=========================================
- LUFA is donation supported. To support LUFA,
+ LUFA is donation supported. To support LUFA,
please donate at http://www.fourwalledcubicle.com.
For Commercial Licensing information, see
@@ -29,7 +29,7 @@ package in your chosen package management tool - under Ubuntu, this can be
achieved by running the following command in the terminal:
sudo apt-get install doxygen
-
+
Other package managers and distributions will have similar methods to
install Doxygen. In Windows, you can download a prebuilt installer for
Doxygen from its website, www.doxygen.org.
@@ -50,3 +50,4 @@ The documentation for the library itself (but not the documentation for the
individual demos, projects or bootloaders) is also available as a separate
package from the project webpage for convenience if Doxygen cannot be
installed.
+
diff --git a/makefile b/makefile
index 4fc793a46..149bcc45e 100644
--- a/makefile
+++ b/makefile
@@ -1,7 +1,7 @@
#
# LUFA Library
# Copyright (C) Dean Camera, 2010.
-#
+#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
@@ -24,3 +24,4 @@ all:
$(MAKE) -C Bootloaders $@ -s
@echo
@echo LUFA \"make $@\" operation complete.
+