diff --git a/leaf-can-bridge-3-port-CCS/Debug/Descriptors.d b/leaf-can-bridge-3-port-CCS/Debug/Descriptors.d new file mode 100644 index 0000000..0da3df3 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/Descriptors.d @@ -0,0 +1,341 @@ +Descriptors.d Descriptors.o: .././Descriptors.c .././Descriptors.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + .././LUFA/Drivers/USB/USB.h .././LUFA/Drivers/USB/../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + .././LUFA/Drivers/USB/../../Common/Architectures.h \ + .././LUFA/Drivers/USB/../../Common/BoardTypes.h \ + .././LUFA/Drivers/USB/../../Common/ArchitectureSpecific.h \ + .././LUFA/Drivers/USB/../../Common/CompilerSpecific.h \ + .././LUFA/Drivers/USB/../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + .././LUFA/Drivers/USB/../../Common/Endianness.h \ + .././LUFA/Drivers/USB/Core/USBMode.h \ + .././LUFA/Drivers/USB/Core/../../../Common/Common.h \ + .././LUFA/Drivers/USB/Core/USBTask.h \ + .././LUFA/Drivers/USB/Core/USBMode.h \ + .././LUFA/Drivers/USB/Core/USBController.h \ + .././LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Device.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBController.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h \ + .././LUFA/Drivers/USB/Core/Events.h \ + .././LUFA/Drivers/USB/Core/StdRequestType.h \ + .././LUFA/Drivers/USB/Core/StdDescriptors.h \ + .././LUFA/Drivers/USB/Core/DeviceStandardReq.h \ + .././LUFA/Drivers/USB/Core/Events.h \ + .././LUFA/Drivers/USB/Core/StdDescriptors.h \ + .././LUFA/Drivers/USB/Core/ConfigDescriptors.h \ + .././LUFA/Drivers/USB/Core/HostStandardReq.h \ + .././LUFA/Drivers/USB/Core/USBController.h \ + .././LUFA/Drivers/USB/Core/USBInterrupt.h \ + .././LUFA/Drivers/USB/Core/Device.h \ + .././LUFA/Drivers/USB/Core/Endpoint.h \ + .././LUFA/Drivers/USB/Core/DeviceStandardReq.h \ + .././LUFA/Drivers/USB/Core/EndpointStream.h \ + .././LUFA/Drivers/USB/Class/AndroidAccessoryClass.h \ + .././LUFA/Drivers/USB/Class/../Core/USBMode.h \ + .././LUFA/Drivers/USB/Class/AudioClass.h \ + .././LUFA/Drivers/USB/Class/Device/AudioClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../../USB.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/AudioClassCommon.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/../../Core/StdDescriptors.h \ + .././LUFA/Drivers/USB/Class/CDCClass.h \ + .././LUFA/Drivers/USB/Class/Device/CDCClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdio.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdarg.h \ + .././LUFA/Drivers/USB/Class/HIDClass.h \ + .././LUFA/Drivers/USB/Class/Device/HIDClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/HIDClassCommon.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/HIDParser.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/../../../../Common/Common.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/HIDReportData.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/HIDClassCommon.h \ + .././LUFA/Drivers/USB/Class/MassStorageClass.h \ + .././LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/MassStorageClassCommon.h \ + .././LUFA/Drivers/USB/Class/MIDIClass.h \ + .././LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/MIDIClassCommon.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/AudioClassCommon.h \ + .././LUFA/Drivers/USB/Class/PrinterClass.h \ + .././LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/PrinterClassCommon.h \ + .././LUFA/Drivers/USB/Class/RNDISClass.h \ + .././LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/RNDISClassCommon.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h \ + .././LUFA/Drivers/USB/Class/StillImageClass.h + +.././Descriptors.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +.././LUFA/Drivers/USB/USB.h: + +.././LUFA/Drivers/USB/../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +.././LUFA/Drivers/USB/../../Common/Architectures.h: + +.././LUFA/Drivers/USB/../../Common/BoardTypes.h: + +.././LUFA/Drivers/USB/../../Common/ArchitectureSpecific.h: + +.././LUFA/Drivers/USB/../../Common/CompilerSpecific.h: + +.././LUFA/Drivers/USB/../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +.././LUFA/Drivers/USB/../../Common/Endianness.h: + +.././LUFA/Drivers/USB/Core/USBMode.h: + +.././LUFA/Drivers/USB/Core/../../../Common/Common.h: + +.././LUFA/Drivers/USB/Core/USBTask.h: + +.././LUFA/Drivers/USB/Core/USBMode.h: + +.././LUFA/Drivers/USB/Core/USBController.h: + +.././LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Device.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBController.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h: + +.././LUFA/Drivers/USB/Core/Events.h: + +.././LUFA/Drivers/USB/Core/StdRequestType.h: + +.././LUFA/Drivers/USB/Core/StdDescriptors.h: + +.././LUFA/Drivers/USB/Core/DeviceStandardReq.h: + +.././LUFA/Drivers/USB/Core/Events.h: + +.././LUFA/Drivers/USB/Core/StdDescriptors.h: + +.././LUFA/Drivers/USB/Core/ConfigDescriptors.h: + +.././LUFA/Drivers/USB/Core/HostStandardReq.h: + +.././LUFA/Drivers/USB/Core/USBController.h: + +.././LUFA/Drivers/USB/Core/USBInterrupt.h: + +.././LUFA/Drivers/USB/Core/Device.h: + +.././LUFA/Drivers/USB/Core/Endpoint.h: + +.././LUFA/Drivers/USB/Core/DeviceStandardReq.h: + +.././LUFA/Drivers/USB/Core/EndpointStream.h: + +.././LUFA/Drivers/USB/Class/AndroidAccessoryClass.h: + +.././LUFA/Drivers/USB/Class/../Core/USBMode.h: + +.././LUFA/Drivers/USB/Class/AudioClass.h: + +.././LUFA/Drivers/USB/Class/Device/AudioClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../../USB.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/AudioClassCommon.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/../../Core/StdDescriptors.h: + +.././LUFA/Drivers/USB/Class/CDCClass.h: + +.././LUFA/Drivers/USB/Class/Device/CDCClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdio.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdarg.h: + +.././LUFA/Drivers/USB/Class/HIDClass.h: + +.././LUFA/Drivers/USB/Class/Device/HIDClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/HIDClassCommon.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/HIDParser.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/../../../../Common/Common.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/HIDReportData.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/HIDClassCommon.h: + +.././LUFA/Drivers/USB/Class/MassStorageClass.h: + +.././LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/MassStorageClassCommon.h: + +.././LUFA/Drivers/USB/Class/MIDIClass.h: + +.././LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/MIDIClassCommon.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/AudioClassCommon.h: + +.././LUFA/Drivers/USB/Class/PrinterClass.h: + +.././LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/PrinterClassCommon.h: + +.././LUFA/Drivers/USB/Class/RNDISClass.h: + +.././LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/RNDISClassCommon.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h: + +.././LUFA/Drivers/USB/Class/StillImageClass.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/Descriptors.o b/leaf-can-bridge-3-port-CCS/Debug/Descriptors.o new file mode 100644 index 0000000..07749c9 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/Descriptors.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/FLASH.BIN b/leaf-can-bridge-3-port-CCS/Debug/FLASH.BIN new file mode 100644 index 0000000..690b93e Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/FLASH.BIN differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Class/Device/CDCClassDevice.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Class/Device/CDCClassDevice.d new file mode 100644 index 0000000..53f7aad --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Class/Device/CDCClassDevice.d @@ -0,0 +1,348 @@ +LUFA/Drivers/USB/Class/Device/CDCClassDevice.d \ + LUFA/Drivers/USB/Class/Device/CDCClassDevice.o: \ + ../LUFA/Drivers/USB/Class/Device/CDCClassDevice.c \ + ../LUFA/Drivers/USB/Class/Device/../../Core/USBMode.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Class/Device/CDCClassDevice.h \ + ../LUFA/Drivers/USB/Class/Device/../../USB.h \ + ../LUFA/Drivers/USB/Class/Device/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/USBMode.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/USBTask.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/USBMode.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/USBController.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/USBController_XMEGA.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/Endpoint_XMEGA.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/Device_XMEGA.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../EndpointStream.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/Events.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/StdRequestType.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/StdDescriptors.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/Events.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/StdDescriptors.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/ConfigDescriptors.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/HostStandardReq.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/USBController.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/USBInterrupt.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/Device.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/Endpoint.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Class/Device/../../Core/EndpointStream.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/AndroidAccessoryClass.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/../Core/USBMode.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/AudioClass.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/AudioClassDevice.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../../USB.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/AudioClassCommon.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/../../Core/StdDescriptors.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/CDCClass.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/CDCClassDevice.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/HIDClass.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/HIDClassDevice.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/HIDClassCommon.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/HIDParser.h \ + c:\users\dalat\documents\atmel\ studio\leaf-can-bridge-3-port-master\lufa\common\common.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/HIDReportData.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/HIDClassCommon.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/MassStorageClass.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/MassStorageClassDevice.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/MassStorageClassCommon.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/MIDIClass.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/MIDIClassDevice.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/MIDIClassCommon.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/AudioClassCommon.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/PrinterClass.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/PrinterClassDevice.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/PrinterClassCommon.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdio.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdarg.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/RNDISClass.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/RNDISClassDevice.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/RNDISClassCommon.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/CDCClassCommon.h \ + ../LUFA/Drivers/USB/Class/Device/../../Class/StillImageClass.h \ + ../LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h + +../LUFA/Drivers/USB/Class/Device/../../Core/USBMode.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Class/Device/CDCClassDevice.h: + +../LUFA/Drivers/USB/Class/Device/../../USB.h: + +../LUFA/Drivers/USB/Class/Device/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/USBMode.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/USBTask.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/USBMode.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/USBController.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/USBController_XMEGA.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Events.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Device.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Events.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/Endpoint_XMEGA.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/Device_XMEGA.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../EndpointStream.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/Events.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/StdRequestType.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/StdDescriptors.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/DeviceStandardReq.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/Events.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/StdDescriptors.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/ConfigDescriptors.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/HostStandardReq.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/USBController.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/USBInterrupt.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/Device.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/Endpoint.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/DeviceStandardReq.h: + +../LUFA/Drivers/USB/Class/Device/../../Core/EndpointStream.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/AndroidAccessoryClass.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/../Core/USBMode.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/AudioClass.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/AudioClassDevice.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../../USB.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/AudioClassCommon.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/../../Core/StdDescriptors.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/CDCClass.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/CDCClassDevice.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/HIDClass.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/HIDClassDevice.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/HIDClassCommon.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/HIDParser.h: + +c:\users\dalat\documents\atmel\ studio\leaf-can-bridge-3-port-master\lufa\common\common.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/HIDReportData.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/HIDClassCommon.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/MassStorageClass.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/MassStorageClassDevice.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/MassStorageClassCommon.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/MIDIClass.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/MIDIClassDevice.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/MIDIClassCommon.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/AudioClassCommon.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/PrinterClass.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/PrinterClassDevice.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/PrinterClassCommon.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdio.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdarg.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/RNDISClass.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/RNDISClassDevice.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/RNDISClassCommon.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/Device/../Common/CDCClassCommon.h: + +../LUFA/Drivers/USB/Class/Device/../../Class/StillImageClass.h: + +../LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Class/Device/CDCClassDevice.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Class/Device/CDCClassDevice.o new file mode 100644 index 0000000..142f392 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Class/Device/CDCClassDevice.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/ConfigDescriptors.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/ConfigDescriptors.d new file mode 100644 index 0000000..2c51da6 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/ConfigDescriptors.d @@ -0,0 +1,201 @@ +LUFA/Drivers/USB/Core/ConfigDescriptors.d \ + LUFA/Drivers/USB/Core/ConfigDescriptors.o: \ + ../LUFA/Drivers/USB/Core/ConfigDescriptors.c \ + ../LUFA/Drivers/USB/Core/ConfigDescriptors.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/USBMode.h \ + ../LUFA/Drivers/USB/Core/HostStandardReq.h \ + ../LUFA/Drivers/USB/Core/StdRequestType.h \ + ../LUFA/Drivers/USB/Core/USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h \ + ../LUFA/Drivers/USB/Core/StdDescriptors.h + +../LUFA/Drivers/USB/Core/ConfigDescriptors.h: + +../LUFA/Drivers/USB/Core/../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/USBMode.h: + +../LUFA/Drivers/USB/Core/HostStandardReq.h: + +../LUFA/Drivers/USB/Core/StdRequestType.h: + +../LUFA/Drivers/USB/Core/USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Device.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h: + +../LUFA/Drivers/USB/Core/StdDescriptors.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/ConfigDescriptors.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/ConfigDescriptors.o new file mode 100644 index 0000000..2eaa7c7 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/ConfigDescriptors.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/DeviceStandardReq.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/DeviceStandardReq.d new file mode 100644 index 0000000..b8a1a99 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/DeviceStandardReq.d @@ -0,0 +1,189 @@ +LUFA/Drivers/USB/Core/DeviceStandardReq.d \ + LUFA/Drivers/USB/Core/DeviceStandardReq.o: \ + ../LUFA/Drivers/USB/Core/DeviceStandardReq.c \ + ../LUFA/Drivers/USB/Core/USBMode.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/Events.h \ + ../LUFA/Drivers/USB/Core/StdRequestType.h \ + ../LUFA/Drivers/USB/Core/USBTask.h \ + ../LUFA/Drivers/USB/Core/USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h + +../LUFA/Drivers/USB/Core/USBMode.h: + +../LUFA/Drivers/USB/Core/../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/StdDescriptors.h: + +../LUFA/Drivers/USB/Core/Events.h: + +../LUFA/Drivers/USB/Core/StdRequestType.h: + +../LUFA/Drivers/USB/Core/USBTask.h: + +../LUFA/Drivers/USB/Core/USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Device.h: + +../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/DeviceStandardReq.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/DeviceStandardReq.o new file mode 100644 index 0000000..0671242 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/DeviceStandardReq.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/Events.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/Events.d new file mode 100644 index 0000000..125efdd --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/Events.d @@ -0,0 +1,91 @@ +LUFA/Drivers/USB/Core/Events.d LUFA/Drivers/USB/Core/Events.o: \ + ../LUFA/Drivers/USB/Core/Events.c ../LUFA/Drivers/USB/Core/Events.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/USBMode.h + +../LUFA/Drivers/USB/Core/Events.h: + +../LUFA/Drivers/USB/Core/../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/USBMode.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/Events.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/Events.o new file mode 100644 index 0000000..f3b8c41 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/Events.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/USBTask.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/USBTask.d new file mode 100644 index 0000000..cee11a2 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/USBTask.d @@ -0,0 +1,199 @@ +LUFA/Drivers/USB/Core/USBTask.d LUFA/Drivers/USB/Core/USBTask.o: \ + ../LUFA/Drivers/USB/Core/USBTask.c ../LUFA/Drivers/USB/Core/USBTask.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/USBMode.h \ + ../LUFA/Drivers/USB/Core/USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h \ + ../LUFA/Drivers/USB/Core/Events.h \ + ../LUFA/Drivers/USB/Core/StdRequestType.h \ + ../LUFA/Drivers/USB/Core/StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/DeviceStandardReq.h + +../LUFA/Drivers/USB/Core/USBTask.h: + +../LUFA/Drivers/USB/Core/../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/USBMode.h: + +../LUFA/Drivers/USB/Core/USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Device.h: + +../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h: + +../LUFA/Drivers/USB/Core/Events.h: + +../LUFA/Drivers/USB/Core/StdRequestType.h: + +../LUFA/Drivers/USB/Core/StdDescriptors.h: + +../LUFA/Drivers/USB/Core/DeviceStandardReq.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/USBTask.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/USBTask.o new file mode 100644 index 0000000..25a1567 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/USBTask.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.d new file mode 100644 index 0000000..465fcc8 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.d @@ -0,0 +1,219 @@ +LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.d \ + LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBController_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/Endpoint_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../EndpointStream.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Device.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBController_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Device.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/Endpoint_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../EndpointStream.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o new file mode 100644 index 0000000..c0dad08 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.d new file mode 100644 index 0000000..7b88fbf --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.d @@ -0,0 +1,219 @@ +LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.d \ + LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBController_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/Endpoint_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/Device_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../EndpointStream.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c \ + ../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c \ + ../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBController_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Device.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/Endpoint_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/Device_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../EndpointStream.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c: + +../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c: + +../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o new file mode 100644 index 0000000..604393e Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.d new file mode 100644 index 0000000..882444a --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.d @@ -0,0 +1,225 @@ +LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.d \ + LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBController_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/Device_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../EndpointStream.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBController_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Device.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/Device_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../EndpointStream.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o new file mode 100644 index 0000000..7a0c15f Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.d new file mode 100644 index 0000000..fa0d2f7 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.d @@ -0,0 +1,93 @@ +LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.d \ + LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o new file mode 100644 index 0000000..1472433 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.d new file mode 100644 index 0000000..858b96f --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.d @@ -0,0 +1,93 @@ +LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.d \ + LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o new file mode 100644 index 0000000..aed7794 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.d new file mode 100644 index 0000000..dab4638 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.d @@ -0,0 +1,90 @@ +LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.d \ + LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o new file mode 100644 index 0000000..bb19df4 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.d new file mode 100644 index 0000000..95358da --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.d @@ -0,0 +1,3 @@ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.d \ + LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o new file mode 100644 index 0000000..a92ab9a Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.d new file mode 100644 index 0000000..b6c5bd6 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.d @@ -0,0 +1,3 @@ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.d \ + LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o new file mode 100644 index 0000000..0ce71eb Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.d new file mode 100644 index 0000000..88b1cd7 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.d @@ -0,0 +1,3 @@ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.d \ + LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o new file mode 100644 index 0000000..2146cbe Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.d new file mode 100644 index 0000000..657c868 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.d @@ -0,0 +1,192 @@ +LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.d \ + LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBController_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/Endpoint_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/Device_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../EndpointStream.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBController_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Device.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/Endpoint_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/Device_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../EndpointStream.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o new file mode 100644 index 0000000..0188dcb Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.d b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.d new file mode 100644 index 0000000..061e40c --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.d @@ -0,0 +1,207 @@ +LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.d \ + LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o: \ + ../LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBController_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdRequestType.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Device.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/Endpoint_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBTask.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBController.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/Device_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../EndpointStream.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h \ + ../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBMode.h + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Architectures.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/BoardTypes.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/ArchitectureSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/CompilerSpecific.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Attributes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Endianness.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/USBController_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBMode.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Events.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdRequestType.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Device.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/Endpoint_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../../../../Common/Common.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBTask.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBInterrupt.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBController.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/Device_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../StdDescriptors.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../Endpoint.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../DeviceStandardReq.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../EndpointStream.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/EndpointStream_XMEGA.h: + +../LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../XMEGA/../XMEGA/../USBMode.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o new file mode 100644 index 0000000..c2d3a19 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/Makefile b/leaf-can-bridge-3-port-CCS/Debug/Makefile new file mode 100644 index 0000000..4958252 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/Makefile @@ -0,0 +1,386 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +SHELL := cmd.exe +RM := rm -rf + +USER_OBJS := + +LIBS := +PROJ := + +O_SRCS := +C_SRCS := +S_SRCS := +S_UPPER_SRCS := +OBJ_SRCS := +ASM_SRCS := +PREPROCESSING_SRCS := +OBJS := +OBJS_AS_ARGS := +C_DEPS := +C_DEPS_AS_ARGS := +EXECUTABLES := +OUTPUT_FILE_PATH := +OUTPUT_FILE_PATH_AS_ARGS := +AVR_APP_PATH :=$$$AVR_APP_PATH$$$ +QUOTE := " +ADDITIONAL_DEPENDENCIES:= +OUTPUT_FILE_DEP:= +LIB_DEP:= +LINKER_SCRIPT_DEP:= + +# Every subdirectory with source files must be described here +SUBDIRS := \ +../LUFA/ \ +../LUFA/ \ +../LUFA/Common/ \ +../LUFA/Common/ \ +../LUFA/Drivers/ \ +../LUFA/Drivers/ \ +../LUFA/Drivers/USB/ \ +../LUFA/Drivers/USB/ \ +../LUFA/Drivers/USB/Class/ \ +../LUFA/Drivers/USB/Class/ \ +../LUFA/Drivers/USB/Class/Common/ \ +../LUFA/Drivers/USB/Class/Device/ \ +../LUFA/Drivers/USB/Class/Device/ \ +../LUFA/Drivers/USB/Core/ \ +../LUFA/Drivers/USB/Core/ \ +../LUFA/Drivers/USB/Core/XMEGA/ \ +../LUFA/Drivers/USB/Core/XMEGA/ \ +../LUFA/Drivers/USB/Core/XMEGA/Template/ \ +../LUFA/Drivers/USB/Core/XMEGA/Template/ + + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../Descriptors.c \ +../helper_functions.c \ +../LUFA/Drivers/USB/Class/Device/CDCClassDevice.c \ +../LUFA/Drivers/USB/Core/ConfigDescriptors.c \ +../LUFA/Drivers/USB/Core/DeviceStandardReq.c \ +../LUFA/Drivers/USB/Core/Events.c \ +../LUFA/Drivers/USB/Core/USBTask.c \ +../LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c \ +../LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c \ +../LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c \ +../LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c \ +../LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c \ +../LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c \ +../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c \ +../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c \ +../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c \ +../LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c \ +../LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c \ +../mcp25xx.c \ +../can-bridge-ccs.c + + +PREPROCESSING_SRCS += \ +../sp_driver.S + + +ASM_SRCS += + + +OBJS += \ +Descriptors.o \ +helper_functions.o \ +LUFA/Drivers/USB/Class/Device/CDCClassDevice.o \ +LUFA/Drivers/USB/Core/ConfigDescriptors.o \ +LUFA/Drivers/USB/Core/DeviceStandardReq.o \ +LUFA/Drivers/USB/Core/Events.o \ +LUFA/Drivers/USB/Core/USBTask.o \ +LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o \ +LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o \ +mcp25xx.o \ +can-bridge-ccs.o \ +sp_driver.o + +OBJS_AS_ARGS += \ +Descriptors.o \ +helper_functions.o \ +LUFA/Drivers/USB/Class/Device/CDCClassDevice.o \ +LUFA/Drivers/USB/Core/ConfigDescriptors.o \ +LUFA/Drivers/USB/Core/DeviceStandardReq.o \ +LUFA/Drivers/USB/Core/Events.o \ +LUFA/Drivers/USB/Core/USBTask.o \ +LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o \ +LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o \ +LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o \ +mcp25xx.o \ +can-bridge-ccs.o \ +sp_driver.o + +C_DEPS += \ +Descriptors.d \ +helper_functions.d \ +LUFA/Drivers/USB/Class/Device/CDCClassDevice.d \ +LUFA/Drivers/USB/Core/ConfigDescriptors.d \ +LUFA/Drivers/USB/Core/DeviceStandardReq.d \ +LUFA/Drivers/USB/Core/Events.d \ +LUFA/Drivers/USB/Core/USBTask.d \ +LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.d \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.d \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.d \ +LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.d \ +mcp25xx.d \ +can-bridge-ccs.d \ +sp_driver.d + +C_DEPS_AS_ARGS += \ +Descriptors.d \ +helper_functions.d \ +LUFA/Drivers/USB/Class/Device/CDCClassDevice.d \ +LUFA/Drivers/USB/Core/ConfigDescriptors.d \ +LUFA/Drivers/USB/Core/DeviceStandardReq.d \ +LUFA/Drivers/USB/Core/Events.d \ +LUFA/Drivers/USB/Core/USBTask.d \ +LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.d \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.d \ +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.d \ +LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.d \ +LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.d \ +mcp25xx.d \ +can-bridge-ccs.d \ +sp_driver.d + +OUTPUT_FILE_PATH +=can-bridge-ccs.elf + +OUTPUT_FILE_PATH_AS_ARGS +=can-bridge-ccs.elf + +ADDITIONAL_DEPENDENCIES:= + +OUTPUT_FILE_DEP:= ./makedep.mk + +LIB_DEP+= + +LINKER_SCRIPT_DEP+= + + +# AVR32/GNU C Compiler +./Descriptors.o: .././Descriptors.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +./helper_functions.o: .././helper_functions.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Class/Device/CDCClassDevice.o: ../LUFA/Drivers/USB/Class/Device/CDCClassDevice.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/ConfigDescriptors.o: ../LUFA/Drivers/USB/Core/ConfigDescriptors.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/DeviceStandardReq.o: ../LUFA/Drivers/USB/Core/DeviceStandardReq.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/Events.o: ../LUFA/Drivers/USB/Core/Events.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/USBTask.o: ../LUFA/Drivers/USB/Core/USBTask.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o: ../LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o: ../LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o: ../LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o: ../LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o: ../LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o: ../LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o: ../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o: ../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o: ../LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o: ../LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o: ../LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +./mcp25xx.o: .././mcp25xx.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + +./can-bridge-ccs.o: .././can-bridge-ccs.c + @echo Building file: $< + @echo Invoking: AVR/GNU C Compiler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -x c -funsigned-char -funsigned-bitfields -DDEBUG -DARCH=ARCH_XMEGA -DUSE_RAM_DESCRIPTORS -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DFIXED_NUM_CONFIGURATIONS=1 -DMAX_ENDPOINT_INDEX=4 -DF_CPU=32000000 -DF_USB=48000000 -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -O1 -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -g2 -Wall -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -c -std=gnu99 -fms-extensions -v -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -o "$@" "$<" + @echo Finished building: $< + + + + + +# AVR32/GNU Preprocessing Assembler + + + +# AVR32/GNU Assembler +./sp_driver.o: .././sp_driver.S + @echo Building file: $< + @echo Invoking: AVR/GNU Assembler : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -Wa,-gdwarf2 -x assembler-with-cpp -c -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" -I "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include" -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)" -mrelax -Wa,-g -o "$@" "$<" + @echo Finished building: $< + + + + + + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +endif + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: $(OUTPUT_FILE_PATH) $(ADDITIONAL_DEPENDENCIES) + +$(OUTPUT_FILE_PATH): $(OBJS) $(USER_OBJS) $(OUTPUT_FILE_DEP) $(LIB_DEP) $(LINKER_SCRIPT_DEP) + @echo Building target: $@ + @echo Invoking: AVR/GNU Linker : 5.4.0 + $(QUOTE)C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-gcc.exe$(QUOTE) -o$(OUTPUT_FILE_PATH_AS_ARGS) $(OBJS_AS_ARGS) $(USER_OBJS) $(LIBS) -Wl,-Map="can-bridge-ccs.map" -Wl,--start-group -Wl,-lm -Wl,--end-group -Wl,--gc-sections -mrelax -mmcu=atxmega32c4 -B "C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" + @echo Finished building target: $@ + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O ihex -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "can-bridge-ccs.elf" "can-bridge-ccs.hex" + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -j .eeprom --set-section-flags=.eeprom=alloc,load --change-section-lma .eeprom=0 --no-change-warnings -O ihex "can-bridge-ccs.elf" "can-bridge-ccs.eep" || exit 0 + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objdump.exe" -h -S "can-bridge-ccs.elf" > "can-bridge-ccs.lss" + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-objcopy.exe" -O srec -R .eeprom -R .fuse -R .lock -R .signature -R .user_signatures "can-bridge-ccs.elf" "can-bridge-ccs.srec" + "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\avr8\avr8-gnu-toolchain\bin\avr-size.exe" "can-bridge-ccs.elf" + + + + + + + +# Other Targets +clean: + -$(RM) $(OBJS_AS_ARGS) $(EXECUTABLES) + -$(RM) $(C_DEPS_AS_ARGS) + rm -rf "can-bridge-ccs.elf" "can-bridge-ccs.a" "can-bridge-ccs.hex" "can-bridge-ccs.lss" "can-bridge-ccs.eep" "can-bridge-ccs.map" "can-bridge-ccs.srec" "can-bridge-ccs.usersignatures" + \ No newline at end of file diff --git a/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.d b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.d new file mode 100644 index 0000000..c549a16 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.d @@ -0,0 +1,369 @@ +can-bridge-ccs.d can-bridge-ccs.o: .././can-bridge-ccs.c \ + .././can-bridge-ccs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\wdt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\power.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdio.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdarg.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h \ + .././Descriptors.h .././LUFA/Drivers/USB/USB.h \ + .././LUFA/Drivers/USB/../../Common/Common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h \ + .././LUFA/Drivers/USB/../../Common/Architectures.h \ + .././LUFA/Drivers/USB/../../Common/BoardTypes.h \ + .././LUFA/Drivers/USB/../../Common/ArchitectureSpecific.h \ + .././LUFA/Drivers/USB/../../Common/CompilerSpecific.h \ + .././LUFA/Drivers/USB/../../Common/Attributes.h \ + .././LUFA/Drivers/USB/../../Common/Endianness.h \ + .././LUFA/Drivers/USB/Core/USBMode.h \ + .././LUFA/Drivers/USB/Core/../../../Common/Common.h \ + .././LUFA/Drivers/USB/Core/USBTask.h \ + .././LUFA/Drivers/USB/Core/USBMode.h \ + .././LUFA/Drivers/USB/Core/USBController.h \ + .././LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBMode.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Device.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Events.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBTask.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../USBController.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h \ + .././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h \ + .././LUFA/Drivers/USB/Core/Events.h \ + .././LUFA/Drivers/USB/Core/StdRequestType.h \ + .././LUFA/Drivers/USB/Core/StdDescriptors.h \ + .././LUFA/Drivers/USB/Core/DeviceStandardReq.h \ + .././LUFA/Drivers/USB/Core/Events.h \ + .././LUFA/Drivers/USB/Core/StdDescriptors.h \ + .././LUFA/Drivers/USB/Core/ConfigDescriptors.h \ + .././LUFA/Drivers/USB/Core/HostStandardReq.h \ + .././LUFA/Drivers/USB/Core/USBController.h \ + .././LUFA/Drivers/USB/Core/USBInterrupt.h \ + .././LUFA/Drivers/USB/Core/Device.h \ + .././LUFA/Drivers/USB/Core/Endpoint.h \ + .././LUFA/Drivers/USB/Core/DeviceStandardReq.h \ + .././LUFA/Drivers/USB/Core/EndpointStream.h \ + .././LUFA/Drivers/USB/Class/AndroidAccessoryClass.h \ + .././LUFA/Drivers/USB/Class/../Core/USBMode.h \ + .././LUFA/Drivers/USB/Class/AudioClass.h \ + .././LUFA/Drivers/USB/Class/Device/AudioClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../../USB.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/AudioClassCommon.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/../../Core/StdDescriptors.h \ + .././LUFA/Drivers/USB/Class/CDCClass.h \ + .././LUFA/Drivers/USB/Class/Device/CDCClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h \ + .././LUFA/Drivers/USB/Class/HIDClass.h \ + .././LUFA/Drivers/USB/Class/Device/HIDClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/HIDClassCommon.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/HIDParser.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/../../../../Common/Common.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/HIDReportData.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/HIDClassCommon.h \ + .././LUFA/Drivers/USB/Class/MassStorageClass.h \ + .././LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/MassStorageClassCommon.h \ + .././LUFA/Drivers/USB/Class/MIDIClass.h \ + .././LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/MIDIClassCommon.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/AudioClassCommon.h \ + .././LUFA/Drivers/USB/Class/PrinterClass.h \ + .././LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/PrinterClassCommon.h \ + .././LUFA/Drivers/USB/Class/RNDISClass.h \ + .././LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/RNDISClassCommon.h \ + .././LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h \ + .././LUFA/Drivers/USB/Class/StillImageClass.h \ + .././LUFA/Platform/Platform.h .././LUFA/Platform/../Common/Common.h \ + .././LUFA/Platform/XMEGA/ClockManagement.h \ + .././LUFA/Platform/XMEGA/../../Common/Common.h .././sp_driver.h \ + .././mcp25xx.h .././helper_functions.h + +.././can-bridge-ccs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\wdt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\power.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdio.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdarg.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\interrupt.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\string.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\eeprom.h: + +.././Descriptors.h: + +.././LUFA/Drivers/USB/USB.h: + +.././LUFA/Drivers/USB/../../Common/Common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdbool.h: + +.././LUFA/Drivers/USB/../../Common/Architectures.h: + +.././LUFA/Drivers/USB/../../Common/BoardTypes.h: + +.././LUFA/Drivers/USB/../../Common/ArchitectureSpecific.h: + +.././LUFA/Drivers/USB/../../Common/CompilerSpecific.h: + +.././LUFA/Drivers/USB/../../Common/Attributes.h: + +.././LUFA/Drivers/USB/../../Common/Endianness.h: + +.././LUFA/Drivers/USB/Core/USBMode.h: + +.././LUFA/Drivers/USB/Core/../../../Common/Common.h: + +.././LUFA/Drivers/USB/Core/USBTask.h: + +.././LUFA/Drivers/USB/Core/USBMode.h: + +.././LUFA/Drivers/USB/Core/USBController.h: + +.././LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../../../../Common/Common.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBMode.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/USBInterrupt_XMEGA.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../../../../Common/Common.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBMode.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Events.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBController.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Device.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../StdDescriptors.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Events.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBInterrupt.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Endpoint_XMEGA.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBTask.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../USBInterrupt.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/Device_XMEGA.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../StdDescriptors.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/../Endpoint.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../Endpoint.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../DeviceStandardReq.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../StdRequestType.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBTask.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../USBController.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../EndpointStream.h: + +.././LUFA/Drivers/USB/Core/XMEGA/../XMEGA/EndpointStream_XMEGA.h: + +.././LUFA/Drivers/USB/Core/Events.h: + +.././LUFA/Drivers/USB/Core/StdRequestType.h: + +.././LUFA/Drivers/USB/Core/StdDescriptors.h: + +.././LUFA/Drivers/USB/Core/DeviceStandardReq.h: + +.././LUFA/Drivers/USB/Core/Events.h: + +.././LUFA/Drivers/USB/Core/StdDescriptors.h: + +.././LUFA/Drivers/USB/Core/ConfigDescriptors.h: + +.././LUFA/Drivers/USB/Core/HostStandardReq.h: + +.././LUFA/Drivers/USB/Core/USBController.h: + +.././LUFA/Drivers/USB/Core/USBInterrupt.h: + +.././LUFA/Drivers/USB/Core/Device.h: + +.././LUFA/Drivers/USB/Core/Endpoint.h: + +.././LUFA/Drivers/USB/Core/DeviceStandardReq.h: + +.././LUFA/Drivers/USB/Core/EndpointStream.h: + +.././LUFA/Drivers/USB/Class/AndroidAccessoryClass.h: + +.././LUFA/Drivers/USB/Class/../Core/USBMode.h: + +.././LUFA/Drivers/USB/Class/AudioClass.h: + +.././LUFA/Drivers/USB/Class/Device/AudioClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../../USB.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/AudioClassCommon.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/../../Core/StdDescriptors.h: + +.././LUFA/Drivers/USB/Class/CDCClass.h: + +.././LUFA/Drivers/USB/Class/Device/CDCClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h: + +.././LUFA/Drivers/USB/Class/HIDClass.h: + +.././LUFA/Drivers/USB/Class/Device/HIDClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/HIDClassCommon.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/HIDParser.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/../../../../Common/Common.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/HIDReportData.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/HIDClassCommon.h: + +.././LUFA/Drivers/USB/Class/MassStorageClass.h: + +.././LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/MassStorageClassCommon.h: + +.././LUFA/Drivers/USB/Class/MIDIClass.h: + +.././LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/MIDIClassCommon.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/AudioClassCommon.h: + +.././LUFA/Drivers/USB/Class/PrinterClass.h: + +.././LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/PrinterClassCommon.h: + +.././LUFA/Drivers/USB/Class/RNDISClass.h: + +.././LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/RNDISClassCommon.h: + +.././LUFA/Drivers/USB/Class/Device/../Common/CDCClassCommon.h: + +.././LUFA/Drivers/USB/Class/StillImageClass.h: + +.././LUFA/Platform/Platform.h: + +.././LUFA/Platform/../Common/Common.h: + +.././LUFA/Platform/XMEGA/ClockManagement.h: + +.././LUFA/Platform/XMEGA/../../Common/Common.h: + +.././sp_driver.h: + +.././mcp25xx.h: + +.././helper_functions.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.eep b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.eep new file mode 100644 index 0000000..7c166a1 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.elf b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.elf new file mode 100644 index 0000000..3b72657 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.elf differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.hex b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.hex new file mode 100644 index 0000000..c1e3d15 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.hex @@ -0,0 +1,270 @@ +:10000000FDC0000016C10000E4C7000012C10000DE +:1000100010C100000EC100000CC100000AC10000A8 +:1000200008C1000006C1000004C1000002C10000B8 +:1000300000C10000FEC0000027C60000FAC000009A +:10004000F8C00000F6C00000F4C00000F2C00000DC +:100050000C943508EEC00000ECC00000EAC00000BF +:10006000E8C00000E6C00000E4C00000E2C00000FC +:10007000E0C00000DEC00000DCC00000DAC000000C +:10008000D8C00000D6C00000D4C00000D2C000001C +:10009000D0C00000CEC00000CCC00000CAC000002C +:1000A000C8C00000C6C00000C4C00000C2C000003C +:1000B000C0C00000BEC00000BCC00000BAC000004C +:1000C000B8C00000B6C00000B4C00000B2C000005C +:1000D000B0C00000AEC00000ACC00000AAC000006C +:1000E000A8C00000A6C00000A4C00000A2C000007C +:1000F000A0C000009EC000009CC000009AC000008C +:100100001BC700003FC7000094C0000092C0000061 +:1001100090C000008EC000008CC000008AC00000AB +:1001200088C0000086C0000084C0000082C00000BB +:1001300080C000007EC000007CC000007AC00000CB +:1001400078C0000076C0000074C0000072C00000DB +:1001500070C000006EC000006CC000006AC00000EB +:1001600068C0000066C0000064C0000062C00000FB +:1001700060C000005EC000005CC000005AC000000B +:1001800058C0000056C0000054C0000052C000001B +:1001900050C000004EC000004CC000004AC000002B +:1001A00048C0000046C0000044C0000042C000003B +:1001B00040C000003EC000003CC000003AC000004B +:1001C00038C0000036C0000034C0000032C000005B +:1001D00030C000002EC000002CC000002AC000006B +:1001E00028C0000026C0000024C0000022C000007B +:1001F00020C0000058C100001CC0000011241FBE18 +:10020000CFEFCDBFDFE2DEBF10E2A0E0B0E2E8EB6F +:10021000F0E102C005900D92A430B107D9F724E2B5 +:10022000A4E0B0E201C01D92AC39B207E1F728D5D5 +:1002300041C7E6CE089580931C20282F2F7030E010 +:100240004091C6045091C7048823E4F464E8629F97 +:10025000C001639F900D1124815A9F4D80931820F7 +:1002600090931920C90182959295907F9827807F5D +:10027000982708969A01280F391F20931A20309347 +:100280001B20089564E8629FC001639F900D1124B4 +:10029000835E9F4D8093182090931920229532956C +:1002A000307F3227207F3227240F351F20931A20DA +:1002B00030931B2008951F93CF93DF93D82F162FD1 +:1002C000C42FB9DFE0911A20F0911B201182E09138 +:1002D0001A20F0911B20DD23A4F01082E0911A2057 +:1002E000F0911B201183E0911A20F0911B201282C3 +:1002F000138280911820909119208483958340E087 +:1003000014C082E08083E0911A20F0911B201183B9 +:10031000E0911A20F0911B20128213828091182004 +:1003200090911920848395834C2FFC01E05CFF4F52 +:1003300040833196108281E0DF91CF911F91089523 +:1003400020E030E0A0ECB4E01696ED91FC91179718 +:10035000C90182959295907F9827807F9827E80F12 +:10036000F91F118616964D915C911797FA01E80FC7 +:10037000F91F11822F5F3F4F2530310529F708956E +:100380008091042380FF04C088E38093440002C06E +:10039000109244008091042383FF06C0E0E4F0E063 +:1003A00084818160848305C0E0E4F0E0848183601F +:1003B00084836CD072D0E0ECF4E080818F7780830E +:1003C00080818068808310920F2010920B20109201 +:1003D0000D2010920C208091042380FF04C08081A6 +:1003E0008F7B808305C0E0ECF4E0808180648083B3 +:1003F00048E068E480E85FDF48E068E480E05BDFD5 +:10040000E0ECF4E080858064808781818160818375 +:100410000895CF93DF93809304232FB7F894C0EC13 +:10042000D1E082E08A87EAE1F0E0E491A0ECB4E078 +:10043000DA96EC93DA97EBE1F0E0E491DB96EC935B +:10044000DB971A8682EB92E28E7F16968D939C93B1 +:10045000179784E18C938091042382FF04C083E08A +:100460008093C8040BC08091042381FF04C082E004 +:100470008093C80403C081E08093C8042FBF81E04B +:1004800080930E207DDFDF91CF910895E0ECF4E0C2 +:1004900080858370808711860895E0ECF4E08FEF0B +:1004A0008287848708951F920F920FB60F921124AE +:1004B0002F933F934F935F936F937F938F939F936C +:1004C000AF93BF93EF93FF938091CA04882344F4C2 +:1004D0008091C804882324F480E88093CA04AADEAB +:1004E0008091CA0486FF06C080E48093CA041092FB +:1004F0000F20C8D38091CA0485FF15C080E2809385 +:10050000CA0480910B20882321F084E080930F207F +:1005100009C08091C304811102C081E001C083E061 +:1005200080930F20B0D38091CA0484FF14C0E0EC04 +:10053000F4E080E1828782E080930F2010920B200C +:100540001382FEDE48E068E480E8B5DE48E068E457 +:1005500080E0B1DE6FDEFF91EF91BF91AF919F918F +:100560008F917F916F915F914F913F912F910F905C +:100570000FBE0F901F901895E0ECF8E092819283E7 +:10058000838382818823ECF78091C30808951F93A9 +:10059000CF93DF93C0E4D6E010E11E8380ECECDF64 +:1005A0001D83DF91CF911F9108951F93CF93DF9308 +:1005B000C0E6D6E010E11E8380ECDEDF1D83DF9114 +:1005C000CF911F9108951F93CF93DF93C0E2D6E0A0 +:1005D00018E01E8380ECD0DF1D83DF91CF911F9147 +:1005E00008951F93CF93DF93182FD62FC42F85E044 +:1005F000C3DF812FC1DF8D2FBFDF8C2FBDDFDF91E8 +:10060000CF911F9108951F93CF93DF93213039F439 +:10061000C0E4D6E010E11E83E4DF1D8311C0223068 +:1006200039F4C0E6D6E010E11E83DBDF1D8308C08D +:10063000233031F4C0E2D6E018E01E83D2DF1D8300 +:10064000DF91CF911F9108951F93CF93DF93C0E463 +:10065000D6E010E11E83C5DF1D83DF91CF911F918E +:1006600008951F93CF93DF93C0E6D6E010E11E8379 +:10067000B8DF1D83DF91CF911F9108951F93CF9312 +:10068000DF93C0E2D6E018E01E83ABDF1D83DF916D +:10069000CF911F910895813039F018F0823039F0F0 +:1006A000089581E869CF089582E866CF089584E8C7 +:1006B00063CF08951F93CF93DF93C0E4D6E010E19A +:1006C0001E83E9DF1D83DF91CF911F9108951F9352 +:1006D000CF93DF93C0E6D6E010E11E83DCDF1D83FD +:1006E000DF91CF911F9108951F93CF93DF93C0E2C5 +:1006F000D6E018E01E83CFDF1D83DF91CF911F91DD +:1007000008950F931F93CF938B01880F805C34DF84 +:10071000F801808191819695879596958795969514 +:1007200087952ADFF80180818295880F807E24DFFB +:1007300080E022DF80E020DFF80182818F701CDF03 +:10074000F8018281882359F0C0E0F801EC0FF11D17 +:10075000838112DFCF5FF8018281C817B0F3CF9198 +:100760001F910F9108951F93CF93DF93C0E4D6E0BC +:1007700010E11E83C6DF1D83DF91CF911F91089585 +:100780001F93CF93DF93C0E6D6E010E11E83B9DF5D +:100790001D83DF91CF911F9108951F93CF93DF9316 +:1007A000C0E2D6E018E01E83ACDF1D83DF91CF915D +:1007B0001F9108950F931F93CF93DF938B01DCDE7E +:1007C00080E0DADE98E0899FE001112480E0D4DE49 +:1007D000829586958770C82B80E0CEDE80E0CCDEE7 +:1007E000F801C083D18380E0C7DE8F70F801828377 +:1007F000882361F0C0E080E0BFDEF801EC0FF11D5E +:100800008383CF5FF8018281C817A8F381E0DF916D +:10081000CF911F910F9108951F93CF93DF93C0E461 +:10082000D6E010E11E83C6DF1D83DF91CF911F91BB +:1008300008951F93CF93DF93C0E6D6E010E11E83A7 +:10084000B9DF1D83DF91CF911F9108951F93CF933F +:10085000DF93C0E2D6E018E01E83ACDF1D83DF919A +:10086000CF911F910895413011F4D6CF08954230B1 +:1008700011F4DFCF0895433011F4E8CF089580E0FC +:1008800008950F931F93CF93DF93082FC0E4D6E012 +:1008900010E11E8383E070DE802F6EDE80E06CDE70 +:1008A0001D83DF91CF911F910F9108950F931F9397 +:1008B000CF93DF93082FC0E6D6E010E11E8383E0DC +:1008C0005BDE802F59DE80E057DE1D83DF91CF9104 +:1008D0001F910F9108950F931F93CF93DF93082FCC +:1008E000C0E2D6E018E01E8383E046DE802F44DEBF +:1008F00080E042DE1D83DF91CF911F910F9108951B +:10090000613011F4BECF0895623011F4CFCF089555 +:10091000E2CF0895FF920F931F93CF93DF93F82EAA +:10092000062FC0E4D6E010E11E8382E025DE8F2D85 +:1009300023DE802F21DE1D83DF91CF911F910F9148 +:10094000FF900895FF920F931F93CF93DF93F82E9C +:10095000062FC0E6D6E010E11E8382E00DDE8F2D6B +:100960000BDE802F09DE1D83DF91CF911F910F9148 +:10097000FF900895FF920F931F93CF93DF93F82E6C +:10098000062FC0E2D6E018E01E8382E0F5DD8F2D51 +:10099000F3DD802FF1DD1D83DF91CF911F910F914A +:1009A000FF9008951F93CF93DF93E0E4F6E090EA81 +:1009B000918390E49283A0E6B6E092E011969C9336 +:1009C00011979093810698E0918320E121831196FD +:1009D0002C939093210690ED9093C008662309F420 +:1009E0007EC0C82F80E1809345068093650688E02D +:1009F000809325068FE193E00197F1F700C0000096 +:100A0000C6DDD3DDE0DD8FE39FE10197F1F700C0A4 +:100A100000008FE036DFD82F8FE048DF182F8FE0FF +:100A20005ADFD295D695D770D43009F05AC01295B6 +:100A300016951770143009F056C082958695877008 +:100A4000843009F052C08FE193E00197F1F700C0C4 +:100A5000000060E08AE25EDF60E08AE273DF60E06F +:100A60008AE288DF67EE89E255DF67EE89E26ADFB6 +:100A700067EE89E27FDF61E088E24CDF61E088E2D7 +:100A800061DF61E088E276DF44E064E080E6DCDD9F +:100A900044E064E080E6E5DD44E064E080E6EEDD2D +:100AA00063EA8BE237DF63EA8BE24CDF63EA8BE2D7 +:100AB00061DF4C2F60EE8FE0C7DD4C2F60EE8FE0E2 +:100AC000D0DD4C2F60EE8FE0D9DD82E080936606AA +:100AD0008093860688E08093460681E007C081E027 +:100AE00005C080E003C080E001C080E0DF91CF91CD +:100AF0001F910895413011F40DCF0895423011F443 +:100B000021CF089537CF0895CF93DF93E0E5F0E04C +:100B1000808182608083818181FFFDCFA0E5B0E08C +:100B200016968C911697846016968C931697C0E64D +:100B3000D0E080E88D838BEB8E8380EC91E022E027 +:100B4000FC012287EDE1F0E0E491EA83ECE1F0E0E2 +:100B5000E491EB83FC01128681E08883E0E7F0E01A +:100B600085E1808383E0818394E5938393E5948397 +:100B700090E59583809321068BEC12968C931297C7 +:100B80008C9188608C93E0E5F0E0818183FFFDCF5C +:100B9000E0E5F0E082EC8583808180618083818163 +:100BA00084FFFDCF88ED84BF34E030934000E0E067 +:100BB000FAE081E0808393E1918341E050E040A737 +:100BC00051A746A357A380938106A0E4B6E093E023 +:100BD00019969C931997E0E6F6E02FE0218782872B +:100BE0002BE1208B40E24387258B1A963C931A9782 +:100BF00050962C93E0E4F8E0808320E83CE026A3C4 +:100C000037A39683E0E0F8E0808320E03DE726A369 +:100C100037A3968380932606C8E7D0E0888183FFB8 +:100C200004C061E080E0BEDE03C061E080E0BADEC7 +:100C300081110AC0FFEF29EF80E0F1502040804091 +:100C4000E1F700C00000EACF25E888ED90E0A2EAD5 +:100C5000B0E01BBEFD0184BF20832BBE80E0D9DB4A +:100C600093E088ED08B618BE84BF90938000809111 +:100C7000820081FDFCCF08BE7894DF91CF9108956A +:100C800043DFFFCF089508951F920F920FB60F9282 +:100C900011248F939F93A895809102209091032017 +:100CA00001978093022090930320809100209091DF +:100CB00001208436910521F4109200201092012029 +:100CC0008091022090910320892B19F482E0809377 +:100CD00026069F918F910F900FBE0F901F90189531 +:100CE00090910820809109209817F1F080E3C9DDE8 +:100CF00083FD1AC06091092081E0860F809309204E +:100D00008BE0689FB001112464517C4D80E02BDDA5 +:100D100080E0D0DC9091092080910820981304C0D5 +:100D200010920820109209200895EF92FF920F93DD +:100D30001F93CF93DF93CDB7DEB72B97CDBFDEBF29 +:100D4000E982FA820B831C832D833E834F8358876D +:100D500069877A878B87A091082081E08A0F80932A +:100D600008209BE0A99FD0011124A451BC4D9BE019 +:100D7000FE01319601900D929A95E1F7803118F0BD +:100D80008FE080930820ACDF2B96CDBFDEBFDF91D4 +:100D9000CF911F910F91FF90EF90089590910620B1 +:100DA000809107209817F1F080E380DD83FD1AC061 +:100DB0006091072081E0860F809307208BE0689F79 +:100DC000B0011124645C7C4D80E0DADC80E07FDCE3 +:100DD0009091072080910620981304C0109206205D +:100DE000109207200895EF92FF920F931F93CF93D5 +:100DF000DF93CDB7DEB72B97CDBFDEBFE982FA8296 +:100E00000B831C832D833E834F83588769877A87A2 +:100E10008B87A091062081E08A0F809306209BE0BB +:100E2000A99FD0011124A45CBC4D9BE0FE0131962A +:100E300001900D929A95E1F7803118F08FE0809340 +:100E40000620ACDF2B96CDBFDEBFDF91CF911F9187 +:100E50000F91FF90EF900895CF92DF92EF92FF9263 +:100E60000F931F93CF93DF93CDB7DEB72B97CDBFF3 +:100E7000DEBFC82E682F8CE243DDD82E8370A9F127 +:100E8000D1FE0CC04C2DBE016F5F7F4F84E9EBDCBF +:100E90002C2D40E062E08CE2B6DB0BC04C2DBE0195 +:100EA0006F5F7F4F80E9DFDC2C2D40E061E08CE25A +:100EB000AADB81E0C8120DC0E980FA800B811C8199 +:100EC0002D813E814F81588569857A858B858BDFA1 +:100ED0000CC0E980FA800B811C812D813E814F81FD +:100EE000588569857A858B8520DF8D2D807AB1F0D4 +:100EF0006C2D8DE205DD182F807C21F04C2D60E0FB +:100F00008DE2F8DD112319F082E0809325066D2D26 +:100F1000607E21F02C2D40E08CE275DB10920A20DF +:100F20002B96CDBFDEBFDF91CF911F910F91FF9028 +:100F3000EF90DF90CF9008951F920F920FB60F920F +:100F400011242F933F934F935F936F937F938F93CE +:100F50009F93AF93BF93EF93FF9381E080930A2019 +:100F60007BDFFF91EF91BF91AF919F918F917F9127 +:100F70006F915F914F913F912F910F900FBE0F9006 +:100F80001F9018951F920F920FB60F9211242F9356 +:100F90003F934F935F936F937F938F939F93AF9301 +:100FA000BF93EF93FF9381E080930A2082E054DFA8 +:100FB000FF91EF91BF91AF919F918F917F916F9131 +:100FC0005F914F913F912F910F900FBE0F901F9007 +:100FD00018951F920F920FB60F9211242F933F93E3 +:100FE0004F935F936F937F938F939F93AF93BF9331 +:100FF000EF93FF9381E080930A2083E02DDFFF9140 +:10100000EF91BF91AF919F918F917F916F915F9180 +:101010004F913F912F910F900FBE0F901F901895F9 +:1010200090910420809105209817F1F080E353DC23 +:1010300083FD1AC06091052081E0860F8093052012 +:101040008BE0689FB00111246B5F7C4D80E0A5DBD5 +:1010500080E04ADB9091052080910420981304C021 +:10106000109204201092052008951F920F920FB63F +:101070000F9211242F933F934F935F936F937F931E +:101080008F939F93AF93BF93EF93FF9329DE86DEF9 +:10109000C7DFFF91EF91BF91AF919F918F917F91AA +:1010A0006F915F914F913F912F910F900FBE0F90D5 +:0810B0001F901895F894FFCF82 +:0410B8000100010032 +:00000001FF diff --git a/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.lss b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.lss new file mode 100644 index 0000000..2c3dc0f --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.lss @@ -0,0 +1,3048 @@ + +can-bridge-ccs.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 000010b8 00000000 00000000 00000094 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .data 00000004 00802000 000010b8 0000114c 2**0 + CONTENTS, ALLOC, LOAD, DATA + 2 .bss 00000498 00802004 00802004 00001150 2**0 + ALLOC + 3 .comment 00000030 00000000 00000000 00001150 2**0 + CONTENTS, READONLY + 4 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00001180 2**2 + CONTENTS, READONLY + 5 .debug_aranges 00000308 00000000 00000000 000011c0 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_info 0000917b 00000000 00000000 000014c8 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_abbrev 000033d7 00000000 00000000 0000a643 2**0 + CONTENTS, READONLY, DEBUGGING + 8 .debug_line 000026fd 00000000 00000000 0000da1a 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_frame 000009e4 00000000 00000000 00010118 2**2 + CONTENTS, READONLY, DEBUGGING + 10 .debug_str 00003c95 00000000 00000000 00010afc 2**0 + CONTENTS, READONLY, DEBUGGING + 11 .debug_loc 0000289d 00000000 00000000 00014791 2**0 + CONTENTS, READONLY, DEBUGGING + 12 .debug_ranges 00000308 00000000 00000000 0001702e 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: fd c0 rjmp .+506 ; 0x1fc <__ctors_end> + 2: 00 00 nop + 4: 16 c1 rjmp .+556 ; 0x232 <__bad_interrupt> + 6: 00 00 nop + 8: e4 c7 rjmp .+4040 ; 0xfd2 <__vector_2> + a: 00 00 nop + c: 12 c1 rjmp .+548 ; 0x232 <__bad_interrupt> + e: 00 00 nop + 10: 10 c1 rjmp .+544 ; 0x232 <__bad_interrupt> + 12: 00 00 nop + 14: 0e c1 rjmp .+540 ; 0x232 <__bad_interrupt> + 16: 00 00 nop + 18: 0c c1 rjmp .+536 ; 0x232 <__bad_interrupt> + 1a: 00 00 nop + 1c: 0a c1 rjmp .+532 ; 0x232 <__bad_interrupt> + 1e: 00 00 nop + 20: 08 c1 rjmp .+528 ; 0x232 <__bad_interrupt> + 22: 00 00 nop + 24: 06 c1 rjmp .+524 ; 0x232 <__bad_interrupt> + 26: 00 00 nop + 28: 04 c1 rjmp .+520 ; 0x232 <__bad_interrupt> + 2a: 00 00 nop + 2c: 02 c1 rjmp .+516 ; 0x232 <__bad_interrupt> + 2e: 00 00 nop + 30: 00 c1 rjmp .+512 ; 0x232 <__bad_interrupt> + 32: 00 00 nop + 34: fe c0 rjmp .+508 ; 0x232 <__bad_interrupt> + 36: 00 00 nop + 38: 27 c6 rjmp .+3150 ; 0xc88 <__vector_14> + 3a: 00 00 nop + 3c: fa c0 rjmp .+500 ; 0x232 <__bad_interrupt> + 3e: 00 00 nop + 40: f8 c0 rjmp .+496 ; 0x232 <__bad_interrupt> + 42: 00 00 nop + 44: f6 c0 rjmp .+492 ; 0x232 <__bad_interrupt> + 46: 00 00 nop + 48: f4 c0 rjmp .+488 ; 0x232 <__bad_interrupt> + 4a: 00 00 nop + 4c: f2 c0 rjmp .+484 ; 0x232 <__bad_interrupt> + 4e: 00 00 nop + 50: 0c 94 35 08 jmp 0x106a ; 0x106a <__vector_20> + 54: ee c0 rjmp .+476 ; 0x232 <__bad_interrupt> + 56: 00 00 nop + 58: ec c0 rjmp .+472 ; 0x232 <__bad_interrupt> + 5a: 00 00 nop + 5c: ea c0 rjmp .+468 ; 0x232 <__bad_interrupt> + 5e: 00 00 nop + 60: e8 c0 rjmp .+464 ; 0x232 <__bad_interrupt> + 62: 00 00 nop + 64: e6 c0 rjmp .+460 ; 0x232 <__bad_interrupt> + 66: 00 00 nop + 68: e4 c0 rjmp .+456 ; 0x232 <__bad_interrupt> + 6a: 00 00 nop + 6c: e2 c0 rjmp .+452 ; 0x232 <__bad_interrupt> + 6e: 00 00 nop + 70: e0 c0 rjmp .+448 ; 0x232 <__bad_interrupt> + 72: 00 00 nop + 74: de c0 rjmp .+444 ; 0x232 <__bad_interrupt> + 76: 00 00 nop + 78: dc c0 rjmp .+440 ; 0x232 <__bad_interrupt> + 7a: 00 00 nop + 7c: da c0 rjmp .+436 ; 0x232 <__bad_interrupt> + 7e: 00 00 nop + 80: d8 c0 rjmp .+432 ; 0x232 <__bad_interrupt> + 82: 00 00 nop + 84: d6 c0 rjmp .+428 ; 0x232 <__bad_interrupt> + 86: 00 00 nop + 88: d4 c0 rjmp .+424 ; 0x232 <__bad_interrupt> + 8a: 00 00 nop + 8c: d2 c0 rjmp .+420 ; 0x232 <__bad_interrupt> + 8e: 00 00 nop + 90: d0 c0 rjmp .+416 ; 0x232 <__bad_interrupt> + 92: 00 00 nop + 94: ce c0 rjmp .+412 ; 0x232 <__bad_interrupt> + 96: 00 00 nop + 98: cc c0 rjmp .+408 ; 0x232 <__bad_interrupt> + 9a: 00 00 nop + 9c: ca c0 rjmp .+404 ; 0x232 <__bad_interrupt> + 9e: 00 00 nop + a0: c8 c0 rjmp .+400 ; 0x232 <__bad_interrupt> + a2: 00 00 nop + a4: c6 c0 rjmp .+396 ; 0x232 <__bad_interrupt> + a6: 00 00 nop + a8: c4 c0 rjmp .+392 ; 0x232 <__bad_interrupt> + aa: 00 00 nop + ac: c2 c0 rjmp .+388 ; 0x232 <__bad_interrupt> + ae: 00 00 nop + b0: c0 c0 rjmp .+384 ; 0x232 <__bad_interrupt> + b2: 00 00 nop + b4: be c0 rjmp .+380 ; 0x232 <__bad_interrupt> + b6: 00 00 nop + b8: bc c0 rjmp .+376 ; 0x232 <__bad_interrupt> + ba: 00 00 nop + bc: ba c0 rjmp .+372 ; 0x232 <__bad_interrupt> + be: 00 00 nop + c0: b8 c0 rjmp .+368 ; 0x232 <__bad_interrupt> + c2: 00 00 nop + c4: b6 c0 rjmp .+364 ; 0x232 <__bad_interrupt> + c6: 00 00 nop + c8: b4 c0 rjmp .+360 ; 0x232 <__bad_interrupt> + ca: 00 00 nop + cc: b2 c0 rjmp .+356 ; 0x232 <__bad_interrupt> + ce: 00 00 nop + d0: b0 c0 rjmp .+352 ; 0x232 <__bad_interrupt> + d2: 00 00 nop + d4: ae c0 rjmp .+348 ; 0x232 <__bad_interrupt> + d6: 00 00 nop + d8: ac c0 rjmp .+344 ; 0x232 <__bad_interrupt> + da: 00 00 nop + dc: aa c0 rjmp .+340 ; 0x232 <__bad_interrupt> + de: 00 00 nop + e0: a8 c0 rjmp .+336 ; 0x232 <__bad_interrupt> + e2: 00 00 nop + e4: a6 c0 rjmp .+332 ; 0x232 <__bad_interrupt> + e6: 00 00 nop + e8: a4 c0 rjmp .+328 ; 0x232 <__bad_interrupt> + ea: 00 00 nop + ec: a2 c0 rjmp .+324 ; 0x232 <__bad_interrupt> + ee: 00 00 nop + f0: a0 c0 rjmp .+320 ; 0x232 <__bad_interrupt> + f2: 00 00 nop + f4: 9e c0 rjmp .+316 ; 0x232 <__bad_interrupt> + f6: 00 00 nop + f8: 9c c0 rjmp .+312 ; 0x232 <__bad_interrupt> + fa: 00 00 nop + fc: 9a c0 rjmp .+308 ; 0x232 <__bad_interrupt> + fe: 00 00 nop + 100: 1b c7 rjmp .+3638 ; 0xf38 <__vector_64> + 102: 00 00 nop + 104: 3f c7 rjmp .+3710 ; 0xf84 <__vector_65> + 106: 00 00 nop + 108: 94 c0 rjmp .+296 ; 0x232 <__bad_interrupt> + 10a: 00 00 nop + 10c: 92 c0 rjmp .+292 ; 0x232 <__bad_interrupt> + 10e: 00 00 nop + 110: 90 c0 rjmp .+288 ; 0x232 <__bad_interrupt> + 112: 00 00 nop + 114: 8e c0 rjmp .+284 ; 0x232 <__bad_interrupt> + 116: 00 00 nop + 118: 8c c0 rjmp .+280 ; 0x232 <__bad_interrupt> + 11a: 00 00 nop + 11c: 8a c0 rjmp .+276 ; 0x232 <__bad_interrupt> + 11e: 00 00 nop + 120: 88 c0 rjmp .+272 ; 0x232 <__bad_interrupt> + 122: 00 00 nop + 124: 86 c0 rjmp .+268 ; 0x232 <__bad_interrupt> + 126: 00 00 nop + 128: 84 c0 rjmp .+264 ; 0x232 <__bad_interrupt> + 12a: 00 00 nop + 12c: 82 c0 rjmp .+260 ; 0x232 <__bad_interrupt> + 12e: 00 00 nop + 130: 80 c0 rjmp .+256 ; 0x232 <__bad_interrupt> + 132: 00 00 nop + 134: 7e c0 rjmp .+252 ; 0x232 <__bad_interrupt> + 136: 00 00 nop + 138: 7c c0 rjmp .+248 ; 0x232 <__bad_interrupt> + 13a: 00 00 nop + 13c: 7a c0 rjmp .+244 ; 0x232 <__bad_interrupt> + 13e: 00 00 nop + 140: 78 c0 rjmp .+240 ; 0x232 <__bad_interrupt> + 142: 00 00 nop + 144: 76 c0 rjmp .+236 ; 0x232 <__bad_interrupt> + 146: 00 00 nop + 148: 74 c0 rjmp .+232 ; 0x232 <__bad_interrupt> + 14a: 00 00 nop + 14c: 72 c0 rjmp .+228 ; 0x232 <__bad_interrupt> + 14e: 00 00 nop + 150: 70 c0 rjmp .+224 ; 0x232 <__bad_interrupt> + 152: 00 00 nop + 154: 6e c0 rjmp .+220 ; 0x232 <__bad_interrupt> + 156: 00 00 nop + 158: 6c c0 rjmp .+216 ; 0x232 <__bad_interrupt> + 15a: 00 00 nop + 15c: 6a c0 rjmp .+212 ; 0x232 <__bad_interrupt> + 15e: 00 00 nop + 160: 68 c0 rjmp .+208 ; 0x232 <__bad_interrupt> + 162: 00 00 nop + 164: 66 c0 rjmp .+204 ; 0x232 <__bad_interrupt> + 166: 00 00 nop + 168: 64 c0 rjmp .+200 ; 0x232 <__bad_interrupt> + 16a: 00 00 nop + 16c: 62 c0 rjmp .+196 ; 0x232 <__bad_interrupt> + 16e: 00 00 nop + 170: 60 c0 rjmp .+192 ; 0x232 <__bad_interrupt> + 172: 00 00 nop + 174: 5e c0 rjmp .+188 ; 0x232 <__bad_interrupt> + 176: 00 00 nop + 178: 5c c0 rjmp .+184 ; 0x232 <__bad_interrupt> + 17a: 00 00 nop + 17c: 5a c0 rjmp .+180 ; 0x232 <__bad_interrupt> + 17e: 00 00 nop + 180: 58 c0 rjmp .+176 ; 0x232 <__bad_interrupt> + 182: 00 00 nop + 184: 56 c0 rjmp .+172 ; 0x232 <__bad_interrupt> + 186: 00 00 nop + 188: 54 c0 rjmp .+168 ; 0x232 <__bad_interrupt> + 18a: 00 00 nop + 18c: 52 c0 rjmp .+164 ; 0x232 <__bad_interrupt> + 18e: 00 00 nop + 190: 50 c0 rjmp .+160 ; 0x232 <__bad_interrupt> + 192: 00 00 nop + 194: 4e c0 rjmp .+156 ; 0x232 <__bad_interrupt> + 196: 00 00 nop + 198: 4c c0 rjmp .+152 ; 0x232 <__bad_interrupt> + 19a: 00 00 nop + 19c: 4a c0 rjmp .+148 ; 0x232 <__bad_interrupt> + 19e: 00 00 nop + 1a0: 48 c0 rjmp .+144 ; 0x232 <__bad_interrupt> + 1a2: 00 00 nop + 1a4: 46 c0 rjmp .+140 ; 0x232 <__bad_interrupt> + 1a6: 00 00 nop + 1a8: 44 c0 rjmp .+136 ; 0x232 <__bad_interrupt> + 1aa: 00 00 nop + 1ac: 42 c0 rjmp .+132 ; 0x232 <__bad_interrupt> + 1ae: 00 00 nop + 1b0: 40 c0 rjmp .+128 ; 0x232 <__bad_interrupt> + 1b2: 00 00 nop + 1b4: 3e c0 rjmp .+124 ; 0x232 <__bad_interrupt> + 1b6: 00 00 nop + 1b8: 3c c0 rjmp .+120 ; 0x232 <__bad_interrupt> + 1ba: 00 00 nop + 1bc: 3a c0 rjmp .+116 ; 0x232 <__bad_interrupt> + 1be: 00 00 nop + 1c0: 38 c0 rjmp .+112 ; 0x232 <__bad_interrupt> + 1c2: 00 00 nop + 1c4: 36 c0 rjmp .+108 ; 0x232 <__bad_interrupt> + 1c6: 00 00 nop + 1c8: 34 c0 rjmp .+104 ; 0x232 <__bad_interrupt> + 1ca: 00 00 nop + 1cc: 32 c0 rjmp .+100 ; 0x232 <__bad_interrupt> + 1ce: 00 00 nop + 1d0: 30 c0 rjmp .+96 ; 0x232 <__bad_interrupt> + 1d2: 00 00 nop + 1d4: 2e c0 rjmp .+92 ; 0x232 <__bad_interrupt> + 1d6: 00 00 nop + 1d8: 2c c0 rjmp .+88 ; 0x232 <__bad_interrupt> + 1da: 00 00 nop + 1dc: 2a c0 rjmp .+84 ; 0x232 <__bad_interrupt> + 1de: 00 00 nop + 1e0: 28 c0 rjmp .+80 ; 0x232 <__bad_interrupt> + 1e2: 00 00 nop + 1e4: 26 c0 rjmp .+76 ; 0x232 <__bad_interrupt> + 1e6: 00 00 nop + 1e8: 24 c0 rjmp .+72 ; 0x232 <__bad_interrupt> + 1ea: 00 00 nop + 1ec: 22 c0 rjmp .+68 ; 0x232 <__bad_interrupt> + 1ee: 00 00 nop + 1f0: 20 c0 rjmp .+64 ; 0x232 <__bad_interrupt> + 1f2: 00 00 nop + 1f4: 58 c1 rjmp .+688 ; 0x4a6 <__vector_125> + 1f6: 00 00 nop + 1f8: 1c c0 rjmp .+56 ; 0x232 <__bad_interrupt> + ... + +000001fc <__ctors_end>: + 1fc: 11 24 eor r1, r1 + 1fe: 1f be out 0x3f, r1 ; 63 + 200: cf ef ldi r28, 0xFF ; 255 + 202: cd bf out 0x3d, r28 ; 61 + 204: df e2 ldi r29, 0x2F ; 47 + 206: de bf out 0x3e, r29 ; 62 + +00000208 <__do_copy_data>: + 208: 10 e2 ldi r17, 0x20 ; 32 + 20a: a0 e0 ldi r26, 0x00 ; 0 + 20c: b0 e2 ldi r27, 0x20 ; 32 + 20e: e8 eb ldi r30, 0xB8 ; 184 + 210: f0 e1 ldi r31, 0x10 ; 16 + 212: 02 c0 rjmp .+4 ; 0x218 <__do_copy_data+0x10> + 214: 05 90 lpm r0, Z+ + 216: 0d 92 st X+, r0 + 218: a4 30 cpi r26, 0x04 ; 4 + 21a: b1 07 cpc r27, r17 + 21c: d9 f7 brne .-10 ; 0x214 <__do_copy_data+0xc> + +0000021e <__do_clear_bss>: + 21e: 24 e2 ldi r18, 0x24 ; 36 + 220: a4 e0 ldi r26, 0x04 ; 4 + 222: b0 e2 ldi r27, 0x20 ; 32 + 224: 01 c0 rjmp .+2 ; 0x228 <.do_clear_bss_start> + +00000226 <.do_clear_bss_loop>: + 226: 1d 92 st X+, r1 + +00000228 <.do_clear_bss_start>: + 228: ac 39 cpi r26, 0x9C ; 156 + 22a: b2 07 cpc r27, r18 + 22c: e1 f7 brne .-8 ; 0x226 <.do_clear_bss_loop> + 22e: 28 d5 rcall .+2640 ; 0xc80
+ 230: 41 c7 rjmp .+3714 ; 0x10b4 <_exit> + +00000232 <__bad_interrupt>: + 232: e6 ce rjmp .-564 ; 0x0 <__vectors> + +00000234 : +#define __INCLUDE_FROM_EVENTS_C +#define __INCLUDE_FROM_USB_DRIVER +#include "Events.h" + +void USB_Event_Stub(void) +{ + 234: 08 95 ret + +00000236 : + return false; + } + } + + return true; +} + 236: 80 93 1c 20 sts 0x201C, r24 ; 0x80201c + 23a: 28 2f mov r18, r24 + 23c: 2f 70 andi r18, 0x0F ; 15 + 23e: 30 e0 ldi r19, 0x00 ; 0 + 240: 40 91 c6 04 lds r20, 0x04C6 ; 0x8004c6 <__TEXT_REGION_LENGTH__+0x7004c6> + 244: 50 91 c7 04 lds r21, 0x04C7 ; 0x8004c7 <__TEXT_REGION_LENGTH__+0x7004c7> + 248: 88 23 and r24, r24 + 24a: e4 f4 brge .+56 ; 0x284 + 24c: 64 e8 ldi r22, 0x84 ; 132 + 24e: 62 9f mul r22, r18 + 250: c0 01 movw r24, r0 + 252: 63 9f mul r22, r19 + 254: 90 0d add r25, r0 + 256: 11 24 eor r1, r1 + 258: 81 5a subi r24, 0xA1 ; 161 + 25a: 9f 4d sbci r25, 0xDF ; 223 + 25c: 80 93 18 20 sts 0x2018, r24 ; 0x802018 + 260: 90 93 19 20 sts 0x2019, r25 ; 0x802019 + 264: c9 01 movw r24, r18 + 266: 82 95 swap r24 + 268: 92 95 swap r25 + 26a: 90 7f andi r25, 0xF0 ; 240 + 26c: 98 27 eor r25, r24 + 26e: 80 7f andi r24, 0xF0 ; 240 + 270: 98 27 eor r25, r24 + 272: 08 96 adiw r24, 0x08 ; 8 + 274: 9a 01 movw r18, r20 + 276: 28 0f add r18, r24 + 278: 39 1f adc r19, r25 + 27a: 20 93 1a 20 sts 0x201A, r18 ; 0x80201a + 27e: 30 93 1b 20 sts 0x201B, r19 ; 0x80201b + 282: 08 95 ret + 284: 64 e8 ldi r22, 0x84 ; 132 + 286: 62 9f mul r22, r18 + 288: c0 01 movw r24, r0 + 28a: 63 9f mul r22, r19 + 28c: 90 0d add r25, r0 + 28e: 11 24 eor r1, r1 + 290: 83 5e subi r24, 0xE3 ; 227 + 292: 9f 4d sbci r25, 0xDF ; 223 + 294: 80 93 18 20 sts 0x2018, r24 ; 0x802018 + 298: 90 93 19 20 sts 0x2019, r25 ; 0x802019 + 29c: 22 95 swap r18 + 29e: 32 95 swap r19 + 2a0: 30 7f andi r19, 0xF0 ; 240 + 2a2: 32 27 eor r19, r18 + 2a4: 20 7f andi r18, 0xF0 ; 240 + 2a6: 32 27 eor r19, r18 + 2a8: 24 0f add r18, r20 + 2aa: 35 1f adc r19, r21 + 2ac: 20 93 1a 20 sts 0x201A, r18 ; 0x80201a + 2b0: 30 93 1b 20 sts 0x201B, r19 ; 0x80201b + 2b4: 08 95 ret + +000002b6 : + 2b6: 1f 93 push r17 + 2b8: cf 93 push r28 + 2ba: df 93 push r29 + 2bc: d8 2f mov r29, r24 + 2be: 16 2f mov r17, r22 + 2c0: c4 2f mov r28, r20 + 2c2: b9 df rcall .-142 ; 0x236 + 2c4: e0 91 1a 20 lds r30, 0x201A ; 0x80201a + 2c8: f0 91 1b 20 lds r31, 0x201B ; 0x80201b + 2cc: 11 82 std Z+1, r1 ; 0x01 + 2ce: e0 91 1a 20 lds r30, 0x201A ; 0x80201a + 2d2: f0 91 1b 20 lds r31, 0x201B ; 0x80201b + 2d6: dd 23 and r29, r29 + 2d8: a4 f0 brlt .+40 ; 0x302 + 2da: 10 82 st Z, r1 + 2dc: e0 91 1a 20 lds r30, 0x201A ; 0x80201a + 2e0: f0 91 1b 20 lds r31, 0x201B ; 0x80201b + 2e4: 11 83 std Z+1, r17 ; 0x01 + 2e6: e0 91 1a 20 lds r30, 0x201A ; 0x80201a + 2ea: f0 91 1b 20 lds r31, 0x201B ; 0x80201b + 2ee: 12 82 std Z+2, r1 ; 0x02 + 2f0: 13 82 std Z+3, r1 ; 0x03 + 2f2: 80 91 18 20 lds r24, 0x2018 ; 0x802018 + 2f6: 90 91 19 20 lds r25, 0x2019 ; 0x802019 + 2fa: 84 83 std Z+4, r24 ; 0x04 + 2fc: 95 83 std Z+5, r25 ; 0x05 + 2fe: 40 e0 ldi r20, 0x00 ; 0 + 300: 14 c0 rjmp .+40 ; 0x32a + 302: 82 e0 ldi r24, 0x02 ; 2 + 304: 80 83 st Z, r24 + 306: e0 91 1a 20 lds r30, 0x201A ; 0x80201a + 30a: f0 91 1b 20 lds r31, 0x201B ; 0x80201b + 30e: 11 83 std Z+1, r17 ; 0x01 + 310: e0 91 1a 20 lds r30, 0x201A ; 0x80201a + 314: f0 91 1b 20 lds r31, 0x201B ; 0x80201b + 318: 12 82 std Z+2, r1 ; 0x02 + 31a: 13 82 std Z+3, r1 ; 0x03 + 31c: 80 91 18 20 lds r24, 0x2018 ; 0x802018 + 320: 90 91 19 20 lds r25, 0x2019 ; 0x802019 + 324: 84 83 std Z+4, r24 ; 0x04 + 326: 95 83 std Z+5, r25 ; 0x05 + 328: 4c 2f mov r20, r28 + 32a: fc 01 movw r30, r24 + 32c: e0 5c subi r30, 0xC0 ; 192 + 32e: ff 4f sbci r31, 0xFF ; 255 + 330: 40 83 st Z, r20 + 332: 31 96 adiw r30, 0x01 ; 1 + 334: 10 82 st Z, r1 + 336: 81 e0 ldi r24, 0x01 ; 1 + 338: df 91 pop r29 + 33a: cf 91 pop r28 + 33c: 1f 91 pop r17 + 33e: 08 95 ret + +00000340 : + + return true; +} + +void Endpoint_ClearEndpoints(void) +{ + 340: 20 e0 ldi r18, 0x00 ; 0 + 342: 30 e0 ldi r19, 0x00 ; 0 + for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) + { + ((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0; + 344: a0 ec ldi r26, 0xC0 ; 192 + 346: b4 e0 ldi r27, 0x04 ; 4 + 348: 16 96 adiw r26, 0x06 ; 6 + 34a: ed 91 ld r30, X+ + 34c: fc 91 ld r31, X + 34e: 17 97 sbiw r26, 0x07 ; 7 + 350: c9 01 movw r24, r18 + 352: 82 95 swap r24 + 354: 92 95 swap r25 + 356: 90 7f andi r25, 0xF0 ; 240 + 358: 98 27 eor r25, r24 + 35a: 80 7f andi r24, 0xF0 ; 240 + 35c: 98 27 eor r25, r24 + 35e: e8 0f add r30, r24 + 360: f9 1f adc r31, r25 + 362: 11 86 std Z+9, r1 ; 0x09 + ((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0; + 364: 16 96 adiw r26, 0x06 ; 6 + 366: 4d 91 ld r20, X+ + 368: 5c 91 ld r21, X + 36a: 17 97 sbiw r26, 0x07 ; 7 + 36c: fa 01 movw r30, r20 + 36e: e8 0f add r30, r24 + 370: f9 1f adc r31, r25 + 372: 11 82 std Z+1, r1 ; 0x01 + 374: 2f 5f subi r18, 0xFF ; 255 + 376: 3f 4f sbci r19, 0xFF ; 255 + return true; +} + +void Endpoint_ClearEndpoints(void) +{ + for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) + 378: 25 30 cpi r18, 0x05 ; 5 + 37a: 31 05 cpc r19, r1 + 37c: 29 f7 brne .-54 ; 0x348 + { + ((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0; + ((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0; + } +} + 37e: 08 95 ret + +00000380 : +} + +void USB_ResetInterface(void) +{ + #if defined(USB_DEVICE_OPT_FULLSPEED) + if (USB_Options & USB_DEVICE_OPT_LOWSPEED) + 380: 80 91 04 23 lds r24, 0x2304 ; 0x802304 + 384: 80 ff sbrs r24, 0 + 386: 04 c0 rjmp .+8 ; 0x390 + CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp); + 388: 88 e3 ldi r24, 0x38 ; 56 + 38a: 80 93 44 00 sts 0x0044, r24 ; 0x800044 <__TEXT_REGION_LENGTH__+0x700044> + 38e: 02 c0 rjmp .+4 ; 0x394 + else + CLK.USBCTRL = (((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp); + 390: 10 92 44 00 sts 0x0044, r1 ; 0x800044 <__TEXT_REGION_LENGTH__+0x700044> + #else + CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp); + #endif + + if (USB_Options & USB_OPT_PLLCLKSRC) + 394: 80 91 04 23 lds r24, 0x2304 ; 0x802304 + 398: 83 ff sbrs r24, 3 + 39a: 06 c0 rjmp .+12 ; 0x3a8 + CLK.USBCTRL |= (CLK_USBSRC_PLL_gc | CLK_USBSEN_bm); + 39c: e0 e4 ldi r30, 0x40 ; 64 + 39e: f0 e0 ldi r31, 0x00 ; 0 + 3a0: 84 81 ldd r24, Z+4 ; 0x04 + 3a2: 81 60 ori r24, 0x01 ; 1 + 3a4: 84 83 std Z+4, r24 ; 0x04 + 3a6: 05 c0 rjmp .+10 ; 0x3b2 + else + CLK.USBCTRL |= (CLK_USBSRC_RC32M_gc | CLK_USBSEN_bm); + 3a8: e0 e4 ldi r30, 0x40 ; 64 + 3aa: f0 e0 ldi r31, 0x00 ; 0 + 3ac: 84 81 ldd r24, Z+4 ; 0x04 + 3ae: 83 60 ori r24, 0x03 ; 3 + 3b0: 84 83 std Z+4, r24 ; 0x04 + + USB_Device_SetDeviceAddress(0); + + USB_INT_DisableAllInterrupts(); + 3b2: 6c d0 rcall .+216 ; 0x48c + USB_INT_ClearAllInterrupts(); + 3b4: 72 d0 rcall .+228 ; 0x49a + 3b6: e0 ec ldi r30, 0xC0 ; 192 + } + + static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE; + static inline void USB_Controller_Reset(void) + { + USB.CTRLA &= ~USB_ENABLE_bm; + 3b8: f4 e0 ldi r31, 0x04 ; 4 + 3ba: 80 81 ld r24, Z + 3bc: 8f 77 andi r24, 0x7F ; 127 + 3be: 80 83 st Z, r24 + 3c0: 80 81 ld r24, Z + USB.CTRLA |= USB_ENABLE_bm; + 3c2: 80 68 ori r24, 0x80 ; 128 + 3c4: 80 83 st Z, r24 + 3c6: 10 92 0f 20 sts 0x200F, r1 ; 0x80200f +} + +#if defined(USB_CAN_BE_DEVICE) +static void USB_Init_Device(void) +{ + USB_DeviceState = DEVICE_STATE_Unattached; + 3ca: 10 92 0b 20 sts 0x200B, r1 ; 0x80200b + USB_Device_ConfigurationNumber = 0; + 3ce: 10 92 0d 20 sts 0x200D, r1 ; 0x80200d + + #if !defined(NO_DEVICE_REMOTE_WAKEUP) + USB_Device_RemoteWakeupEnabled = false; + 3d2: 10 92 0c 20 sts 0x200C, r1 ; 0x80200c + #endif + + #if !defined(NO_DEVICE_SELF_POWER) + USB_Device_CurrentlySelfPowered = false; + 3d6: 80 91 04 23 lds r24, 0x2304 ; 0x802304 + #endif + } + #endif + #endif + + if (USB_Options & USB_DEVICE_OPT_LOWSPEED) + 3da: 80 ff sbrs r24, 0 + 3dc: 04 c0 rjmp .+8 ; 0x3e6 + 3de: 80 81 ld r24, Z + #if !defined(__DOXYGEN__) + /* Inline Functions: */ + static inline void USB_Device_SetLowSpeed(void) ATTR_ALWAYS_INLINE; + static inline void USB_Device_SetLowSpeed(void) + { + USB.CTRLA &= ~USB_SPEED_bm; + 3e0: 8f 7b andi r24, 0xBF ; 191 + 3e2: 80 83 st Z, r24 + 3e4: 05 c0 rjmp .+10 ; 0x3f0 + 3e6: e0 ec ldi r30, 0xC0 ; 192 + } + + static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE; + static inline void USB_Device_SetFullSpeed(void) + { + USB.CTRLA |= USB_SPEED_bm; + 3e8: f4 e0 ldi r31, 0x04 ; 4 + 3ea: 80 81 ld r24, Z + 3ec: 80 64 ori r24, 0x40 ; 64 + 3ee: 80 83 st Z, r24 + 3f0: 48 e0 ldi r20, 0x08 ; 8 + EPConfigMask |= USB_EP_TYPE_BULK_gc; + break; + } + + if (Type == EP_TYPE_CONTROL) + Endpoint_ConfigureEndpoint_PRV(Address ^ ENDPOINT_DIR_IN, EPConfigMask, Size); + 3f2: 68 e4 ldi r22, 0x48 ; 72 + 3f4: 80 e8 ldi r24, 0x80 ; 128 + 3f6: 5f df rcall .-322 ; 0x2b6 + 3f8: 48 e0 ldi r20, 0x08 ; 8 + + return Endpoint_ConfigureEndpoint_PRV(Address, EPConfigMask, Size); + 3fa: 68 e4 ldi r22, 0x48 ; 72 + 3fc: 80 e0 ldi r24, 0x00 ; 0 + 3fe: 5b df rcall .-330 ; 0x2b6 + 400: e0 ec ldi r30, 0xC0 ; 192 + static inline void USB_INT_Enable(const uint8_t Interrupt) + { + switch (Interrupt) + { + case USB_INT_BUSEVENTI: + USB.INTCTRLA |= USB_BUSEVIE_bm; + 402: f4 e0 ldi r31, 0x04 ; 4 + 404: 80 85 ldd r24, Z+8 ; 0x08 + 406: 80 64 ori r24, 0x40 ; 64 + 408: 80 87 std Z+8, r24 ; 0x08 + 40a: 81 81 ldd r24, Z+1 ; 0x01 + * register and despite the datasheet making no mention of its requirement in host mode. + */ + static inline void USB_Attach(void) ATTR_ALWAYS_INLINE; + static inline void USB_Attach(void) + { + USB.CTRLB |= USB_ATTACH_bm; + 40c: 81 60 ori r24, 0x01 ; 1 + 40e: 81 83 std Z+1, r24 ; 0x01 + 410: 08 95 ret + +00000412 : + 412: cf 93 push r28 + + #if !defined(USE_STATIC_OPTIONS) + const uint8_t Options + #endif + ) +{ + 414: df 93 push r29 + #if !defined(USE_STATIC_OPTIONS) + USB_Options = Options; + 416: 80 93 04 23 sts 0x2304, r24 ; 0x802304 + #if (ARCH == ARCH_AVR8) + return SREG; + #elif (ARCH == ARCH_UC3) + return __builtin_mfsr(AVR32_SR); + #elif (ARCH == ARCH_XMEGA) + return SREG; + 41a: 2f b7 in r18, 0x3f ; 63 + #if (ARCH == ARCH_AVR8) + cli(); + #elif (ARCH == ARCH_UC3) + __builtin_ssrf(AVR32_SR_GM_OFFSET); + #elif (ARCH == ARCH_XMEGA) + cli(); + 41c: f8 94 cli + #endif + + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); + + NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc; + 41e: c0 ec ldi r28, 0xC0 ; 192 + 420: d1 e0 ldi r29, 0x01 ; 1 + 422: 82 e0 ldi r24, 0x02 ; 2 + 424: 8a 87 std Y+10, r24 ; 0x0a + USB.CAL0 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL0)); + 426: ea e1 ldi r30, 0x1A ; 26 + 428: f0 e0 ldi r31, 0x00 ; 0 + 42a: e4 91 lpm r30, Z + 42c: a0 ec ldi r26, 0xC0 ; 192 + 42e: b4 e0 ldi r27, 0x04 ; 4 + 430: da 96 adiw r26, 0x3a ; 58 + 432: ec 93 st X, r30 + 434: da 97 sbiw r26, 0x3a ; 58 + USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1)); + 436: eb e1 ldi r30, 0x1B ; 27 + 438: f0 e0 ldi r31, 0x00 ; 0 + 43a: e4 91 lpm r30, Z + 43c: db 96 adiw r26, 0x3b ; 59 + 43e: ec 93 st X, r30 + 440: db 97 sbiw r26, 0x3b ; 59 + NVM.CMD = NVM_CMD_NO_OPERATION_gc; + 442: 1a 86 std Y+10, r1 ; 0x0a + + /* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for the 8-bit AVR-GCC toolchain */ + USB.EPPTR = ((intptr_t)&USB_EndpointTable[1] & ~(1 << 0)); + 444: 82 eb ldi r24, 0xB2 ; 178 + 446: 92 e2 ldi r25, 0x22 ; 34 + 448: 8e 7f andi r24, 0xFE ; 254 + 44a: 16 96 adiw r26, 0x06 ; 6 + 44c: 8d 93 st X+, r24 + 44e: 9c 93 st X, r25 + 450: 17 97 sbiw r26, 0x07 ; 7 + USB.CTRLA = (USB_STFRNUM_bm | ((ENDPOINT_TOTAL_ENDPOINTS - 1) << USB_MAXEP_gp)); + 452: 84 e1 ldi r24, 0x14 ; 20 + 454: 8c 93 st X, r24 + + if ((USB_Options & USB_OPT_BUSEVENT_PRIHIGH) == USB_OPT_BUSEVENT_PRIHIGH) + 456: 80 91 04 23 lds r24, 0x2304 ; 0x802304 + 45a: 82 ff sbrs r24, 2 + 45c: 04 c0 rjmp .+8 ; 0x466 + USB.INTCTRLA = (3 << USB_INTLVL_gp); + 45e: 83 e0 ldi r24, 0x03 ; 3 + 460: 80 93 c8 04 sts 0x04C8, r24 ; 0x8004c8 <__TEXT_REGION_LENGTH__+0x7004c8> + 464: 0b c0 rjmp .+22 ; 0x47c + else if ((USB_Options & USB_OPT_BUSEVENT_PRIMED) == USB_OPT_BUSEVENT_PRIMED) + 466: 80 91 04 23 lds r24, 0x2304 ; 0x802304 + 46a: 81 ff sbrs r24, 1 + 46c: 04 c0 rjmp .+8 ; 0x476 + USB.INTCTRLA = (2 << USB_INTLVL_gp); + 46e: 82 e0 ldi r24, 0x02 ; 2 + 470: 80 93 c8 04 sts 0x04C8, r24 ; 0x8004c8 <__TEXT_REGION_LENGTH__+0x7004c8> + 474: 03 c0 rjmp .+6 ; 0x47c + else + USB.INTCTRLA = (1 << USB_INTLVL_gp); + 476: 81 e0 ldi r24, 0x01 ; 1 + 478: 80 93 c8 04 sts 0x04C8, r24 ; 0x8004c8 <__TEXT_REGION_LENGTH__+0x7004c8> + if (GlobalIntState & AVR32_SR_GM) + __builtin_ssrf(AVR32_SR_GM_OFFSET); + else + __builtin_csrf(AVR32_SR_GM_OFFSET); + #elif (ARCH == ARCH_XMEGA) + SREG = GlobalIntState; + 47c: 2f bf out 0x3f, r18 ; 63 + + #if defined(USB_CAN_BE_BOTH) + USB_CurrentMode = Mode; + #endif + + USB_IsInitialized = true; + 47e: 81 e0 ldi r24, 0x01 ; 1 + 480: 80 93 0e 20 sts 0x200E, r24 ; 0x80200e + + USB_ResetInterface(); + 484: 7d df rcall .-262 ; 0x380 +} + 486: df 91 pop r29 + 488: cf 91 pop r28 + 48a: 08 95 ret + +0000048c : +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBInterrupt.h" + +void USB_INT_DisableAllInterrupts(void) +{ + USB.INTCTRLA &= USB_INTLVL_gm; + 48c: e0 ec ldi r30, 0xC0 ; 192 + 48e: f4 e0 ldi r31, 0x04 ; 4 + 490: 80 85 ldd r24, Z+8 ; 0x08 + 492: 83 70 andi r24, 0x03 ; 3 + 494: 80 87 std Z+8, r24 ; 0x08 + USB.INTCTRLB = 0; + 496: 11 86 std Z+9, r1 ; 0x09 + 498: 08 95 ret + +0000049a : +} + +void USB_INT_ClearAllInterrupts(void) +{ + USB.INTFLAGSACLR = 0xFF; + 49a: e0 ec ldi r30, 0xC0 ; 192 + 49c: f4 e0 ldi r31, 0x04 ; 4 + 49e: 8f ef ldi r24, 0xFF ; 255 + 4a0: 82 87 std Z+10, r24 ; 0x0a + USB.INTFLAGSBCLR = 0xFF; + 4a2: 84 87 std Z+12, r24 ; 0x0c + 4a4: 08 95 ret + +000004a6 <__vector_125>: +} + +ISR(USB_BUSEVENT_vect) +{ + 4a6: 1f 92 push r1 + 4a8: 0f 92 push r0 + 4aa: 0f b6 in r0, 0x3f ; 63 + 4ac: 0f 92 push r0 + 4ae: 11 24 eor r1, r1 + 4b0: 2f 93 push r18 + 4b2: 3f 93 push r19 + 4b4: 4f 93 push r20 + 4b6: 5f 93 push r21 + 4b8: 6f 93 push r22 + 4ba: 7f 93 push r23 + 4bc: 8f 93 push r24 + 4be: 9f 93 push r25 + 4c0: af 93 push r26 + 4c2: bf 93 push r27 + 4c4: ef 93 push r30 + 4c6: ff 93 push r31 + case USB_INT_BUSEVENTI_Resume: + return ((USB.INTFLAGSACLR & USB_RESUMEIF_bm) ? true : false); + case USB_INT_BUSEVENTI_Reset: + return ((USB.INTFLAGSACLR & USB_RSTIF_bm) ? true : false); + case USB_INT_SOFI: + return ((USB.INTFLAGSACLR & USB_SOFIF_bm) ? true : false); + 4c8: 80 91 ca 04 lds r24, 0x04CA ; 0x8004ca <__TEXT_REGION_LENGTH__+0x7004ca> + #if !defined(NO_SOF_EVENTS) + if (USB_INT_HasOccurred(USB_INT_SOFI) && USB_INT_IsEnabled(USB_INT_SOFI)) + 4cc: 88 23 and r24, r24 + 4ce: 44 f4 brge .+16 ; 0x4e0 <__vector_125+0x3a> + switch (Interrupt) + { + case USB_INT_BUSEVENTI: + return ((USB.INTCTRLA & USB_BUSEVIE_bm) ? true : false); + case USB_INT_SOFI: + return ((USB.INTCTRLA & USB_SOFIE_bm) ? true : false); + 4d0: 80 91 c8 04 lds r24, 0x04C8 ; 0x8004c8 <__TEXT_REGION_LENGTH__+0x7004c8> + 4d4: 88 23 and r24, r24 + 4d6: 24 f4 brge .+8 ; 0x4e0 <__vector_125+0x3a> + break; + case USB_INT_BUSEVENTI_Reset: + USB.INTFLAGSACLR = USB_RSTIF_bm; + break; + case USB_INT_SOFI: + USB.INTFLAGSACLR = USB_SOFIF_bm; + 4d8: 80 e8 ldi r24, 0x80 ; 128 + 4da: 80 93 ca 04 sts 0x04CA, r24 ; 0x8004ca <__TEXT_REGION_LENGTH__+0x7004ca> + { + USB_INT_Clear(USB_INT_SOFI); + + EVENT_USB_Device_StartOfFrame(); + 4de: aa de rcall .-684 ; 0x234 + static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) + { + switch (Interrupt) + { + case USB_INT_BUSEVENTI_Suspend: + return ((USB.INTFLAGSACLR & USB_SUSPENDIF_bm) ? true : false); + 4e0: 80 91 ca 04 lds r24, 0x04CA ; 0x8004ca <__TEXT_REGION_LENGTH__+0x7004ca> + } + #endif + + if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Suspend)) + 4e4: 86 ff sbrs r24, 6 + 4e6: 06 c0 rjmp .+12 ; 0x4f4 <__vector_125+0x4e> + static inline void USB_INT_Clear(const uint8_t Interrupt) + { + switch (Interrupt) + { + case USB_INT_BUSEVENTI_Suspend: + USB.INTFLAGSACLR = USB_SUSPENDIF_bm; + 4e8: 80 e4 ldi r24, 0x40 ; 64 + 4ea: 80 93 ca 04 sts 0x04CA, r24 ; 0x8004ca <__TEXT_REGION_LENGTH__+0x7004ca> + { + USB_INT_Clear(USB_INT_BUSEVENTI_Suspend); + + #if !defined(NO_LIMITED_CONTROLLER_CONNECT) + USB_DeviceState = DEVICE_STATE_Unattached; + 4ee: 10 92 0f 20 sts 0x200F, r1 ; 0x80200f + EVENT_USB_Device_Disconnect(); + 4f2: c8 d3 rcall .+1936 ; 0xc84 + switch (Interrupt) + { + case USB_INT_BUSEVENTI_Suspend: + return ((USB.INTFLAGSACLR & USB_SUSPENDIF_bm) ? true : false); + case USB_INT_BUSEVENTI_Resume: + return ((USB.INTFLAGSACLR & USB_RESUMEIF_bm) ? true : false); + 4f4: 80 91 ca 04 lds r24, 0x04CA ; 0x8004ca <__TEXT_REGION_LENGTH__+0x7004ca> + USB_DeviceState = DEVICE_STATE_Suspended; + EVENT_USB_Device_Suspend(); + #endif + } + + if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Resume)) + 4f8: 85 ff sbrs r24, 5 + 4fa: 15 c0 rjmp .+42 ; 0x526 <__vector_125+0x80> + { + case USB_INT_BUSEVENTI_Suspend: + USB.INTFLAGSACLR = USB_SUSPENDIF_bm; + break; + case USB_INT_BUSEVENTI_Resume: + USB.INTFLAGSACLR = USB_RESUMEIF_bm; + 4fc: 80 e2 ldi r24, 0x20 ; 32 + 4fe: 80 93 ca 04 sts 0x04CA, r24 ; 0x8004ca <__TEXT_REGION_LENGTH__+0x7004ca> + { + + USB_INT_Clear(USB_INT_BUSEVENTI_Resume); + + if (USB_Device_ConfigurationNumber) + 502: 80 91 0b 20 lds r24, 0x200B ; 0x80200b + 506: 88 23 and r24, r24 + 508: 21 f0 breq .+8 ; 0x512 <__vector_125+0x6c> + USB_DeviceState = DEVICE_STATE_Configured; + 50a: 84 e0 ldi r24, 0x04 ; 4 + 50c: 80 93 0f 20 sts 0x200F, r24 ; 0x80200f + 510: 09 c0 rjmp .+18 ; 0x524 <__vector_125+0x7e> + } + + static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; + static inline bool USB_Device_IsAddressSet(void) + { + return ((USB.ADDR != 0) ? true : false); + 512: 80 91 c3 04 lds r24, 0x04C3 ; 0x8004c3 <__TEXT_REGION_LENGTH__+0x7004c3> + else + USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Addressed : DEVICE_STATE_Powered; + 516: 81 11 cpse r24, r1 + 518: 02 c0 rjmp .+4 ; 0x51e <__vector_125+0x78> + 51a: 81 e0 ldi r24, 0x01 ; 1 + 51c: 01 c0 rjmp .+2 ; 0x520 <__vector_125+0x7a> + 51e: 83 e0 ldi r24, 0x03 ; 3 + 520: 80 93 0f 20 sts 0x200F, r24 ; 0x80200f + + #if !defined(NO_LIMITED_CONTROLLER_CONNECT) + EVENT_USB_Device_Connect(); + 524: b0 d3 rcall .+1888 ; 0xc86 + case USB_INT_BUSEVENTI_Suspend: + return ((USB.INTFLAGSACLR & USB_SUSPENDIF_bm) ? true : false); + case USB_INT_BUSEVENTI_Resume: + return ((USB.INTFLAGSACLR & USB_RESUMEIF_bm) ? true : false); + case USB_INT_BUSEVENTI_Reset: + return ((USB.INTFLAGSACLR & USB_RSTIF_bm) ? true : false); + 526: 80 91 ca 04 lds r24, 0x04CA ; 0x8004ca <__TEXT_REGION_LENGTH__+0x7004ca> + #else + EVENT_USB_Device_WakeUp(); + #endif + } + + if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Reset)) + 52a: 84 ff sbrs r24, 4 + 52c: 14 c0 rjmp .+40 ; 0x556 <__vector_125+0xb0> + break; + case USB_INT_BUSEVENTI_Resume: + USB.INTFLAGSACLR = USB_RESUMEIF_bm; + break; + case USB_INT_BUSEVENTI_Reset: + USB.INTFLAGSACLR = USB_RSTIF_bm; + 52e: e0 ec ldi r30, 0xC0 ; 192 + 530: f4 e0 ldi r31, 0x04 ; 4 + 532: 80 e1 ldi r24, 0x10 ; 16 + 534: 82 87 std Z+10, r24 ; 0x0a + { + + USB_INT_Clear(USB_INT_BUSEVENTI_Reset); + + USB_DeviceState = DEVICE_STATE_Default; + 536: 82 e0 ldi r24, 0x02 ; 2 + 538: 80 93 0f 20 sts 0x200F, r24 ; 0x80200f + USB_Device_ConfigurationNumber = 0; + 53c: 10 92 0b 20 sts 0x200B, r1 ; 0x80200b + + USB_Device_EnableDeviceAddress(0); + + Endpoint_ClearEndpoints(); + 540: 13 82 std Z+3, r1 ; 0x03 + EPConfigMask |= USB_EP_TYPE_BULK_gc; + break; + } + + if (Type == EP_TYPE_CONTROL) + Endpoint_ConfigureEndpoint_PRV(Address ^ ENDPOINT_DIR_IN, EPConfigMask, Size); + 542: fe de rcall .-516 ; 0x340 + 544: 48 e0 ldi r20, 0x08 ; 8 + 546: 68 e4 ldi r22, 0x48 ; 72 + 548: 80 e8 ldi r24, 0x80 ; 128 + + return Endpoint_ConfigureEndpoint_PRV(Address, EPConfigMask, Size); + 54a: b5 de rcall .-662 ; 0x2b6 + 54c: 48 e0 ldi r20, 0x08 ; 8 + 54e: 68 e4 ldi r22, 0x48 ; 72 + 550: 80 e0 ldi r24, 0x00 ; 0 + 552: b1 de rcall .-670 ; 0x2b6 + Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, + USB_Device_ControlEndpointSize, 1); + + EVENT_USB_Device_Reset(); + 554: 6f de rcall .-802 ; 0x234 + 556: ff 91 pop r31 + } +} + 558: ef 91 pop r30 + 55a: bf 91 pop r27 + 55c: af 91 pop r26 + 55e: 9f 91 pop r25 + 560: 8f 91 pop r24 + 562: 7f 91 pop r23 + 564: 6f 91 pop r22 + 566: 5f 91 pop r21 + 568: 4f 91 pop r20 + 56a: 3f 91 pop r19 + 56c: 2f 91 pop r18 + 56e: 0f 90 pop r0 + 570: 0f be out 0x3f, r0 ; 63 + 572: 0f 90 pop r0 + 574: 1f 90 pop r1 + 576: 18 95 reti + +00000578 : + 578: e0 ec ldi r30, 0xC0 ; 192 + can3_unstandby(); + return 1; +} + +//reset +void all_reset(){ can1_reset();can2_reset();can3_reset();} + 57a: f8 e0 ldi r31, 0x08 ; 8 + 57c: 92 81 ldd r25, Z+2 ; 0x02 + 57e: 92 83 std Z+2, r25 ; 0x02 + 580: 83 83 std Z+3, r24 ; 0x03 + 582: 82 81 ldd r24, Z+2 ; 0x02 + 584: 88 23 and r24, r24 + 586: ec f7 brge .-6 ; 0x582 + 588: 80 91 c3 08 lds r24, 0x08C3 ; 0x8008c3 <__TEXT_REGION_LENGTH__+0x7008c3> + 58c: 08 95 ret + +0000058e : + 58e: 1f 93 push r17 + 590: cf 93 push r28 + 592: df 93 push r29 + 594: c0 e4 ldi r28, 0x40 ; 64 + 596: d6 e0 ldi r29, 0x06 ; 6 + 598: 10 e1 ldi r17, 0x10 ; 16 + 59a: 1e 83 std Y+6, r17 ; 0x06 + 59c: 80 ec ldi r24, 0xC0 ; 192 + 59e: ec df rcall .-40 ; 0x578 + 5a0: 1d 83 std Y+5, r17 ; 0x05 + 5a2: df 91 pop r29 + 5a4: cf 91 pop r28 + 5a6: 1f 91 pop r17 + 5a8: 08 95 ret + +000005aa : + 5aa: 1f 93 push r17 + 5ac: cf 93 push r28 + 5ae: df 93 push r29 + 5b0: c0 e6 ldi r28, 0x60 ; 96 + 5b2: d6 e0 ldi r29, 0x06 ; 6 + 5b4: 10 e1 ldi r17, 0x10 ; 16 + 5b6: 1e 83 std Y+6, r17 ; 0x06 + 5b8: 80 ec ldi r24, 0xC0 ; 192 + 5ba: de df rcall .-68 ; 0x578 + 5bc: 1d 83 std Y+5, r17 ; 0x05 + 5be: df 91 pop r29 + 5c0: cf 91 pop r28 + 5c2: 1f 91 pop r17 + 5c4: 08 95 ret + +000005c6 : + 5c6: 1f 93 push r17 + 5c8: cf 93 push r28 + 5ca: df 93 push r29 + 5cc: c0 e2 ldi r28, 0x20 ; 32 + 5ce: d6 e0 ldi r29, 0x06 ; 6 + 5d0: 18 e0 ldi r17, 0x08 ; 8 + 5d2: 1e 83 std Y+6, r17 ; 0x06 + 5d4: 80 ec ldi r24, 0xC0 ; 192 + 5d6: d0 df rcall .-96 ; 0x578 + 5d8: 1d 83 std Y+5, r17 ; 0x05 + 5da: df 91 pop r29 + 5dc: cf 91 pop r28 + 5de: 1f 91 pop r17 + 5e0: 08 95 ret + +000005e2 : + if(bus == 2){can2_select();can123_bit_modify(reg,mask,val);can2_deselect();} + if(bus == 3){can3_select();can123_bit_modify(reg,mask,val);can3_deselect();}} +void can1_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can1_select();can123_bit_modify(reg,mask,val);can1_deselect(); } +void can2_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can2_select();can123_bit_modify(reg,mask,val);can2_deselect(); } +void can3_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can3_select();can123_bit_modify(reg,mask,val);can3_deselect(); } +void can123_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ spi0_write(MCP_BITMOD); spi0_write(reg); spi0_write(mask); spi0_write(val);} + 5e2: 1f 93 push r17 + 5e4: cf 93 push r28 + 5e6: df 93 push r29 + 5e8: 18 2f mov r17, r24 + 5ea: d6 2f mov r29, r22 + 5ec: c4 2f mov r28, r20 + 5ee: 85 e0 ldi r24, 0x05 ; 5 + 5f0: c3 df rcall .-122 ; 0x578 + 5f2: 81 2f mov r24, r17 + 5f4: c1 df rcall .-126 ; 0x578 + 5f6: 8d 2f mov r24, r29 + 5f8: bf df rcall .-130 ; 0x578 + 5fa: 8c 2f mov r24, r28 + 5fc: bd df rcall .-134 ; 0x578 + 5fe: df 91 pop r29 + 600: cf 91 pop r28 + 602: 1f 91 pop r17 + 604: 08 95 ret + +00000606 : +void can1_reset(){ can1_select();spi0_write(MCP_RESET);can1_deselect(); } +void can2_reset(){ can2_select();spi0_write(MCP_RESET);can2_deselect(); } +void can3_reset(){ can3_select();spi0_write(MCP_RESET);can3_deselect(); } + +//bit modify +void can_bit_modify(uint8_t reg, uint8_t mask, uint8_t val, uint8_t bus){if(bus == 1){can1_select();can123_bit_modify(reg,mask,val);can1_deselect();} + 606: 1f 93 push r17 + 608: cf 93 push r28 + 60a: df 93 push r29 + 60c: 21 30 cpi r18, 0x01 ; 1 + 60e: 39 f4 brne .+14 ; 0x61e + 610: c0 e4 ldi r28, 0x40 ; 64 + 612: d6 e0 ldi r29, 0x06 ; 6 + 614: 10 e1 ldi r17, 0x10 ; 16 + 616: 1e 83 std Y+6, r17 ; 0x06 + 618: e4 df rcall .-56 ; 0x5e2 + 61a: 1d 83 std Y+5, r17 ; 0x05 + 61c: 11 c0 rjmp .+34 ; 0x640 + if(bus == 2){can2_select();can123_bit_modify(reg,mask,val);can2_deselect();} + 61e: 22 30 cpi r18, 0x02 ; 2 + 620: 39 f4 brne .+14 ; 0x630 + 622: c0 e6 ldi r28, 0x60 ; 96 + 624: d6 e0 ldi r29, 0x06 ; 6 + 626: 10 e1 ldi r17, 0x10 ; 16 + 628: 1e 83 std Y+6, r17 ; 0x06 + 62a: db df rcall .-74 ; 0x5e2 + 62c: 1d 83 std Y+5, r17 ; 0x05 + 62e: 08 c0 rjmp .+16 ; 0x640 + if(bus == 3){can3_select();can123_bit_modify(reg,mask,val);can3_deselect();}} + 630: 23 30 cpi r18, 0x03 ; 3 + 632: 31 f4 brne .+12 ; 0x640 + 634: c0 e2 ldi r28, 0x20 ; 32 + 636: d6 e0 ldi r29, 0x06 ; 6 + 638: 18 e0 ldi r17, 0x08 ; 8 + 63a: 1e 83 std Y+6, r17 ; 0x06 + 63c: d2 df rcall .-92 ; 0x5e2 + 63e: 1d 83 std Y+5, r17 ; 0x05 + 640: df 91 pop r29 + 642: cf 91 pop r28 + 644: 1f 91 pop r17 + 646: 08 95 ret + +00000648 : +void can1_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can1_select();can123_bit_modify(reg,mask,val);can1_deselect(); } + 648: 1f 93 push r17 + 64a: cf 93 push r28 + 64c: df 93 push r29 + 64e: c0 e4 ldi r28, 0x40 ; 64 + 650: d6 e0 ldi r29, 0x06 ; 6 + 652: 10 e1 ldi r17, 0x10 ; 16 + 654: 1e 83 std Y+6, r17 ; 0x06 + 656: c5 df rcall .-118 ; 0x5e2 + 658: 1d 83 std Y+5, r17 ; 0x05 + 65a: df 91 pop r29 + 65c: cf 91 pop r28 + 65e: 1f 91 pop r17 + 660: 08 95 ret + +00000662 : +void can2_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can2_select();can123_bit_modify(reg,mask,val);can2_deselect(); } + 662: 1f 93 push r17 + 664: cf 93 push r28 + 666: df 93 push r29 + 668: c0 e6 ldi r28, 0x60 ; 96 + 66a: d6 e0 ldi r29, 0x06 ; 6 + 66c: 10 e1 ldi r17, 0x10 ; 16 + 66e: 1e 83 std Y+6, r17 ; 0x06 + 670: b8 df rcall .-144 ; 0x5e2 + 672: 1d 83 std Y+5, r17 ; 0x05 + 674: df 91 pop r29 + 676: cf 91 pop r28 + 678: 1f 91 pop r17 + 67a: 08 95 ret + +0000067c : +void can3_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can3_select();can123_bit_modify(reg,mask,val);can3_deselect(); } + 67c: 1f 93 push r17 + 67e: cf 93 push r28 + 680: df 93 push r29 + 682: c0 e2 ldi r28, 0x20 ; 32 + 684: d6 e0 ldi r29, 0x06 ; 6 + 686: 18 e0 ldi r17, 0x08 ; 8 + 688: 1e 83 std Y+6, r17 ; 0x06 + 68a: ab df rcall .-170 ; 0x5e2 + 68c: 1d 83 std Y+5, r17 ; 0x05 + 68e: df 91 pop r29 + 690: cf 91 pop r28 + 692: 1f 91 pop r17 + 694: 08 95 ret + +00000696 : +void can1_rts(uint8_t channel){ can1_select(); can123_rts(channel); can1_deselect(); } +void can2_rts(uint8_t channel){ can2_select(); can123_rts(channel); can2_deselect(); } +void can3_rts(uint8_t channel){ can3_select(); can123_rts(channel); can3_deselect(); } + +void can123_rts(uint8_t channel){ + switch (channel){ + 696: 81 30 cpi r24, 0x01 ; 1 + 698: 39 f0 breq .+14 ; 0x6a8 + 69a: 18 f0 brcs .+6 ; 0x6a2 + 69c: 82 30 cpi r24, 0x02 ; 2 + 69e: 39 f0 breq .+14 ; 0x6ae + 6a0: 08 95 ret + case MCP_TX_0: spi0_write(MCP_RTS_TXB0); break; + 6a2: 81 e8 ldi r24, 0x81 ; 129 + 6a4: 69 cf rjmp .-302 ; 0x578 + 6a6: 08 95 ret + case MCP_TX_1: spi0_write(MCP_RTS_TXB1); break; + 6a8: 82 e8 ldi r24, 0x82 ; 130 + 6aa: 66 cf rjmp .-308 ; 0x578 + 6ac: 08 95 ret + case MCP_TX_2: spi0_write(MCP_RTS_TXB2); break; + 6ae: 84 e8 ldi r24, 0x84 ; 132 + 6b0: 63 cf rjmp .-314 ; 0x578 + 6b2: 08 95 ret + +000006b4 : + 6b4: 1f 93 push r17 +void can2_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can2_select();can123_bit_modify(reg,mask,val);can2_deselect(); } +void can3_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can3_select();can123_bit_modify(reg,mask,val);can3_deselect(); } +void can123_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ spi0_write(MCP_BITMOD); spi0_write(reg); spi0_write(mask); spi0_write(val);} + +//RTS from SPI +void can1_rts(uint8_t channel){ can1_select(); can123_rts(channel); can1_deselect(); } + 6b6: cf 93 push r28 + 6b8: df 93 push r29 + 6ba: c0 e4 ldi r28, 0x40 ; 64 + 6bc: d6 e0 ldi r29, 0x06 ; 6 + 6be: 10 e1 ldi r17, 0x10 ; 16 + 6c0: 1e 83 std Y+6, r17 ; 0x06 + 6c2: e9 df rcall .-46 ; 0x696 + 6c4: 1d 83 std Y+5, r17 ; 0x05 + 6c6: df 91 pop r29 + 6c8: cf 91 pop r28 + 6ca: 1f 91 pop r17 + 6cc: 08 95 ret + +000006ce : +void can2_rts(uint8_t channel){ can2_select(); can123_rts(channel); can2_deselect(); } + 6ce: 1f 93 push r17 + 6d0: cf 93 push r28 + 6d2: df 93 push r29 + 6d4: c0 e6 ldi r28, 0x60 ; 96 + 6d6: d6 e0 ldi r29, 0x06 ; 6 + 6d8: 10 e1 ldi r17, 0x10 ; 16 + 6da: 1e 83 std Y+6, r17 ; 0x06 + 6dc: dc df rcall .-72 ; 0x696 + 6de: 1d 83 std Y+5, r17 ; 0x05 + 6e0: df 91 pop r29 + 6e2: cf 91 pop r28 + 6e4: 1f 91 pop r17 + 6e6: 08 95 ret + +000006e8 : +void can3_rts(uint8_t channel){ can3_select(); can123_rts(channel); can3_deselect(); } + 6e8: 1f 93 push r17 + 6ea: cf 93 push r28 + 6ec: df 93 push r29 + 6ee: c0 e2 ldi r28, 0x20 ; 32 + 6f0: d6 e0 ldi r29, 0x06 ; 6 + 6f2: 18 e0 ldi r17, 0x08 ; 8 + 6f4: 1e 83 std Y+6, r17 ; 0x06 + 6f6: cf df rcall .-98 ; 0x696 + 6f8: 1d 83 std Y+5, r17 ; 0x05 + 6fa: df 91 pop r29 + 6fc: cf 91 pop r28 + 6fe: 1f 91 pop r17 + 700: 08 95 ret + +00000702 : + +void can1_load_txbuff(uint8_t channel, can_frame_t* frame){ can1_select(); can123_load_txbuff(channel, frame); can1_deselect(); } +void can2_load_txbuff(uint8_t channel, can_frame_t* frame){ can2_select(); can123_load_txbuff(channel, frame); can2_deselect(); } +void can3_load_txbuff(uint8_t channel, can_frame_t* frame){ can3_select(); can123_load_txbuff(channel, frame); can3_deselect(); } + +void can123_load_txbuff(uint8_t channel, can_frame_t* frame){ + 702: 0f 93 push r16 + 704: 1f 93 push r17 + 706: cf 93 push r28 + 708: 8b 01 movw r16, r22 + uint8_t tmp = 0; + + spi0_write(MCP_LOAD_BUF_TXB0SIDH + (channel * 2)); //set buffer + 70a: 88 0f add r24, r24 + 70c: 80 5c subi r24, 0xC0 ; 192 + 70e: 34 df rcall .-408 ; 0x578 + spi0_write((uint8_t)(frame->can_id >> 8)); // send XXXnEID8 + spi0_write((uint8_t)(frame->can_id)); // send XXXnEID0 + } else { + #endif + + spi0_write((uint8_t)(frame->can_id>>3)); // send XXXnSIDH + 710: f8 01 movw r30, r16 + 712: 80 81 ld r24, Z + 714: 91 81 ldd r25, Z+1 ; 0x01 + 716: 96 95 lsr r25 + 718: 87 95 ror r24 + 71a: 96 95 lsr r25 + 71c: 87 95 ror r24 + 71e: 96 95 lsr r25 + 720: 87 95 ror r24 + 722: 2a df rcall .-428 ; 0x578 + tmp = ((uint8_t)(frame->can_id << 5) ) & 0xe0; + tmp |= ((uint8_t)(frame->can_id << 2) ) & 0x03; + spi0_write(tmp); // send XXXnSIDL + 724: f8 01 movw r30, r16 + 726: 80 81 ld r24, Z + 728: 82 95 swap r24 + 72a: 88 0f add r24, r24 + 72c: 80 7e andi r24, 0xE0 ; 224 + spi0_write(0); // send XXXnEID8 + 72e: 24 df rcall .-440 ; 0x578 + 730: 80 e0 ldi r24, 0x00 ; 0 + spi0_write(0); // send XXXnEID0 + 732: 22 df rcall .-444 ; 0x578 + 734: 80 e0 ldi r24, 0x00 ; 0 + + #ifdef TC_CHARGER + } + #endif + + spi0_write(frame->can_dlc & 0x0f); + 736: 20 df rcall .-448 ; 0x578 + 738: f8 01 movw r30, r16 + 73a: 82 81 ldd r24, Z+2 ; 0x02 + 73c: 8f 70 andi r24, 0x0F ; 15 + 73e: 1c df rcall .-456 ; 0x578 + + for(uint8_t i= 0; ican_dlc; i++){ spi0_write(frame->data[i]); } + 740: f8 01 movw r30, r16 + 742: 82 81 ldd r24, Z+2 ; 0x02 + 744: 88 23 and r24, r24 + 746: 59 f0 breq .+22 ; 0x75e + 748: c0 e0 ldi r28, 0x00 ; 0 + 74a: f8 01 movw r30, r16 + 74c: ec 0f add r30, r28 + 74e: f1 1d adc r31, r1 + 750: 83 81 ldd r24, Z+3 ; 0x03 + 752: 12 df rcall .-476 ; 0x578 + 754: cf 5f subi r28, 0xFF ; 255 + 756: f8 01 movw r30, r16 + 758: 82 81 ldd r24, Z+2 ; 0x02 + 75a: c8 17 cp r28, r24 + 75c: b0 f3 brcs .-20 ; 0x74a +} + 75e: cf 91 pop r28 + 760: 1f 91 pop r17 + 762: 0f 91 pop r16 + 764: 08 95 ret + +00000766 : + case MCP_TX_1: spi0_write(MCP_RTS_TXB1); break; + case MCP_TX_2: spi0_write(MCP_RTS_TXB2); break; + default: return; +} } + +void can1_load_txbuff(uint8_t channel, can_frame_t* frame){ can1_select(); can123_load_txbuff(channel, frame); can1_deselect(); } + 766: 1f 93 push r17 + 768: cf 93 push r28 + 76a: df 93 push r29 + 76c: c0 e4 ldi r28, 0x40 ; 64 + 76e: d6 e0 ldi r29, 0x06 ; 6 + 770: 10 e1 ldi r17, 0x10 ; 16 + 772: 1e 83 std Y+6, r17 ; 0x06 + 774: c6 df rcall .-116 ; 0x702 + 776: 1d 83 std Y+5, r17 ; 0x05 + 778: df 91 pop r29 + 77a: cf 91 pop r28 + 77c: 1f 91 pop r17 + 77e: 08 95 ret + +00000780 : +void can2_load_txbuff(uint8_t channel, can_frame_t* frame){ can2_select(); can123_load_txbuff(channel, frame); can2_deselect(); } + 780: 1f 93 push r17 + 782: cf 93 push r28 + 784: df 93 push r29 + 786: c0 e6 ldi r28, 0x60 ; 96 + 788: d6 e0 ldi r29, 0x06 ; 6 + 78a: 10 e1 ldi r17, 0x10 ; 16 + 78c: 1e 83 std Y+6, r17 ; 0x06 + 78e: b9 df rcall .-142 ; 0x702 + 790: 1d 83 std Y+5, r17 ; 0x05 + 792: df 91 pop r29 + 794: cf 91 pop r28 + 796: 1f 91 pop r17 + 798: 08 95 ret + +0000079a : +void can3_load_txbuff(uint8_t channel, can_frame_t* frame){ can3_select(); can123_load_txbuff(channel, frame); can3_deselect(); } + 79a: 1f 93 push r17 + 79c: cf 93 push r28 + 79e: df 93 push r29 + 7a0: c0 e2 ldi r28, 0x20 ; 32 + 7a2: d6 e0 ldi r29, 0x06 ; 6 + 7a4: 18 e0 ldi r17, 0x08 ; 8 + 7a6: 1e 83 std Y+6, r17 ; 0x06 + 7a8: ac df rcall .-168 ; 0x702 + 7aa: 1d 83 std Y+5, r17 ; 0x05 + 7ac: df 91 pop r29 + 7ae: cf 91 pop r28 + 7b0: 1f 91 pop r17 + 7b2: 08 95 ret + +000007b4 : +uint8_t can_read_rx_buf(uint8_t channel, can_frame_t* frame, uint8_t bus){uint8_t res = 0; if(bus == 1){res = can1_read_rx_buf(channel, frame);} if(bus == 2){res = can2_read_rx_buf(channel, frame);} if(bus == 3){res = can3_read_rx_buf(channel, frame);} return res;} +uint8_t can1_read_rx_buf(uint8_t channel, can_frame_t* frame){uint8_t res = 0; can1_select(); res = can123_read_rx_buf(channel, frame); can1_deselect(); return res;} +uint8_t can2_read_rx_buf(uint8_t channel, can_frame_t* frame){uint8_t res = 0; can2_select(); res = can123_read_rx_buf(channel, frame); can2_deselect(); return res;} +uint8_t can3_read_rx_buf(uint8_t channel, can_frame_t* frame){uint8_t res = 0; can3_select(); res = can123_read_rx_buf(channel, frame); can3_deselect(); return res;} + +uint8_t can123_read_rx_buf(uint8_t channel, can_frame_t* frame){ + 7b4: 0f 93 push r16 + 7b6: 1f 93 push r17 + 7b8: cf 93 push r28 + 7ba: df 93 push r29 + 7bc: 8b 01 movw r16, r22 + uint16_t id = 0; + uint8_t data; + + spi0_write(channel); + 7be: dc de rcall .-584 ; 0x578 + + data = spi0_write(0); // read XXXnSIDH + 7c0: 80 e0 ldi r24, 0x00 ; 0 + 7c2: da de rcall .-588 ; 0x578 + id = (((uint16_t)data) << 3); + 7c4: 98 e0 ldi r25, 0x08 ; 8 + 7c6: 89 9f mul r24, r25 + 7c8: e0 01 movw r28, r0 + + data = spi0_write(0); // read XXXnSIDL + 7ca: 11 24 eor r1, r1 + 7cc: 80 e0 ldi r24, 0x00 ; 0 + 7ce: d4 de rcall .-600 ; 0x578 + id |= (((uint16_t)(data & 0xe0)) >> 5); + 7d0: 82 95 swap r24 + 7d2: 86 95 lsr r24 + 7d4: 87 70 andi r24, 0x07 ; 7 + + spi0_write(0); // read XXXnEID8 + 7d6: c8 2b or r28, r24 + 7d8: 80 e0 ldi r24, 0x00 ; 0 + spi0_write(0); // read XXXnEID0 + 7da: ce de rcall .-612 ; 0x578 + 7dc: 80 e0 ldi r24, 0x00 ; 0 + + frame->can_id = id; + 7de: cc de rcall .-616 ; 0x578 + 7e0: f8 01 movw r30, r16 + 7e2: c0 83 st Z, r28 + frame->can_dlc = spi0_write(0); // read length of the frame + 7e4: d1 83 std Z+1, r29 ; 0x01 + 7e6: 80 e0 ldi r24, 0x00 ; 0 + 7e8: c7 de rcall .-626 ; 0x578 + frame->can_dlc &= 0x0f; + 7ea: 8f 70 andi r24, 0x0F ; 15 + 7ec: f8 01 movw r30, r16 + + for (uint8_t i=0; ican_dlc; i++){ frame->data[i] = spi0_write(0); } + 7ee: 82 83 std Z+2, r24 ; 0x02 + 7f0: 88 23 and r24, r24 + 7f2: 61 f0 breq .+24 ; 0x80c + 7f4: c0 e0 ldi r28, 0x00 ; 0 + 7f6: 80 e0 ldi r24, 0x00 ; 0 + 7f8: bf de rcall .-642 ; 0x578 + 7fa: f8 01 movw r30, r16 + 7fc: ec 0f add r30, r28 + 7fe: f1 1d adc r31, r1 + 800: 83 83 std Z+3, r24 ; 0x03 + 802: cf 5f subi r28, 0xFF ; 255 + 804: f8 01 movw r30, r16 + 806: 82 81 ldd r24, Z+2 ; 0x02 + 808: c8 17 cp r28, r24 + 80a: a8 f3 brcs .-22 ; 0x7f6 + + return 1; +} + 80c: 81 e0 ldi r24, 0x01 ; 1 + 80e: df 91 pop r29 + 810: cf 91 pop r28 + 812: 1f 91 pop r17 + 814: 0f 91 pop r16 + 816: 08 95 ret + +00000818 : + for(uint8_t i= 0; ican_dlc; i++){ spi0_write(frame->data[i]); } +} + +//Read rxbuffer to a frame +uint8_t can_read_rx_buf(uint8_t channel, can_frame_t* frame, uint8_t bus){uint8_t res = 0; if(bus == 1){res = can1_read_rx_buf(channel, frame);} if(bus == 2){res = can2_read_rx_buf(channel, frame);} if(bus == 3){res = can3_read_rx_buf(channel, frame);} return res;} +uint8_t can1_read_rx_buf(uint8_t channel, can_frame_t* frame){uint8_t res = 0; can1_select(); res = can123_read_rx_buf(channel, frame); can1_deselect(); return res;} + 818: 1f 93 push r17 + 81a: cf 93 push r28 + 81c: df 93 push r29 + 81e: c0 e4 ldi r28, 0x40 ; 64 + 820: d6 e0 ldi r29, 0x06 ; 6 + 822: 10 e1 ldi r17, 0x10 ; 16 + 824: 1e 83 std Y+6, r17 ; 0x06 + 826: c6 df rcall .-116 ; 0x7b4 + 828: 1d 83 std Y+5, r17 ; 0x05 + 82a: df 91 pop r29 + 82c: cf 91 pop r28 + 82e: 1f 91 pop r17 + 830: 08 95 ret + +00000832 : +uint8_t can2_read_rx_buf(uint8_t channel, can_frame_t* frame){uint8_t res = 0; can2_select(); res = can123_read_rx_buf(channel, frame); can2_deselect(); return res;} + 832: 1f 93 push r17 + 834: cf 93 push r28 + 836: df 93 push r29 + 838: c0 e6 ldi r28, 0x60 ; 96 + 83a: d6 e0 ldi r29, 0x06 ; 6 + 83c: 10 e1 ldi r17, 0x10 ; 16 + 83e: 1e 83 std Y+6, r17 ; 0x06 + 840: b9 df rcall .-142 ; 0x7b4 + 842: 1d 83 std Y+5, r17 ; 0x05 + 844: df 91 pop r29 + 846: cf 91 pop r28 + 848: 1f 91 pop r17 + 84a: 08 95 ret + +0000084c : +uint8_t can3_read_rx_buf(uint8_t channel, can_frame_t* frame){uint8_t res = 0; can3_select(); res = can123_read_rx_buf(channel, frame); can3_deselect(); return res;} + 84c: 1f 93 push r17 + 84e: cf 93 push r28 + 850: df 93 push r29 + 852: c0 e2 ldi r28, 0x20 ; 32 + 854: d6 e0 ldi r29, 0x06 ; 6 + 856: 18 e0 ldi r17, 0x08 ; 8 + 858: 1e 83 std Y+6, r17 ; 0x06 + 85a: ac df rcall .-168 ; 0x7b4 + 85c: 1d 83 std Y+5, r17 ; 0x05 + 85e: df 91 pop r29 + 860: cf 91 pop r28 + 862: 1f 91 pop r17 + 864: 08 95 ret + +00000866 : + + for(uint8_t i= 0; ican_dlc; i++){ spi0_write(frame->data[i]); } +} + +//Read rxbuffer to a frame +uint8_t can_read_rx_buf(uint8_t channel, can_frame_t* frame, uint8_t bus){uint8_t res = 0; if(bus == 1){res = can1_read_rx_buf(channel, frame);} if(bus == 2){res = can2_read_rx_buf(channel, frame);} if(bus == 3){res = can3_read_rx_buf(channel, frame);} return res;} + 866: 41 30 cpi r20, 0x01 ; 1 + 868: 11 f4 brne .+4 ; 0x86e + 86a: d6 cf rjmp .-84 ; 0x818 + 86c: 08 95 ret + 86e: 42 30 cpi r20, 0x02 ; 2 + 870: 11 f4 brne .+4 ; 0x876 + 872: df cf rjmp .-66 ; 0x832 + 874: 08 95 ret + 876: 43 30 cpi r20, 0x03 ; 3 + 878: 11 f4 brne .+4 ; 0x87e + 87a: e8 cf rjmp .-48 ; 0x84c + 87c: 08 95 ret + 87e: 80 e0 ldi r24, 0x00 ; 0 + 880: 08 95 ret + +00000882 : + return 1; +} + +//read a register +uint8_t can_read(uint8_t reg, uint8_t bus){if(bus == 1){return can1_read(reg);} else if(bus == 2) {return can2_read(reg);} else {return can3_read(reg);}} +uint8_t can1_read(uint8_t reg){uint8_t res=0; can1_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can1_deselect(); return res;} + 882: 0f 93 push r16 + 884: 1f 93 push r17 + 886: cf 93 push r28 + 888: df 93 push r29 + 88a: 08 2f mov r16, r24 + 88c: c0 e4 ldi r28, 0x40 ; 64 + 88e: d6 e0 ldi r29, 0x06 ; 6 + 890: 10 e1 ldi r17, 0x10 ; 16 + 892: 1e 83 std Y+6, r17 ; 0x06 + 894: 83 e0 ldi r24, 0x03 ; 3 + 896: 70 de rcall .-800 ; 0x578 + 898: 80 2f mov r24, r16 + 89a: 6e de rcall .-804 ; 0x578 + 89c: 80 e0 ldi r24, 0x00 ; 0 + 89e: 6c de rcall .-808 ; 0x578 + 8a0: 1d 83 std Y+5, r17 ; 0x05 + 8a2: df 91 pop r29 + 8a4: cf 91 pop r28 + 8a6: 1f 91 pop r17 + 8a8: 0f 91 pop r16 + 8aa: 08 95 ret + +000008ac : +uint8_t can2_read(uint8_t reg){uint8_t res=0; can2_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can2_deselect(); return res;} + 8ac: 0f 93 push r16 + 8ae: 1f 93 push r17 + 8b0: cf 93 push r28 + 8b2: df 93 push r29 + 8b4: 08 2f mov r16, r24 + 8b6: c0 e6 ldi r28, 0x60 ; 96 + 8b8: d6 e0 ldi r29, 0x06 ; 6 + 8ba: 10 e1 ldi r17, 0x10 ; 16 + 8bc: 1e 83 std Y+6, r17 ; 0x06 + 8be: 83 e0 ldi r24, 0x03 ; 3 + 8c0: 5b de rcall .-842 ; 0x578 + 8c2: 80 2f mov r24, r16 + 8c4: 59 de rcall .-846 ; 0x578 + 8c6: 80 e0 ldi r24, 0x00 ; 0 + 8c8: 57 de rcall .-850 ; 0x578 + 8ca: 1d 83 std Y+5, r17 ; 0x05 + 8cc: df 91 pop r29 + 8ce: cf 91 pop r28 + 8d0: 1f 91 pop r17 + 8d2: 0f 91 pop r16 + 8d4: 08 95 ret + +000008d6 : +uint8_t can3_read(uint8_t reg){uint8_t res=0; can3_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can3_deselect(); return res;} + 8d6: 0f 93 push r16 + 8d8: 1f 93 push r17 + 8da: cf 93 push r28 + 8dc: df 93 push r29 + 8de: 08 2f mov r16, r24 + 8e0: c0 e2 ldi r28, 0x20 ; 32 + 8e2: d6 e0 ldi r29, 0x06 ; 6 + 8e4: 18 e0 ldi r17, 0x08 ; 8 + 8e6: 1e 83 std Y+6, r17 ; 0x06 + 8e8: 83 e0 ldi r24, 0x03 ; 3 + 8ea: 46 de rcall .-884 ; 0x578 + 8ec: 80 2f mov r24, r16 + 8ee: 44 de rcall .-888 ; 0x578 + 8f0: 80 e0 ldi r24, 0x00 ; 0 + 8f2: 42 de rcall .-892 ; 0x578 + 8f4: 1d 83 std Y+5, r17 ; 0x05 + 8f6: df 91 pop r29 + 8f8: cf 91 pop r28 + 8fa: 1f 91 pop r17 + 8fc: 0f 91 pop r16 + 8fe: 08 95 ret + +00000900 : + + return 1; +} + +//read a register +uint8_t can_read(uint8_t reg, uint8_t bus){if(bus == 1){return can1_read(reg);} else if(bus == 2) {return can2_read(reg);} else {return can3_read(reg);}} + 900: 61 30 cpi r22, 0x01 ; 1 + 902: 11 f4 brne .+4 ; 0x908 + 904: be cf rjmp .-132 ; 0x882 + 906: 08 95 ret + 908: 62 30 cpi r22, 0x02 ; 2 + 90a: 11 f4 brne .+4 ; 0x910 + 90c: cf cf rjmp .-98 ; 0x8ac + 90e: 08 95 ret + 910: e2 cf rjmp .-60 ; 0x8d6 + 912: 08 95 ret + +00000914 : +uint8_t can2_read(uint8_t reg){uint8_t res=0; can2_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can2_deselect(); return res;} +uint8_t can3_read(uint8_t reg){uint8_t res=0; can3_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can3_deselect(); return res;} + +//write a register. +void can_write(uint8_t reg, uint8_t value, uint8_t bus){if(bus == 1){can1_write(reg, value);} else if(bus == 2){can2_write(reg, value);} else {can3_write(reg, value);}} +void can1_write(uint8_t reg, uint8_t value){can1_select(); spi0_write(MCP_WRITE);spi0_write(reg);spi0_write(value); can1_deselect();} + 914: ff 92 push r15 + 916: 0f 93 push r16 + 918: 1f 93 push r17 + 91a: cf 93 push r28 + 91c: df 93 push r29 + 91e: f8 2e mov r15, r24 + 920: 06 2f mov r16, r22 + 922: c0 e4 ldi r28, 0x40 ; 64 + 924: d6 e0 ldi r29, 0x06 ; 6 + 926: 10 e1 ldi r17, 0x10 ; 16 + 928: 1e 83 std Y+6, r17 ; 0x06 + 92a: 82 e0 ldi r24, 0x02 ; 2 + 92c: 25 de rcall .-950 ; 0x578 + 92e: 8f 2d mov r24, r15 + 930: 23 de rcall .-954 ; 0x578 + 932: 80 2f mov r24, r16 + 934: 21 de rcall .-958 ; 0x578 + 936: 1d 83 std Y+5, r17 ; 0x05 + 938: df 91 pop r29 + 93a: cf 91 pop r28 + 93c: 1f 91 pop r17 + 93e: 0f 91 pop r16 + 940: ff 90 pop r15 + 942: 08 95 ret + +00000944 : +void can2_write(uint8_t reg, uint8_t value){can2_select(); spi0_write(MCP_WRITE);spi0_write(reg);spi0_write(value); can2_deselect();} + 944: ff 92 push r15 + 946: 0f 93 push r16 + 948: 1f 93 push r17 + 94a: cf 93 push r28 + 94c: df 93 push r29 + 94e: f8 2e mov r15, r24 + 950: 06 2f mov r16, r22 + 952: c0 e6 ldi r28, 0x60 ; 96 + 954: d6 e0 ldi r29, 0x06 ; 6 + 956: 10 e1 ldi r17, 0x10 ; 16 + 958: 1e 83 std Y+6, r17 ; 0x06 + 95a: 82 e0 ldi r24, 0x02 ; 2 + 95c: 0d de rcall .-998 ; 0x578 + 95e: 8f 2d mov r24, r15 + 960: 0b de rcall .-1002 ; 0x578 + 962: 80 2f mov r24, r16 + 964: 09 de rcall .-1006 ; 0x578 + 966: 1d 83 std Y+5, r17 ; 0x05 + 968: df 91 pop r29 + 96a: cf 91 pop r28 + 96c: 1f 91 pop r17 + 96e: 0f 91 pop r16 + 970: ff 90 pop r15 + 972: 08 95 ret + +00000974 : +void can3_write(uint8_t reg, uint8_t value){can3_select(); spi0_write(MCP_WRITE);spi0_write(reg);spi0_write(value); can3_deselect();} + 974: ff 92 push r15 + 976: 0f 93 push r16 + 978: 1f 93 push r17 + 97a: cf 93 push r28 + 97c: df 93 push r29 + 97e: f8 2e mov r15, r24 + 980: 06 2f mov r16, r22 + 982: c0 e2 ldi r28, 0x20 ; 32 + 984: d6 e0 ldi r29, 0x06 ; 6 + 986: 18 e0 ldi r17, 0x08 ; 8 + 988: 1e 83 std Y+6, r17 ; 0x06 + 98a: 82 e0 ldi r24, 0x02 ; 2 + 98c: f5 dd rcall .-1046 ; 0x578 + 98e: 8f 2d mov r24, r15 + 990: f3 dd rcall .-1050 ; 0x578 + 992: 80 2f mov r24, r16 + 994: f1 dd rcall .-1054 ; 0x578 + 996: 1d 83 std Y+5, r17 ; 0x05 + 998: df 91 pop r29 + 99a: cf 91 pop r28 + 99c: 1f 91 pop r17 + 99e: 0f 91 pop r16 + 9a0: ff 90 pop r15 + 9a2: 08 95 ret + +000009a4 : +#define can3_select() CAN3_CS_PORT.OUTCLR = CAN3_CS +#define can1_deselect() CAN1_CS_PORT.OUTSET = CAN1_CS +#define can2_deselect() CAN2_CS_PORT.OUTSET = CAN2_CS +#define can3_deselect() CAN3_CS_PORT.OUTSET = CAN3_CS + +uint8_t can_init(uint8_t opmod, uint8_t reset){ + 9a4: 1f 93 push r17 + 9a6: cf 93 push r28 + 9a8: df 93 push r29 + uint8_t mode1, mode2, mode3; + + SPI0_PORT.DIRSET = SPI0_SCK | SPI0_MOSI; + 9aa: e0 e4 ldi r30, 0x40 ; 64 + 9ac: f6 e0 ldi r31, 0x06 ; 6 + 9ae: 90 ea ldi r25, 0xA0 ; 160 + 9b0: 91 83 std Z+1, r25 ; 0x01 + SPI0_PORT.DIRCLR = SPI0_MISO; + 9b2: 90 e4 ldi r25, 0x40 ; 64 + 9b4: 92 83 std Z+2, r25 ; 0x02 + CAN1_PORT.DIRSET = CAN1_STBY; + 9b6: a0 e6 ldi r26, 0x60 ; 96 + 9b8: b6 e0 ldi r27, 0x06 ; 6 + 9ba: 92 e0 ldi r25, 0x02 ; 2 + 9bc: 11 96 adiw r26, 0x01 ; 1 + 9be: 9c 93 st X, r25 + 9c0: 11 97 sbiw r26, 0x01 ; 1 + CAN2_PORT.DIRSET = CAN2_STBY; + 9c2: 90 93 81 06 sts 0x0681, r25 ; 0x800681 <__TEXT_REGION_LENGTH__+0x700681> + CAN3_PORT.DIRSET = CAN3_STBY; + 9c6: 98 e0 ldi r25, 0x08 ; 8 + 9c8: 91 83 std Z+1, r25 ; 0x01 + CAN1_CS_PORT.DIRSET = CAN1_CS; + 9ca: 20 e1 ldi r18, 0x10 ; 16 + 9cc: 21 83 std Z+1, r18 ; 0x01 + CAN2_CS_PORT.DIRSET = CAN2_CS; + 9ce: 11 96 adiw r26, 0x01 ; 1 + 9d0: 2c 93 st X, r18 + CAN3_CS_PORT.DIRSET = CAN3_CS; + 9d2: 90 93 21 06 sts 0x0621, r25 ; 0x800621 <__TEXT_REGION_LENGTH__+0x700621> + SPI0.CTRL = SPI_ENABLE_bm | SPI_MASTER_bm | SPI_CLK2X_bm | //enable SPI SPI_CLK2X_bm | + 9d6: 90 ed ldi r25, 0xD0 ; 208 + 9d8: 90 93 c0 08 sts 0x08C0, r25 ; 0x8008c0 <__TEXT_REGION_LENGTH__+0x7008c0> + SPI_PRESCALER_DIV4_gc; //run faster than usual (clkperx2/4=24MHz) + + if(!reset) return 1; + 9dc: 66 23 and r22, r22 + 9de: 09 f4 brne .+2 ; 0x9e2 + 9e0: 7e c0 rjmp .+252 ; 0xade + 9e2: c8 2f mov r28, r24 + + can1_deselect(); + 9e4: 80 e1 ldi r24, 0x10 ; 16 + 9e6: 80 93 45 06 sts 0x0645, r24 ; 0x800645 <__TEXT_REGION_LENGTH__+0x700645> + can2_deselect(); + 9ea: 80 93 65 06 sts 0x0665, r24 ; 0x800665 <__TEXT_REGION_LENGTH__+0x700665> + can3_deselect(); + 9ee: 88 e0 ldi r24, 0x08 ; 8 + 9f0: 80 93 25 06 sts 0x0625, r24 ; 0x800625 <__TEXT_REGION_LENGTH__+0x700625> + #else + //round up by default + __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + #endif + + __builtin_avr_delay_cycles(__ticks_dc); + 9f4: 8f e1 ldi r24, 0x1F ; 31 + 9f6: 93 e0 ldi r25, 0x03 ; 3 + 9f8: 01 97 sbiw r24, 0x01 ; 1 + 9fa: f1 f7 brne .-4 ; 0x9f8 + 9fc: 00 c0 rjmp .+0 ; 0x9fe + 9fe: 00 00 nop + + _delay_ms(0.1); + + can1_reset(); + a00: c6 dd rcall .-1140 ; 0x58e + can2_reset(); + a02: d3 dd rcall .-1114 ; 0x5aa + can3_reset(); + a04: e0 dd rcall .-1088 ; 0x5c6 + a06: 8f e3 ldi r24, 0x3F ; 63 + a08: 9f e1 ldi r25, 0x1F ; 31 + a0a: 01 97 sbiw r24, 0x01 ; 1 + a0c: f1 f7 brne .-4 ; 0xa0a + a0e: 00 c0 rjmp .+0 ; 0xa10 + a10: 00 00 nop + + _delay_ms(1); //wait for MCP25625 to be ready + + mode1 = can1_read(MCP_REG_CANCTRL); //read opmode + a12: 8f e0 ldi r24, 0x0F ; 15 + a14: 36 df rcall .-404 ; 0x882 + a16: d8 2f mov r29, r24 + mode1 = (mode1 & MCP_MASK_OPMOD)>>5; //mask with opmode bits + + mode2 = can2_read(MCP_REG_CANCTRL); //read opmode + a18: 8f e0 ldi r24, 0x0F ; 15 + a1a: 48 df rcall .-368 ; 0x8ac + a1c: 18 2f mov r17, r24 + mode2 = (mode2 & MCP_MASK_OPMOD)>>5; //mask with opmode bits + + mode3 = can3_read(MCP_REG_CANCTRL); //read opmode + a1e: 8f e0 ldi r24, 0x0F ; 15 + a20: 5a df rcall .-332 ; 0x8d6 + a22: d2 95 swap r29 + mode3 = (mode3 & MCP_MASK_OPMOD)>>5; //mask with opmode bits + + if(mode1 != MCP_OPMOD_CONFIG) return 0; //return error if not opmode CONFIG + a24: d6 95 lsr r29 + a26: d7 70 andi r29, 0x07 ; 7 + a28: d4 30 cpi r29, 0x04 ; 4 + a2a: 09 f0 breq .+2 ; 0xa2e + a2c: 5a c0 rjmp .+180 ; 0xae2 + a2e: 12 95 swap r17 + if(mode2 != MCP_OPMOD_CONFIG) return 0; //return error if not opmode CONFIG + a30: 16 95 lsr r17 + a32: 17 70 andi r17, 0x07 ; 7 + a34: 14 30 cpi r17, 0x04 ; 4 + a36: 09 f0 breq .+2 ; 0xa3a + a38: 56 c0 rjmp .+172 ; 0xae6 + a3a: 82 95 swap r24 + if(mode3 != MCP_OPMOD_CONFIG) return 0; //return error if not opmode CONFIG + a3c: 86 95 lsr r24 + a3e: 87 70 andi r24, 0x07 ; 7 + a40: 84 30 cpi r24, 0x04 ; 4 + a42: 09 f0 breq .+2 ; 0xa46 + a44: 52 c0 rjmp .+164 ; 0xaea + a46: 8f e1 ldi r24, 0x1F ; 31 + a48: 93 e0 ldi r25, 0x03 ; 3 + a4a: 01 97 sbiw r24, 0x01 ; 1 + a4c: f1 f7 brne .-4 ; 0xa4a + a4e: 00 c0 rjmp .+0 ; 0xa50 + a50: 00 00 nop + can1_write(MCP_REG_CNF2,0xF0); //PHSEG1 is 7xTq, PRSEG = 1xTq, SAM=1 + can2_write(MCP_REG_CNF2,0xF0); + can1_write(MCP_REG_CNF3,0x06); //PHSEG2 is 7xTq, so total is (7+7+1+1)=16Tq + can2_write(MCP_REG_CNF3,0x06); + #else + can1_write(MCP_REG_CNF1,0b00000000); //set BRP to 0 so we get Tq = 1/8M, then we need 16xTq to get 500kHz, SJW=1 + a52: 60 e0 ldi r22, 0x00 ; 0 + a54: 8a e2 ldi r24, 0x2A ; 42 + a56: 5e df rcall .-324 ; 0x914 + can2_write(MCP_REG_CNF1,0b00000000); + a58: 60 e0 ldi r22, 0x00 ; 0 + a5a: 8a e2 ldi r24, 0x2A ; 42 + a5c: 73 df rcall .-282 ; 0x944 + can3_write(MCP_REG_CNF1,0b00000000); + a5e: 60 e0 ldi r22, 0x00 ; 0 + a60: 8a e2 ldi r24, 0x2A ; 42 + a62: 88 df rcall .-240 ; 0x974 + can1_write(MCP_REG_CNF2,0b11100111); //PHSEG1 is 5xTq, PRSEG = 8xTq, SAM=1 + a64: 67 ee ldi r22, 0xE7 ; 231 + a66: 89 e2 ldi r24, 0x29 ; 41 + a68: 55 df rcall .-342 ; 0x914 + can2_write(MCP_REG_CNF2,0b11100111); + a6a: 67 ee ldi r22, 0xE7 ; 231 + a6c: 89 e2 ldi r24, 0x29 ; 41 + a6e: 6a df rcall .-300 ; 0x944 + can3_write(MCP_REG_CNF2,0b11100111); + a70: 67 ee ldi r22, 0xE7 ; 231 + a72: 89 e2 ldi r24, 0x29 ; 41 + a74: 7f df rcall .-258 ; 0x974 + can1_write(MCP_REG_CNF3,0b00000001); //PHSEG2 is 2xTq, so total is (5+5+5+1)=16Tq + a76: 61 e0 ldi r22, 0x01 ; 1 + a78: 88 e2 ldi r24, 0x28 ; 40 + a7a: 4c df rcall .-360 ; 0x914 + can2_write(MCP_REG_CNF3,0b00000001); + a7c: 61 e0 ldi r22, 0x01 ; 1 + a7e: 88 e2 ldi r24, 0x28 ; 40 + a80: 61 df rcall .-318 ; 0x944 + can3_write(MCP_REG_CNF3,0b00000001); + a82: 61 e0 ldi r22, 0x01 ; 1 + a84: 88 e2 ldi r24, 0x28 ; 40 + a86: 76 df rcall .-276 ; 0x974 + + + //we leave RXM to 0 and set acceptance filters to 0 to avoid bogus data from error frames + //ending up in the data stream + + can1_bit_modify(MCP_REG_RXB0CTRL, MCP_RXB_BUKT_MASK, MCP_RXB_BUKT_MASK);//configure message rollover + a88: 44 e0 ldi r20, 0x04 ; 4 + a8a: 64 e0 ldi r22, 0x04 ; 4 + a8c: 80 e6 ldi r24, 0x60 ; 96 + a8e: dc dd rcall .-1096 ; 0x648 + can2_bit_modify(MCP_REG_RXB0CTRL, MCP_RXB_BUKT_MASK, MCP_RXB_BUKT_MASK); + a90: 44 e0 ldi r20, 0x04 ; 4 + a92: 64 e0 ldi r22, 0x04 ; 4 + a94: 80 e6 ldi r24, 0x60 ; 96 + a96: e5 dd rcall .-1078 ; 0x662 + can3_bit_modify(MCP_REG_RXB0CTRL, MCP_RXB_BUKT_MASK, MCP_RXB_BUKT_MASK); + a98: 44 e0 ldi r20, 0x04 ; 4 + a9a: 64 e0 ldi r22, 0x04 ; 4 + a9c: 80 e6 ldi r24, 0x60 ; 96 + a9e: ee dd rcall .-1060 ; 0x67c + can1_write(MCP_REG_CANINTE, 0xA3); //enable both RX interrupts and the error interrupt + aa0: 63 ea ldi r22, 0xA3 ; 163 + aa2: 8b e2 ldi r24, 0x2B ; 43 + aa4: 37 df rcall .-402 ; 0x914 + can2_write(MCP_REG_CANINTE, 0xA3); + aa6: 63 ea ldi r22, 0xA3 ; 163 + aa8: 8b e2 ldi r24, 0x2B ; 43 + aaa: 4c df rcall .-360 ; 0x944 + aac: 63 ea ldi r22, 0xA3 ; 163 + can3_write(MCP_REG_CANINTE, 0xA3); + aae: 8b e2 ldi r24, 0x2B ; 43 + ab0: 61 df rcall .-318 ; 0x974 + ab2: 4c 2f mov r20, r28 + ab4: 60 ee ldi r22, 0xE0 ; 224 + can1_bit_modify(MCP_REG_CANCTRL, MCP_MASK_OPMOD, opmod); //Set device mode per argument + ab6: 8f e0 ldi r24, 0x0F ; 15 + ab8: c7 dd rcall .-1138 ; 0x648 + aba: 4c 2f mov r20, r28 + abc: 60 ee ldi r22, 0xE0 ; 224 + abe: 8f e0 ldi r24, 0x0F ; 15 + can2_bit_modify(MCP_REG_CANCTRL, MCP_MASK_OPMOD, opmod); + ac0: d0 dd rcall .-1120 ; 0x662 + ac2: 4c 2f mov r20, r28 + ac4: 60 ee ldi r22, 0xE0 ; 224 + ac6: 8f e0 ldi r24, 0x0F ; 15 + ac8: d9 dd rcall .-1102 ; 0x67c + can3_bit_modify(MCP_REG_CANCTRL, MCP_MASK_OPMOD, opmod); + aca: 82 e0 ldi r24, 0x02 ; 2 + acc: 80 93 66 06 sts 0x0666, r24 ; 0x800666 <__TEXT_REGION_LENGTH__+0x700666> + ad0: 80 93 86 06 sts 0x0686, r24 ; 0x800686 <__TEXT_REGION_LENGTH__+0x700686> + can1_unstandby(); //set to active + ad4: 88 e0 ldi r24, 0x08 ; 8 + ad6: 80 93 46 06 sts 0x0646, r24 ; 0x800646 <__TEXT_REGION_LENGTH__+0x700646> + can2_unstandby(); + ada: 81 e0 ldi r24, 0x01 ; 1 + adc: 07 c0 rjmp .+14 ; 0xaec + can3_unstandby(); + ade: 81 e0 ldi r24, 0x01 ; 1 + ae0: 05 c0 rjmp .+10 ; 0xaec + ae2: 80 e0 ldi r24, 0x00 ; 0 + return 1; + ae4: 03 c0 rjmp .+6 ; 0xaec + ae6: 80 e0 ldi r24, 0x00 ; 0 + CAN2_CS_PORT.DIRSET = CAN2_CS; + CAN3_CS_PORT.DIRSET = CAN3_CS; + SPI0.CTRL = SPI_ENABLE_bm | SPI_MASTER_bm | SPI_CLK2X_bm | //enable SPI SPI_CLK2X_bm | + SPI_PRESCALER_DIV4_gc; //run faster than usual (clkperx2/4=24MHz) + + if(!reset) return 1; + ae8: 01 c0 rjmp .+2 ; 0xaec + aea: 80 e0 ldi r24, 0x00 ; 0 + mode2 = (mode2 & MCP_MASK_OPMOD)>>5; //mask with opmode bits + + mode3 = can3_read(MCP_REG_CANCTRL); //read opmode + mode3 = (mode3 & MCP_MASK_OPMOD)>>5; //mask with opmode bits + + if(mode1 != MCP_OPMOD_CONFIG) return 0; //return error if not opmode CONFIG + aec: df 91 pop r29 + aee: cf 91 pop r28 + if(mode2 != MCP_OPMOD_CONFIG) return 0; //return error if not opmode CONFIG + af0: 1f 91 pop r17 + af2: 08 95 ret + +00000af4 : + if(mode3 != MCP_OPMOD_CONFIG) return 0; //return error if not opmode CONFIG + af4: 41 30 cpi r20, 0x01 ; 1 + can3_bit_modify(MCP_REG_CANCTRL, MCP_MASK_OPMOD, opmod); + can1_unstandby(); //set to active + can2_unstandby(); + can3_unstandby(); + return 1; +} + af6: 11 f4 brne .+4 ; 0xafc + af8: 0d cf rjmp .-486 ; 0x914 + afa: 08 95 ret + afc: 42 30 cpi r20, 0x02 ; 2 +uint8_t can1_read(uint8_t reg){uint8_t res=0; can1_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can1_deselect(); return res;} +uint8_t can2_read(uint8_t reg){uint8_t res=0; can2_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can2_deselect(); return res;} +uint8_t can3_read(uint8_t reg){uint8_t res=0; can3_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can3_deselect(); return res;} + +//write a register. +void can_write(uint8_t reg, uint8_t value, uint8_t bus){if(bus == 1){can1_write(reg, value);} else if(bus == 2){can2_write(reg, value);} else {can3_write(reg, value);}} + afe: 11 f4 brne .+4 ; 0xb04 + b00: 21 cf rjmp .-446 ; 0x944 + b02: 08 95 ret + b04: 37 cf rjmp .-402 ; 0x974 + b06: 08 95 ret + +00000b08 : +uint8_t signature[11]; //signature bytes +//print variables +volatile uint8_t print_char_limit = 0; +#endif + +void hw_init(void){ + b08: cf 93 push r28 + b0a: df 93 push r29 + case CLOCK_SRC_INT_RC2MHZ: + OSC.CTRL |= OSC_RC2MEN_bm; + while (!(OSC.STATUS & OSC_RC2MRDY_bm)); + return true; + case CLOCK_SRC_INT_RC32MHZ: + OSC.CTRL |= OSC_RC32MEN_bm; + b0c: e0 e5 ldi r30, 0x50 ; 80 + b0e: f0 e0 ldi r31, 0x00 ; 0 + b10: 80 81 ld r24, Z + b12: 82 60 ori r24, 0x02 ; 2 + b14: 80 83 st Z, r24 + while (!(OSC.STATUS & OSC_RC32MRDY_bm)); + b16: 81 81 ldd r24, Z+1 ; 0x01 + b18: 81 ff sbrs r24, 1 + b1a: fd cf rjmp .-6 ; 0xb16 + DFLLRC2M.COMP1 = (DFLLCompare & 0xFF); + DFLLRC2M.COMP2 = (DFLLCompare >> 8); + DFLLRC2M.CTRL = DFLL_ENABLE_bm; + break; + case CLOCK_SRC_INT_RC32MHZ: + OSC.DFLLCTRL |= (Reference << OSC_RC32MCREF_gp); + b1c: a0 e5 ldi r26, 0x50 ; 80 + b1e: b0 e0 ldi r27, 0x00 ; 0 + b20: 16 96 adiw r26, 0x06 ; 6 + b22: 8c 91 ld r24, X + b24: 16 97 sbiw r26, 0x06 ; 6 + b26: 84 60 ori r24, 0x04 ; 4 + b28: 16 96 adiw r26, 0x06 ; 6 + b2a: 8c 93 st X, r24 + b2c: 16 97 sbiw r26, 0x06 ; 6 + DFLLRC32M.COMP1 = (DFLLCompare & 0xFF); + b2e: c0 e6 ldi r28, 0x60 ; 96 + b30: d0 e0 ldi r29, 0x00 ; 0 + b32: 80 e8 ldi r24, 0x80 ; 128 + b34: 8d 83 std Y+5, r24 ; 0x05 + DFLLRC32M.COMP2 = (DFLLCompare >> 8); + b36: 8b eb ldi r24, 0xBB ; 187 + b38: 8e 83 std Y+6, r24 ; 0x06 + + if (Reference == DFLL_REF_INT_USBSOF) + { + NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc; + b3a: 80 ec ldi r24, 0xC0 ; 192 + b3c: 91 e0 ldi r25, 0x01 ; 1 + b3e: 22 e0 ldi r18, 0x02 ; 2 + b40: fc 01 movw r30, r24 + b42: 22 87 std Z+10, r18 ; 0x0a + DFLLRC32M.CALA = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBRCOSCA)); + b44: ed e1 ldi r30, 0x1D ; 29 + b46: f0 e0 ldi r31, 0x00 ; 0 + b48: e4 91 lpm r30, Z + b4a: ea 83 std Y+2, r30 ; 0x02 + DFLLRC32M.CALB = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBRCOSC)); + b4c: ec e1 ldi r30, 0x1C ; 28 + b4e: f0 e0 ldi r31, 0x00 ; 0 + b50: e4 91 lpm r30, Z + b52: eb 83 std Y+3, r30 ; 0x03 + NVM.CMD = 0; + b54: fc 01 movw r30, r24 + b56: 12 86 std Z+10, r1 ; 0x0a + } + + DFLLRC32M.CTRL = DFLL_ENABLE_bm; + b58: 81 e0 ldi r24, 0x01 ; 1 + b5a: 88 83 st Y, r24 + /* Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference */ + XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ); + XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, 48000000); + + //turn off everything we don' t use + PR.PRGEN = PR_AES_bm | PR_RTC_bm | PR_DMA_bm; + b5c: e0 e7 ldi r30, 0x70 ; 112 + b5e: f0 e0 ldi r31, 0x00 ; 0 + b60: 85 e1 ldi r24, 0x15 ; 21 + b62: 80 83 st Z, r24 + PR.PRPA = PR_ADC_bm | PR_AC_bm; + b64: 83 e0 ldi r24, 0x03 ; 3 + b66: 81 83 std Z+1, r24 ; 0x01 + PR.PRPC = PR_TWI_bm | PR_USART0_bm | PR_HIRES_bm; + b68: 94 e5 ldi r25, 0x54 ; 84 + b6a: 93 83 std Z+3, r25 ; 0x03 + PR.PRPD = PR_TWI_bm | PR_USART0_bm | PR_TC0_bm | PR_TC1_bm; + b6c: 93 e5 ldi r25, 0x53 ; 83 + b6e: 94 83 std Z+4, r25 ; 0x04 + PR.PRPE = PR_TWI_bm | PR_USART0_bm; + b70: 90 e5 ldi r25, 0x50 ; 80 + b72: 95 83 std Z+5, r25 ; 0x05 + + //blink output + PORTB.DIRSET = 3; + b74: 80 93 21 06 sts 0x0621, r24 ; 0x800621 <__TEXT_REGION_LENGTH__+0x700621> + + //start 16MHz crystal and PLL it up to 48MHz + OSC.XOSCCTRL = OSC_FRQRANGE_12TO16_gc | //16MHz crystal + b78: 8b ec ldi r24, 0xCB ; 203 + b7a: 12 96 adiw r26, 0x02 ; 2 + b7c: 8c 93 st X, r24 + b7e: 12 97 sbiw r26, 0x02 ; 2 + OSC_XOSCSEL_XTAL_16KCLK_gc; //16kclk startup + OSC.CTRL |= OSC_XOSCEN_bm; //enable crystal + b80: 8c 91 ld r24, X + b82: 88 60 ori r24, 0x08 ; 8 + b84: 8c 93 st X, r24 + while(!(OSC.STATUS & OSC_XOSCRDY_bm)); //wait until ready + b86: e0 e5 ldi r30, 0x50 ; 80 + b88: f0 e0 ldi r31, 0x00 ; 0 + b8a: 81 81 ldd r24, Z+1 ; 0x01 + b8c: 83 ff sbrs r24, 3 + b8e: fd cf rjmp .-6 ; 0xb8a + OSC.PLLCTRL = OSC_PLLSRC_XOSC_gc | 2; //XTAL->PLL, 2x multiplier (32MHz) + b90: e0 e5 ldi r30, 0x50 ; 80 + b92: f0 e0 ldi r31, 0x00 ; 0 + b94: 82 ec ldi r24, 0xC2 ; 194 + b96: 85 83 std Z+5, r24 ; 0x05 + OSC.CTRL |= OSC_PLLEN_bm; //start PLL + b98: 80 81 ld r24, Z + b9a: 80 61 ori r24, 0x10 ; 16 + b9c: 80 83 st Z, r24 + while (!(OSC.STATUS & OSC_PLLRDY_bm)); //wait until ready + b9e: 81 81 ldd r24, Z+1 ; 0x01 + ba0: 84 ff sbrs r24, 4 + ba2: fd cf rjmp .-6 ; 0xb9e + CCP = CCP_IOREG_gc; //allow changing CLK.CTRL + ba4: 88 ed ldi r24, 0xD8 ; 216 + ba6: 84 bf out 0x34, r24 ; 52 + CLK.CTRL = CLK_SCLKSEL_PLL_gc; //use PLL output as system clock + ba8: 34 e0 ldi r19, 0x04 ; 4 + baa: 30 93 40 00 sts 0x0040, r19 ; 0x800040 <__TEXT_REGION_LENGTH__+0x700040> + + //output 16MHz clock to MCP25625 chips (PE0) + //next iteration: put this on some other port, pin 4 or 7, so we can use the event system + TCE0.CTRLA = TC0_CLKSEL_DIV1_gc; //clkper/1 + bae: e0 e0 ldi r30, 0x00 ; 0 + bb0: fa e0 ldi r31, 0x0A ; 10 + bb2: 81 e0 ldi r24, 0x01 ; 1 + bb4: 80 83 st Z, r24 + TCE0.CTRLB = TC0_CCAEN_bm | TC0_WGMODE_SINGLESLOPE_bm; //enable CCA, single-slope PWM + bb6: 93 e1 ldi r25, 0x13 ; 19 + bb8: 91 83 std Z+1, r25 ; 0x01 + TCE0.CCA = 1; //compare value + bba: 41 e0 ldi r20, 0x01 ; 1 + bbc: 50 e0 ldi r21, 0x00 ; 0 + bbe: 40 a7 std Z+40, r20 ; 0x28 + bc0: 51 a7 std Z+41, r21 ; 0x29 + TCE0.PER = 1; //period of 1, generates 24MHz output + bc2: 46 a3 std Z+38, r20 ; 0x26 + bc4: 57 a3 std Z+39, r21 ; 0x27 + + PORTE.DIRSET = PIN0_bm; //set CLKOUT pin to output + bc6: 80 93 81 06 sts 0x0681, r24 ; 0x800681 <__TEXT_REGION_LENGTH__+0x700681> + + //setup CAN pin interrupts + PORTC.INTCTRL = PORT_INT0LVL_HI_gc; + bca: a0 e4 ldi r26, 0x40 ; 64 + bcc: b6 e0 ldi r27, 0x06 ; 6 + bce: 93 e0 ldi r25, 0x03 ; 3 + bd0: 19 96 adiw r26, 0x09 ; 9 + bd2: 9c 93 st X, r25 + bd4: 19 97 sbiw r26, 0x09 ; 9 + PORTD.INTCTRL = PORT_INT0LVL_HI_gc | PORT_INT1LVL_HI_gc; + bd6: e0 e6 ldi r30, 0x60 ; 96 + bd8: f6 e0 ldi r31, 0x06 ; 6 + bda: 2f e0 ldi r18, 0x0F ; 15 + bdc: 21 87 std Z+9, r18 ; 0x09 + + PORTD.INT0MASK = PIN0_bm; //PORTD0 has can1 interrupt + bde: 82 87 std Z+10, r24 ; 0x0a + PORTD.PIN0CTRL = PORT_OPC_PULLUP_gc | PORT_ISC_LEVEL_gc; + be0: 2b e1 ldi r18, 0x1B ; 27 + be2: 20 8b std Z+16, r18 ; 0x10 + + PORTD.INT1MASK = PIN5_bm; //PORTD5 has can2 interrupt + be4: 40 e2 ldi r20, 0x20 ; 32 + be6: 43 87 std Z+11, r20 ; 0x0b + PORTD.PIN5CTRL = PORT_OPC_PULLUP_gc | PORT_ISC_LEVEL_gc; + be8: 25 8b std Z+21, r18 ; 0x15 + + #ifdef ENABLE_CAN3 + PORTC.INT0MASK = PIN2_bm; //PORTC2 has can3 interrupt + bea: 1a 96 adiw r26, 0x0a ; 10 + bec: 3c 93 st X, r19 + bee: 1a 97 sbiw r26, 0x0a ; 10 + PORTC.PIN0CTRL = PORT_OPC_PULLUP_gc | PORT_ISC_LEVEL_gc; + bf0: 50 96 adiw r26, 0x10 ; 16 + bf2: 2c 93 st X, r18 + #endif + + //buffer checking interrupt + TCC1.CTRLA = TC0_CLKSEL_DIV1_gc; //32M/1/3200 ~ 100usec + bf4: e0 e4 ldi r30, 0x40 ; 64 + bf6: f8 e0 ldi r31, 0x08 ; 8 + bf8: 80 83 st Z, r24 + TCC1.PER = 3200; + bfa: 20 e8 ldi r18, 0x80 ; 128 + bfc: 3c e0 ldi r19, 0x0C ; 12 + bfe: 26 a3 std Z+38, r18 ; 0x26 + c00: 37 a3 std Z+39, r19 ; 0x27 + TCC1.INTCTRLA = TC0_OVFINTLVL_HI_gc; //same priority as can interrupts + c02: 96 83 std Z+6, r25 ; 0x06 + + //we want to optimize performance, so we're going to time stuff + //48MHz/48=1us timer, which we just freerun and reset whenever we want to start timing something + //frame time timer + TCC0.CTRLA = TC0_CLKSEL_DIV1_gc; + c04: e0 e0 ldi r30, 0x00 ; 0 + c06: f8 e0 ldi r31, 0x08 ; 8 + c08: 80 83 st Z, r24 + TCC0.PER = 32000; //32MHz/32000=1ms + c0a: 20 e0 ldi r18, 0x00 ; 0 + c0c: 3d e7 ldi r19, 0x7D ; 125 + c0e: 26 a3 std Z+38, r18 ; 0x26 + c10: 37 a3 std Z+39, r19 ; 0x27 + TCC0.INTCTRLA = TC0_OVFINTLVL_HI_gc; //interrupt on overflow + c12: 96 83 std Z+6, r25 ; 0x06 + + PORTB.OUTCLR = (1 << 0); + c14: 80 93 26 06 sts 0x0626, r24 ; 0x800626 <__TEXT_REGION_LENGTH__+0x700626> + + can_system_init: + + //Init SPI and CAN interface: + if(RST.STATUS & RST_WDRF_bm){ //if we come from a watchdog reset, we don't need to setup CAN + c18: c8 e7 ldi r28, 0x78 ; 120 + c1a: d0 e0 ldi r29, 0x00 ; 0 + c1c: 88 81 ld r24, Y + c1e: 83 ff sbrs r24, 3 + c20: 04 c0 rjmp .+8 ; 0xc2a + caninit = can_init(MCP_OPMOD_NORMAL, 1); //on second thought, we do + c22: 61 e0 ldi r22, 0x01 ; 1 + c24: 80 e0 ldi r24, 0x00 ; 0 + c26: be de rcall .-644 ; 0x9a4 + c28: 03 c0 rjmp .+6 ; 0xc30 + } else { + caninit = can_init(MCP_OPMOD_NORMAL, 1); + c2a: 61 e0 ldi r22, 0x01 ; 1 + c2c: 80 e0 ldi r24, 0x00 ; 0 + c2e: ba de rcall .-652 ; 0x9a4 + } + + if(caninit){ + c30: 81 11 cpse r24, r1 + c32: 0a c0 rjmp .+20 ; 0xc48 + c34: ff ef ldi r31, 0xFF ; 255 + c36: 29 ef ldi r18, 0xF9 ; 249 + c38: 80 e0 ldi r24, 0x00 ; 0 + c3a: f1 50 subi r31, 0x01 ; 1 + c3c: 20 40 sbci r18, 0x00 ; 0 + c3e: 80 40 sbci r24, 0x00 ; 0 + c40: e1 f7 brne .-8 ; 0xc3a + c42: 00 c0 rjmp .+0 ; 0xc44 + c44: 00 00 nop + c46: ea cf rjmp .-44 ; 0xc1c + * \param[in] Value Value to write to the protected location + */ + static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) + { + __asm__ __volatile__ ( + c48: 25 e8 ldi r18, 0x85 ; 133 + c4a: 88 ed ldi r24, 0xD8 ; 216 + c4c: 90 e0 ldi r25, 0x00 ; 0 + c4e: a2 ea ldi r26, 0xA2 ; 162 + c50: b0 e0 ldi r27, 0x00 ; 0 + c52: 1b be out 0x3b, r1 ; 59 + c54: fd 01 movw r30, r26 + c56: 84 bf out 0x34, r24 ; 52 + c58: 20 83 st Z, r18 + } + + //Set and enable interrupts with round-robin + XMEGACLK_CCP_Write((void * ) &PMIC.CTRL, PMIC_RREN_bm | PMIC_LOLVLEN_bm | PMIC_HILVLEN_bm);//PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm| PMIC_HILVLEN_bm; + + USB_Init(USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRILOW); + c5a: 2b be out 0x3b, r2 ; 59 + c5c: 80 e0 ldi r24, 0x00 ; 0 + c5e: d9 db rcall .-2126 ; 0x412 + #ifdef USB_SERIAL + CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream); + #endif + + wdt_enable(WDTO_15MS); + c60: 93 e0 ldi r25, 0x03 ; 3 + c62: 88 ed ldi r24, 0xD8 ; 216 + c64: 08 b6 in r0, 0x38 ; 56 + c66: 18 be out 0x38, r1 ; 56 + c68: 84 bf out 0x34, r24 ; 52 + c6a: 90 93 80 00 sts 0x0080, r25 ; 0x800080 <__TEXT_REGION_LENGTH__+0x700080> + c6e: 80 91 82 00 lds r24, 0x0082 ; 0x800082 <__TEXT_REGION_LENGTH__+0x700082> + c72: 81 fd sbrc r24, 1 + c74: fc cf rjmp .-8 ; 0xc6e + c76: 08 be out 0x38, r0 ; 56 + + sei(); + c78: 78 94 sei +} + c7a: df 91 pop r29 + c7c: cf 91 pop r28 + c7e: 08 95 ret + +00000c80
: +int main(void){ + #ifdef USB_SERIAL + char * str = ""; + #endif + + hw_init(); + c80: 43 df rcall .-378 ; 0xb08 + c82: ff cf rjmp .-2 ; 0xc82 + +00000c84 : + + } +} +#endif +// Event handler for the LUFA library USB Disconnection event. +void EVENT_USB_Device_Disconnect(void){} + c84: 08 95 ret + +00000c86 : + +void EVENT_USB_Device_Connect(void){} + c86: 08 95 ret + +00000c88 <__vector_14>: + } +} +#endif + +//fires every 1ms +ISR(TCC0_OVF_vect){ + c88: 1f 92 push r1 + c8a: 0f 92 push r0 + c8c: 0f b6 in r0, 0x3f ; 63 + c8e: 0f 92 push r0 + c90: 11 24 eor r1, r1 + c92: 8f 93 push r24 + c94: 9f 93 push r25 + wdt_reset(); //Reset the watchdog + c96: a8 95 wdr + sec_timer--; //Increment the 1000ms timer + c98: 80 91 02 20 lds r24, 0x2002 ; 0x802002 + c9c: 90 91 03 20 lds r25, 0x2003 ; 0x802003 + ca0: 01 97 sbiw r24, 0x01 ; 1 + ca2: 80 93 02 20 sts 0x2002, r24 ; 0x802002 + ca6: 90 93 03 20 sts 0x2003, r25 ; 0x802003 + if(print_char_limit <= 64) { print_char_limit = 0; } + else { print_char_limit -= 64; } + #endif + + //fires every 100ms + if(ms_timer_100 == 100) //Task that need to be performed each 100ms go here + caa: 80 91 00 20 lds r24, 0x2000 ; 0x802000 <__data_start> + cae: 90 91 01 20 lds r25, 0x2001 ; 0x802001 <__data_start+0x1> + cb2: 84 36 cpi r24, 0x64 ; 100 + cb4: 91 05 cpc r25, r1 + cb6: 21 f4 brne .+8 ; 0xcc0 <__vector_14+0x38> + { + ms_timer_100 = 0; //reset the timer + cb8: 10 92 00 20 sts 0x2000, r1 ; 0x802000 <__data_start> + cbc: 10 92 01 20 sts 0x2001, r1 ; 0x802001 <__data_start+0x1> + } + + //fires every second (1000ms tasks go here) + if(sec_timer == 0){ + cc0: 80 91 02 20 lds r24, 0x2002 ; 0x802002 + cc4: 90 91 03 20 lds r25, 0x2003 ; 0x802003 + cc8: 89 2b or r24, r25 + cca: 19 f4 brne .+6 ; 0xcd2 <__vector_14+0x4a> + PORTB.OUTCLR = (1 << 1); + ccc: 82 e0 ldi r24, 0x02 ; 2 + cce: 80 93 26 06 sts 0x0626, r24 ; 0x800626 <__TEXT_REGION_LENGTH__+0x700626> + + } +} + cd2: 9f 91 pop r25 + cd4: 8f 91 pop r24 + cd6: 0f 90 pop r0 + cd8: 0f be out 0x3f, r0 ; 63 + cda: 0f 90 pop r0 + cdc: 1f 90 pop r1 + cde: 18 95 reti + +00000ce0 : + + +void check_can1(void){ + uint8_t reg; + + if(tx0_buffer_end != tx0_buffer_pos){ + ce0: 90 91 08 20 lds r25, 0x2008 ; 0x802008 + ce4: 80 91 09 20 lds r24, 0x2009 ; 0x802009 + ce8: 98 17 cp r25, r24 + cea: f1 f0 breq .+60 ; 0xd28 + //check if TXB0 is free use + reg = can1_read(MCP_REG_TXB0CTRL); + cec: 80 e3 ldi r24, 0x30 ; 48 + cee: c9 dd rcall .-1134 ; 0x882 + + if(!(reg & MCP_TXREQ_bm)){ //we're free to send + cf0: 83 fd sbrc r24, 3 + cf2: 1a c0 rjmp .+52 ; 0xd28 + can1_load_txbuff(0, (can_frame_t *) &tx0_buffer[tx0_buffer_pos++]); + cf4: 60 91 09 20 lds r22, 0x2009 ; 0x802009 + cf8: 81 e0 ldi r24, 0x01 ; 1 + cfa: 86 0f add r24, r22 + cfc: 80 93 09 20 sts 0x2009, r24 ; 0x802009 + d00: 8b e0 ldi r24, 0x0B ; 11 + d02: 68 9f mul r22, r24 + d04: b0 01 movw r22, r0 + d06: 11 24 eor r1, r1 + d08: 64 51 subi r22, 0x14 ; 20 + d0a: 7c 4d sbci r23, 0xDC ; 220 + d0c: 80 e0 ldi r24, 0x00 ; 0 + d0e: 2b dd rcall .-1450 ; 0x766 + can1_rts(0); + d10: 80 e0 ldi r24, 0x00 ; 0 + d12: d0 dc rcall .-1632 ; 0x6b4 + d14: 90 91 09 20 lds r25, 0x2009 ; 0x802009 + if(tx0_buffer_pos == tx0_buffer_end){ //end of buffer, reset + d18: 80 91 08 20 lds r24, 0x2008 ; 0x802008 + d1c: 98 13 cpse r25, r24 + d1e: 04 c0 rjmp .+8 ; 0xd28 + d20: 10 92 08 20 sts 0x2008, r1 ; 0x802008 + tx0_buffer_end = 0; + d24: 10 92 09 20 sts 0x2009, r1 ; 0x802009 + tx0_buffer_pos = 0; + d28: 08 95 ret + +00000d2a : + d2a: ef 92 push r14 + if(can_bus == 1) send_can1(frame); + if(can_bus == 2) send_can2(frame); + if(can_bus == 3) send_can3(frame); +} + +void send_can1(can_frame_t frame){ + d2c: ff 92 push r15 + d2e: 0f 93 push r16 + d30: 1f 93 push r17 + d32: cf 93 push r28 + d34: df 93 push r29 + d36: cd b7 in r28, 0x3d ; 61 + d38: de b7 in r29, 0x3e ; 62 + d3a: 2b 97 sbiw r28, 0x0b ; 11 + d3c: cd bf out 0x3d, r28 ; 61 + d3e: de bf out 0x3e, r29 ; 62 + d40: e9 82 std Y+1, r14 ; 0x01 + d42: fa 82 std Y+2, r15 ; 0x02 + d44: 0b 83 std Y+3, r16 ; 0x03 + d46: 1c 83 std Y+4, r17 ; 0x04 + d48: 2d 83 std Y+5, r18 ; 0x05 + d4a: 3e 83 std Y+6, r19 ; 0x06 + d4c: 4f 83 std Y+7, r20 ; 0x07 + d4e: 58 87 std Y+8, r21 ; 0x08 + d50: 69 87 std Y+9, r22 ; 0x09 + d52: 7a 87 std Y+10, r23 ; 0x0a + d54: 8b 87 std Y+11, r24 ; 0x0b + //put in the buffer + memcpy(&tx0_buffer[tx0_buffer_end++], &frame, sizeof(frame)); + d56: a0 91 08 20 lds r26, 0x2008 ; 0x802008 + d5a: 81 e0 ldi r24, 0x01 ; 1 + d5c: 8a 0f add r24, r26 + d5e: 80 93 08 20 sts 0x2008, r24 ; 0x802008 + d62: 9b e0 ldi r25, 0x0B ; 11 + d64: a9 9f mul r26, r25 + d66: d0 01 movw r26, r0 + d68: 11 24 eor r1, r1 + d6a: a4 51 subi r26, 0x14 ; 20 + d6c: bc 4d sbci r27, 0xDC ; 220 + d6e: 9b e0 ldi r25, 0x0B ; 11 + d70: fe 01 movw r30, r28 + d72: 31 96 adiw r30, 0x01 ; 1 + d74: 01 90 ld r0, Z+ + d76: 0d 92 st X+, r0 + d78: 9a 95 dec r25 + d7a: e1 f7 brne .-8 ; 0xd74 + + if(tx0_buffer_end >= TXBUFFER_SIZE){ //silently handle buffer overflows + d7c: 80 31 cpi r24, 0x10 ; 16 + d7e: 18 f0 brcs .+6 ; 0xd86 + tx0_buffer_end = TXBUFFER_SIZE - 1; + d80: 8f e0 ldi r24, 0x0F ; 15 + d82: 80 93 08 20 sts 0x2008, r24 ; 0x802008 + } + + check_can1(); + d86: ac df rcall .-168 ; 0xce0 +} + d88: 2b 96 adiw r28, 0x0b ; 11 + d8a: cd bf out 0x3d, r28 ; 61 + d8c: de bf out 0x3e, r29 ; 62 + d8e: df 91 pop r29 + d90: cf 91 pop r28 + d92: 1f 91 pop r17 + d94: 0f 91 pop r16 + d96: ff 90 pop r15 + d98: ef 90 pop r14 + d9a: 08 95 ret + +00000d9c : +} + +void check_can2(void){ + uint8_t reg; + + if(tx2_buffer_end != tx2_buffer_pos){ + d9c: 90 91 06 20 lds r25, 0x2006 ; 0x802006 + da0: 80 91 07 20 lds r24, 0x2007 ; 0x802007 + da4: 98 17 cp r25, r24 + da6: f1 f0 breq .+60 ; 0xde4 + //check if TXB0 is free use + reg = can2_read(MCP_REG_TXB0CTRL); + da8: 80 e3 ldi r24, 0x30 ; 48 + daa: 80 dd rcall .-1280 ; 0x8ac + + if(!(reg & MCP_TXREQ_bm)){ //we're free to send + dac: 83 fd sbrc r24, 3 + dae: 1a c0 rjmp .+52 ; 0xde4 + can2_load_txbuff(0, (can_frame_t *) &tx2_buffer[tx2_buffer_pos++]); + db0: 60 91 07 20 lds r22, 0x2007 ; 0x802007 + db4: 81 e0 ldi r24, 0x01 ; 1 + db6: 86 0f add r24, r22 + db8: 80 93 07 20 sts 0x2007, r24 ; 0x802007 + dbc: 8b e0 ldi r24, 0x0B ; 11 + dbe: 68 9f mul r22, r24 + dc0: b0 01 movw r22, r0 + dc2: 11 24 eor r1, r1 + dc4: 64 5c subi r22, 0xC4 ; 196 + dc6: 7c 4d sbci r23, 0xDC ; 220 + dc8: 80 e0 ldi r24, 0x00 ; 0 + dca: da dc rcall .-1612 ; 0x780 + can2_rts(0); + dcc: 80 e0 ldi r24, 0x00 ; 0 + dce: 7f dc rcall .-1794 ; 0x6ce + dd0: 90 91 07 20 lds r25, 0x2007 ; 0x802007 + if(tx2_buffer_pos == tx2_buffer_end){ //end of buffer, reset + dd4: 80 91 06 20 lds r24, 0x2006 ; 0x802006 + dd8: 98 13 cpse r25, r24 + dda: 04 c0 rjmp .+8 ; 0xde4 + ddc: 10 92 06 20 sts 0x2006, r1 ; 0x802006 + tx2_buffer_end = 0; + de0: 10 92 07 20 sts 0x2007, r1 ; 0x802007 + tx2_buffer_pos = 0; + de4: 08 95 ret + +00000de6 : + de6: ef 92 push r14 + } + } + } +} + +void send_can2(can_frame_t frame){ + de8: ff 92 push r15 + dea: 0f 93 push r16 + dec: 1f 93 push r17 + dee: cf 93 push r28 + df0: df 93 push r29 + df2: cd b7 in r28, 0x3d ; 61 + df4: de b7 in r29, 0x3e ; 62 + df6: 2b 97 sbiw r28, 0x0b ; 11 + df8: cd bf out 0x3d, r28 ; 61 + dfa: de bf out 0x3e, r29 ; 62 + dfc: e9 82 std Y+1, r14 ; 0x01 + dfe: fa 82 std Y+2, r15 ; 0x02 + e00: 0b 83 std Y+3, r16 ; 0x03 + e02: 1c 83 std Y+4, r17 ; 0x04 + e04: 2d 83 std Y+5, r18 ; 0x05 + e06: 3e 83 std Y+6, r19 ; 0x06 + e08: 4f 83 std Y+7, r20 ; 0x07 + e0a: 58 87 std Y+8, r21 ; 0x08 + e0c: 69 87 std Y+9, r22 ; 0x09 + e0e: 7a 87 std Y+10, r23 ; 0x0a + e10: 8b 87 std Y+11, r24 ; 0x0b + //put in the buffer + memcpy(&tx2_buffer[tx2_buffer_end++], &frame, sizeof(frame)); + e12: a0 91 06 20 lds r26, 0x2006 ; 0x802006 + e16: 81 e0 ldi r24, 0x01 ; 1 + e18: 8a 0f add r24, r26 + e1a: 80 93 06 20 sts 0x2006, r24 ; 0x802006 + e1e: 9b e0 ldi r25, 0x0B ; 11 + e20: a9 9f mul r26, r25 + e22: d0 01 movw r26, r0 + e24: 11 24 eor r1, r1 + e26: a4 5c subi r26, 0xC4 ; 196 + e28: bc 4d sbci r27, 0xDC ; 220 + e2a: 9b e0 ldi r25, 0x0B ; 11 + e2c: fe 01 movw r30, r28 + e2e: 31 96 adiw r30, 0x01 ; 1 + e30: 01 90 ld r0, Z+ + e32: 0d 92 st X+, r0 + e34: 9a 95 dec r25 + e36: e1 f7 brne .-8 ; 0xe30 + + if(tx2_buffer_end >= TXBUFFER_SIZE){ //silently handle buffer overflows + e38: 80 31 cpi r24, 0x10 ; 16 + e3a: 18 f0 brcs .+6 ; 0xe42 + tx2_buffer_end = TXBUFFER_SIZE - 1; + e3c: 8f e0 ldi r24, 0x0F ; 15 + e3e: 80 93 06 20 sts 0x2006, r24 ; 0x802006 + } + + check_can2(); + e42: ac df rcall .-168 ; 0xd9c +} + e44: 2b 96 adiw r28, 0x0b ; 11 + e46: cd bf out 0x3d, r28 ; 61 + e48: de bf out 0x3e, r29 ; 62 + e4a: df 91 pop r29 + e4c: cf 91 pop r28 + e4e: 1f 91 pop r17 + e50: 0f 91 pop r16 + e52: ff 90 pop r15 + e54: ef 90 pop r14 + e56: 08 95 ret + +00000e58 : + can_busy = 1; + can_handler(3); +} + +//VCM side of the CAN bus (in Muxsan) +void can_handler(uint8_t can_bus){ + e58: cf 92 push r12 + e5a: df 92 push r13 + e5c: ef 92 push r14 + e5e: ff 92 push r15 + e60: 0f 93 push r16 + e62: 1f 93 push r17 + e64: cf 93 push r28 + e66: df 93 push r29 + e68: cd b7 in r28, 0x3d ; 61 + e6a: de b7 in r29, 0x3e ; 62 + e6c: 2b 97 sbiw r28, 0x0b ; 11 + e6e: cd bf out 0x3d, r28 ; 61 + e70: de bf out 0x3e, r29 ; 62 + e72: c8 2e mov r12, r24 + can_frame_t frame; + uint8_t flag = can_read(MCP_REG_CANINTF, can_bus); + e74: 68 2f mov r22, r24 + e76: 8c e2 ldi r24, 0x2C ; 44 + e78: 43 dd rcall .-1402 ; 0x900 + e7a: d8 2e mov r13, r24 + + if (flag & (MCP_RX0IF | MCP_RX1IF)){ + e7c: 83 70 andi r24, 0x03 ; 3 + e7e: a9 f1 breq .+106 ; 0xeea + + if(flag & MCP_RX1IF){ //prioritize the rollover buffer + e80: d1 fe sbrs r13, 1 + e82: 0c c0 rjmp .+24 ; 0xe9c + can_read_rx_buf(MCP_RX_1, &frame, can_bus); + e84: 4c 2d mov r20, r12 + e86: be 01 movw r22, r28 + e88: 6f 5f subi r22, 0xFF ; 255 + e8a: 7f 4f sbci r23, 0xFF ; 255 + e8c: 84 e9 ldi r24, 0x94 ; 148 + e8e: eb dc rcall .-1578 ; 0x866 + can_bit_modify(MCP_REG_CANINTF, MCP_RX1IF, 0x00, can_bus); + e90: 2c 2d mov r18, r12 + e92: 40 e0 ldi r20, 0x00 ; 0 + e94: 62 e0 ldi r22, 0x02 ; 2 + e96: 8c e2 ldi r24, 0x2C ; 44 + e98: b6 db rcall .-2196 ; 0x606 + e9a: 0b c0 rjmp .+22 ; 0xeb2 + } else { + can_read_rx_buf(MCP_RX_0, &frame, can_bus); + e9c: 4c 2d mov r20, r12 + e9e: be 01 movw r22, r28 + ea0: 6f 5f subi r22, 0xFF ; 255 + ea2: 7f 4f sbci r23, 0xFF ; 255 + ea4: 80 e9 ldi r24, 0x90 ; 144 + ea6: df dc rcall .-1602 ; 0x866 + can_bit_modify(MCP_REG_CANINTF, MCP_RX0IF, 0x00, can_bus); + ea8: 2c 2d mov r18, r12 + eaa: 40 e0 ldi r20, 0x00 ; 0 + eac: 61 e0 ldi r22, 0x01 ; 1 + eae: 8c e2 ldi r24, 0x2C ; 44 + eb0: aa db rcall .-2220 ; 0x606 + default: + block = 0; + break; + } + if(!block){ + if(can_bus == 1){send_can2(frame);} else {send_can1(frame); + eb2: 81 e0 ldi r24, 0x01 ; 1 + eb4: c8 12 cpse r12, r24 + eb6: 0d c0 rjmp .+26 ; 0xed2 + eb8: e9 80 ldd r14, Y+1 ; 0x01 + eba: fa 80 ldd r15, Y+2 ; 0x02 + ebc: 0b 81 ldd r16, Y+3 ; 0x03 + ebe: 1c 81 ldd r17, Y+4 ; 0x04 + ec0: 2d 81 ldd r18, Y+5 ; 0x05 + ec2: 3e 81 ldd r19, Y+6 ; 0x06 + ec4: 4f 81 ldd r20, Y+7 ; 0x07 + ec6: 58 85 ldd r21, Y+8 ; 0x08 + ec8: 69 85 ldd r22, Y+9 ; 0x09 + eca: 7a 85 ldd r23, Y+10 ; 0x0a + ecc: 8b 85 ldd r24, Y+11 ; 0x0b + ece: 8b df rcall .-234 ; 0xde6 + ed0: 0c c0 rjmp .+24 ; 0xeea + ed2: e9 80 ldd r14, Y+1 ; 0x01 + ed4: fa 80 ldd r15, Y+2 ; 0x02 + ed6: 0b 81 ldd r16, Y+3 ; 0x03 + ed8: 1c 81 ldd r17, Y+4 ; 0x04 + eda: 2d 81 ldd r18, Y+5 ; 0x05 + edc: 3e 81 ldd r19, Y+6 ; 0x06 + ede: 4f 81 ldd r20, Y+7 ; 0x07 + ee0: 58 85 ldd r21, Y+8 ; 0x08 + ee2: 69 85 ldd r22, Y+9 ; 0x09 + ee4: 7a 85 ldd r23, Y+10 ; 0x0a + ee6: 8b 85 ldd r24, Y+11 ; 0x0b + } + } + } + + + if(flag & 0xA0){ + ee8: 20 df rcall .-448 ; 0xd2a + eea: 8d 2d mov r24, r13 + eec: 80 7a andi r24, 0xA0 ; 160 + uint8_t flag2 = can_read(MCP_REG_EFLG, can_bus); + eee: b1 f0 breq .+44 ; 0xf1c + ef0: 6c 2d mov r22, r12 + ef2: 8d e2 ldi r24, 0x2D ; 45 + ef4: 05 dd rcall .-1526 ; 0x900 + if(flag2 & 0xC0){ + ef6: 18 2f mov r17, r24 + ef8: 80 7c andi r24, 0xC0 ; 192 + can_write(MCP_REG_EFLG, 0, can_bus); //reset all errors + efa: 21 f0 breq .+8 ; 0xf04 + efc: 4c 2d mov r20, r12 + efe: 60 e0 ldi r22, 0x00 ; 0 + f00: 8d e2 ldi r24, 0x2D ; 45 + f02: f8 dd rcall .-1040 ; 0xaf4 + //ReportString = "CANX RX OVF\n"; + //ReportString[3] = 48 + can_bus; + //print(ReportString,12); + } + if(flag2 > 0){ PORTB.OUTSET = (1 << 1); } + f04: 11 23 and r17, r17 + f06: 19 f0 breq .+6 ; 0xf0e + f08: 82 e0 ldi r24, 0x02 ; 2 + f0a: 80 93 25 06 sts 0x0625, r24 ; 0x800625 <__TEXT_REGION_LENGTH__+0x700625> + f0e: 6d 2d mov r22, r13 + if(flag & 0xE0){ can_bit_modify(MCP_REG_CANINTF, (flag & 0xE0), 0x00, can_bus); } + f10: 60 7e andi r22, 0xE0 ; 224 + f12: 21 f0 breq .+8 ; 0xf1c + f14: 2c 2d mov r18, r12 + f16: 40 e0 ldi r20, 0x00 ; 0 + f18: 8c e2 ldi r24, 0x2C ; 44 + f1a: 75 db rcall .-2326 ; 0x606 + } + can_busy = 0; + f1c: 10 92 0a 20 sts 0x200A, r1 ; 0x80200a +} + f20: 2b 96 adiw r28, 0x0b ; 11 + f22: cd bf out 0x3d, r28 ; 61 + f24: de bf out 0x3e, r29 ; 62 + f26: df 91 pop r29 + f28: cf 91 pop r28 + f2a: 1f 91 pop r17 + f2c: 0f 91 pop r16 + f2e: ff 90 pop r15 + f30: ef 90 pop r14 + f32: df 90 pop r13 + f34: cf 90 pop r12 + f36: 08 95 ret + +00000f38 <__vector_64>: + check_can2(); + check_can3(); +} + +//can1 interrupt +ISR(PORTD_INT0_vect){ + f38: 1f 92 push r1 + f3a: 0f 92 push r0 + f3c: 0f b6 in r0, 0x3f ; 63 + f3e: 0f 92 push r0 + f40: 11 24 eor r1, r1 + f42: 2f 93 push r18 + f44: 3f 93 push r19 + f46: 4f 93 push r20 + f48: 5f 93 push r21 + f4a: 6f 93 push r22 + f4c: 7f 93 push r23 + f4e: 8f 93 push r24 + f50: 9f 93 push r25 + f52: af 93 push r26 + f54: bf 93 push r27 + f56: ef 93 push r30 + f58: ff 93 push r31 + can_busy = 1; + f5a: 81 e0 ldi r24, 0x01 ; 1 + f5c: 80 93 0a 20 sts 0x200A, r24 ; 0x80200a + can_handler(1); + f60: 7b df rcall .-266 ; 0xe58 +} + f62: ff 91 pop r31 + f64: ef 91 pop r30 + f66: bf 91 pop r27 + f68: af 91 pop r26 + f6a: 9f 91 pop r25 + f6c: 8f 91 pop r24 + f6e: 7f 91 pop r23 + f70: 6f 91 pop r22 + f72: 5f 91 pop r21 + f74: 4f 91 pop r20 + f76: 3f 91 pop r19 + f78: 2f 91 pop r18 + f7a: 0f 90 pop r0 + f7c: 0f be out 0x3f, r0 ; 63 + f7e: 0f 90 pop r0 + f80: 1f 90 pop r1 + f82: 18 95 reti + +00000f84 <__vector_65>: + +//can2 interrupt +ISR(PORTD_INT1_vect){ + f84: 1f 92 push r1 + f86: 0f 92 push r0 + f88: 0f b6 in r0, 0x3f ; 63 + f8a: 0f 92 push r0 + f8c: 11 24 eor r1, r1 + f8e: 2f 93 push r18 + f90: 3f 93 push r19 + f92: 4f 93 push r20 + f94: 5f 93 push r21 + f96: 6f 93 push r22 + f98: 7f 93 push r23 + f9a: 8f 93 push r24 + f9c: 9f 93 push r25 + f9e: af 93 push r26 + fa0: bf 93 push r27 + fa2: ef 93 push r30 + fa4: ff 93 push r31 + can_busy = 1; + fa6: 81 e0 ldi r24, 0x01 ; 1 + fa8: 80 93 0a 20 sts 0x200A, r24 ; 0x80200a + can_handler(2); + fac: 82 e0 ldi r24, 0x02 ; 2 + fae: 54 df rcall .-344 ; 0xe58 +} + fb0: ff 91 pop r31 + fb2: ef 91 pop r30 + fb4: bf 91 pop r27 + fb6: af 91 pop r26 + fb8: 9f 91 pop r25 + fba: 8f 91 pop r24 + fbc: 7f 91 pop r23 + fbe: 6f 91 pop r22 + fc0: 5f 91 pop r21 + fc2: 4f 91 pop r20 + fc4: 3f 91 pop r19 + fc6: 2f 91 pop r18 + fc8: 0f 90 pop r0 + fca: 0f be out 0x3f, r0 ; 63 + fcc: 0f 90 pop r0 + fce: 1f 90 pop r1 + fd0: 18 95 reti + +00000fd2 <__vector_2>: + +//can3 receive interrupt +ISR(PORTC_INT0_vect){ + fd2: 1f 92 push r1 + fd4: 0f 92 push r0 + fd6: 0f b6 in r0, 0x3f ; 63 + fd8: 0f 92 push r0 + fda: 11 24 eor r1, r1 + fdc: 2f 93 push r18 + fde: 3f 93 push r19 + fe0: 4f 93 push r20 + fe2: 5f 93 push r21 + fe4: 6f 93 push r22 + fe6: 7f 93 push r23 + fe8: 8f 93 push r24 + fea: 9f 93 push r25 + fec: af 93 push r26 + fee: bf 93 push r27 + ff0: ef 93 push r30 + ff2: ff 93 push r31 + can_busy = 1; + ff4: 81 e0 ldi r24, 0x01 ; 1 + ff6: 80 93 0a 20 sts 0x200A, r24 ; 0x80200a + can_handler(3); + ffa: 83 e0 ldi r24, 0x03 ; 3 + ffc: 2d df rcall .-422 ; 0xe58 +} + ffe: ff 91 pop r31 + 1000: ef 91 pop r30 + 1002: bf 91 pop r27 + 1004: af 91 pop r26 + 1006: 9f 91 pop r25 + 1008: 8f 91 pop r24 + 100a: 7f 91 pop r23 + 100c: 6f 91 pop r22 + 100e: 5f 91 pop r21 + 1010: 4f 91 pop r20 + 1012: 3f 91 pop r19 + 1014: 2f 91 pop r18 + 1016: 0f 90 pop r0 + 1018: 0f be out 0x3f, r0 ; 63 + 101a: 0f 90 pop r0 + 101c: 1f 90 pop r1 + 101e: 18 95 reti + +00001020 : +} + +void check_can3(void){ + uint8_t reg; + + if(tx3_buffer_end != tx3_buffer_pos){ + 1020: 90 91 04 20 lds r25, 0x2004 ; 0x802004 <__data_end> + 1024: 80 91 05 20 lds r24, 0x2005 ; 0x802005 + 1028: 98 17 cp r25, r24 + 102a: f1 f0 breq .+60 ; 0x1068 + //check if TXB0 is free use + reg = can3_read(MCP_REG_TXB0CTRL); + 102c: 80 e3 ldi r24, 0x30 ; 48 + 102e: 53 dc rcall .-1882 ; 0x8d6 + + if(!(reg & MCP_TXREQ_bm)){ //we're free to send + 1030: 83 fd sbrc r24, 3 + 1032: 1a c0 rjmp .+52 ; 0x1068 + can3_load_txbuff(0, (can_frame_t *) &tx3_buffer[tx3_buffer_pos++]); + 1034: 60 91 05 20 lds r22, 0x2005 ; 0x802005 + 1038: 81 e0 ldi r24, 0x01 ; 1 + 103a: 86 0f add r24, r22 + 103c: 80 93 05 20 sts 0x2005, r24 ; 0x802005 + 1040: 8b e0 ldi r24, 0x0B ; 11 + 1042: 68 9f mul r22, r24 + 1044: b0 01 movw r22, r0 + 1046: 11 24 eor r1, r1 + 1048: 6b 5f subi r22, 0xFB ; 251 + 104a: 7c 4d sbci r23, 0xDC ; 220 + 104c: 80 e0 ldi r24, 0x00 ; 0 + 104e: a5 db rcall .-2230 ; 0x79a + can3_rts(0); + 1050: 80 e0 ldi r24, 0x00 ; 0 + 1052: 4a db rcall .-2412 ; 0x6e8 + 1054: 90 91 05 20 lds r25, 0x2005 ; 0x802005 + if(tx3_buffer_pos == tx3_buffer_end){ //end of buffer, reset + 1058: 80 91 04 20 lds r24, 0x2004 ; 0x802004 <__data_end> + 105c: 98 13 cpse r25, r24 + 105e: 04 c0 rjmp .+8 ; 0x1068 + 1060: 10 92 04 20 sts 0x2004, r1 ; 0x802004 <__data_end> + tx3_buffer_end = 0; + 1064: 10 92 05 20 sts 0x2005, r1 ; 0x802005 + tx3_buffer_pos = 0; + 1068: 08 95 ret + +0000106a <__vector_20>: + 106a: 1f 92 push r1 + + } +} + +//fires approx. every 100us +ISR(TCC1_OVF_vect){ + 106c: 0f 92 push r0 + 106e: 0f b6 in r0, 0x3f ; 63 + 1070: 0f 92 push r0 + 1072: 11 24 eor r1, r1 + 1074: 2f 93 push r18 + 1076: 3f 93 push r19 + 1078: 4f 93 push r20 + 107a: 5f 93 push r21 + 107c: 6f 93 push r22 + 107e: 7f 93 push r23 + 1080: 8f 93 push r24 + 1082: 9f 93 push r25 + 1084: af 93 push r26 + 1086: bf 93 push r27 + 1088: ef 93 push r30 + 108a: ff 93 push r31 + check_can1(); + 108c: 29 de rcall .-942 ; 0xce0 + check_can2(); + 108e: 86 de rcall .-756 ; 0xd9c + check_can3(); + 1090: c7 df rcall .-114 ; 0x1020 + 1092: ff 91 pop r31 +} + 1094: ef 91 pop r30 + 1096: bf 91 pop r27 + 1098: af 91 pop r26 + 109a: 9f 91 pop r25 + 109c: 8f 91 pop r24 + 109e: 7f 91 pop r23 + 10a0: 6f 91 pop r22 + 10a2: 5f 91 pop r21 + 10a4: 4f 91 pop r20 + 10a6: 3f 91 pop r19 + 10a8: 2f 91 pop r18 + 10aa: 0f 90 pop r0 + 10ac: 0f be out 0x3f, r0 ; 63 + 10ae: 0f 90 pop r0 + 10b0: 1f 90 pop r1 + 10b2: 18 95 reti + +000010b4 <_exit>: + 10b4: f8 94 cli + +000010b6 <__stop_program>: + 10b6: ff cf rjmp .-2 ; 0x10b6 <__stop_program> diff --git a/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.map b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.map new file mode 100644 index 0000000..3a47fb1 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.map @@ -0,0 +1,1298 @@ +Archive member included to satisfy reference by file (symbol) + +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + helper_functions.o (__udivmodhi4) +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o (exit) +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + LUFA/Drivers/USB/Core/DeviceStandardReq.o (__tablejump2__) +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + Descriptors.o (__do_copy_data) +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + LUFA/Drivers/USB/Core/DeviceStandardReq.o (__do_clear_bss) +c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + helper_functions.o (__umulhisi3) +C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eerd_byte.o) + LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o (eeprom_read_byte) +C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) + LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o (eeprom_update_byte) +C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eewr_byte.o) + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) (eeprom_write_r18) + +Allocating common symbols +Common symbol size file + +tx3_buffer 0x37 can-bridge-ccs.o +USB_IsInitialized 0x1 LUFA/Drivers/USB/Core/USBTask.o +USB_EndpointTable 0x53 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o +USB_Endpoint_SelectedFIFO + 0x2 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o +USB_DeviceState 0x1 LUFA/Drivers/USB/Core/USBTask.o +USB_Device_ConfigurationNumber + 0x1 LUFA/Drivers/USB/Core/DeviceStandardReq.o +USB_Endpoint_SelectedHandle + 0x2 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o +USB_Options 0x1 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o +USB_Device_CurrentlySelfPowered + 0x1 LUFA/Drivers/USB/Core/DeviceStandardReq.o +USB_Endpoint_SelectedEndpoint + 0x1 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o +USB_ControlRequest 0x8 LUFA/Drivers/USB/Core/USBTask.o +tx2_buffer 0xb0 can-bridge-ccs.o +USB_Endpoint_FIFOs 0x294 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o +USB_Device_RemoteWakeupEnabled + 0x1 LUFA/Drivers/USB/Core/DeviceStandardReq.o +tx0_buffer 0xb0 can-bridge-ccs.o + +Discarded input sections + + .data 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + .bss 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + .text 0x00000000 0x0 Descriptors.o + .data 0x00000000 0x0 Descriptors.o + .bss 0x00000000 0x0 Descriptors.o + .text.CALLBACK_USB_GetDescriptor + 0x00000000 0x72 Descriptors.o + .rodata.ProductString + 0x00000000 0x18 Descriptors.o + .rodata.ManufacturerString + 0x00000000 0x1e Descriptors.o + .rodata.LanguageString + 0x00000000 0x4 Descriptors.o + .rodata.ConfigurationDescriptor + 0x00000000 0x3e Descriptors.o + .rodata.DeviceDescriptor + 0x00000000 0x12 Descriptors.o + .debug_info 0x00000000 0x938 Descriptors.o + .debug_abbrev 0x00000000 0x18d Descriptors.o + .debug_loc 0x00000000 0x1bd Descriptors.o + .debug_aranges + 0x00000000 0x20 Descriptors.o + .debug_ranges 0x00000000 0x10 Descriptors.o + .debug_line 0x00000000 0x2e0 Descriptors.o + .debug_str 0x00000000 0xc78 Descriptors.o + .comment 0x00000000 0x31 Descriptors.o + .debug_frame 0x00000000 0x24 Descriptors.o + .text 0x00000000 0x0 helper_functions.o + .data 0x00000000 0x0 helper_functions.o + .bss 0x00000000 0x0 helper_functions.o + .text.SID_to_str + 0x00000000 0x6e helper_functions.o + .text.uint32_to_str + 0x00000000 0x82 helper_functions.o + .text.canframe_to_str + 0x00000000 0xae helper_functions.o + .text.int_to_hex + 0x00000000 0x42 helper_functions.o + .text.calc_crc8 + 0x00000000 0x2c helper_functions.o + .text.calc_sum4 + 0x00000000 0x36 helper_functions.o + .text.int_to_3digit + 0x00000000 0x54 helper_functions.o + .text.int_to_4digit + 0x00000000 0x98 helper_functions.o + .text.int_to_4digit_nodec + 0x00000000 0x54 helper_functions.o + .text.int_to_5digit + 0x00000000 0x46 helper_functions.o + .text.ReadCalibrationByte + 0x00000000 0x12 helper_functions.o + .text.NVM_GetGUID + 0x00000000 0x64 helper_functions.o + .data.crctable + 0x00000000 0x100 helper_functions.o + .debug_info 0x00000000 0x6b4 helper_functions.o + .debug_abbrev 0x00000000 0x17b helper_functions.o + .debug_loc 0x00000000 0xd6f helper_functions.o + .debug_aranges + 0x00000000 0x78 helper_functions.o + .debug_ranges 0x00000000 0x80 helper_functions.o + .debug_line 0x00000000 0x4d8 helper_functions.o + .debug_str 0x00000000 0x65a helper_functions.o + .comment 0x00000000 0x31 helper_functions.o + .debug_frame 0x00000000 0x19c helper_functions.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_ConfigureEndpoints + 0x00000000 0x4a LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_SendString + 0x00000000 0x4e LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_SendData + 0x00000000 0x4a LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_SendByte + 0x00000000 0x5c LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_putchar + 0x00000000 0x22 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_Flush + 0x00000000 0xa0 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_USBTask + 0x00000000 0x3a LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_BytesReceived + 0x00000000 0xbe LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_ReceiveByte + 0x00000000 0xd6 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_getchar + 0x00000000 0x14 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_getchar_Blocking + 0x00000000 0x34 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .rodata 0x00000000 0x8 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_SendControlLineStateChange + 0x00000000 0x7a LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_CreateStream + 0x00000000 0x26 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_CreateBlockingStream + 0x00000000 0x26 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_Event_Stub + 0x00000000 0x2 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text.CDC_Device_ProcessControlRequest + 0x00000000 0x158 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .debug_info 0x00000000 0xf72 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .debug_abbrev 0x00000000 0x394 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .debug_loc 0x00000000 0x91a LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .debug_aranges + 0x00000000 0x98 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .debug_ranges 0x00000000 0x88 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .debug_line 0x00000000 0x7b3 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .debug_str 0x00000000 0xb3a LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .debug_frame 0x00000000 0x1bc LUFA/Drivers/USB/Class/Device/CDCClassDevice.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .text.USB_GetNextDescriptorOfType + 0x00000000 0x4e LUFA/Drivers/USB/Core/ConfigDescriptors.o + .text.USB_GetNextDescriptorOfTypeBefore + 0x00000000 0x5c LUFA/Drivers/USB/Core/ConfigDescriptors.o + .text.USB_GetNextDescriptorOfTypeAfter + 0x00000000 0x34 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .text.USB_GetNextDescriptorComp + 0x00000000 0x8e LUFA/Drivers/USB/Core/ConfigDescriptors.o + .debug_info 0x00000000 0x608 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .debug_abbrev 0x00000000 0x239 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .debug_loc 0x00000000 0x457 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .debug_aranges + 0x00000000 0x38 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .debug_ranges 0x00000000 0x28 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .debug_line 0x00000000 0x2b0 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .debug_str 0x00000000 0x50c LUFA/Drivers/USB/Core/ConfigDescriptors.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Core/ConfigDescriptors.o + .debug_frame 0x00000000 0xbc LUFA/Drivers/USB/Core/ConfigDescriptors.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .text.USB_Device_ProcessControlRequest + 0x00000000 0x2b0 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .progmem.gcc_sw_table.USB_Device_ProcessControlRequest + 0x00000000 0x14 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/Events.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/Events.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/Events.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/USBTask.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/USBTask.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/USBTask.o + .text.USB_USBTask + 0x00000000 0x28 LUFA/Drivers/USB/Core/USBTask.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .text.USB_Device_SendRemoteWakeup + 0x00000000 0xc LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .debug_info 0x00000000 0x670 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .debug_abbrev 0x00000000 0x11e LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .debug_aranges + 0x00000000 0x20 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .debug_ranges 0x00000000 0x10 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .debug_line 0x00000000 0x170 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .debug_str 0x00000000 0x5f9 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .debug_frame 0x00000000 0x24 LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Discard_Stream + 0x00000000 0x9e LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Null_Stream + 0x00000000 0x92 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_Stream_LE + 0x00000000 0xaa LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_Stream_BE + 0x00000000 0xb4 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Read_Stream_LE + 0x00000000 0xaa LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Read_Stream_BE + 0x00000000 0xb4 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_PStream_LE + 0x00000000 0xb8 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_PStream_BE + 0x00000000 0xc0 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_EStream_LE + 0x00000000 0xae LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_EStream_BE + 0x00000000 0xb6 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Read_EStream_LE + 0x00000000 0xb0 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Read_EStream_BE + 0x00000000 0xb8 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_Control_Stream_LE + 0x00000000 0x120 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_Control_Stream_BE + 0x00000000 0x128 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Read_Control_Stream_LE + 0x00000000 0xea LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Read_Control_Stream_BE + 0x00000000 0xe6 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_Control_PStream_LE + 0x00000000 0x126 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_Control_PStream_BE + 0x00000000 0x128 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_Control_EStream_LE + 0x00000000 0x128 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Write_Control_EStream_BE + 0x00000000 0x12a LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Read_Control_EStream_LE + 0x00000000 0xf2 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text.Endpoint_Read_Control_EStream_BE + 0x00000000 0xea LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .debug_info 0x00000000 0x1776 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .debug_abbrev 0x00000000 0x212 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .debug_loc 0x00000000 0x24f5 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .debug_aranges + 0x00000000 0xc8 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .debug_ranges 0x00000000 0x348 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .debug_line 0x00000000 0x130c LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .debug_str 0x00000000 0x9ac LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .debug_frame 0x00000000 0x488 LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_ClearIN + 0x00000000 0x32 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_ClearOUT + 0x00000000 0x1e LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_Read_8 + 0x00000000 0x20 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_Write_8 + 0x00000000 0x20 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_IsINReady + 0x00000000 0x1a LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_IsOUTReceived + 0x00000000 0x34 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_IsSETUPReceived + 0x00000000 0x34 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_ClearSETUP + 0x00000000 0x5c LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_StallTransaction + 0x00000000 0x38 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_ConfigureEndpointTable + 0x00000000 0xca LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_ClearStatusStage + 0x00000000 0x36 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text.Endpoint_WaitUntilReady + 0x00000000 0xa2 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o + .debug_info 0x00000000 0x5d LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o + .debug_abbrev 0x00000000 0x26 LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o + .debug_aranges + 0x00000000 0x18 LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o + .debug_line 0x00000000 0x1a LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o + .debug_str 0x00000000 0x1b4 LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o + .debug_info 0x00000000 0x5d LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o + .debug_abbrev 0x00000000 0x26 LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o + .debug_aranges + 0x00000000 0x18 LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o + .debug_line 0x00000000 0x1a LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o + .debug_str 0x00000000 0x1ba LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o + .debug_info 0x00000000 0x5d LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o + .debug_abbrev 0x00000000 0x26 LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o + .debug_aranges + 0x00000000 0x18 LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o + .debug_line 0x00000000 0x1a LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o + .debug_str 0x00000000 0x1b4 LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o + .debug_line 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o + .debug_str 0x00000000 0x15e LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o + .debug_line 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o + .debug_str 0x00000000 0x15e LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o + .debug_line 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o + .debug_str 0x00000000 0x157 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o + .comment 0x00000000 0x31 LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .text.USB_Disable + 0x00000000 0x1e LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .text 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .data 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .bss 0x00000000 0x0 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .text 0x00000000 0x0 mcp25xx.o + .data 0x00000000 0x0 mcp25xx.o + .bss 0x00000000 0x0 mcp25xx.o + .text.all_reset + 0x00000000 0xe mcp25xx.o + .text 0x00000000 0x0 can-bridge-ccs.o + .data 0x00000000 0x0 can-bridge-ccs.o + .bss 0x00000000 0x0 can-bridge-ccs.o + .text.send_can3 + 0x00000000 0x74 can-bridge-ccs.o + .text.send_can + 0x00000000 0xa6 can-bridge-ccs.o + .data.can_EV 0x00000000 0x1 can-bridge-ccs.o + .data.can_QC 0x00000000 0x1 can-bridge-ccs.o + .data.can_LIM 0x00000000 0x1 can-bridge-ccs.o + .data.VirtualSerial_CDC_Interface + 0x00000000 0x1b can-bridge-ccs.o + .text 0x00000000 0x16a sp_driver.o + .data 0x00000000 0x0 sp_driver.o + .bss 0x00000000 0x0 sp_driver.o + .debug_line 0x00000000 0x3b7 sp_driver.o + .debug_info 0x00000000 0x81 sp_driver.o + .debug_abbrev 0x00000000 0x14 sp_driver.o + .debug_aranges + 0x00000000 0x20 sp_driver.o + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .text.libgcc.div + 0x00000000 0x28 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_udivmodhi4.o) + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .text.libgcc 0x00000000 0xc c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_tablejump2.o) + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .text.libgcc.mul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + .text 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .data 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .bss 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .text.libgcc.mul + 0x00000000 0x1e c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .text.libgcc.div + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .text.libgcc 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .text.libgcc.prologue + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .text.libgcc.builtins + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .text.libgcc.fmul + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .text.libgcc.fixed + 0x00000000 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_umulhisi3.o) + .text 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eerd_byte.o) + .data 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eerd_byte.o) + .bss 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eerd_byte.o) + .text.avr-libc + 0x00000000 0x20 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eerd_byte.o) + .debug_line 0x00000000 0xa9 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eerd_byte.o) + .debug_info 0x00000000 0xb2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eerd_byte.o) + .debug_abbrev 0x00000000 0x14 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eerd_byte.o) + .debug_aranges + 0x00000000 0x20 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eerd_byte.o) + .text 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) + .data 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) + .bss 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) + .text.avr-libc + 0x00000000 0x16 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) + .debug_line 0x00000000 0x80 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) + .debug_info 0x00000000 0xb3 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) + .debug_abbrev 0x00000000 0x14 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) + .debug_aranges + 0x00000000 0x20 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eeupd_byte.o) + .text 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eewr_byte.o) + .data 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eewr_byte.o) + .bss 0x00000000 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eewr_byte.o) + .text.avr-libc + 0x00000000 0x46 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eewr_byte.o) + .debug_line 0x00000000 0x11b C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eewr_byte.o) + .debug_info 0x00000000 0xb2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eewr_byte.o) + .debug_abbrev 0x00000000 0x14 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eewr_byte.o) + .debug_aranges + 0x00000000 0x20 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a(eewr_byte.o) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00100000 xr +data 0x00802000 0x0000ffa0 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000006 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +user_signatures 0x00850000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o +LOAD Descriptors.o +LOAD helper_functions.o +LOAD LUFA/Drivers/USB/Class/Device/CDCClassDevice.o +LOAD LUFA/Drivers/USB/Core/ConfigDescriptors.o +LOAD LUFA/Drivers/USB/Core/DeviceStandardReq.o +LOAD LUFA/Drivers/USB/Core/Events.o +LOAD LUFA/Drivers/USB/Core/USBTask.o +LOAD LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.o +LOAD LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.o +LOAD LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o +LOAD LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.o +LOAD LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.o +LOAD LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.o +LOAD LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.o +LOAD LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.o +LOAD LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.o +LOAD LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o +LOAD LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o +LOAD mcp25xx.o +LOAD can-bridge-ccs.o +LOAD sp_driver.o +START GROUP +LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega2\libm.a +END GROUP +START GROUP +LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a +LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega2\libm.a +LOAD c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/../../../../avr/lib/avrxmega2\libc.a +LOAD C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2\libatxmega32c4.a +END GROUP + 0x00100000 __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x100000 + 0x0000ffa0 __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0 + 0x00010000 __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000 + [0x00000006] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x400 + 0x00000400 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x400 + 0x00000400 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x400 + 0x00000400 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED (__USER_SIGNATURE_REGION_LENGTH__)?__USER_SIGNATURE_REGION_LENGTH__:0x400 + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0x10b8 + *(.vectors) + .vectors 0x00000000 0x1fc C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + 0x00000000 __vector_default + 0x00000000 __vectors + *(.vectors) + *(.progmem.gcc*) + 0x000001fc . = ALIGN (0x2) + 0x000001fc __trampolines_start = . + *(.trampolines) + .trampolines 0x000001fc 0x0 linker stubs + *(.trampolines*) + 0x000001fc __trampolines_end = . + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + 0x000001fc . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x000001fc __ctors_start = . + *(.ctors) + 0x000001fc __ctors_end = . + 0x000001fc __dtors_start = . + *(.dtors) + 0x000001fc __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x000001fc 0x0 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + 0x000001fc __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x000001fc 0xc C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + .init4 0x00000208 0x16 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_copy_data.o) + 0x00000208 __do_copy_data + .init4 0x0000021e 0x10 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_clear_bss.o) + 0x0000021e __do_clear_bss + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x0000022e 0x4 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + *(.init9) + *(.text) + .text 0x00000232 0x2 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + 0x00000232 __vector_38 + 0x00000232 __vector_104 + 0x00000232 __vector_22 + 0x00000232 __vector_63 + 0x00000232 __vector_28 + 0x00000232 __vector_67 + 0x00000232 __vector_1 + 0x00000232 __vector_119 + 0x00000232 __vector_32 + 0x00000232 __vector_75 + 0x00000232 __vector_71 + 0x00000232 __vector_91 + 0x00000232 __vector_34 + 0x00000232 __vector_62 + 0x00000232 __vector_77 + 0x00000232 __vector_102 + 0x00000232 __vector_24 + 0x00000232 __vector_12 + 0x00000232 __vector_55 + 0x00000232 __vector_69 + 0x00000232 __vector_81 + 0x00000232 __vector_90 + 0x00000232 __vector_46 + 0x00000232 __bad_interrupt + 0x00000232 __vector_122 + 0x00000232 __vector_72 + 0x00000232 __vector_114 + 0x00000232 __vector_6 + 0x00000232 __vector_110 + 0x00000232 __vector_31 + 0x00000232 __vector_92 + 0x00000232 __vector_35 + 0x00000232 __vector_78 + 0x00000232 __vector_74 + 0x00000232 __vector_117 + 0x00000232 __vector_39 + 0x00000232 __vector_107 + 0x00000232 __vector_3 + 0x00000232 __vector_105 + 0x00000232 __vector_98 + 0x00000232 __vector_23 + 0x00000232 __vector_68 + 0x00000232 __vector_30 + 0x00000232 __vector_73 + 0x00000232 __vector_45 + 0x00000232 __vector_25 + 0x00000232 __vector_93 + 0x00000232 __vector_61 + 0x00000232 __vector_11 + 0x00000232 __vector_54 + 0x00000232 __vector_99 + 0x00000232 __vector_13 + 0x00000232 __vector_17 + 0x00000232 __vector_19 + 0x00000232 __vector_56 + 0x00000232 __vector_7 + 0x00000232 __vector_49 + 0x00000232 __vector_123 + 0x00000232 __vector_41 + 0x00000232 __vector_86 + 0x00000232 __vector_100 + 0x00000232 __vector_101 + 0x00000232 __vector_88 + 0x00000232 __vector_109 + 0x00000232 __vector_43 + 0x00000232 __vector_27 + 0x00000232 __vector_5 + 0x00000232 __vector_113 + 0x00000232 __vector_33 + 0x00000232 __vector_76 + 0x00000232 __vector_115 + 0x00000232 __vector_47 + 0x00000232 __vector_52 + 0x00000232 __vector_37 + 0x00000232 __vector_95 + 0x00000232 __vector_103 + 0x00000232 __vector_96 + 0x00000232 __vector_89 + 0x00000232 __vector_108 + 0x00000232 __vector_4 + 0x00000232 __vector_44 + 0x00000232 __vector_82 + 0x00000232 __vector_106 + 0x00000232 __vector_118 + 0x00000232 __vector_51 + 0x00000232 __vector_9 + 0x00000232 __vector_21 + 0x00000232 __vector_15 + 0x00000232 __vector_66 + 0x00000232 __vector_36 + 0x00000232 __vector_79 + 0x00000232 __vector_58 + 0x00000232 __vector_70 + 0x00000232 __vector_83 + 0x00000232 __vector_29 + 0x00000232 __vector_60 + 0x00000232 __vector_121 + 0x00000232 __vector_40 + 0x00000232 __vector_85 + 0x00000232 __vector_94 + 0x00000232 __vector_126 + 0x00000232 __vector_8 + 0x00000232 __vector_26 + 0x00000232 __vector_48 + 0x00000232 __vector_124 + 0x00000232 __vector_116 + 0x00000232 __vector_112 + 0x00000232 __vector_111 + 0x00000232 __vector_80 + 0x00000232 __vector_84 + 0x00000232 __vector_57 + 0x00000232 __vector_53 + 0x00000232 __vector_10 + 0x00000232 __vector_50 + 0x00000232 __vector_16 + 0x00000232 __vector_59 + 0x00000232 __vector_18 + 0x00000232 __vector_97 + 0x00000232 __vector_42 + 0x00000232 __vector_87 + 0x00000232 __vector_120 + 0x00000234 . = ALIGN (0x2) + *(.text.*) + .text.USB_Event_Stub + 0x00000234 0x2 LUFA/Drivers/USB/Core/Events.o + 0x00000234 EVENT_USB_Device_WakeUp + 0x00000234 USB_Event_Stub + 0x00000234 EVENT_USB_Device_Suspend + 0x00000234 EVENT_USB_Device_StartOfFrame + 0x00000234 EVENT_USB_Device_Reset + 0x00000234 EVENT_USB_Device_ControlRequest + 0x00000234 EVENT_USB_Device_ConfigurationChanged + .text.Endpoint_SelectEndpoint + 0x00000236 0x80 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + 0x00000236 Endpoint_SelectEndpoint + .text.Endpoint_ConfigureEndpoint_PRV + 0x000002b6 0x8a LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + 0x000002b6 Endpoint_ConfigureEndpoint_PRV + .text.Endpoint_ClearEndpoints + 0x00000340 0x40 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + 0x00000340 Endpoint_ClearEndpoints + .text.USB_ResetInterface + 0x00000380 0x92 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + 0x00000380 USB_ResetInterface + .text.USB_Init + 0x00000412 0x7a LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + 0x00000412 USB_Init + .text.USB_INT_DisableAllInterrupts + 0x0000048c 0xe LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + 0x0000048c USB_INT_DisableAllInterrupts + .text.USB_INT_ClearAllInterrupts + 0x0000049a 0xc LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + 0x0000049a USB_INT_ClearAllInterrupts + .text.__vector_125 + 0x000004a6 0xd2 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + 0x000004a6 __vector_125 + .text.spi0_write + 0x00000578 0x16 mcp25xx.o + 0x00000578 spi0_write + .text.can1_reset + 0x0000058e 0x1c mcp25xx.o + 0x0000058e can1_reset + .text.can2_reset + 0x000005aa 0x1c mcp25xx.o + 0x000005aa can2_reset + .text.can3_reset + 0x000005c6 0x1c mcp25xx.o + 0x000005c6 can3_reset + .text.can123_bit_modify + 0x000005e2 0x24 mcp25xx.o + 0x000005e2 can123_bit_modify + .text.can_bit_modify + 0x00000606 0x42 mcp25xx.o + 0x00000606 can_bit_modify + .text.can1_bit_modify + 0x00000648 0x1a mcp25xx.o + 0x00000648 can1_bit_modify + .text.can2_bit_modify + 0x00000662 0x1a mcp25xx.o + 0x00000662 can2_bit_modify + .text.can3_bit_modify + 0x0000067c 0x1a mcp25xx.o + 0x0000067c can3_bit_modify + .text.can123_rts + 0x00000696 0x1e mcp25xx.o + 0x00000696 can123_rts + .text.can1_rts + 0x000006b4 0x1a mcp25xx.o + 0x000006b4 can1_rts + .text.can2_rts + 0x000006ce 0x1a mcp25xx.o + 0x000006ce can2_rts + .text.can3_rts + 0x000006e8 0x1a mcp25xx.o + 0x000006e8 can3_rts + .text.can123_load_txbuff + 0x00000702 0x64 mcp25xx.o + 0x00000702 can123_load_txbuff + .text.can1_load_txbuff + 0x00000766 0x1a mcp25xx.o + 0x00000766 can1_load_txbuff + .text.can2_load_txbuff + 0x00000780 0x1a mcp25xx.o + 0x00000780 can2_load_txbuff + .text.can3_load_txbuff + 0x0000079a 0x1a mcp25xx.o + 0x0000079a can3_load_txbuff + .text.can123_read_rx_buf + 0x000007b4 0x64 mcp25xx.o + 0x000007b4 can123_read_rx_buf + .text.can1_read_rx_buf + 0x00000818 0x1a mcp25xx.o + 0x00000818 can1_read_rx_buf + .text.can2_read_rx_buf + 0x00000832 0x1a mcp25xx.o + 0x00000832 can2_read_rx_buf + .text.can3_read_rx_buf + 0x0000084c 0x1a mcp25xx.o + 0x0000084c can3_read_rx_buf + .text.can_read_rx_buf + 0x00000866 0x1c mcp25xx.o + 0x00000866 can_read_rx_buf + .text.can1_read + 0x00000882 0x2a mcp25xx.o + 0x00000882 can1_read + .text.can2_read + 0x000008ac 0x2a mcp25xx.o + 0x000008ac can2_read + .text.can3_read + 0x000008d6 0x2a mcp25xx.o + 0x000008d6 can3_read + .text.can_read + 0x00000900 0x14 mcp25xx.o + 0x00000900 can_read + .text.can1_write + 0x00000914 0x30 mcp25xx.o + 0x00000914 can1_write + .text.can2_write + 0x00000944 0x30 mcp25xx.o + 0x00000944 can2_write + .text.can3_write + 0x00000974 0x30 mcp25xx.o + 0x00000974 can3_write + .text.can_init + 0x000009a4 0x150 mcp25xx.o + 0x000009a4 can_init + .text.can_write + 0x00000af4 0x14 mcp25xx.o + 0x00000af4 can_write + .text.hw_init 0x00000b08 0x178 can-bridge-ccs.o + 0x00000b08 hw_init + .text.main 0x00000c80 0x4 can-bridge-ccs.o + 0x00000c80 main + .text.EVENT_USB_Device_Disconnect + 0x00000c84 0x2 can-bridge-ccs.o + 0x00000c84 EVENT_USB_Device_Disconnect + .text.EVENT_USB_Device_Connect + 0x00000c86 0x2 can-bridge-ccs.o + 0x00000c86 EVENT_USB_Device_Connect + .text.__vector_14 + 0x00000c88 0x58 can-bridge-ccs.o + 0x00000c88 __vector_14 + .text.check_can1 + 0x00000ce0 0x4a can-bridge-ccs.o + 0x00000ce0 check_can1 + .text.send_can1 + 0x00000d2a 0x72 can-bridge-ccs.o + 0x00000d2a send_can1 + .text.check_can2 + 0x00000d9c 0x4a can-bridge-ccs.o + 0x00000d9c check_can2 + .text.send_can2 + 0x00000de6 0x72 can-bridge-ccs.o + 0x00000de6 send_can2 + .text.can_handler + 0x00000e58 0xe0 can-bridge-ccs.o + 0x00000e58 can_handler + .text.__vector_64 + 0x00000f38 0x4c can-bridge-ccs.o + 0x00000f38 __vector_64 + .text.__vector_65 + 0x00000f84 0x4e can-bridge-ccs.o + 0x00000f84 __vector_65 + .text.__vector_2 + 0x00000fd2 0x4e can-bridge-ccs.o + 0x00000fd2 __vector_2 + .text.check_can3 + 0x00001020 0x4a can-bridge-ccs.o + 0x00001020 check_can3 + .text.__vector_20 + 0x0000106a 0x4a can-bridge-ccs.o + 0x0000106a __vector_20 + 0x000010b4 . = ALIGN (0x2) + *(.fini9) + .fini9 0x000010b4 0x0 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + 0x000010b4 _exit + 0x000010b4 exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x000010b4 0x4 c:/program files (x86)/atmel/studio/7.0/toolchain/avr8/avr8-gnu-toolchain/bin/../lib/gcc/avr/5.4.0/avrxmega2\libgcc.a(_exit.o) + *(.fini0) + 0x000010b8 _etext = . + +.data 0x00802000 0x4 load address 0x000010b8 + 0x00802000 PROVIDE (__data_start, .) + *(.data) + *(.data*) + .data.ms_timer_100 + 0x00802000 0x2 can-bridge-ccs.o + 0x00802000 ms_timer_100 + .data.sec_timer + 0x00802002 0x2 can-bridge-ccs.o + 0x00802002 sec_timer + *(.gnu.linkonce.d*) + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.r*) + 0x00802004 . = ALIGN (0x2) + 0x00802004 _edata = . + 0x00802004 PROVIDE (__data_end, .) + +.bss 0x00802004 0x498 + 0x00802004 PROVIDE (__bss_start, .) + *(.bss) + *(.bss*) + .bss.tx3_buffer_end + 0x00802004 0x1 can-bridge-ccs.o + 0x00802004 tx3_buffer_end + .bss.tx3_buffer_pos + 0x00802005 0x1 can-bridge-ccs.o + 0x00802005 tx3_buffer_pos + .bss.tx2_buffer_end + 0x00802006 0x1 can-bridge-ccs.o + 0x00802006 tx2_buffer_end + .bss.tx2_buffer_pos + 0x00802007 0x1 can-bridge-ccs.o + 0x00802007 tx2_buffer_pos + .bss.tx0_buffer_end + 0x00802008 0x1 can-bridge-ccs.o + 0x00802008 tx0_buffer_end + .bss.tx0_buffer_pos + 0x00802009 0x1 can-bridge-ccs.o + 0x00802009 tx0_buffer_pos + .bss.can_busy 0x0080200a 0x1 can-bridge-ccs.o + 0x0080200a can_busy + *(COMMON) + COMMON 0x0080200b 0x3 LUFA/Drivers/USB/Core/DeviceStandardReq.o + 0x0080200b USB_Device_ConfigurationNumber + 0x0080200c USB_Device_CurrentlySelfPowered + 0x0080200d USB_Device_RemoteWakeupEnabled + COMMON 0x0080200e 0xa LUFA/Drivers/USB/Core/USBTask.o + 0x0080200e USB_IsInitialized + 0x0080200f USB_DeviceState + 0x00802010 USB_ControlRequest + COMMON 0x00802018 0x299 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + 0x00802018 USB_Endpoint_SelectedFIFO + 0x0080201a USB_Endpoint_SelectedHandle + 0x0080201c USB_Endpoint_SelectedEndpoint + 0x0080201d USB_Endpoint_FIFOs + COMMON 0x008022b1 0x54 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + 0x008022b1 USB_EndpointTable + 0x00802304 USB_Options + COMMON 0x00802305 0x197 can-bridge-ccs.o + 0x00802305 tx3_buffer + 0x0080233c tx2_buffer + 0x008023ec tx0_buffer + 0x0080249c PROVIDE (__bss_end, .) + 0x000010b8 __data_load_start = LOADADDR (.data) + 0x000010bc __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x0080249c 0x0 + [!provide] PROVIDE (__noinit_start, .) + *(.noinit*) + [!provide] PROVIDE (__noinit_end, .) + 0x0080249c _end = . + [!provide] PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.user_signatures + *(.user_signatures*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment 0x00000000 0x30 + *(.comment) + .comment 0x00000000 0x30 LUFA/Drivers/USB/Core/DeviceStandardReq.o + 0x31 (size before relaxing) + .comment 0x00000030 0x31 LUFA/Drivers/USB/Core/Events.o + .comment 0x00000030 0x31 LUFA/Drivers/USB/Core/USBTask.o + .comment 0x00000030 0x31 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .comment 0x00000030 0x31 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .comment 0x00000030 0x31 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .comment 0x00000030 0x31 mcp25xx.o + .comment 0x00000030 0x31 can-bridge-ccs.o + +.note.gnu.avr.deviceinfo + 0x00000000 0x40 + .note.gnu.avr.deviceinfo + 0x00000000 0x40 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + +.note.gnu.build-id + *(.note.gnu.build-id) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x308 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x20 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .debug_aranges + 0x00000020 0x20 LUFA/Drivers/USB/Core/Events.o + .debug_aranges + 0x00000040 0x20 LUFA/Drivers/USB/Core/USBTask.o + .debug_aranges + 0x00000060 0x90 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .debug_aranges + 0x000000f0 0x30 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .debug_aranges + 0x00000120 0x30 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .debug_aranges + 0x00000150 0x118 mcp25xx.o + .debug_aranges + 0x00000268 0xa0 can-bridge-ccs.o + +.debug_pubnames + *(.debug_pubnames) + +.debug_info 0x00000000 0x917b + *(.debug_info .gnu.linkonce.wi.*) + .debug_info 0x00000000 0x2226 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + .debug_info 0x00002226 0x1180 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .debug_info 0x000033a6 0x7f LUFA/Drivers/USB/Core/Events.o + .debug_info 0x00003425 0x42d LUFA/Drivers/USB/Core/USBTask.o + .debug_info 0x00003852 0xd24 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .debug_info 0x00004576 0xd90 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .debug_info 0x00005306 0xa81 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .debug_info 0x00005d87 0x12ed mcp25xx.o + .debug_info 0x00007074 0x2107 can-bridge-ccs.o + +.debug_abbrev 0x00000000 0x33d7 + *(.debug_abbrev) + .debug_abbrev 0x00000000 0x2056 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + .debug_abbrev 0x00002056 0x313 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .debug_abbrev 0x00002369 0x44 LUFA/Drivers/USB/Core/Events.o + .debug_abbrev 0x000023ad 0x1fb LUFA/Drivers/USB/Core/USBTask.o + .debug_abbrev 0x000025a8 0x2f6 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .debug_abbrev 0x0000289e 0x2cb LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .debug_abbrev 0x00002b69 0x247 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .debug_abbrev 0x00002db0 0x2ae mcp25xx.o + .debug_abbrev 0x0000305e 0x379 can-bridge-ccs.o + +.debug_line 0x00000000 0x26fd + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x00000000 0x391 C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + .debug_line 0x00000391 0x49c LUFA/Drivers/USB/Core/DeviceStandardReq.o + .debug_line 0x0000082d 0x4f LUFA/Drivers/USB/Core/Events.o + .debug_line 0x0000087c 0x1d6 LUFA/Drivers/USB/Core/USBTask.o + .debug_line 0x00000a52 0x6a0 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .debug_line 0x000010f2 0x3d6 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .debug_line 0x000014c8 0x395 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .debug_line 0x0000185d 0x6f4 mcp25xx.o + .debug_line 0x00001f51 0x7ac can-bridge-ccs.o + +.debug_frame 0x00000000 0x9e4 + *(.debug_frame) + .debug_frame 0x00000000 0x48 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .debug_frame 0x00000048 0x24 LUFA/Drivers/USB/Core/Events.o + .debug_frame 0x0000006c 0x2c LUFA/Drivers/USB/Core/USBTask.o + .debug_frame 0x00000098 0x158 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .debug_frame 0x000001f0 0x50 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .debug_frame 0x00000240 0x8c LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .debug_frame 0x000002cc 0x3e8 mcp25xx.o + .debug_frame 0x000006b4 0x330 can-bridge-ccs.o + +.debug_str 0x00000000 0x3c95 + *(.debug_str) + .debug_str 0x00000000 0x168f C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/XMEGAC_DFP/1.1.50/gcc/dev/atxmega32c4/avrxmega2/crtatxmega32c4.o + .debug_str 0x0000168f 0x117f LUFA/Drivers/USB/Core/DeviceStandardReq.o + 0x11f2 (size before relaxing) + .debug_str 0x0000280e 0x31 LUFA/Drivers/USB/Core/Events.o + 0x1b9 (size before relaxing) + .debug_str 0x0000283f 0x79 LUFA/Drivers/USB/Core/USBTask.o + 0x485 (size before relaxing) + .debug_str 0x000028b8 0x334 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + 0xb0b (size before relaxing) + .debug_str 0x00002bec 0x234 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + 0xec7 (size before relaxing) + .debug_str 0x00002e20 0xdf LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + 0x96c (size before relaxing) + .debug_str 0x00002eff 0x37e mcp25xx.o + 0x55f (size before relaxing) + .debug_str 0x0000327d 0xa18 can-bridge-ccs.o + 0x1520 (size before relaxing) + +.debug_loc 0x00000000 0x289d + *(.debug_loc) + .debug_loc 0x00000000 0x2d7 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .debug_loc 0x000002d7 0x22 LUFA/Drivers/USB/Core/USBTask.o + .debug_loc 0x000002f9 0x578 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .debug_loc 0x00000871 0x109 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .debug_loc 0x0000097a 0x1e4 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .debug_loc 0x00000b5e 0x14cb mcp25xx.o + .debug_loc 0x00002029 0x874 can-bridge-ccs.o + +.debug_macinfo + *(.debug_macinfo) + +.debug_weaknames + *(.debug_weaknames) + +.debug_funcnames + *(.debug_funcnames) + +.debug_typenames + *(.debug_typenames) + +.debug_varnames + *(.debug_varnames) + +.debug_pubtypes + *(.debug_pubtypes) + +.debug_ranges 0x00000000 0x308 + *(.debug_ranges) + .debug_ranges 0x00000000 0x58 LUFA/Drivers/USB/Core/DeviceStandardReq.o + .debug_ranges 0x00000058 0x10 LUFA/Drivers/USB/Core/Events.o + .debug_ranges 0x00000068 0x10 LUFA/Drivers/USB/Core/USBTask.o + .debug_ranges 0x00000078 0xb8 LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.o + .debug_ranges 0x00000130 0x20 LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.o + .debug_ranges 0x00000150 0x20 LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.o + .debug_ranges 0x00000170 0x108 mcp25xx.o + .debug_ranges 0x00000278 0x90 can-bridge-ccs.o + +.debug_macro + *(.debug_macro) +OUTPUT(can-bridge-ccs.elf elf32-avr) +LOAD linker stubs diff --git a/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.o b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.o new file mode 100644 index 0000000..3a07079 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.srec b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.srec new file mode 100644 index 0000000..a41b827 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/can-bridge-ccs.srec @@ -0,0 +1,271 @@ +S016000063616E2D6272696467652D6363732E73726563DC +S1130000FDC0000016C10000E4C7000012C10000DA +S113001010C100000EC100000CC100000AC10000A4 +S113002008C1000006C1000004C1000002C10000B4 +S113003000C10000FEC0000027C60000FAC0000096 +S1130040F8C00000F6C00000F4C00000F2C00000D8 +S11300500C943508EEC00000ECC00000EAC00000BB +S1130060E8C00000E6C00000E4C00000E2C00000F8 +S1130070E0C00000DEC00000DCC00000DAC0000008 +S1130080D8C00000D6C00000D4C00000D2C0000018 +S1130090D0C00000CEC00000CCC00000CAC0000028 +S11300A0C8C00000C6C00000C4C00000C2C0000038 +S11300B0C0C00000BEC00000BCC00000BAC0000048 +S11300C0B8C00000B6C00000B4C00000B2C0000058 +S11300D0B0C00000AEC00000ACC00000AAC0000068 +S11300E0A8C00000A6C00000A4C00000A2C0000078 +S11300F0A0C000009EC000009CC000009AC0000088 +S11301001BC700003FC7000094C0000092C000005D +S113011090C000008EC000008CC000008AC00000A7 +S113012088C0000086C0000084C0000082C00000B7 +S113013080C000007EC000007CC000007AC00000C7 +S113014078C0000076C0000074C0000072C00000D7 +S113015070C000006EC000006CC000006AC00000E7 +S113016068C0000066C0000064C0000062C00000F7 +S113017060C000005EC000005CC000005AC0000007 +S113018058C0000056C0000054C0000052C0000017 +S113019050C000004EC000004CC000004AC0000027 +S11301A048C0000046C0000044C0000042C0000037 +S11301B040C000003EC000003CC000003AC0000047 +S11301C038C0000036C0000034C0000032C0000057 +S11301D030C000002EC000002CC000002AC0000067 +S11301E028C0000026C0000024C0000022C0000077 +S11301F020C0000058C100001CC0000011241FBE14 +S1130200CFEFCDBFDFE2DEBF10E2A0E0B0E2E8EB6B +S1130210F0E102C005900D92A430B107D9F724E2B1 +S1130220A4E0B0E201C01D92AC39B207E1F728D5D1 +S113023041C7E6CE089580931C20282F2F7030E00C +S11302404091C6045091C7048823E4F464E8629F93 +S1130250C001639F900D1124815A9F4D80931820F3 +S113026090931920C90182959295907F9827807F59 +S1130270982708969A01280F391F20931A20309343 +S11302801B20089564E8629FC001639F900D1124B0 +S1130290835E9F4D80931820909319202295329568 +S11302A0307F3227207F3227240F351F20931A20D6 +S11302B030931B2008951F93CF93DF93D82F162FCD +S11302C0C42FB9DFE0911A20F0911B201182E09134 +S11302D01A20F0911B20DD23A4F01082E0911A2053 +S11302E0F0911B201183E0911A20F0911B201282BF +S11302F0138280911820909119208483958340E083 +S113030014C082E08083E0911A20F0911B201183B5 +S1130310E0911A20F0911B20128213828091182000 +S113032090911920848395834C2FFC01E05CFF4F4E +S113033040833196108281E0DF91CF911F9108951F +S113034020E030E0A0ECB4E01696ED91FC91179714 +S1130350C90182959295907F9827807F9827E80F0E +S1130360F91F118616964D915C911797FA01E80FC3 +S1130370F91F11822F5F3F4F2530310529F708956A +S11303808091042380FF04C088E38093440002C06A +S1130390109244008091042383FF06C0E0E4F0E05F +S11303A084818160848305C0E0E4F0E0848183601B +S11303B084836CD072D0E0ECF4E080818F7780830A +S11303C080818068808310920F2010920B201092FD +S11303D00D2010920C208091042380FF04C08081A2 +S11303E08F7B808305C0E0ECF4E0808180648083AF +S11303F048E068E480E85FDF48E068E480E05BDFD1 +S1130400E0ECF4E080858064808781818160818371 +S11304100895CF93DF93809304232FB7F894C0EC0F +S1130420D1E082E08A87EAE1F0E0E491A0ECB4E074 +S1130430DA96EC93DA97EBE1F0E0E491DB96EC9357 +S1130440DB971A8682EB92E28E7F16968D939C93AD +S1130450179784E18C938091042382FF04C083E086 +S11304608093C8040BC08091042381FF04C082E000 +S11304708093C80403C081E08093C8042FBF81E047 +S113048080930E207DDFDF91CF910895E0ECF4E0BE +S113049080858370808711860895E0ECF4E08FEF07 +S11304A08287848708951F920F920FB60F921124AA +S11304B02F933F934F935F936F937F938F939F9368 +S11304C0AF93BF93EF93FF938091CA04882344F4BE +S11304D08091C804882324F480E88093CA04AADEA7 +S11304E08091CA0486FF06C080E48093CA041092F7 +S11304F00F20C8D38091CA0485FF15C080E2809381 +S1130500CA0480910B20882321F084E080930F207B +S113051009C08091C304811102C081E001C083E05D +S113052080930F20B0D38091CA0484FF14C0E0EC00 +S1130530F4E080E1828782E080930F2010920B2008 +S11305401382FEDE48E068E480E8B5DE48E068E453 +S113055080E0B1DE6FDEFF91EF91BF91AF919F918B +S11305608F917F916F915F914F913F912F910F9058 +S11305700FBE0F901F901895E0ECF8E092819283E3 +S1130580838382818823ECF78091C30808951F93A5 +S1130590CF93DF93C0E4D6E010E11E8380ECECDF60 +S11305A01D83DF91CF911F9108951F93CF93DF9304 +S11305B0C0E6D6E010E11E8380ECDEDF1D83DF9110 +S11305C0CF911F9108951F93CF93DF93C0E2D6E09C +S11305D018E01E8380ECD0DF1D83DF91CF911F9143 +S11305E008951F93CF93DF93182FD62FC42F85E040 +S11305F0C3DF812FC1DF8D2FBFDF8C2FBDDFDF91E4 +S1130600CF911F9108951F93CF93DF93213039F435 +S1130610C0E4D6E010E11E83E4DF1D8311C0223064 +S113062039F4C0E6D6E010E11E83DBDF1D8308C089 +S1130630233031F4C0E2D6E018E01E83D2DF1D83FC +S1130640DF91CF911F9108951F93CF93DF93C0E45F +S1130650D6E010E11E83C5DF1D83DF91CF911F918A +S113066008951F93CF93DF93C0E6D6E010E11E8375 +S1130670B8DF1D83DF91CF911F9108951F93CF930E +S1130680DF93C0E2D6E018E01E83ABDF1D83DF9169 +S1130690CF911F910895813039F018F0823039F0EC +S11306A0089581E869CF089582E866CF089584E8C3 +S11306B063CF08951F93CF93DF93C0E4D6E010E196 +S11306C01E83E9DF1D83DF91CF911F9108951F934E +S11306D0CF93DF93C0E6D6E010E11E83DCDF1D83F9 +S11306E0DF91CF911F9108951F93CF93DF93C0E2C1 +S11306F0D6E018E01E83CFDF1D83DF91CF911F91D9 +S113070008950F931F93CF938B01880F805C34DF80 +S1130710F801808191819695879596958795969510 +S113072087952ADFF80180818295880F807E24DFF7 +S113073080E022DF80E020DFF80182818F701CDFFF +S1130740F8018281882359F0C0E0F801EC0FF11D13 +S1130750838112DFCF5FF8018281C817B0F3CF9194 +S11307601F910F9108951F93CF93DF93C0E4D6E0B8 +S113077010E11E83C6DF1D83DF91CF911F91089581 +S11307801F93CF93DF93C0E6D6E010E11E83B9DF59 +S11307901D83DF91CF911F9108951F93CF93DF9312 +S11307A0C0E2D6E018E01E83ACDF1D83DF91CF9159 +S11307B01F9108950F931F93CF93DF938B01DCDE7A +S11307C080E0DADE98E0899FE001112480E0D4DE45 +S11307D0829586958770C82B80E0CEDE80E0CCDEE3 +S11307E0F801C083D18380E0C7DE8F70F801828373 +S11307F0882361F0C0E080E0BFDEF801EC0FF11D5A +S11308008383CF5FF8018281C817A8F381E0DF9169 +S1130810CF911F910F9108951F93CF93DF93C0E45D +S1130820D6E010E11E83C6DF1D83DF91CF911F91B7 +S113083008951F93CF93DF93C0E6D6E010E11E83A3 +S1130840B9DF1D83DF91CF911F9108951F93CF933B +S1130850DF93C0E2D6E018E01E83ACDF1D83DF9196 +S1130860CF911F910895413011F4D6CF08954230AD +S113087011F4DFCF0895433011F4E8CF089580E0F8 +S113088008950F931F93CF93DF93082FC0E4D6E00E +S113089010E11E8383E070DE802F6EDE80E06CDE6C +S11308A01D83DF91CF911F910F9108950F931F9393 +S11308B0CF93DF93082FC0E6D6E010E11E8383E0D8 +S11308C05BDE802F59DE80E057DE1D83DF91CF9100 +S11308D01F910F9108950F931F93CF93DF93082FC8 +S11308E0C0E2D6E018E01E8383E046DE802F44DEBB +S11308F080E042DE1D83DF91CF911F910F91089517 +S1130900613011F4BECF0895623011F4CFCF089551 +S1130910E2CF0895FF920F931F93CF93DF93F82EA6 +S1130920062FC0E4D6E010E11E8382E025DE8F2D81 +S113093023DE802F21DE1D83DF91CF911F910F9144 +S1130940FF900895FF920F931F93CF93DF93F82E98 +S1130950062FC0E6D6E010E11E8382E00DDE8F2D67 +S11309600BDE802F09DE1D83DF91CF911F910F9144 +S1130970FF900895FF920F931F93CF93DF93F82E68 +S1130980062FC0E2D6E018E01E8382E0F5DD8F2D4D +S1130990F3DD802FF1DD1D83DF91CF911F910F9146 +S11309A0FF9008951F93CF93DF93E0E4F6E090EA7D +S11309B0918390E49283A0E6B6E092E011969C9332 +S11309C011979093810698E0918320E121831196F9 +S11309D02C939093210690ED9093C008662309F41C +S11309E07EC0C82F80E1809345068093650688E029 +S11309F0809325068FE193E00197F1F700C0000092 +S1130A00C6DDD3DDE0DD8FE39FE10197F1F700C0A0 +S1130A1000008FE036DFD82F8FE048DF182F8FE0FB +S1130A205ADFD295D695D770D43009F05AC01295B2 +S1130A3016951770143009F056C082958695877004 +S1130A40843009F052C08FE193E00197F1F700C0C0 +S1130A50000060E08AE25EDF60E08AE273DF60E06B +S1130A608AE288DF67EE89E255DF67EE89E26ADFB2 +S1130A7067EE89E27FDF61E088E24CDF61E088E2D3 +S1130A8061DF61E088E276DF44E064E080E6DCDD9B +S1130A9044E064E080E6E5DD44E064E080E6EEDD29 +S1130AA063EA8BE237DF63EA8BE24CDF63EA8BE2D3 +S1130AB061DF4C2F60EE8FE0C7DD4C2F60EE8FE0DE +S1130AC0D0DD4C2F60EE8FE0D9DD82E080936606A6 +S1130AD08093860688E08093460681E007C081E023 +S1130AE005C080E003C080E001C080E0DF91CF91C9 +S1130AF01F910895413011F40DCF0895423011F43F +S1130B0021CF089537CF0895CF93DF93E0E5F0E048 +S1130B10808182608083818181FFFDCFA0E5B0E088 +S1130B2016968C911697846016968C931697C0E649 +S1130B30D0E080E88D838BEB8E8380EC91E022E023 +S1130B40FC012287EDE1F0E0E491EA83ECE1F0E0DE +S1130B50E491EB83FC01128681E08883E0E7F0E016 +S1130B6085E1808383E0818394E5938393E5948393 +S1130B7090E59583809321068BEC12968C931297C3 +S1130B808C9188608C93E0E5F0E0818183FFFDCF58 +S1130B90E0E5F0E082EC858380818061808381815F +S1130BA084FFFDCF88ED84BF34E030934000E0E063 +S1130BB0FAE081E0808393E1918341E050E040A733 +S1130BC051A746A357A380938106A0E4B6E093E01F +S1130BD019969C931997E0E6F6E02FE02187828727 +S1130BE02BE1208B40E24387258B1A963C931A977E +S1130BF050962C93E0E4F8E0808320E83CE026A3C0 +S1130C0037A39683E0E0F8E0808320E03DE726A365 +S1130C1037A3968380932606C8E7D0E0888183FFB4 +S1130C2004C061E080E0BEDE03C061E080E0BADEC3 +S1130C3081110AC0FFEF29EF80E0F150204080408D +S1130C40E1F700C00000EACF25E888ED90E0A2EAD1 +S1130C50B0E01BBEFD0184BF20832BBE80E0D9DB46 +S1130C6093E088ED08B618BE84BF9093800080910D +S1130C70820081FDFCCF08BE7894DF91CF91089566 +S1130C8043DFFFCF089508951F920F920FB60F927E +S1130C9011248F939F93A895809102209091032013 +S1130CA001978093022090930320809100209091DB +S1130CB001208436910521F4109200201092012025 +S1130CC08091022090910320892B19F482E0809373 +S1130CD026069F918F910F900FBE0F901F9018952D +S1130CE090910820809109209817F1F080E3C9DDE4 +S1130CF083FD1AC06091092081E0860F809309204A +S1130D008BE0689FB001112464517C4D80E02BDDA1 +S1130D1080E0D0DC9091092080910820981304C0D1 +S1130D2010920820109209200895EF92FF920F93D9 +S1130D301F93CF93DF93CDB7DEB72B97CDBFDEBF25 +S1130D40E982FA820B831C832D833E834F83588769 +S1130D5069877A878B87A091082081E08A0F809326 +S1130D6008209BE0A99FD0011124A451BC4D9BE015 +S1130D70FE01319601900D929A95E1F7803118F0B9 +S1130D808FE080930820ACDF2B96CDBFDEBFDF91D0 +S1130D90CF911F910F91FF90EF90089590910620AD +S1130DA0809107209817F1F080E380DD83FD1AC05D +S1130DB06091072081E0860F809307208BE0689F75 +S1130DC0B0011124645C7C4D80E0DADC80E07FDCDF +S1130DD09091072080910620981304C01092062059 +S1130DE0109207200895EF92FF920F931F93CF93D1 +S1130DF0DF93CDB7DEB72B97CDBFDEBFE982FA8292 +S1130E000B831C832D833E834F83588769877A879E +S1130E108B87A091062081E08A0F809306209BE0B7 +S1130E20A99FD0011124A45CBC4D9BE0FE01319626 +S1130E3001900D929A95E1F7803118F08FE080933C +S1130E400620ACDF2B96CDBFDEBFDF91CF911F9183 +S1130E500F91FF90EF900895CF92DF92EF92FF925F +S1130E600F931F93CF93DF93CDB7DEB72B97CDBFEF +S1130E70DEBFC82E682F8CE243DDD82E8370A9F123 +S1130E80D1FE0CC04C2DBE016F5F7F4F84E9EBDCBB +S1130E902C2D40E062E08CE2B6DB0BC04C2DBE0191 +S1130EA06F5F7F4F80E9DFDC2C2D40E061E08CE256 +S1130EB0AADB81E0C8120DC0E980FA800B811C8195 +S1130EC02D813E814F81588569857A858B858BDF9D +S1130ED00CC0E980FA800B811C812D813E814F81F9 +S1130EE0588569857A858B8520DF8D2D807AB1F0D0 +S1130EF06C2D8DE205DD182F807C21F04C2D60E0F7 +S1130F008DE2F8DD112319F082E0809325066D2D22 +S1130F10607E21F02C2D40E08CE275DB10920A20DB +S1130F202B96CDBFDEBFDF91CF911F910F91FF9024 +S1130F30EF90DF90CF9008951F920F920FB60F920B +S1130F4011242F933F934F935F936F937F938F93CA +S1130F509F93AF93BF93EF93FF9381E080930A2015 +S1130F607BDFFF91EF91BF91AF919F918F917F9123 +S1130F706F915F914F913F912F910F900FBE0F9002 +S1130F801F9018951F920F920FB60F9211242F9352 +S1130F903F934F935F936F937F938F939F93AF93FD +S1130FA0BF93EF93FF9381E080930A2082E054DFA4 +S1130FB0FF91EF91BF91AF919F918F917F916F912D +S1130FC05F914F913F912F910F900FBE0F901F9003 +S1130FD018951F920F920FB60F9211242F933F93DF +S1130FE04F935F936F937F938F939F93AF93BF932D +S1130FF0EF93FF9381E080930A2083E02DDFFF913C +S1131000EF91BF91AF919F918F917F916F915F917C +S11310104F913F912F910F900FBE0F901F901895F5 +S113102090910420809105209817F1F080E353DC1F +S113103083FD1AC06091052081E0860F809305200E +S11310408BE0689FB00111246B5F7C4D80E0A5DBD1 +S113105080E04ADB9091052080910420981304C01D +S1131060109204201092052008951F920F920FB63B +S11310700F9211242F933F934F935F936F937F931A +S11310808F939F93AF93BF93EF93FF9329DE86DEF5 +S1131090C7DFFF91EF91BF91AF919F918F917F91A6 +S11310A06F915F914F913F912F910F900FBE0F90D1 +S10B10B01F901895F894FFCF7E +S10710B8010001002E +S9030000FC diff --git a/leaf-can-bridge-3-port-CCS/Debug/helper_functions.d b/leaf-can-bridge-3-port-CCS/Debug/helper_functions.d new file mode 100644 index 0000000..ac317e0 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/helper_functions.d @@ -0,0 +1,54 @@ +helper_functions.d helper_functions.o: .././helper_functions.c \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdio.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdarg.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + .././mcp25xx.h .././helper_functions.h + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdio.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdarg.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stddef.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\pgmspace.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +.././mcp25xx.h: + +.././helper_functions.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/helper_functions.o b/leaf-can-bridge-3-port-CCS/Debug/helper_functions.o new file mode 100644 index 0000000..85db69e Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/helper_functions.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/makedep.mk b/leaf-can-bridge-3-port-CCS/Debug/makedep.mk new file mode 100644 index 0000000..9cc2920 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/makedep.mk @@ -0,0 +1,46 @@ +################################################################################ +# Automatically-generated file. Do not edit or delete the file +################################################################################ + +Descriptors.c + +helper_functions.c + +LUFA\Drivers\USB\Class\Device\CDCClassDevice.c + +LUFA\Drivers\USB\Core\ConfigDescriptors.c + +LUFA\Drivers\USB\Core\DeviceStandardReq.c + +LUFA\Drivers\USB\Core\Events.c + +LUFA\Drivers\USB\Core\USBTask.c + +LUFA\Drivers\USB\Core\XMEGA\Device_XMEGA.c + +LUFA\Drivers\USB\Core\XMEGA\EndpointStream_XMEGA.c + +LUFA\Drivers\USB\Core\XMEGA\Endpoint_XMEGA.c + +LUFA\Drivers\USB\Core\XMEGA\Host_XMEGA.c + +LUFA\Drivers\USB\Core\XMEGA\PipeStream_XMEGA.c + +LUFA\Drivers\USB\Core\XMEGA\Pipe_XMEGA.c + +LUFA\Drivers\USB\Core\XMEGA\Template\Template_Endpoint_Control_R.c + +LUFA\Drivers\USB\Core\XMEGA\Template\Template_Endpoint_Control_W.c + +LUFA\Drivers\USB\Core\XMEGA\Template\Template_Endpoint_RW.c + +LUFA\Drivers\USB\Core\XMEGA\USBController_XMEGA.c + +LUFA\Drivers\USB\Core\XMEGA\USBInterrupt_XMEGA.c + +mcp25xx.c + +can-bridge-ccs.c + +sp_driver.S + diff --git a/leaf-can-bridge-3-port-CCS/Debug/mcp25xx.d b/leaf-can-bridge-3-port-CCS/Debug/mcp25xx.d new file mode 100644 index 0000000..ac18c74 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/mcp25xx.d @@ -0,0 +1,48 @@ +mcp25xx.d mcp25xx.o: .././mcp25xx.c .././mcp25xx.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h + +.././mcp25xx.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\inttypes.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\lib\gcc\avr\5.4.0\include\stdint.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\stdint.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\util\delay_basic.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\math.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/mcp25xx.o b/leaf-can-bridge-3-port-CCS/Debug/mcp25xx.o new file mode 100644 index 0000000..7ae84d4 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/mcp25xx.o differ diff --git a/leaf-can-bridge-3-port-CCS/Debug/sp_driver.d b/leaf-can-bridge-3-port-CCS/Debug/sp_driver.d new file mode 100644 index 0000000..a49fa2e --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Debug/sp_driver.d @@ -0,0 +1,28 @@ +sp_driver.d sp_driver.o: .././sp_driver.S \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h \ + C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h \ + c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\io.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\sfr_defs.h: + +C:\Program\ Files\ (x86)\Atmel\Studio\7.0\Packs\atmel\XMEGAC_DFP\1.1.50\include/avr/iox32c4.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\portpins.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\common.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\version.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\xmega.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\fuse.h: + +c:\program\ files\ (x86)\atmel\studio\7.0\toolchain\avr8\avr8-gnu-toolchain\avr\include\avr\lock.h: diff --git a/leaf-can-bridge-3-port-CCS/Debug/sp_driver.o b/leaf-can-bridge-3-port-CCS/Debug/sp_driver.o new file mode 100644 index 0000000..e11aea8 Binary files /dev/null and b/leaf-can-bridge-3-port-CCS/Debug/sp_driver.o differ diff --git a/leaf-can-bridge-3-port-CCS/Descriptors.c b/leaf-can-bridge-3-port-CCS/Descriptors.c new file mode 100644 index 0000000..28210a4 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Descriptors.c @@ -0,0 +1,222 @@ +#include "Descriptors.h" + + +/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall + * device characteristics, including the supported USB version, control endpoint size and the + * number of device configurations. The descriptor is read out by the USB host when the enumeration + * process begins. + */ +const USB_Descriptor_Device_t DeviceDescriptor = +{ + .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, + + .USBSpecification = VERSION_BCD(1,1,0), + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_NoSpecificSubclass, + .Protocol = CDC_CSCP_NoSpecificProtocol, + + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, + + .VendorID = 0x03EB, + .ProductID = 0x2044, + .ReleaseNumber = VERSION_BCD(0,0,1), + + .ManufacturerStrIndex = STRING_ID_Manufacturer, + .ProductStrIndex = STRING_ID_Product, + .SerialNumStrIndex = USE_INTERNAL_SERIAL, + + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS +}; + +/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage + * of the device in one of its supported configurations, including information about any device interfaces + * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting + * a configuration so that the host may correctly communicate with the USB device. + */ +const USB_Descriptor_Configuration_t ConfigurationDescriptor = +{ + .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_RESERVED | USB_CONFIG_ATTR_SELFPOWERED), + + .MaxPowerConsumption = USB_CONFIG_POWER_MA(20) + }, + + .CDC_CCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_CDC_CCI, + .AlternateSetting = 0, + + .TotalEndpoints = 1, + + .Class = CDC_CSCP_CDCClass, + .SubClass = CDC_CSCP_ACMSubclass, + .Protocol = CDC_CSCP_ATCommandProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_Functional_Header = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Header, + + .CDCSpecification = VERSION_BCD(1,1,0), + }, + + .CDC_Functional_ACM = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalACM_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_ACM, + + .Capabilities = 0x06, + }, + + .CDC_Functional_Union = + { + .Header = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface}, + .Subtype = CDC_DSUBTYPE_CSInterface_Union, + + .MasterInterfaceNumber = INTERFACE_ID_CDC_CCI, + .SlaveInterfaceNumber = INTERFACE_ID_CDC_DCI, + }, + + .CDC_NotificationEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_NOTIFICATION_EPADDR, + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .PollingIntervalMS = 0xFF + }, + + .CDC_DCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = INTERFACE_ID_CDC_DCI, + .AlternateSetting = 0, + + .TotalEndpoints = 2, + + .Class = CDC_CSCP_CDCDataClass, + .SubClass = CDC_CSCP_NoDataSubclass, + .Protocol = CDC_CSCP_NoDataProtocol, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_DataOutEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_RX_EPADDR, + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x05 + }, + + .CDC_DataInEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = CDC_TX_EPADDR, + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x05 + } +}; + +/** 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. + */ +const USB_Descriptor_String_t LanguageString = +{ + .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, + + .UnicodeString = {LANGUAGE_ID_ENG} +}; + +/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable + * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t ManufacturerString = +{ + .Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String}, + + .UnicodeString = L"Emile Nijssen" +}; + +/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, + * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +const USB_Descriptor_String_t ProductString = +{ + .Header = {.Size = USB_STRING_LEN(10), .Type = DTYPE_String}, + + .UnicodeString = L"CAN-bridge" +}; + +/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" + * documentation) by the application code so that the address and size of a requested descriptor can be given + * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function + * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the + * USB host. + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress) +{ + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (wValue & 0xFF); + + 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: + Address = &ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); + break; + case DTYPE_String: + switch (DescriptorNumber) + { + case 0x00: + Address = &LanguageString; + Size = LanguageString.Header.Size; + break; + case 0x01: + Address = &ManufacturerString; + Size = ManufacturerString.Header.Size; + break; + case 0x02: + Address = &ProductString; + Size = ProductString.Header.Size; + break; + } + + break; + } + + *DescriptorAddress = Address; + return Size; +} diff --git a/leaf-can-bridge-3-port-CCS/Descriptors.h b/leaf-can-bridge-3-port-CCS/Descriptors.h new file mode 100644 index 0000000..74d2cd5 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/Descriptors.h @@ -0,0 +1,74 @@ +#ifndef _DESCRIPTORS_H_ +#define _DESCRIPTORS_H_ + + /* Includes: */ + #include + + #include "LUFA/Drivers/USB/USB.h" + + /* Macros: */ + /** Endpoint address of the CDC device-to-host notification IN endpoint. */ + #define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2) + + /** Endpoint address of the CDC device-to-host data IN endpoint. */ + #define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3) + + /** Endpoint address of the CDC host-to-device data OUT endpoint. */ + #define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 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 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 + * vary between devices, and which describe the device's usage to the host. + */ + typedef struct + { + USB_Descriptor_Configuration_Header_t Config; + + // CDC Control Interface + USB_Descriptor_Interface_t CDC_CCI_Interface; + USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header; + USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM; + USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union; + USB_Descriptor_Endpoint_t CDC_NotificationEndpoint; + + // CDC Data Interface + USB_Descriptor_Interface_t CDC_DCI_Interface; + USB_Descriptor_Endpoint_t CDC_DataOutEndpoint; + USB_Descriptor_Endpoint_t CDC_DataInEndpoint; + } USB_Descriptor_Configuration_t; + + /** Enum for the device interface descriptor IDs within the device. Each interface descriptor + * should have a unique ID index associated with it, which can be used to refer to the + * interface from other descriptors. + */ + enum InterfaceDescriptors_t + { + INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */ + INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */ + }; + + /** Enum for the device string descriptor IDs within the device. Each string descriptor should + * have a unique ID index associated with it, which can be used to refer to the string from + * other descriptors. + */ + enum StringDescriptors_t + { + STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */ + STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */ + STRING_ID_Product = 2, /**< Product string ID */ + }; + + /* 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 \ No newline at end of file diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Common/ArchitectureSpecific.h b/leaf-can-bridge-3-port-CCS/LUFA/Common/ArchitectureSpecific.h new file mode 100644 index 0000000..e7608d4 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Common/ArchitectureSpecific.h @@ -0,0 +1,177 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Architecture specific definitions relating to specific processor architectures. + * + * \copydetails Group_ArchitectureSpecific + * + * \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_ArchitectureSpecific Architecture Specific Definitions + * \brief Architecture specific definitions relating to specific processor architectures. + * + * Architecture specific macros, functions and other definitions, which relate to specific architectures. This + * definitions may or may not be available in some form on other architectures, and thus should be protected by + * preprocessor checks in portable code to prevent compile errors. + * + * @{ + */ + +#ifndef __LUFA_ARCHSPEC_H__ +#define __LUFA_ARCHSPEC_H__ + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + #if (ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA) || defined(__DOXYGEN__) + #if (ARCH == ARCH_AVR8) || defined(__DOXYGEN__) + /** Re-enables the AVR's JTAG bus in software, until a system reset. This will re-enable JTAG debugging + * interface after is has been disabled in software via \ref JTAG_DISABLE(). + * + * \note This macro is not available for all architectures. + */ + #define JTAG_ENABLE() MACROS{ \ + __asm__ __volatile__ ( \ + "in __tmp_reg__,__SREG__" "\n\t" \ + "cli" "\n\t" \ + "out %1, %0" "\n\t" \ + "out __SREG__, __tmp_reg__" "\n\t" \ + "out %1, %0" "\n\t" \ + : \ + : "r" (MCUCR & ~(1 << JTD)), \ + "M" (_SFR_IO_ADDR(MCUCR)) \ + : "r0"); \ + }MACROE + + /** Disables the AVR's JTAG bus in software, until a system reset. This will override the current JTAG + * status as set by the JTAGEN fuse, disabling JTAG debugging and reverting the JTAG pins back to GPIO + * mode. + * + * \note This macro is not available for all architectures. + */ + #define JTAG_DISABLE() MACROS{ \ + __asm__ __volatile__ ( \ + "in __tmp_reg__,__SREG__" "\n\t" \ + "cli" "\n\t" \ + "out %1, %0" "\n\t" \ + "out __SREG__, __tmp_reg__" "\n\t" \ + "out %1, %0" "\n\t" \ + : \ + : "r" (MCUCR | (1 << JTD)), \ + "M" (_SFR_IO_ADDR(MCUCR)) \ + : "r0"); \ + }MACROE + #endif + + /** Defines a volatile \c 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 optimizer + * removes/reorders code to the point where break points cannot reliably be set. + * + * \note This macro is not available for all architectures. + */ + #define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::) + + /** Defines an explicit JTAG break point in the resulting binary via the assembly \c BREAK statement. When + * a JTAG is used, this causes the program execution to halt when reached until manually resumed. + * + * \note This macro is not available for all architectures. + */ + #define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("break" ::) + + /** Macro for testing condition "x" and breaking via \ref JTAG_DEBUG_BREAK() if the condition is false. + * + * \note This macro is not available for all architectures. + * + * \param[in] Condition Condition that will be evaluated. + */ + #define JTAG_ASSERT(Condition) MACROS{ if (!(Condition)) { JTAG_DEBUG_BREAK(); } }MACROE + + /** Macro for testing condition \c "x" and writing debug data to the stdout stream if \c false. The stdout stream + * must be pre-initialized before this macro is run and linked to an output device, such as the microcontroller's + * USART peripheral. + * + * The output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion {Condition} failed." + * + * \note This macro is not available for all architectures. + * + * \param[in] Condition Condition that will be evaluated, + */ + #define STDOUT_ASSERT(Condition) MACROS{ if (!(Condition)) { \ + printf_P(PSTR("%s: Function \"%s\", Line %d: " \ + "Assertion \"%s\" failed.\r\n"), \ + __FILE__, __func__, __LINE__, #Condition); } }MACROE + + #if !defined(pgm_read_ptr) || defined(__DOXYGEN__) + /** Reads a pointer out of PROGMEM space on the AVR8 architecture. This is currently a wrapper for the + * avr-libc \c pgm_read_word() macro with a \c void* cast, so that its value can be assigned directly + * to a pointer variable or used in pointer arithmetic without further casting in C. In a future + * avr-libc distribution this will be part of the standard API and will be implemented in a more formal + * manner. + * + * \note This macro is not available for all architectures. + * + * \param[in] Address Address of the pointer to read. + * + * \return Pointer retrieved from PROGMEM space. + */ + #define pgm_read_ptr(Address) (void*)pgm_read_word(Address) + #endif + #elif (ARCH == ARCH_UC3) + #define JTAG_DEBUG_POINT() __asm__ __volatile__ ("nop" ::) + #define JTAG_DEBUG_BREAK() __asm__ __volatile__ ("breakpoint" ::) + #define JTAG_ASSERT(Condition) MACROS{ if (!(Condition)) { JTAG_DEBUG_BREAK(); } }MACROE + #define STDOUT_ASSERT(Condition) MACROS{ if (!(Condition)) { \ + printf("%s: Function \"%s\", Line %d: " \ + "Assertion \"%s\" failed.\r\n"), \ + __FILE__, __func__, __LINE__, #Condition); } }MACROE + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Common/Architectures.h b/leaf-can-bridge-3-port-CCS/LUFA/Common/Architectures.h new file mode 100644 index 0000000..265b412 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Common/Architectures.h @@ -0,0 +1,84 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Supported library architecture defines. + * + * \copydetails Group_Architectures + * + * \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_Architectures Hardware Architectures + * \brief Supported library architecture defines. + * + * Architecture macros for selecting the desired target microcontroller architecture. One of these values should be + * defined as the value of \c ARCH in the user project makefile via the \c -D compiler switch to GCC, to select the + * target architecture. + * + * The selected architecture should remain consistent with the makefile \c ARCH value, which is used to select the + * underlying driver source files for each architecture. + * + * @{ + */ + +#ifndef __LUFA_ARCHITECTURES_H__ +#define __LUFA_ARCHITECTURES_H__ + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Selects the Atmel 8-bit AVR (AT90USB* and ATMEGA*U* chips) architecture. */ + #define ARCH_AVR8 0 + + /** Selects the Atmel 32-bit UC3 AVR (AT32UC3* chips) architecture. */ + #define ARCH_UC3 1 + + /** Selects the Atmel XMEGA AVR (ATXMEGA* chips) architecture. */ + #define ARCH_XMEGA 2 + + #if !defined(__DOXYGEN__) + #define ARCH_ ARCH_AVR8 + + #if !defined(ARCH) + #define ARCH ARCH_AVR8 + #endif + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Common/Attributes.h b/leaf-can-bridge-3-port-CCS/LUFA/Common/Attributes.h new file mode 100644 index 0000000..dc5c6be --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Common/Attributes.h @@ -0,0 +1,150 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Special function/variable attribute macros. + * + * \copydetails Group_FuncVarAttributes + * + * \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_FuncVarAttributes Function/Variable Attributes + * \brief Special function/variable attribute macros. + * + * This module contains macros for applying specific attributes to functions and variables to control various + * optimizer 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. + * + * On incompatible versions of GCC or on other compilers, these macros evaluate to nothing unless they are + * critical to the code's function and thus must throw a compile error when used. + * + * @{ + */ + +#ifndef __LUFA_ATTR_H__ +#define __LUFA_ATTR_H__ + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + #if (__GNUC__ >= 3) || defined(__DOXYGEN__) + /** Indicates to the compiler that the function can not ever return, so that any stack restoring or + * 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. + */ + #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result)) + + /** Indicates that the specified parameters of the function are pointers which should never be \c NULL. + * When applied as a 1-based comma separated list the compiler will emit a warning if the specified + * parameters are known at compiler time to be \c NULL at the point of calling the function. + */ + #define ATTR_NON_NULL_PTR_ARG(...) __attribute__ ((nonnull (__VA_ARGS__))) + + /** Removes any preamble or postamble from the function. When used, the function will not have any + * register or stack saving code. This should be used with caution, and when used the programmer + * is responsible for maintaining stack and register integrity. + */ + #define ATTR_NAKED __attribute__ ((naked)) + + /** Prevents the compiler from considering a specified function for in-lining. When applied, the given + * function will not be in-lined under any circumstances. + */ + #define ATTR_NO_INLINE __attribute__ ((noinline)) + + /** Forces the compiler to inline the specified function. When applied, the given function will be + * in-lined 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)) + #endif + + /** 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 + * behavior of volatile memory once power is removed, but may be used in some specific circumstances, + * like the passing of values back after a system watchdog reset. + */ + #define ATTR_NO_INIT __attribute__ ((section (".noinit"))) + + /** Places the function in one of the initialization sections, which execute before the main function + * of the application. Refer to the avr-libc manual for more information on the initialization sections. + * + * \param[in] SectionIndex Initialization section number where the function should be placed. + */ + #define ATTR_INIT_SECTION(SectionIndex) __attribute__ ((used, 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. + */ + #define ATTR_ALIAS(Func) __attribute__ ((alias( #Func ))) + + /** Marks a variable or struct element for packing into the smallest space available, omitting any + * alignment bytes usually added between fields to optimize field accesses. + */ + #define ATTR_PACKED __attribute__ ((packed)) + + /** Indicates the minimum alignment in bytes for a variable or struct element. + * + * \param[in] Bytes Minimum number of bytes the item should be aligned to. + */ + #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes))) +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Common/BoardTypes.h b/leaf-can-bridge-3-port-CCS/LUFA/Common/BoardTypes.h new file mode 100644 index 0000000..07c60bb --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Common/BoardTypes.h @@ -0,0 +1,248 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Supported pre-made board hardware defines. + * + * \copydetails Group_BoardTypes + * + * \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_BoardTypes Board Types + * \brief Supported pre-made board hardware defines. + * + * Board macros for indicating the chosen physical board hardware to the library. These macros should be used when + * defining the \c BOARD token to the chosen hardware via the \c -D switch in the project makefile. If a custom + * board is used, the \ref BOARD_NONE or \ref BOARD_USER values should be selected. + * + * @{ + */ + +#ifndef __LUFA_BOARDTYPES_H__ +#define __LUFA_BOARDTYPES_H__ + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Selects the user-defined board drivers, which should be placed in the user project's folder + * under a directory named \c /Board/. Each board driver should be named identically to the LUFA + * master board driver (i.e., driver in the \c LUFA/Drivers/Board directory) so that the library + * can correctly identify it. + */ + #define BOARD_USER 0 + + /** 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 1 + + /** Selects the USBKEY specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ + #define BOARD_USBKEY 2 + + /** Selects the STK525 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ + #define BOARD_STK525 3 + + /** Selects the STK526 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ + #define BOARD_STK526 4 + + /** Selects the RZUSBSTICK specific board drivers, including the driver for the boards LEDs. */ + #define BOARD_RZUSBSTICK 5 + + /** Selects the ATAVRUSBRF01 specific board drivers, including the driver for the board LEDs. */ + #define BOARD_ATAVRUSBRF01 6 + + /** Selects the BUMBLEB specific board drivers, using the officially recommended peripheral layout. */ + #define BOARD_BUMBLEB 7 + + /** Selects the XPLAIN (Revision 2 or newer) specific board drivers, including LED and Dataflash drivers. */ + #define BOARD_XPLAIN 8 + + /** Selects the XPLAIN (Revision 1) specific board drivers, including LED and Dataflash drivers. */ + #define BOARD_XPLAIN_REV1 9 + + /** Selects the EVK527 specific board drivers, including Temperature, Button, Dataflash, Joystick and LED drivers. */ + #define BOARD_EVK527 10 + + /** Selects the Teensy version 1.x 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 + + /** Selects the Olimex AVR-USB-162 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_OLIMEX162 15 + + /** Selects the UDIP specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_UDIP 16 + + /** Selects the BUI specific board drivers, including the driver for the board LEDs. */ + #define BOARD_BUI 17 + + /** Selects the Arduino Uno specific board drivers, including the driver for the board LEDs. */ + #define BOARD_UNO 18 + + /** Selects the Busware CUL V3 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_CULV3 19 + + /** Selects the Blackcat USB JTAG specific board drivers, including the driver for the board LEDs. */ + #define BOARD_BLACKCAT 20 + + /** Selects the Maximus specific board drivers, including the driver for the board LEDs. */ + #define BOARD_MAXIMUS 21 + + /** Selects the Minimus specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_MINIMUS 22 + + /** Selects the Adafruit U4 specific board drivers, including the Button driver. */ + #define BOARD_ADAFRUITU4 23 + + /** Selects the Microsin AVR-USB162 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_MICROSIN162 24 + + /** Selects the Kernel Concepts USBFOO specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_USBFOO 25 + + /** Selects the Sparkfun ATMEGA8U2 specific board drivers, including the driver for the board LEDs. */ + #define BOARD_SPARKFUN8U2 26 + + /** Selects the Atmel EVK1101 specific board drivers, including the Button, Joystick and LED drivers. */ + #define BOARD_EVK1101 27 + + /** Selects the Busware TUL specific board drivers, including the Button and LED drivers. */ + #define BOARD_TUL 28 + + /** Selects the Atmel EVK1100 specific board drivers, including the Button, Joystick and LED drivers. */ + #define BOARD_EVK1100 29 + + /** Selects the Atmel EVK1104 specific board drivers, including the Button and LED drivers. */ + #define BOARD_EVK1104 30 + + /** Selects the Atmel XMEGA A3BU Xplained specific board drivers, including Dataflash, Button and LED drivers. */ + #define BOARD_A3BU_XPLAINED 31 + + /** Selects the Teensy version 2.x specific board drivers, including the driver for the board LEDs. */ + #define BOARD_TEENSY2 32 + + /** Selects the USB2AX version 1 and 2 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_USB2AX 33 + + /** Selects the USB2AX version 3 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_USB2AX_V3 34 + + /** Selects the Micropendous 32U2 specific board drivers, including the Button and LED drivers. */ + #define BOARD_MICROPENDOUS_32U2 35 + + /** Selects the Micropendous A specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_A 36 + + /** Selects the Micropendous 1 specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_1 37 + + /** Selects the Micropendous 2 specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_2 38 + + /** Selects the Micropendous 3 specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_3 39 + + /** Selects the Micropendous 4 specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_4 40 + + /** Selects the Micropendous DIP specific board drivers, including the driver for the board Button. */ + #define BOARD_MICROPENDOUS_DIP 41 + + /** Selects the Micropendous (Arduino-like) revision 1 specific board drivers, including the Button and LED drivers. */ + #define BOARD_MICROPENDOUS_REV1 42 + + /** Selects the Micropendous (Arduino-like) revision 2 specific board drivers, including the Button and LED drivers. */ + #define BOARD_MICROPENDOUS_REV2 43 + + /** Selects the XMEGA B1 Xplained specific board drivers, including the Button and LED drivers. */ + #define BOARD_B1_XPLAINED 44 + + /** Selects the Bitwizard Multio specific board drivers, including the driver for the board LEDs. */ + #define BOARD_MULTIO 45 + + /** Selects the Bitwizard Big-Multio specific board drivers, including the driver for the board LEDs. */ + #define BOARD_BIGMULTIO 46 + + /** Selects the DorkbotPDX Duce specific board drivers, including the driver for the board LEDs. */ + #define BOARD_DUCE 47 + + /** Selects the Olimex AVR-USB-32U4 specific board drivers, including the Button and LED drivers. */ + #define BOARD_OLIMEX32U4 48 + + /** Selects the Olimex AVR-USB-T32U4 specific board drivers, including the Button and LED drivers. */ + #define BOARD_OLIMEXT32U4 49 + + /** Selects the Olimex AVR-ISP-MK2 specific board drivers, including the Button and LED drivers. */ + #define BOARD_OLIMEXISPMK2 50 + + /** Selects the Arduino Leonardo specific board drivers, including the driver for the board LEDs. */ + #define BOARD_LEONARDO 51 + + /** Selects the UC3-A3 Xplained specific board drivers, including the Button and LED drivers. */ + #define BOARD_UC3A3_XPLAINED 52 + + /** Selects the USB2AX version 3.1 specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_USB2AX_V31 53 + + /** Selects the Stange-ISP specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_STANGE_ISP 54 + + /** Selects the XMEGA C3 XPLAINED specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_C3_XPLAINED 55 + + /** Selects the U2S specific board drivers, including the Button and LEDs drivers. */ + #define BOARD_U2S 56 + + #if !defined(__DOXYGEN__) + #define BOARD_ BOARD_NONE + + #if !defined(BOARD) + #define BOARD BOARD_NONE + #endif + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Common/Common.h b/leaf-can-bridge-3-port-CCS/LUFA/Common/Common.h new file mode 100644 index 0000000..38afb85 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Common/Common.h @@ -0,0 +1,401 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \dir + * \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. + */ + +/** \file + * \brief Common library convenience headers, macros and functions. + * + * \copydetails Group_Common + */ + +/** \defgroup Group_Common Common Utility Headers - LUFA/Drivers/Common/Common.h + * \brief Common library convenience headers, macros and functions. + * + * Common utility headers containing macros, functions, enums and types which are common to all + * aspects of the library. + * + * @{ + */ + +/** \defgroup Group_GlobalInt Global Interrupt Macros + * \brief Convenience macros for the management of interrupts globally within the device. + * + * Macros and functions to create and control global interrupts within the device. + */ + +#ifndef __LUFA_COMMON_H__ +#define __LUFA_COMMON_H__ + + /* Macros: */ + #define __INCLUDE_FROM_COMMON_H + + /* Includes: */ + #include + #include + #include + #include + + #include "Architectures.h" + #include "BoardTypes.h" + #include "ArchitectureSpecific.h" + #include "CompilerSpecific.h" + #include "Attributes.h" + + #if defined(USE_LUFA_CONFIG_HEADER) + #include "LUFAConfig.h" + #endif + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Architecture specific utility includes: */ + #if defined(__DOXYGEN__) + /** Type define for an unsigned integer the same width as the selected architecture's machine register. + * This is distinct from the non-specific standard int data type, whose width is machine dependant but + * which may not reflect the actual machine register width on some targets (e.g. AVR8). + */ + typedef MACHINE_REG_t uint_reg_t; + #elif (ARCH == ARCH_AVR8) + #include + #include + #include + #include + #include + #include + #include + + typedef uint8_t uint_reg_t; + + #define ARCH_HAS_EEPROM_ADDRESS_SPACE + #define ARCH_HAS_FLASH_ADDRESS_SPACE + #define ARCH_HAS_MULTI_ADDRESS_SPACE + #define ARCH_LITTLE_ENDIAN + + #include "Endianness.h" + #elif (ARCH == ARCH_UC3) + #include + #include + + // === TODO: Find abstracted way to handle these === + #define PROGMEM + #define pgm_read_byte(x) *x + #define memcmp_P(...) memcmp(__VA_ARGS__) + #define memcpy_P(...) memcpy(__VA_ARGS__) + // ================================================= + + typedef uint32_t uint_reg_t; + + #define ARCH_BIG_ENDIAN + + #include "Endianness.h" + #elif (ARCH == ARCH_XMEGA) + #include + #include + #include + #include + #include + #include + + typedef uint8_t uint_reg_t; + + #define ARCH_HAS_EEPROM_ADDRESS_SPACE + #define ARCH_HAS_FLASH_ADDRESS_SPACE + #define ARCH_HAS_MULTI_ADDRESS_SPACE + #define ARCH_LITTLE_ENDIAN + + #include "Endianness.h" + #else + #error Unknown device architecture specified. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Macro for encasing other multi-statement macros. This should be used along with an opening brace + * before the start of any multi-statement macro, so that the macros contents as a whole are treated + * as a discrete block and not as a list of separate statements which may cause problems when used as + * a block (such as inline \c if statements). + */ + #define MACROS do + + /** Macro for encasing other multi-statement macros. This should be used along with a preceding closing + * brace at the end of any multi-statement macro, so that the macros contents as a whole are treated + * as a discrete block and not as a list of separate statements which may cause problems when used as + * a block (such as inline \c if statements). + */ + #define MACROE while (0) + + /** Convenience macro to determine the larger of two values. + * + * \attention This macro should only be used with operands that do not have side effects from being evaluated + * multiple times. + * + * \param[in] x First value to compare + * \param[in] y First value to compare + * + * \return The larger of the two input parameters + */ + #if !defined(MAX) || defined(__DOXYGEN__) + #define MAX(x, y) (((x) > (y)) ? (x) : (y)) + #endif + + /** Convenience macro to determine the smaller of two values. + * + * \attention This macro should only be used with operands that do not have side effects from being evaluated + * multiple times. + * + * \param[in] x First value to compare. + * \param[in] y First value to compare. + * + * \return The smaller of the two input parameters + */ + #if !defined(MIN) || defined(__DOXYGEN__) + #define MIN(x, y) (((x) < (y)) ? (x) : (y)) + #endif + + #if !defined(STRINGIFY) || defined(__DOXYGEN__) + /** Converts the given input into a string, via the C Preprocessor. This macro puts literal quotation + * marks around the input, converting the source into a string literal. + * + * \param[in] x Input to convert into a string literal. + * + * \return String version of the input. + */ + #define STRINGIFY(x) #x + + /** Converts the given input into a string after macro expansion, via the C Preprocessor. This macro puts + * literal quotation marks around the expanded input, converting the source into a string literal. + * + * \param[in] x Input to expand and convert into a string literal. + * + * \return String version of the expanded input. + */ + #define STRINGIFY_EXPANDED(x) STRINGIFY(x) + #endif + + #if !defined(CONCAT) || defined(__DOXYGEN__) + /** Concatenates the given input into a single token, via the C Preprocessor. + * + * \param[in] x First item to concatenate. + * \param[in] y Second item to concatenate. + * + * \return Concatenated version of the input. + */ + #define CONCAT(x, y) x ## y + + /** CConcatenates the given input into a single token after macro expansion, via the C Preprocessor. + * + * \param[in] x First item to concatenate. + * \param[in] y Second item to concatenate. + * + * \return Concatenated version of the expanded input. + */ + #define CONCAT_EXPANDED(x, y) CONCAT(x, y) + #endif + + #if !defined(ISR) || defined(__DOXYGEN__) + /** Macro for the definition of interrupt service routines, so that the compiler can insert the required + * prologue and epilogue code to properly manage the interrupt routine without affecting the main thread's + * state with unintentional side-effects. + * + * Interrupt handlers written using this macro may still need to be registered with the microcontroller's + * Interrupt Controller (if present) before they will properly handle incoming interrupt events. + * + * \note This macro is only supplied on some architectures, where the standard library does not include a valid + * definition. If an existing definition exists, the alternative definition here will be ignored. + * + * \ingroup Group_GlobalInt + * + * \param[in] Name Unique name of the interrupt service routine. + */ + #define ISR(Name, ...) void Name (void) __attribute__((__interrupt__)) __VA_ARGS__; void Name (void) + #endif + + /* Inline Functions: */ + /** Function to reverse the individual bits in a byte - i.e. bit 7 is moved to bit 0, bit 6 to bit 1, + * etc. + * + * \param[in] Byte Byte of data whose bits are to be reversed. + * + * \return Input data with the individual bits reversed (mirrored). + */ + static inline uint8_t BitReverse(uint8_t Byte) ATTR_WARN_UNUSED_RESULT ATTR_CONST; + static inline uint8_t BitReverse(uint8_t Byte) + { + Byte = (((Byte & 0xF0) >> 4) | ((Byte & 0x0F) << 4)); + Byte = (((Byte & 0xCC) >> 2) | ((Byte & 0x33) << 2)); + Byte = (((Byte & 0xAA) >> 1) | ((Byte & 0x55) << 1)); + + return Byte; + } + + /** Function to perform a blocking delay for a specified number of milliseconds. The actual delay will be + * at a minimum the specified number of milliseconds, however due to loop overhead and internal calculations + * may be slightly higher. + * + * \param[in] Milliseconds Number of milliseconds to delay + */ + static inline void Delay_MS(uint16_t Milliseconds) ATTR_ALWAYS_INLINE; + static inline void Delay_MS(uint16_t Milliseconds) + { + #if (ARCH == ARCH_AVR8) + if (GCC_IS_COMPILE_CONST(Milliseconds)) + { + _delay_ms(Milliseconds); + } + else + { + while (Milliseconds--) + _delay_ms(1); + } + #elif (ARCH == ARCH_UC3) + while (Milliseconds--) + { + __builtin_mtsr(AVR32_COUNT, 0); + while ((uint32_t)__builtin_mfsr(AVR32_COUNT) < (F_CPU / 1000)); + } + #elif (ARCH == ARCH_XMEGA) + if (GCC_IS_COMPILE_CONST(Milliseconds)) + { + _delay_ms(Milliseconds); + } + else + { + while (Milliseconds--) + _delay_ms(1); + } + #endif + } + + /** Retrieves a mask which contains the current state of the global interrupts for the device. This + * value can be stored before altering the global interrupt enable state, before restoring the + * flag(s) back to their previous values after a critical section using \ref SetGlobalInterruptMask(). + * + * \ingroup Group_GlobalInt + * + * \return Mask containing the current Global Interrupt Enable Mask bit(s). + */ + static inline uint_reg_t GetGlobalInterruptMask(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; + static inline uint_reg_t GetGlobalInterruptMask(void) + { + GCC_MEMORY_BARRIER(); + + #if (ARCH == ARCH_AVR8) + return SREG; + #elif (ARCH == ARCH_UC3) + return __builtin_mfsr(AVR32_SR); + #elif (ARCH == ARCH_XMEGA) + return SREG; + #endif + } + + /** Sets the global interrupt enable state of the microcontroller to the mask passed into the function. + * This can be combined with \ref GetGlobalInterruptMask() to save and restore the Global Interrupt Enable + * Mask bit(s) of the device after a critical section has completed. + * + * \ingroup Group_GlobalInt + * + * \param[in] GlobalIntState Global Interrupt Enable Mask value to use + */ + static inline void SetGlobalInterruptMask(const uint_reg_t GlobalIntState) ATTR_ALWAYS_INLINE; + static inline void SetGlobalInterruptMask(const uint_reg_t GlobalIntState) + { + GCC_MEMORY_BARRIER(); + + #if (ARCH == ARCH_AVR8) + SREG = GlobalIntState; + #elif (ARCH == ARCH_UC3) + if (GlobalIntState & AVR32_SR_GM) + __builtin_ssrf(AVR32_SR_GM_OFFSET); + else + __builtin_csrf(AVR32_SR_GM_OFFSET); + #elif (ARCH == ARCH_XMEGA) + SREG = GlobalIntState; + #endif + + GCC_MEMORY_BARRIER(); + } + + /** Enables global interrupt handling for the device, allowing interrupts to be handled. + * + * \ingroup Group_GlobalInt + */ + static inline void GlobalInterruptEnable(void) ATTR_ALWAYS_INLINE; + static inline void GlobalInterruptEnable(void) + { + GCC_MEMORY_BARRIER(); + + #if (ARCH == ARCH_AVR8) + sei(); + #elif (ARCH == ARCH_UC3) + __builtin_csrf(AVR32_SR_GM_OFFSET); + #elif (ARCH == ARCH_XMEGA) + sei(); + #endif + + GCC_MEMORY_BARRIER(); + } + + /** Disabled global interrupt handling for the device, preventing interrupts from being handled. + * + * \ingroup Group_GlobalInt + */ + static inline void GlobalInterruptDisable(void) ATTR_ALWAYS_INLINE; + static inline void GlobalInterruptDisable(void) + { + GCC_MEMORY_BARRIER(); + + #if (ARCH == ARCH_AVR8) + cli(); + #elif (ARCH == ARCH_UC3) + __builtin_ssrf(AVR32_SR_GM_OFFSET); + #elif (ARCH == ARCH_XMEGA) + cli(); + #endif + + GCC_MEMORY_BARRIER(); + } + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Common/CompilerSpecific.h b/leaf-can-bridge-3-port-CCS/LUFA/Common/CompilerSpecific.h new file mode 100644 index 0000000..9979fff --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Common/CompilerSpecific.h @@ -0,0 +1,97 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Compiler specific definitions for code optimization and correctness. + * + * \copydetails Group_CompilerSpecific + * + * \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_CompilerSpecific Compiler Specific Definitions + * \brief Compiler specific definitions for code optimization and correctness. + * + * Compiler specific definitions to expose certain compiler features which may increase the level of code optimization + * for a specific compiler, or correct certain issues that may be present such as memory barriers for use in conjunction + * with atomic variable access. + * + * Where possible, on alternative compilers, these macros will either have no effect, or default to returning a sane value + * so that they can be used in existing code without the need for extra compiler checks in the user application code. + * + * @{ + */ + +#ifndef __LUFA_COMPILERSPEC_H__ +#define __LUFA_COMPILERSPEC_H__ + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + #if defined(__GNUC__) || defined(__DOXYGEN__) + /** Forces GCC to use pointer indirection (via the device's pointer register pairs) when accessing the given + * struct pointer. In some cases GCC will emit non-optimal assembly code when accessing a structure through + * a pointer, resulting in a larger binary. When this macro is used on a (non \c const) structure pointer before + * use, it will force GCC to use pointer indirection on the elements rather than direct store and load + * instructions. + * + * \param[in, out] StructPtr Pointer to a structure which is to be forced into indirect access mode. + */ + #define GCC_FORCE_POINTER_ACCESS(StructPtr) __asm__ __volatile__("" : "=b" (StructPtr) : "0" (StructPtr)) + + /** Forces GCC to create a memory barrier, ensuring that memory accesses are not reordered past the barrier point. + * This can be used before ordering-critical operations, to ensure that the compiler does not re-order the resulting + * assembly output in an unexpected manner on sections of code that are ordering-specific. + */ + #define GCC_MEMORY_BARRIER() __asm__ __volatile__("" ::: "memory"); + + /** Determines if the specified value can be determined at compile-time to be a constant value when compiling under GCC. + * + * \param[in] x Value to check compile-time constantness of. + * + * \return Boolean \c true if the given value is known to be a compile time constant, \c false otherwise. + */ + #define GCC_IS_COMPILE_CONST(x) __builtin_constant_p(x) + #else + #define GCC_FORCE_POINTER_ACCESS(StructPtr) + #define GCC_MEMORY_BARRIER() + #define GCC_IS_COMPILE_CONST(x) 0 + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Common/Endianness.h b/leaf-can-bridge-3-port-CCS/LUFA/Common/Endianness.h new file mode 100644 index 0000000..2eb3ad0 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Common/Endianness.h @@ -0,0 +1,493 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Endianness and Byte Ordering macros and functions. + * + * \copydetails Group_Endianness + */ + +/** \ingroup Group_Endianness + * \defgroup Group_ByteSwapping Byte Reordering + * \brief Macros and functions for forced byte reordering. + */ + +/** \ingroup Group_Endianness + * \defgroup Group_EndianConversion Endianness Conversion + * \brief Macros and functions for automatic endianness conversion. + */ + +/** \ingroup Group_Common + * \defgroup Group_Endianness Endianness and Byte Ordering + * \brief Convenience macros and functions relating to byte (re-)ordering + * + * Common library convenience macros and functions relating to byte (re-)ordering. + * + * @{ + */ + +#ifndef __LUFA_ENDIANNESS_H__ +#define __LUFA_ENDIANNESS_H__ + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_COMMON_H) + #error Do not include this file directly. Include LUFA/Common/Common.h instead to gain this functionality. + #endif + + #if !(defined(ARCH_BIG_ENDIAN) || defined(ARCH_LITTLE_ENDIAN)) + #error ARCH_BIG_ENDIAN or ARCH_LITTLE_ENDIAN not set for the specified architecture. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Swaps the byte ordering of a 16-bit value at compile-time. Do not use this macro for swapping byte orderings + * of dynamic values computed at runtime, use \ref SwapEndian_16() instead. The result of this macro can be used + * inside struct or other variable initializers outside of a function, something that is not possible with the + * inline function variant. + * + * \hideinitializer + * + * \ingroup Group_ByteSwapping + * + * \param[in] x 16-bit value whose byte ordering is to be swapped. + * + * \return Input value with the byte ordering reversed. + */ + #define SWAPENDIAN_16(x) (uint16_t)((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) + + /** Swaps the byte ordering of a 32-bit value at compile-time. Do not use this macro for swapping byte orderings + * of dynamic values computed at runtime- use \ref SwapEndian_32() instead. The result of this macro can be used + * inside struct or other variable initializers outside of a function, something that is not possible with the + * inline function variant. + * + * \hideinitializer + * + * \ingroup Group_ByteSwapping + * + * \param[in] x 32-bit value whose byte ordering is to be swapped. + * + * \return Input value with the byte ordering reversed. + */ + #define SWAPENDIAN_32(x) (uint32_t)((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \ + (((x) & 0x0000FF00UL) << 8UL) | (((x) & 0x000000FFUL) << 24UL)) + + #if defined(ARCH_BIG_ENDIAN) && !defined(le16_to_cpu) + #define le16_to_cpu(x) SwapEndian_16(x) + #define le32_to_cpu(x) SwapEndian_32(x) + #define be16_to_cpu(x) (x) + #define be32_to_cpu(x) (x) + #define cpu_to_le16(x) SwapEndian_16(x) + #define cpu_to_le32(x) SwapEndian_32(x) + #define cpu_to_be16(x) (x) + #define cpu_to_be32(x) (x) + #define LE16_TO_CPU(x) SWAPENDIAN_16(x) + #define LE32_TO_CPU(x) SWAPENDIAN_32(x) + #define BE16_TO_CPU(x) (x) + #define BE32_TO_CPU(x) (x) + #define CPU_TO_LE16(x) SWAPENDIAN_16(x) + #define CPU_TO_LE32(x) SWAPENDIAN_32(x) + #define CPU_TO_BE16(x) (x) + #define CPU_TO_BE32(x) (x) + #elif !defined(le16_to_cpu) + /** \name Run-time endianness conversion */ + //@{ + + /** Performs a conversion between a Little Endian encoded 16-bit piece of data and the + * Endianness of the currently selected CPU architecture. + * + * On little endian architectures, this macro does nothing. + * + * \note This macro is designed for run-time conversion of data - for compile-time endianness + * conversion, use \ref LE16_TO_CPU instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define le16_to_cpu(x) (x) + + /** Performs a conversion between a Little Endian encoded 32-bit piece of data and the + * Endianness of the currently selected CPU architecture. + * + * On little endian architectures, this macro does nothing. + * + * \note This macro is designed for run-time conversion of data - for compile-time endianness + * conversion, use \ref LE32_TO_CPU instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define le32_to_cpu(x) (x) + + /** Performs a conversion between a Big Endian encoded 16-bit piece of data and the + * Endianness of the currently selected CPU architecture. + * + * On big endian architectures, this macro does nothing. + * + * \note This macro is designed for run-time conversion of data - for compile-time endianness + * conversion, use \ref BE16_TO_CPU instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define be16_to_cpu(x) SwapEndian_16(x) + + /** Performs a conversion between a Big Endian encoded 32-bit piece of data and the + * Endianness of the currently selected CPU architecture. + * + * On big endian architectures, this macro does nothing. + * + * \note This macro is designed for run-time conversion of data - for compile-time endianness + * conversion, use \ref BE32_TO_CPU instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define be32_to_cpu(x) SwapEndian_32(x) + + /** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it + * is in Little Endian format regardless of the currently selected CPU architecture. + * + * On little endian architectures, this macro does nothing. + * + * \note This macro is designed for run-time conversion of data - for compile-time endianness + * conversion, use \ref CPU_TO_LE16 instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define cpu_to_le16(x) (x) + + /** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it + * is in Little Endian format regardless of the currently selected CPU architecture. + * + * On little endian architectures, this macro does nothing. + * + * \note This macro is designed for run-time conversion of data - for compile-time endianness + * conversion, use \ref CPU_TO_LE32 instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define cpu_to_le32(x) (x) + + /** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it + * is in Big Endian format regardless of the currently selected CPU architecture. + * + * On big endian architectures, this macro does nothing. + * + * \note This macro is designed for run-time conversion of data - for compile-time endianness + * conversion, use \ref CPU_TO_BE16 instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define cpu_to_be16(x) SwapEndian_16(x) + + /** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it + * is in Big Endian format regardless of the currently selected CPU architecture. + * + * On big endian architectures, this macro does nothing. + * + * \note This macro is designed for run-time conversion of data - for compile-time endianness + * conversion, use \ref CPU_TO_BE32 instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define cpu_to_be32(x) SwapEndian_32(x) + + //@} + + /** \name Compile-time endianness conversion */ + //@{ + + /** Performs a conversion between a Little Endian encoded 16-bit piece of data and the + * Endianness of the currently selected CPU architecture. + * + * On little endian architectures, this macro does nothing. + * + * \note This macro is designed for compile-time conversion of data - for run time endianness + * conversion, use \ref le16_to_cpu instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define LE16_TO_CPU(x) (x) + + /** Performs a conversion between a Little Endian encoded 32-bit piece of data and the + * Endianness of the currently selected CPU architecture. + * + * On little endian architectures, this macro does nothing. + * + * \note This macro is designed for compile-time conversion of data - for run time endianness + * conversion, use \ref le32_to_cpu instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define LE32_TO_CPU(x) (x) + + /** Performs a conversion between a Big Endian encoded 16-bit piece of data and the + * Endianness of the currently selected CPU architecture. + * + * On big endian architectures, this macro does nothing. + * + * \note This macro is designed for compile-time conversion of data - for run-time endianness + * conversion, use \ref be16_to_cpu instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define BE16_TO_CPU(x) SWAPENDIAN_16(x) + + /** Performs a conversion between a Big Endian encoded 32-bit piece of data and the + * Endianness of the currently selected CPU architecture. + * + * On big endian architectures, this macro does nothing. + * + * \note This macro is designed for compile-time conversion of data - for run-time endianness + * conversion, use \ref be32_to_cpu instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define BE32_TO_CPU(x) SWAPENDIAN_32(x) + + /** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it + * is in Little Endian format regardless of the currently selected CPU architecture. + * + * On little endian architectures, this macro does nothing. + * + * \note This macro is designed for compile-time conversion of data - for run-time endianness + * conversion, use \ref cpu_to_le16 instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define CPU_TO_LE16(x) (x) + + /** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it + * is in Little Endian format regardless of the currently selected CPU architecture. + * + * On little endian architectures, this macro does nothing. + * + * \note This macro is designed for compile-time conversion of data - for run-time endianness + * conversion, use \ref cpu_to_le32 instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define CPU_TO_LE32(x) (x) + + /** Performs a conversion on a natively encoded 16-bit piece of data to ensure that it + * is in Big Endian format regardless of the currently selected CPU architecture. + * + * On big endian architectures, this macro does nothing. + * + * \note This macro is designed for compile-time conversion of data - for run-time endianness + * conversion, use \ref cpu_to_be16 instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define CPU_TO_BE16(x) SWAPENDIAN_16(x) + + /** Performs a conversion on a natively encoded 32-bit piece of data to ensure that it + * is in Big Endian format regardless of the currently selected CPU architecture. + * + * On big endian architectures, this macro does nothing. + * + * \note This macro is designed for compile-time conversion of data - for run-time endianness + * conversion, use \ref cpu_to_be32 instead. + * + * \ingroup Group_EndianConversion + * + * \param[in] x Data to perform the endianness conversion on. + * + * \return Endian corrected version of the input value. + */ + #define CPU_TO_BE32(x) SWAPENDIAN_32(x) + + //! @} + #endif + + /* Inline Functions: */ + /** Function to reverse the byte ordering of the individual bytes in a 16 bit value. + * + * \ingroup Group_ByteSwapping + * + * \param[in] Word Word of data whose bytes are to be swapped. + * + * \return Input data with the individual bytes reversed. + */ + static inline uint16_t SwapEndian_16(const uint16_t Word) ATTR_WARN_UNUSED_RESULT ATTR_CONST; + static inline uint16_t SwapEndian_16(const uint16_t Word) + { + if (GCC_IS_COMPILE_CONST(Word)) + return SWAPENDIAN_16(Word); + + uint8_t Temp; + + union + { + 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; + } + + /** Function to reverse the byte ordering of the individual bytes in a 32 bit value. + * + * \ingroup Group_ByteSwapping + * + * \param[in] DWord Double word of data whose bytes are to be swapped. + * + * \return Input data with the individual bytes reversed. + */ + static inline uint32_t SwapEndian_32(const uint32_t DWord) ATTR_WARN_UNUSED_RESULT ATTR_CONST; + static inline uint32_t SwapEndian_32(const uint32_t DWord) + { + if (GCC_IS_COMPILE_CONST(DWord)) + return SWAPENDIAN_32(DWord); + + uint8_t Temp; + + union + { + 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; + } + + /** Function to reverse the byte ordering of the individual bytes in a n byte value. + * + * \ingroup Group_ByteSwapping + * + * \param[in,out] Data Pointer to a number containing an even number of bytes to be reversed. + * \param[in] Length Length of the data in bytes. + * + * \return Input data with the individual bytes reversed. + */ + static inline void SwapEndian_n(void* const Data, + uint8_t Length) ATTR_NON_NULL_PTR_ARG(1); + static inline void SwapEndian_n(void* const Data, + uint8_t Length) + { + uint8_t* CurrDataPos = (uint8_t*)Data; + + while (Length > 1) + { + uint8_t Temp = *CurrDataPos; + *CurrDataPos = *(CurrDataPos + Length - 1); + *(CurrDataPos + Length - 1) = Temp; + + CurrDataPos++; + Length -= 2; + } + } + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h new file mode 100644 index 0000000..24978ca --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/AndroidAccessoryClass.h @@ -0,0 +1,77 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB Android Open Accessory Class driver. + * + * Master include file for the library USB Android Open Accessory Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassAOA Android Open Accessory Class Driver + * \brief USB class driver for the Google Android Open Accessory class standard. + * + * \section Sec_USBClassAOA_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassAOA_ModDescription Module Description + * Android Open Accessory Class Driver module. This module contains an internal implementation of the USB Android Open Accessory + * Class, for Host USB mode. User applications can use this class driver instead of implementing the Android Open Accessory 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 + * Host using the USB Android Open Accessory Class. + * + * @{ + */ + +#ifndef _AOA_CLASS_H_ +#define _AOA_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_AOA_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_HOST) + #include "Host/AndroidAccessoryClassHost.h" + #endif + +#endif + +/** @} */ + + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/AudioClass.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/AudioClass.h new file mode 100644 index 0000000..0e3ca8d --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/AudioClass.h @@ -0,0 +1,81 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB Audio 1.0 Class driver. + * + * Master include file for the library USB Audio 1.0 Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassAudio Audio 1.0 Class Driver + * \brief USB class driver for the USB-IF Audio 1.0 class standard. + * + * \section Sec_USBClassAudio_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/AudioClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * - LUFA/Drivers/USB/Class/Host/AudioClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassAudio_ModDescription Module Description + * Audio 1.0 Class Driver module. This module contains an internal implementation of the USB Audio 1.0 Class, for both + * Device and Host USB modes. User applications can use this class driver instead of implementing the Audio 1.0 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 + * Hosts or Devices using the USB Audio 1.0 Class. + * + * @{ + */ + +#ifndef _AUDIO_CLASS_H_ +#define _AUDIO_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_AUDIO_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_DEVICE) + #include "Device/AudioClassDevice.h" + #endif + + #if defined(USB_CAN_BE_HOST) + #include "Host/AudioClassHost.h" + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/CDCClass.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/CDCClass.h new file mode 100644 index 0000000..3bad74b --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/CDCClass.h @@ -0,0 +1,81 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB CDC-ACM Class driver. + * + * Master include file for the library USB CDC Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassCDC CDC-ACM (Virtual Serial) Class Driver + * \brief USB class driver for the USB-IF CDC-ACM (Virtual Serial) class standard. + * + * \section Sec_USBClassCDC_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/CDCClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * - LUFA/Drivers/USB/Class/Host/CDCClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassCDC_ModDescription Module Description + * CDC Class Driver module. This module contains an internal implementation of the USB CDC-ACM class Virtual Serial + * Ports, for both Device and Host USB modes. User applications can use this class driver instead of implementing the + * CDC 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 + * Hosts or Devices using the USB CDC Class. + * + * @{ + */ + +#ifndef _CDC_CLASS_H_ +#define _CDC_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_CDC_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_DEVICE) + #include "Device/CDCClassDevice.h" + #endif + + #if defined(USB_CAN_BE_HOST) + #include "Host/CDCClassHost.h" + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h new file mode 100644 index 0000000..c3153da --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/AndroidAccessoryClassCommon.h @@ -0,0 +1,129 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB Android Open Accessory Class driver. + * + * Common definitions and declarations for the library USB Android Open Accessory Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassAOA + * \defgroup Group_USBClassAOACommon Common Class Definitions + * + * \section Sec_USBClassAOACommon_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Android Open Accessory Class. + * + * @{ + */ + +#ifndef _AOA_CLASS_COMMON_H_ +#define _AOA_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_AOA_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Macros: */ + /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory mode. */ + #define ANDROID_ACCESSORY_PRODUCT_ID 0x2D00 + + /** Product ID value in a Device Descriptor to indicate an Android device in Open Accessory and Android Debug mode. */ + #define ANDROID_ACCESSORY_ADB_PRODUCT_ID 0x2D01 + + /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the + * Android Open Accessory class. + */ + enum AOA_Descriptor_ClassSubclassProtocol_t + { + AOA_CSCP_AOADataClass = 0xFF, /**< Descriptor Class value indicating that the device or interface + * belongs to the AOA data class. + */ + AOA_CSCP_AOADataSubclass = 0xFF, /**< Descriptor Subclass value indicating that the device or interface + * belongs to AOA data subclass. + */ + AOA_CSCP_AOADataProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the AOA data class protocol. + */ + }; + + /** Enum for the Android Open Accessory class specific control requests that can be issued by the USB bus host. */ + enum AOA_ClassRequests_t + { + AOA_REQ_GetAccessoryProtocol = 0x33, /**< Android Open Accessory control request to retrieve the device's supported Accessory Protocol version. */ + AOA_REQ_SendString = 0x34, /**< Android Open Accessory control request to set an accessory property string in the device. */ + AOA_REQ_StartAccessoryMode = 0x35, /**< Android Open Accessory control request to switch the device into Accessory mode. */ + }; + + /** Enum for the possible Android Open Accessory property string indexes. */ + enum AOA_Strings_t + { + AOA_STRING_Manufacturer = 0, /**< Index of the Manufacturer property string. */ + AOA_STRING_Model = 1, /**< Index of the Model Name property string. */ + AOA_STRING_Description = 2, /**< Index of the Description property string. */ + AOA_STRING_Version = 3, /**< Index of the Version Number property string. */ + AOA_STRING_URI = 4, /**< Index of the URI Information property string. */ + AOA_STRING_Serial = 5, /**< Index of the Serial Number property string. */ + + #if !defined(__DOXYGEN__) + AOA_STRING_TOTAL_STRINGS + #endif + }; + + /** Enum for the possible Android Open Accessory protocol versions. */ + enum AOA_Protocols_t + { + AOA_PROTOCOL_AccessoryV1 = 0x0001, /**< Android Open Accessory version 1. */ + AOA_PROTOCOL_AccessoryV2 = 0x0002, /**< Android Open Accessory version 2. */ + }; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h new file mode 100644 index 0000000..2db5eee --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/AudioClassCommon.h @@ -0,0 +1,780 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB Audio 1.0 Class driver. + * + * Common definitions and declarations for the library USB Audio 1.0 Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassAudio + * \defgroup Group_USBClassAudioCommon Common Class Definitions + * + * \section Sec_USBClassAudioCommon_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Audio 1.0 Class. + * + * @{ + */ + +#ifndef _AUDIO_CLASS_COMMON_H_ +#define _AUDIO_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_AUDIO_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Macros: */ + /** \name Audio Channel Masks */ + //@{ + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_LEFT_FRONT (1 << 0) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_RIGHT_FRONT (1 << 1) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_CENTER_FRONT (1 << 2) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_LOW_FREQ_ENHANCE (1 << 3) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_LEFT_SURROUND (1 << 4) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_RIGHT_SURROUND (1 << 5) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_LEFT_OF_CENTER (1 << 6) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_RIGHT_OF_CENTER (1 << 7) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_SURROUND (1 << 8) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_SIDE_LEFT (1 << 9) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_SIDE_RIGHT (1 << 10) + + /** Supported channel mask for an Audio class terminal descriptor. See the Audio class specification for more details. */ + #define AUDIO_CHANNEL_TOP (1 << 11) + //@} + + /** \name Audio Feature Masks */ + //@{ + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define AUDIO_FEATURE_MUTE (1 << 0) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define AUDIO_FEATURE_VOLUME (1 << 1) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define AUDIO_FEATURE_BASS (1 << 2) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define AUDIO_FEATURE_MID (1 << 3) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define AUDIO_FEATURE_TREBLE (1 << 4) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define AUDIO_FEATURE_GRAPHIC_EQUALIZER (1 << 5) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define AUDIO_FEATURE_AUTOMATIC_GAIN (1 << 6) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define AUDIO_FEATURE_DELAY (1 << 7) + + /** Supported feature mask for an Audio class feature unit descriptor. See the Audio class specification for more details. */ + #define AUDIO_FEATURE_BASS_BOOST (1 << 8) + + /** 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) + //@} + + /** \name Audio Terminal Types */ + //@{ + /** 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. */ + #define AUDIO_TERMINAL_STREAMING 0x0101 + + /** 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. */ + #define AUDIO_TERMINAL_IN_UNDEFINED 0x0200 + + /** 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. */ + #define AUDIO_TERMINAL_IN_DESKTOP_MIC 0x0202 + + /** 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. */ + #define AUDIO_TERMINAL_IN_OMNIDIR_MIC 0x0204 + + /** 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. */ + #define AUDIO_TERMINAL_IN_PROCESSING_MIC 0x0206 + + /** 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. */ + #define AUDIO_TERMINAL_OUT_SPEAKER 0x0301 + + /** 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. */ + #define AUDIO_TERMINAL_OUT_HEAD_MOUNTED 0x0303 + + /** 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. */ + #define AUDIO_TERMINAL_OUT_ROOM 0x0305 + + /** 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. */ + #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. + * + * \param[in] freq Required audio sampling frequency in HZ + */ + #define AUDIO_SAMPLE_FREQ(freq) {.Byte1 = ((uint32_t)freq & 0xFF), .Byte2 = (((uint32_t)freq >> 8) & 0xFF), .Byte3 = (((uint32_t)freq >> 16) & 0xFF)} + + /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint + * accepts only filled endpoint packets of audio samples. + */ + #define AUDIO_EP_FULL_PACKETS_ONLY (1 << 7) + + /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint + * will accept partially filled endpoint packets of audio samples. + */ + #define AUDIO_EP_ACCEPTS_SMALL_PACKETS (0 << 7) + + /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint + * allows for sampling frequency adjustments to be made via control requests directed at the endpoint. + */ + #define AUDIO_EP_SAMPLE_FREQ_CONTROL (1 << 0) + + /** Mask for the attributes parameter of an Audio class-specific Endpoint descriptor, indicating that the endpoint + * allows for pitch adjustments to be made via control requests directed at the endpoint. + */ + #define AUDIO_EP_PITCH_CONTROL (1 << 1) + + /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Audio + * device class. + */ + enum Audio_Descriptor_ClassSubclassProtocol_t + { + AUDIO_CSCP_AudioClass = 0x01, /**< Descriptor Class value indicating that the device or + * interface belongs to the USB Audio 1.0 class. + */ + AUDIO_CSCP_ControlSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or + * interface belongs to the Audio Control subclass. + */ + AUDIO_CSCP_ControlProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or + * interface belongs to the Audio Control protocol. + */ + AUDIO_CSCP_AudioStreamingSubclass = 0x02, /**< Descriptor Subclass value indicating that the device or + * interface belongs to the MIDI Streaming subclass. + */ + AUDIO_CSCP_MIDIStreamingSubclass = 0x03, /**< Descriptor Subclass value indicating that the device or + * interface belongs to the Audio streaming subclass. + */ + AUDIO_CSCP_StreamingProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or + * interface belongs to the Streaming Audio protocol. + */ + }; + + /** Audio class specific interface description subtypes, for the Audio Control interface. */ + enum Audio_CSInterface_AC_SubTypes_t + { + AUDIO_DSUBTYPE_CSInterface_Header = 0x01, /**< Audio class specific control interface header. */ + AUDIO_DSUBTYPE_CSInterface_InputTerminal = 0x02, /**< Audio class specific control interface Input Terminal. */ + AUDIO_DSUBTYPE_CSInterface_OutputTerminal = 0x03, /**< Audio class specific control interface Output Terminal. */ + AUDIO_DSUBTYPE_CSInterface_Mixer = 0x04, /**< Audio class specific control interface Mixer Unit. */ + AUDIO_DSUBTYPE_CSInterface_Selector = 0x05, /**< Audio class specific control interface Selector Unit. */ + AUDIO_DSUBTYPE_CSInterface_Feature = 0x06, /**< Audio class specific control interface Feature Unit. */ + AUDIO_DSUBTYPE_CSInterface_Processing = 0x07, /**< Audio class specific control interface Processing Unit. */ + AUDIO_DSUBTYPE_CSInterface_Extension = 0x08, /**< Audio class specific control interface Extension Unit. */ + }; + + /** Audio class specific interface description subtypes, for the Audio Streaming interface. */ + enum Audio_CSInterface_AS_SubTypes_t + { + AUDIO_DSUBTYPE_CSInterface_General = 0x01, /**< Audio class specific streaming interface general descriptor. */ + AUDIO_DSUBTYPE_CSInterface_FormatType = 0x02, /**< Audio class specific streaming interface format type descriptor. */ + AUDIO_DSUBTYPE_CSInterface_FormatSpecific = 0x03, /**< Audio class specific streaming interface format information descriptor. */ + }; + + /** Audio class specific endpoint description subtypes, for the Audio Streaming interface. */ + enum Audio_CSEndpoint_SubTypes_t + { + AUDIO_DSUBTYPE_CSEndpoint_General = 0x01, /**< Audio class specific endpoint general descriptor. */ + }; + + /** Enum for the Audio class specific control requests that can be issued by the USB bus host. */ + enum Audio_ClassRequests_t + { + AUDIO_REQ_SetCurrent = 0x01, /**< Audio class-specific request to set the current value of a parameter within the device. */ + AUDIO_REQ_SetMinimum = 0x02, /**< Audio class-specific request to set the minimum value of a parameter within the device. */ + AUDIO_REQ_SetMaximum = 0x03, /**< Audio class-specific request to set the maximum value of a parameter within the device. */ + AUDIO_REQ_SetResolution = 0x04, /**< Audio class-specific request to set the resolution value of a parameter within the device. */ + AUDIO_REQ_SetMemory = 0x05, /**< Audio class-specific request to set the memory value of a parameter within the device. */ + AUDIO_REQ_GetCurrent = 0x81, /**< Audio class-specific request to get the current value of a parameter within the device. */ + AUDIO_REQ_GetMinimum = 0x82, /**< Audio class-specific request to get the minimum value of a parameter within the device. */ + AUDIO_REQ_GetMaximum = 0x83, /**< Audio class-specific request to get the maximum value of a parameter within the device. */ + AUDIO_REQ_GetResolution = 0x84, /**< Audio class-specific request to get the resolution value of a parameter within the device. */ + AUDIO_REQ_GetMemory = 0x85, /**< Audio class-specific request to get the memory value of a parameter within the device. */ + AUDIO_REQ_GetStatus = 0xFF, /**< Audio class-specific request to get the device status. */ + }; + + /** Enum for Audio class specific Endpoint control modifiers which can be set and retrieved by a USB host, if the corresponding + * endpoint control is indicated to be supported in the Endpoint's Audio-class specific endpoint descriptor. + */ + enum Audio_EndpointControls_t + { + AUDIO_EPCONTROL_SamplingFreq = 0x01, /**< Sampling frequency adjustment of the endpoint. */ + AUDIO_EPCONTROL_Pitch = 0x02, /**< Pitch adjustment of the endpoint. */ + }; + + /* Type Defines: */ + /** \brief Audio class-specific Input Terminal Descriptor (LUFA naming conventions). + * + * Type define for an Audio class-specific input terminal descriptor. This indicates to the host that the device + * contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example, + * a USB endpoint). See the USB Audio specification for more details. + * + * \see \ref USB_Audio_StdDescriptor_InputTerminal_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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, + * 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 \c TERMINAL_* mask. */ + uint8_t AssociatedOutputTerminal; /**< ID of associated output terminal, for physically grouped terminals + * such as the speaker and microphone of a phone handset. + */ + uint8_t TotalChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */ + uint16_t ChannelConfig; /**< \c 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. */ + } ATTR_PACKED USB_Audio_Descriptor_InputTerminal_t; + + /** \brief Audio class-specific Input Terminal Descriptor (USB-IF naming conventions). + * + * Type define for an Audio class-specific input terminal descriptor. This indicates to the host that the device + * contains an input audio source, either from a physical terminal on the device, or a logical terminal (for example, + * a USB endpoint). See the USB Audio specification for more details. + * + * \see \ref USB_Audio_Descriptor_InputTerminal_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, + * must be \ref AUDIO_DSUBTYPE_CSInterface_InputTerminal. + */ + uint8_t bTerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ + uint16_t wTerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */ + uint8_t bAssocTerminal; /**< ID of associated output terminal, for physically grouped terminals + * such as the speaker and microphone of a phone handset. + */ + uint8_t bNrChannels; /**< Total number of separate audio channels within this interface (right, left, etc.) */ + uint16_t wChannelConfig; /**< \c 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. */ + } ATTR_PACKED USB_Audio_StdDescriptor_InputTerminal_t; + + /** \brief Audio class-specific Output Terminal Descriptor (LUFA naming conventions). + * + * Type define for an Audio class-specific output terminal descriptor. This indicates to the host that the device + * contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example, + * a USB endpoint). See the USB Audio specification for more details. + * + * \see \ref USB_Audio_StdDescriptor_OutputTerminal_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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, + * 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 \c 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. */ + } ATTR_PACKED USB_Audio_Descriptor_OutputTerminal_t; + + /** \brief Audio class-specific Output Terminal Descriptor (USB-IF naming conventions). + * + * Type define for an Audio class-specific output terminal descriptor. This indicates to the host that the device + * contains an output audio sink, either to a physical terminal on the device, or a logical terminal (for example, + * a USB endpoint). See the USB Audio specification for more details. + * + * \see \ref USB_Audio_Descriptor_OutputTerminal_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + uint8_t bDescriptorType; /**< Sub type value used to distinguish between audio class-specific descriptors, + * must be \ref AUDIO_DSUBTYPE_CSInterface_OutputTerminal. + */ + + uint8_t bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors, + * a value from the \ref Audio_CSInterface_AC_SubTypes_t enum. + */ + uint8_t bTerminalID; /**< ID value of this terminal unit - must be a unique value within the device. */ + uint16_t wTerminalType; /**< Type of terminal, a \c TERMINAL_* mask. */ + uint8_t bAssocTerminal; /**< ID of associated input terminal, for physically grouped terminals + * 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. */ + } ATTR_PACKED USB_Audio_StdDescriptor_OutputTerminal_t; + + /** \brief Audio class-specific Interface Descriptor (LUFA naming conventions). + * + * 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 + * details. + * + * \see \ref USB_Audio_StdDescriptor_Interface_AC_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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, + * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. + */ + + uint16_t ACSpecification; /**< Binary Coded Decimal value, indicating the supported Audio Class specification version. + * + * \see \ref VERSION_BCD() utility macro. + */ + 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. */ + } ATTR_PACKED USB_Audio_Descriptor_Interface_AC_t; + + /** \brief Audio class-specific Interface Descriptor (USB-IF naming conventions). + * + * 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 + * details. + * + * \see \ref USB_Audio_Descriptor_Interface_AC_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubtype;/**< Sub type value used to distinguish between audio class-specific descriptors, + * a value from the \ref Audio_CSInterface_AS_SubTypes_t enum. + */ + + uint16_t bcdADC; /**< Binary coded decimal value, indicating the supported Audio Class specification version. + * + * \see \ref VERSION_BCD() utility macro. + */ + 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. */ + } ATTR_PACKED 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 + * are present in the device's audio stream for basic control, such as per-channel volume. See the USB Audio + * specification for more details. + * + * \see \ref USB_Audio_StdDescriptor_FeatureUnit_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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, + * 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 \c ChannelControls 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. */ + } ATTR_PACKED USB_Audio_Descriptor_FeatureUnit_t; + + /** \brief Audio class-specific Feature Unit Descriptor (USB-IF naming conventions). + * + * 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. + * + * \see \ref USB_Audio_Descriptor_FeatureUnit_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 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 \c ChannelControls 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. */ + } ATTR_PACKED 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 + * how audio streams within the device are formatted. See the USB Audio specification for more details. + * + * \see \ref USB_Audio_StdDescriptor_Interface_AS_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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, + * 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. */ + } ATTR_PACKED USB_Audio_Descriptor_Interface_AS_t; + + /** \brief Audio class-specific Streaming Audio Interface Descriptor (USB-IF naming conventions). + * + * 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. + * + * \see \ref USB_Audio_Descriptor_Interface_AS_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 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. */ + } ATTR_PACKED USB_Audio_StdDescriptor_Interface_AS_t; + + /** \brief Audio class-specific Format Descriptor (LUFA naming conventions). + * + * Type define for an Audio class-specific audio format descriptor. This is used to give the host full details + * about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used + * in the device's audio streams. See the USB Audio specification for more details. + * + * \attention This descriptor must be followed by one or more \ref USB_Audio_SampleFreq_t elements containing + * the continuous or discrete sample frequencies. + * + * \see \ref USB_Audio_StdDescriptor_Format_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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, + * 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 TotalDiscreteSampleRates; /**< Total number of discrete sample frequencies supported by the device. When + * zero, this must be followed by the lower and upper continuous sampling + * frequencies supported by the device; otherwise, this must be followed + * by the given number of discrete sampling frequencies supported. + */ + } ATTR_PACKED USB_Audio_Descriptor_Format_t; + + /** \brief 24-Bit Audio Frequency Structure. + * + * Type define for a 24-bit audio sample frequency structure. As GCC does not contain a built in 24-bit datatype, + * this this structure is used to build up the value instead. Fill this structure with the \ref AUDIO_SAMPLE_FREQ() macro. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t Byte1; /**< Lowest 8 bits of the 24-bit value. */ + uint8_t Byte2; /**< Middle 8 bits of the 24-bit value. */ + uint8_t Byte3; /**< Upper 8 bits of the 24-bit value. */ + } ATTR_PACKED USB_Audio_SampleFreq_t; + + /** \brief Audio class-specific Format Descriptor (USB-IF naming conventions). + * + * Type define for an Audio class-specific audio format descriptor. This is used to give the host full details + * about the number of channels, the sample resolution, acceptable sample frequencies and encoding method used + * in the device's audio streams. See the USB Audio specification for more details. + * + * \attention This descriptor must be followed by one or more 24-bit integer elements containing the continuous + * or discrete sample frequencies. + * + * \see \ref USB_Audio_Descriptor_Format_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + uint8_t bDescriptorType; /**< Sub type value used to distinguish between audio class-specific descriptors, + * must be \ref AUDIO_DSUBTYPE_CSInterface_FormatType. + */ + + 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 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. When + * zero, this must be followed by the lower and upper continuous sampling + * frequencies supported by the device; otherwise, this must be followed + * by the given number of discrete sampling frequencies supported. + */ + } ATTR_PACKED 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 + * 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. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + USB_Descriptor_Endpoint_t Endpoint; /**< Standard endpoint descriptor describing the audio endpoint. */ + + uint8_t Refresh; /**< Always set to zero for Audio class devices. */ + uint8_t SyncEndpointNumber; /**< Endpoint address to send synchronization information to, if needed (zero otherwise). */ + } ATTR_PACKED USB_Audio_Descriptor_StreamEndpoint_Std_t; + + /** \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 + * 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 + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 + * configuration, including direction mask. + */ + uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (\c EP_TYPE_*) + * and attributes (\c ENDPOINT_ATTR_*) masks. + */ + uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size + * that the endpoint can receive at a time. + */ + 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). */ + } ATTR_PACKED USB_Audio_StdDescriptor_StreamEndpoint_Std_t; + + /** \brief Audio class-specific Extended Endpoint Descriptor (LUFA naming conventions). + * + * 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. + * + * \see \ref USB_Audio_StdDescriptor_StreamEndpoint_Spc_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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, + * a value from the \ref Audio_CSEndpoint_SubTypes_t enum. + */ + + uint8_t Attributes; /**< Audio class-specific endpoint attributes, such as \ref AUDIO_EP_FULL_PACKETS_ONLY. */ + + 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. */ + } ATTR_PACKED USB_Audio_Descriptor_StreamEndpoint_Spc_t; + + /** \brief Audio class-specific Extended Endpoint Descriptor (USB-IF naming conventions). + * + * 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. + * + * \see \ref USB_Audio_Descriptor_StreamEndpoint_Spc_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 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 \ref AUDIO_EP_FULL_PACKETS_ONLY. */ + + 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. */ + } ATTR_PACKED USB_Audio_StdDescriptor_StreamEndpoint_Spc_t; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h new file mode 100644 index 0000000..94e6c68 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h @@ -0,0 +1,391 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB CDC Class driver. + * + * Common definitions and declarations for the library USB CDC Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassCDC + * \defgroup Group_USBClassCDCCommon Common Class Definitions + * + * \section Sec_USBClassCDCCommon_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * CDC Class. + * + * @{ + */ + +#ifndef _CDC_CLASS_COMMON_H_ +#define _CDC_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_CDC_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Macros: */ + /** \name Virtual Control Line Masks */ + //@{ + /** 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. + */ + #define CDC_CONTROL_LINE_OUT_DTR (1 << 0) + + /** Mask for the RTS handshake line for use with the \ref CDC_REQ_SetControlLineState class-specific request + * 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. + */ + #define CDC_CONTROL_LINE_IN_DCD (1 << 0) + + /** Mask for the DSR handshake line for use with the \ref CDC_NOTIF_SerialState class-specific notification + * from the device to the host, to indicate that the DSR line state is currently high. + */ + #define CDC_CONTROL_LINE_IN_DSR (1 << 1) + + /** Mask for the BREAK handshake line for use with the \ref CDC_NOTIF_SerialState class-specific notification + * from the device to the host, to indicate that the BREAK line state is currently high. + */ + #define CDC_CONTROL_LINE_IN_BREAK (1 << 2) + + /** Mask for the RING handshake line for use with the \ref CDC_NOTIF_SerialState class-specific notification + * from the device to the host, to indicate that the RING line state is currently high. + */ + #define CDC_CONTROL_LINE_IN_RING (1 << 3) + + /** Mask for use with the \ref CDC_NOTIF_SerialState class-specific notification from the device to the host, + * to indicate that a framing error has occurred on the virtual serial port. + */ + #define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4) + + /** Mask for use with the \ref CDC_NOTIF_SerialState class-specific notification from the device to the host, + * to indicate that a parity error has occurred on the virtual serial port. + */ + #define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5) + + /** Mask for use with the \ref CDC_NOTIF_SerialState class-specific notification from the device to the host, + * 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 \c typedef \c struct. A macro is used instead so that functional descriptors can be created + * easily by specifying the size of the payload. This allows \c sizeof() to work correctly. + * + * \param[in] DataSize Size in bytes of the CDC functional descriptor's data payload. + */ + #define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \ + struct \ + { \ + USB_Descriptor_Header_t Header; \ + uint8_t SubType; \ + uint8_t Data[DataSize]; \ + } + + /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the CDC + * device class. + */ + enum CDC_Descriptor_ClassSubclassProtocol_t + { + CDC_CSCP_CDCClass = 0x02, /**< Descriptor Class value indicating that the device or interface + * belongs to the CDC class. + */ + CDC_CSCP_NoSpecificSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface + * belongs to no specific subclass of the CDC class. + */ + CDC_CSCP_ACMSubclass = 0x02, /**< Descriptor Subclass value indicating that the device or interface + * belongs to the Abstract Control Model CDC subclass. + */ + CDC_CSCP_ATCommandProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the AT Command protocol of the CDC class. + */ + CDC_CSCP_NoSpecificProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface + * belongs to no specific protocol of the CDC class. + */ + CDC_CSCP_VendorSpecificProtocol = 0xFF, /**< Descriptor Protocol value indicating that the device or interface + * belongs to a vendor-specific protocol of the CDC class. + */ + CDC_CSCP_CDCDataClass = 0x0A, /**< Descriptor Class value indicating that the device or interface + * belongs to the CDC Data class. + */ + CDC_CSCP_NoDataSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface + * belongs to no specific subclass of the CDC data class. + */ + CDC_CSCP_NoDataProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface + * belongs to no specific protocol of the CDC data class. + */ + }; + + /** 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_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 + { + CDC_NOTIF_SerialState = 0x20, /**< Notification type constant for a change in the virtual serial port + * handshake line states, for use with a \ref USB_Request_Header_t + * notification structure when sent to the host via the CDC notification + * endpoint. + */ + }; + + /** Enum for the CDC class specific interface descriptor subtypes. */ + enum CDC_DescriptorSubtypes_t + { + CDC_DSUBTYPE_CSInterface_Header = 0x00, /**< CDC class-specific Header functional descriptor. */ + CDC_DSUBTYPE_CSInterface_CallManagement = 0x01, /**< CDC class-specific Call Management functional descriptor. */ + CDC_DSUBTYPE_CSInterface_ACM = 0x02, /**< CDC class-specific Abstract Control Model functional descriptor. */ + CDC_DSUBTYPE_CSInterface_DirectLine = 0x03, /**< CDC class-specific Direct Line functional descriptor. */ + CDC_DSUBTYPE_CSInterface_TelephoneRinger = 0x04, /**< CDC class-specific Telephone Ringer functional descriptor. */ + CDC_DSUBTYPE_CSInterface_TelephoneCall = 0x05, /**< CDC class-specific Telephone Call functional descriptor. */ + CDC_DSUBTYPE_CSInterface_Union = 0x06, /**< CDC class-specific Union functional descriptor. */ + CDC_DSUBTYPE_CSInterface_CountrySelection = 0x07, /**< CDC class-specific Country Selection functional descriptor. */ + CDC_DSUBTYPE_CSInterface_TelephoneOpModes = 0x08, /**< CDC class-specific Telephone Operation Modes functional descriptor. */ + CDC_DSUBTYPE_CSInterface_USBTerminal = 0x09, /**< CDC class-specific USB Terminal functional descriptor. */ + CDC_DSUBTYPE_CSInterface_NetworkChannel = 0x0A, /**< CDC class-specific Network Channel functional descriptor. */ + CDC_DSUBTYPE_CSInterface_ProtocolUnit = 0x0B, /**< CDC class-specific Protocol Unit functional descriptor. */ + CDC_DSUBTYPE_CSInterface_ExtensionUnit = 0x0C, /**< CDC class-specific Extension Unit functional descriptor. */ + CDC_DSUBTYPE_CSInterface_MultiChannel = 0x0D, /**< CDC class-specific Multi-Channel Management functional descriptor. */ + CDC_DSUBTYPE_CSInterface_CAPI = 0x0E, /**< CDC class-specific Common ISDN API functional descriptor. */ + 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 + { + CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit. */ + 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 + { + CDC_PARITY_None = 0, /**< No parity bit mode on each frame. */ + CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame. */ + CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame. */ + CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame. */ + CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame. */ + }; + + /* Type Defines: */ + /** \brief CDC class-specific Functional Header Descriptor (LUFA naming conventions). + * + * Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device + * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration. + * See the CDC class specification for more details. + * + * \see \ref USB_CDC_StdDescriptor_FunctionalHeader_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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 CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_Header. + */ + uint16_t CDCSpecification; /**< Version number of the CDC specification implemented by the device, + * encoded in BCD format. + * + * \see \ref VERSION_BCD() utility macro. + */ + } ATTR_PACKED USB_CDC_Descriptor_FunctionalHeader_t; + + /** \brief CDC class-specific Functional Header Descriptor (USB-IF naming conventions). + * + * Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device + * contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration. + * See the CDC class specification for more details. + * + * \see \ref USB_CDC_Descriptor_FunctionalHeader_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bFunctionLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubType; /**< Sub type value used to distinguish between CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_Header. + */ + uint16_t bcdCDC; /**< Version number of the CDC specification implemented by the device, encoded in BCD format. + * + * \see \ref VERSION_BCD() utility macro. + */ + } ATTR_PACKED USB_CDC_StdDescriptor_FunctionalHeader_t; + + /** \brief CDC class-specific Functional ACM Descriptor (LUFA naming conventions). + * + * Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface + * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details. + * + * \see \ref USB_CDC_StdDescriptor_FunctionalACM_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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 CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_ACM. + */ + uint8_t Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. For most devices, + * this should be set to a fixed value of \c 0x06 - for other capabilities, refer + * to the CDC ACM specification. + */ + } ATTR_PACKED USB_CDC_Descriptor_FunctionalACM_t; + + /** \brief CDC class-specific Functional ACM Descriptor (USB-IF naming conventions). + * + * Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface + * supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details. + * + * \see \ref USB_CDC_Descriptor_FunctionalACM_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bFunctionLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubType; /**< Sub type value used to distinguish between CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_ACM. + */ + uint8_t bmCapabilities; /**< Capabilities of the ACM interface, given as a bit mask. For most devices, + * this should be set to a fixed value of 0x06 - for other capabilities, refer + * to the CDC ACM specification. + */ + } ATTR_PACKED 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 + * CDC control and data interfaces are related. See the CDC class specification for more details. + * + * \see \ref USB_CDC_StdDescriptor_FunctionalUnion_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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 CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_Union. + */ + uint8_t MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */ + uint8_t SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */ + } ATTR_PACKED 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 + * CDC control and data interfaces are related. See the CDC class specification for more details. + * + * \see \ref USB_CDC_Descriptor_FunctionalUnion_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bFunctionLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubType; /**< Sub type value used to distinguish between CDC class-specific descriptors, + * must be \ref CDC_DSUBTYPE_CSInterface_Union. + */ + uint8_t bMasterInterface; /**< Interface number of the CDC Control interface. */ + uint8_t bSlaveInterface0; /**< Interface number of the CDC Data interface. */ + } ATTR_PACKED USB_CDC_StdDescriptor_FunctionalUnion_t; + + /** \brief CDC Virtual Serial Port Line Encoding Settings Structure. + * + * Type define for a CDC Line Encoding structure, used to hold the various encoding parameters for a virtual + * serial port. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second. */ + uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the + * \ref CDC_LineEncodingFormats_t enum. + */ + uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the + * \ref CDC_LineEncodingParity_t enum. + */ + uint8_t DataBits; /**< Bits of data per character of the virtual serial port. */ + } ATTR_PACKED CDC_LineEncoding_t; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h new file mode 100644 index 0000000..f1e1d07 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h @@ -0,0 +1,665 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB HID Class driver. + * + * Common definitions and declarations for the library USB HID Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassHID + * \defgroup Group_USBClassHIDCommon Common Class Definitions + * + * \section Sec_USBClassHIDCommon_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * HID Class. + * + * @{ + */ + +#ifndef _HID_CLASS_COMMON_H_ +#define _HID_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + #include "HIDParser.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_HID_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Macros: */ + /** \name Keyboard Standard Report Modifier Masks */ + //@{ + /** Constant for a keyboard report modifier byte, indicating that the keyboard's left control key is currently pressed. */ + #define HID_KEYBOARD_MODIFIER_LEFTCTRL (1 << 0) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's left shift key is currently pressed. */ + #define HID_KEYBOARD_MODIFIER_LEFTSHIFT (1 << 1) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's left alt key is currently pressed. */ + #define HID_KEYBOARD_MODIFIER_LEFTALT (1 << 2) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's left GUI key is currently pressed. */ + #define HID_KEYBOARD_MODIFIER_LEFTGUI (1 << 3) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's right control key is currently pressed. */ + #define HID_KEYBOARD_MODIFIER_RIGHTCTRL (1 << 4) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's right shift key is currently pressed. */ + #define HID_KEYBOARD_MODIFIER_RIGHTSHIFT (1 << 5) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's right alt key is currently pressed. */ + #define HID_KEYBOARD_MODIFIER_RIGHTALT (1 << 6) + + /** Constant for a keyboard report modifier byte, indicating that the keyboard's right GUI key is currently pressed. */ + #define HID_KEYBOARD_MODIFIER_RIGHTGUI (1 << 7) + //@} + + /** \name Keyboard Standard Report LED Masks */ + //@{ + /** 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) + + /** Constant for a keyboard output report LED byte, indicating that the host's SCROLL LOCK mode is currently set. */ + #define HID_KEYBOARD_LED_SCROLLLOCK (1 << 2) + + /** Constant for a keyboard output report LED byte, indicating that the host's COMPOSE mode is currently set. */ + #define HID_KEYBOARD_LED_COMPOSE (1 << 3) + + /** Constant for a keyboard output report LED byte, indicating that the host's KANA mode is currently set. */ + #define HID_KEYBOARD_LED_KANA (1 << 4) + //@} + + /** \name Keyboard Standard Report Key Scan-codes */ + //@{ + #define HID_KEYBOARD_SC_ERROR_ROLLOVER 0x01 + #define HID_KEYBOARD_SC_POST_FAIL 0x02 + #define HID_KEYBOARD_SC_ERROR_UNDEFINED 0x03 + #define HID_KEYBOARD_SC_A 0x04 + #define HID_KEYBOARD_SC_B 0x05 + #define HID_KEYBOARD_SC_C 0x06 + #define HID_KEYBOARD_SC_D 0x07 + #define HID_KEYBOARD_SC_E 0x08 + #define HID_KEYBOARD_SC_F 0x09 + #define HID_KEYBOARD_SC_G 0x0A + #define HID_KEYBOARD_SC_H 0x0B + #define HID_KEYBOARD_SC_I 0x0C + #define HID_KEYBOARD_SC_J 0x0D + #define HID_KEYBOARD_SC_K 0x0E + #define HID_KEYBOARD_SC_L 0x0F + #define HID_KEYBOARD_SC_M 0x10 + #define HID_KEYBOARD_SC_N 0x11 + #define HID_KEYBOARD_SC_O 0x12 + #define HID_KEYBOARD_SC_P 0x13 + #define HID_KEYBOARD_SC_Q 0x14 + #define HID_KEYBOARD_SC_R 0x15 + #define HID_KEYBOARD_SC_S 0x16 + #define HID_KEYBOARD_SC_T 0x17 + #define HID_KEYBOARD_SC_U 0x18 + #define HID_KEYBOARD_SC_V 0x19 + #define HID_KEYBOARD_SC_W 0x1A + #define HID_KEYBOARD_SC_X 0x1B + #define HID_KEYBOARD_SC_Y 0x1C + #define HID_KEYBOARD_SC_Z 0x1D + #define HID_KEYBOARD_SC_1_AND_EXCLAMATION 0x1E + #define HID_KEYBOARD_SC_2_AND_AT 0x1F + #define HID_KEYBOARD_SC_3_AND_HASHMARK 0x20 + #define HID_KEYBOARD_SC_4_AND_DOLLAR 0x21 + #define HID_KEYBOARD_SC_5_AND_PERCENTAGE 0x22 + #define HID_KEYBOARD_SC_6_AND_CARET 0x23 + #define HID_KEYBOARD_SC_7_AND_AND_AMPERSAND 0x24 + #define HID_KEYBOARD_SC_8_AND_ASTERISK 0x25 + #define HID_KEYBOARD_SC_9_AND_OPENING_PARENTHESIS 0x26 + #define HID_KEYBOARD_SC_0_AND_CLOSING_PARENTHESIS 0x27 + #define HID_KEYBOARD_SC_ENTER 0x28 + #define HID_KEYBOARD_SC_ESCAPE 0x29 + #define HID_KEYBOARD_SC_BACKSPACE 0x2A + #define HID_KEYBOARD_SC_TAB 0x2B + #define HID_KEYBOARD_SC_SPACE 0x2C + #define HID_KEYBOARD_SC_MINUS_AND_UNDERSCORE 0x2D + #define HID_KEYBOARD_SC_EQUAL_AND_PLUS 0x2E + #define HID_KEYBOARD_SC_OPENING_BRACKET_AND_OPENING_BRACE 0x2F + #define HID_KEYBOARD_SC_CLOSING_BRACKET_AND_CLOSING_BRACE 0x30 + #define HID_KEYBOARD_SC_BACKSLASH_AND_PIPE 0x31 + #define HID_KEYBOARD_SC_NON_US_HASHMARK_AND_TILDE 0x32 + #define HID_KEYBOARD_SC_SEMICOLON_AND_COLON 0x33 + #define HID_KEYBOARD_SC_APOSTROPHE_AND_QUOTE 0x34 + #define HID_KEYBOARD_SC_GRAVE_ACCENT_AND_TILDE 0x35 + #define HID_KEYBOARD_SC_COMMA_AND_LESS_THAN_SIGN 0x36 + #define HID_KEYBOARD_SC_DOT_AND_GREATER_THAN_SIGN 0x37 + #define HID_KEYBOARD_SC_SLASH_AND_QUESTION_MARK 0x38 + #define HID_KEYBOARD_SC_CAPS_LOCK 0x39 + #define HID_KEYBOARD_SC_F1 0x3A + #define HID_KEYBOARD_SC_F2 0x3B + #define HID_KEYBOARD_SC_F3 0x3C + #define HID_KEYBOARD_SC_F4 0x3D + #define HID_KEYBOARD_SC_F5 0x3E + #define HID_KEYBOARD_SC_F6 0x3F + #define HID_KEYBOARD_SC_F7 0x40 + #define HID_KEYBOARD_SC_F8 0x41 + #define HID_KEYBOARD_SC_F9 0x42 + #define HID_KEYBOARD_SC_F10 0x43 + #define HID_KEYBOARD_SC_F11 0x44 + #define HID_KEYBOARD_SC_F12 0x45 + #define HID_KEYBOARD_SC_PRINT_SCREEN 0x46 + #define HID_KEYBOARD_SC_SCROLL_LOCK 0x47 + #define HID_KEYBOARD_SC_PAUSE 0x48 + #define HID_KEYBOARD_SC_INSERT 0x49 + #define HID_KEYBOARD_SC_HOME 0x4A + #define HID_KEYBOARD_SC_PAGE_UP 0x4B + #define HID_KEYBOARD_SC_DELETE 0x4C + #define HID_KEYBOARD_SC_END 0x4D + #define HID_KEYBOARD_SC_PAGE_DOWN 0x4E + #define HID_KEYBOARD_SC_RIGHT_ARROW 0x4F + #define HID_KEYBOARD_SC_LEFT_ARROW 0x50 + #define HID_KEYBOARD_SC_DOWN_ARROW 0x51 + #define HID_KEYBOARD_SC_UP_ARROW 0x52 + #define HID_KEYBOARD_SC_NUM_LOCK 0x53 + #define HID_KEYBOARD_SC_KEYPAD_SLASH 0x54 + #define HID_KEYBOARD_SC_KEYPAD_ASTERISK 0x55 + #define HID_KEYBOARD_SC_KEYPAD_MINUS 0x56 + #define HID_KEYBOARD_SC_KEYPAD_PLUS 0x57 + #define HID_KEYBOARD_SC_KEYPAD_ENTER 0x58 + #define HID_KEYBOARD_SC_KEYPAD_1_AND_END 0x59 + #define HID_KEYBOARD_SC_KEYPAD_2_AND_DOWN_ARROW 0x5A + #define HID_KEYBOARD_SC_KEYPAD_3_AND_PAGE_DOWN 0x5B + #define HID_KEYBOARD_SC_KEYPAD_4_AND_LEFT_ARROW 0x5C + #define HID_KEYBOARD_SC_KEYPAD_5 0x5D + #define HID_KEYBOARD_SC_KEYPAD_6_AND_RIGHT_ARROW 0x5E + #define HID_KEYBOARD_SC_KEYPAD_7_AND_HOME 0x5F + #define HID_KEYBOARD_SC_KEYPAD_8_AND_UP_ARROW 0x60 + #define HID_KEYBOARD_SC_KEYPAD_9_AND_PAGE_UP 0x61 + #define HID_KEYBOARD_SC_KEYPAD_0_AND_INSERT 0x62 + #define HID_KEYBOARD_SC_KEYPAD_DOT_AND_DELETE 0x63 + #define HID_KEYBOARD_SC_NON_US_BACKSLASH_AND_PIPE 0x64 + #define HID_KEYBOARD_SC_APPLICATION 0x65 + #define HID_KEYBOARD_SC_POWER 0x66 + #define HID_KEYBOARD_SC_KEYPAD_EQUAL_SIGN 0x67 + #define HID_KEYBOARD_SC_F13 0x68 + #define HID_KEYBOARD_SC_F14 0x69 + #define HID_KEYBOARD_SC_F15 0x6A + #define HID_KEYBOARD_SC_F16 0x6B + #define HID_KEYBOARD_SC_F17 0x6C + #define HID_KEYBOARD_SC_F18 0x6D + #define HID_KEYBOARD_SC_F19 0x6E + #define HID_KEYBOARD_SC_F20 0x6F + #define HID_KEYBOARD_SC_F21 0x70 + #define HID_KEYBOARD_SC_F22 0x71 + #define HID_KEYBOARD_SC_F23 0x72 + #define HID_KEYBOARD_SC_F24 0x73 + #define HID_KEYBOARD_SC_EXECUTE 0x74 + #define HID_KEYBOARD_SC_HELP 0x75 + #define HID_KEYBOARD_SC_MANU 0x76 + #define HID_KEYBOARD_SC_SELECT 0x77 + #define HID_KEYBOARD_SC_STOP 0x78 + #define HID_KEYBOARD_SC_AGAIN 0x79 + #define HID_KEYBOARD_SC_UNDO 0x7A + #define HID_KEYBOARD_SC_CUT 0x7B + #define HID_KEYBOARD_SC_COPY 0x7C + #define HID_KEYBOARD_SC_PASTE 0x7D + #define HID_KEYBOARD_SC_FIND 0x7E + #define HID_KEYBOARD_SC_MUTE 0x7F + #define HID_KEYBOARD_SC_VOLUME_UP 0x80 + #define HID_KEYBOARD_SC_VOLUME_DOWN 0x81 + #define HID_KEYBOARD_SC_LOCKING_CAPS_LOCK 0x82 + #define HID_KEYBOARD_SC_LOCKING_NUM_LOCK 0x83 + #define HID_KEYBOARD_SC_LOCKING_SCROLL_LOCK 0x84 + #define HID_KEYBOARD_SC_KEYPAD_COMMA 0x85 + #define HID_KEYBOARD_SC_KEYPAD_EQUAL_SIGN_AS400 0x86 + #define HID_KEYBOARD_SC_INTERNATIONAL1 0x87 + #define HID_KEYBOARD_SC_INTERNATIONAL2 0x88 + #define HID_KEYBOARD_SC_INTERNATIONAL3 0x89 + #define HID_KEYBOARD_SC_INTERNATIONAL4 0x8A + #define HID_KEYBOARD_SC_INTERNATIONAL5 0x8B + #define HID_KEYBOARD_SC_INTERNATIONAL6 0x8C + #define HID_KEYBOARD_SC_INTERNATIONAL7 0x8D + #define HID_KEYBOARD_SC_INTERNATIONAL8 0x8E + #define HID_KEYBOARD_SC_INTERNATIONAL9 0x8F + #define HID_KEYBOARD_SC_LANG1 0x90 + #define HID_KEYBOARD_SC_LANG2 0x91 + #define HID_KEYBOARD_SC_LANG3 0x92 + #define HID_KEYBOARD_SC_LANG4 0x93 + #define HID_KEYBOARD_SC_LANG5 0x94 + #define HID_KEYBOARD_SC_LANG6 0x95 + #define HID_KEYBOARD_SC_LANG7 0x96 + #define HID_KEYBOARD_SC_LANG8 0x97 + #define HID_KEYBOARD_SC_LANG9 0x98 + #define HID_KEYBOARD_SC_ALTERNATE_ERASE 0x99 + #define HID_KEYBOARD_SC_SISREQ 0x9A + #define HID_KEYBOARD_SC_CANCEL 0x9B + #define HID_KEYBOARD_SC_CLEAR 0x9C + #define HID_KEYBOARD_SC_PRIOR 0x9D + #define HID_KEYBOARD_SC_RETURN 0x9E + #define HID_KEYBOARD_SC_SEPARATOR 0x9F + #define HID_KEYBOARD_SC_OUT 0xA0 + #define HID_KEYBOARD_SC_OPER 0xA1 + #define HID_KEYBOARD_SC_CLEAR_AND_AGAIN 0xA2 + #define HID_KEYBOARD_SC_CRSEL_ANDPROPS 0xA3 + #define HID_KEYBOARD_SC_EXSEL 0xA4 + #define HID_KEYBOARD_SC_KEYPAD_00 0xB0 + #define HID_KEYBOARD_SC_KEYPAD_000 0xB1 + #define HID_KEYBOARD_SC_THOUSANDS_SEPARATOR 0xB2 + #define HID_KEYBOARD_SC_DECIMAL_SEPARATOR 0xB3 + #define HID_KEYBOARD_SC_CURRENCY_UNIT 0xB4 + #define HID_KEYBOARD_SC_CURRENCY_SUB_UNIT 0xB5 + #define HID_KEYBOARD_SC_KEYPAD_OPENING_PARENTHESIS 0xB6 + #define HID_KEYBOARD_SC_KEYPAD_CLOSING_PARENTHESIS 0xB7 + #define HID_KEYBOARD_SC_KEYPAD_OPENING_BRACE 0xB8 + #define HID_KEYBOARD_SC_KEYPAD_CLOSING_BRACE 0xB9 + #define HID_KEYBOARD_SC_KEYPAD_TAB 0xBA + #define HID_KEYBOARD_SC_KEYPAD_BACKSPACE 0xBB + #define HID_KEYBOARD_SC_KEYPAD_A 0xBC + #define HID_KEYBOARD_SC_KEYPAD_B 0xBD + #define HID_KEYBOARD_SC_KEYPAD_C 0xBE + #define HID_KEYBOARD_SC_KEYPAD_D 0xBF + #define HID_KEYBOARD_SC_KEYPAD_E 0xC0 + #define HID_KEYBOARD_SC_KEYPAD_F 0xC1 + #define HID_KEYBOARD_SC_KEYPAD_XOR 0xC2 + #define HID_KEYBOARD_SC_KEYPAD_CARET 0xC3 + #define HID_KEYBOARD_SC_KEYPAD_PERCENTAGE 0xC4 + #define HID_KEYBOARD_SC_KEYPAD_LESS_THAN_SIGN 0xC5 + #define HID_KEYBOARD_SC_KEYPAD_GREATER_THAN_SIGN 0xC6 + #define HID_KEYBOARD_SC_KEYPAD_AMP 0xC7 + #define HID_KEYBOARD_SC_KEYPAD_AMP_AMP 0xC8 + #define HID_KEYBOARD_SC_KEYPAD_PIPE 0xC9 + #define HID_KEYBOARD_SC_KEYPAD_PIPE_PIPE 0xCA + #define HID_KEYBOARD_SC_KEYPAD_COLON 0xCB + #define HID_KEYBOARD_SC_KEYPAD_HASHMARK 0xCC + #define HID_KEYBOARD_SC_KEYPAD_SPACE 0xCD + #define HID_KEYBOARD_SC_KEYPAD_AT 0xCE + #define HID_KEYBOARD_SC_KEYPAD_EXCLAMATION_SIGN 0xCF + #define HID_KEYBOARD_SC_KEYPAD_MEMORY_STORE 0xD0 + #define HID_KEYBOARD_SC_KEYPAD_MEMORY_RECALL 0xD1 + #define HID_KEYBOARD_SC_KEYPAD_MEMORY_CLEAR 0xD2 + #define HID_KEYBOARD_SC_KEYPAD_MEMORY_ADD 0xD3 + #define HID_KEYBOARD_SC_KEYPAD_MEMORY_SUBTRACT 0xD4 + #define HID_KEYBOARD_SC_KEYPAD_MEMORY_MULTIPLY 0xD5 + #define HID_KEYBOARD_SC_KEYPAD_MEMORY_DIVIDE 0xD6 + #define HID_KEYBOARD_SC_KEYPAD_PLUS_AND_MINUS 0xD7 + #define HID_KEYBOARD_SC_KEYPAD_CLEAR 0xD8 + #define HID_KEYBOARD_SC_KEYPAD_CLEAR_ENTRY 0xD9 + #define HID_KEYBOARD_SC_KEYPAD_BINARY 0xDA + #define HID_KEYBOARD_SC_KEYPAD_OCTAL 0xDB + #define HID_KEYBOARD_SC_KEYPAD_DECIMAL 0xDC + #define HID_KEYBOARD_SC_KEYPAD_HEXADECIMAL 0xDD + #define HID_KEYBOARD_SC_LEFT_CONTROL 0xE0 + #define HID_KEYBOARD_SC_LEFT_SHIFT 0xE1 + #define HID_KEYBOARD_SC_LEFT_ALT 0xE2 + #define HID_KEYBOARD_SC_LEFT_GUI 0xE3 + #define HID_KEYBOARD_SC_RIGHT_CONTROL 0xE4 + #define HID_KEYBOARD_SC_RIGHT_SHIFT 0xE5 + #define HID_KEYBOARD_SC_RIGHT_ALT 0xE6 + #define HID_KEYBOARD_SC_RIGHT_GUI 0xE7 + //@} + + /** \name Common HID Device Report Descriptors */ + //@{ + /** \hideinitializer + * A list of HID report item array elements that describe a typical HID USB Joystick. The resulting report + * descriptor is structured according to the following layout: + * + * \code + * struct + * { + * intA_t X; // Signed X axis value + * intA_t Y; // Signed Y axis value + * intA_t Z; // Signed Z axis value + * uintB_t Buttons; // Pressed buttons bitmask + * } Joystick_Report; + * \endcode + * + * Where \c uintA_t is a type large enough to hold the ranges of the signed \c MinAxisVal and \c MaxAxisVal values, + * and \c intB_t is a type large enough to hold one bit per button. + * + * \param[in] MinAxisVal Minimum logical axis value (16-bit). + * \param[in] MaxAxisVal Maximum logical axis value (16-bit). + * \param[in] MinPhysicalVal Minimum physical axis value, for movement resolution calculations (16-bit). + * \param[in] MaxPhysicalVal Maximum physical axis value, for movement resolution calculations (16-bit). + * \param[in] Buttons Total number of buttons in the device (8-bit). + */ + #define HID_DESCRIPTOR_JOYSTICK(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons) \ + HID_RI_USAGE_PAGE(8, 0x01), \ + HID_RI_USAGE(8, 0x04), \ + HID_RI_COLLECTION(8, 0x01), \ + HID_RI_USAGE(8, 0x01), \ + HID_RI_COLLECTION(8, 0x00), \ + HID_RI_USAGE(8, 0x30), \ + HID_RI_USAGE(8, 0x31), \ + HID_RI_USAGE(8, 0x32), \ + HID_RI_LOGICAL_MINIMUM(16, MinAxisVal), \ + HID_RI_LOGICAL_MAXIMUM(16, MaxAxisVal), \ + HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \ + HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \ + HID_RI_REPORT_COUNT(8, 3), \ + HID_RI_REPORT_SIZE(8, (((MinAxisVal >= -128) && (MaxAxisVal <= 127)) ? 8 : 16)), \ + HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ + HID_RI_END_COLLECTION(0), \ + HID_RI_USAGE_PAGE(8, 0x09), \ + HID_RI_USAGE_MINIMUM(8, 0x01), \ + HID_RI_USAGE_MAXIMUM(8, Buttons), \ + HID_RI_LOGICAL_MINIMUM(8, 0x00), \ + HID_RI_LOGICAL_MAXIMUM(8, 0x01), \ + HID_RI_REPORT_SIZE(8, 0x01), \ + HID_RI_REPORT_COUNT(8, Buttons), \ + HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ + HID_RI_REPORT_SIZE(8, (Buttons % 8) ? (8 - (Buttons % 8)) : 0), \ + HID_RI_REPORT_COUNT(8, 0x01), \ + HID_RI_INPUT(8, HID_IOF_CONSTANT), \ + HID_RI_END_COLLECTION(0) + + /** \hideinitializer + * A list of HID report item array elements that describe a typical HID USB keyboard. The resulting report descriptor + * is compatible with \ref USB_KeyboardReport_Data_t when \c MaxKeys is equal to 6. For other values, the report will + * be structured according to the following layout: + * + * \code + * struct + * { + * uint8_t Modifier; // Keyboard modifier byte indicating pressed modifier keys (\c HID_KEYBOARD_MODIFER_* masks) + * uint8_t Reserved; // Reserved for OEM use, always set to 0. + * uint8_t KeyCode[MaxKeys]; // Length determined by the number of keys that can be reported + * } Keyboard_Report; + * \endcode + * + * \param[in] MaxKeys Number of simultaneous keys that can be reported at the one time (8-bit). + */ + #define HID_DESCRIPTOR_KEYBOARD(MaxKeys) \ + HID_RI_USAGE_PAGE(8, 0x01), \ + HID_RI_USAGE(8, 0x06), \ + HID_RI_COLLECTION(8, 0x01), \ + HID_RI_USAGE_PAGE(8, 0x07), \ + HID_RI_USAGE_MINIMUM(8, 0xE0), \ + HID_RI_USAGE_MAXIMUM(8, 0xE7), \ + HID_RI_LOGICAL_MINIMUM(8, 0x00), \ + HID_RI_LOGICAL_MAXIMUM(8, 0x01), \ + HID_RI_REPORT_SIZE(8, 0x01), \ + HID_RI_REPORT_COUNT(8, 0x08), \ + HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ + HID_RI_REPORT_COUNT(8, 0x01), \ + HID_RI_REPORT_SIZE(8, 0x08), \ + HID_RI_INPUT(8, HID_IOF_CONSTANT), \ + HID_RI_USAGE_PAGE(8, 0x08), \ + HID_RI_USAGE_MINIMUM(8, 0x01), \ + HID_RI_USAGE_MAXIMUM(8, 0x05), \ + HID_RI_REPORT_COUNT(8, 0x05), \ + HID_RI_REPORT_SIZE(8, 0x01), \ + HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), \ + HID_RI_REPORT_COUNT(8, 0x01), \ + HID_RI_REPORT_SIZE(8, 0x03), \ + HID_RI_OUTPUT(8, HID_IOF_CONSTANT), \ + HID_RI_LOGICAL_MINIMUM(8, 0x00), \ + HID_RI_LOGICAL_MAXIMUM(8, 0xFF), \ + HID_RI_USAGE_PAGE(8, 0x07), \ + HID_RI_USAGE_MINIMUM(8, 0x00), \ + HID_RI_USAGE_MAXIMUM(8, 0xFF), \ + HID_RI_REPORT_COUNT(8, MaxKeys), \ + HID_RI_REPORT_SIZE(8, 0x08), \ + HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), \ + HID_RI_END_COLLECTION(0) + + /** \hideinitializer + * A list of HID report item array elements that describe a typical HID USB mouse. The resulting report descriptor + * is compatible with \ref USB_MouseReport_Data_t if the \c MinAxisVal and \c MaxAxisVal values fit within a \c int8_t range + * and the number of Buttons is less than 8. For other values, the report is structured according to the following layout: + * + * \code + * struct + * { + * uintA_t Buttons; // Pressed buttons bitmask + * intB_t X; // X axis value + * intB_t Y; // Y axis value + * } Mouse_Report; + * \endcode + * + * Where \c intA_t is a type large enough to hold one bit per button, and \c intB_t is a type large enough to hold the + * ranges of the signed \c MinAxisVal and \c MaxAxisVal values. + * + * \param[in] MinAxisVal Minimum X/Y logical axis value (16-bit). + * \param[in] MaxAxisVal Maximum X/Y logical axis value (16-bit). + * \param[in] MinPhysicalVal Minimum X/Y physical axis value, for movement resolution calculations (16-bit). + * \param[in] MaxPhysicalVal Maximum X/Y physical axis value, for movement resolution calculations (16-bit). + * \param[in] Buttons Total number of buttons in the device (8-bit). + * \param[in] AbsoluteCoords Boolean \c true to use absolute X/Y coordinates (e.g. touchscreen). + */ + #define HID_DESCRIPTOR_MOUSE(MinAxisVal, MaxAxisVal, MinPhysicalVal, MaxPhysicalVal, Buttons, AbsoluteCoords) \ + HID_RI_USAGE_PAGE(8, 0x01), \ + HID_RI_USAGE(8, 0x02), \ + HID_RI_COLLECTION(8, 0x01), \ + HID_RI_USAGE(8, 0x01), \ + HID_RI_COLLECTION(8, 0x00), \ + HID_RI_USAGE_PAGE(8, 0x09), \ + HID_RI_USAGE_MINIMUM(8, 0x01), \ + HID_RI_USAGE_MAXIMUM(8, Buttons), \ + HID_RI_LOGICAL_MINIMUM(8, 0x00), \ + HID_RI_LOGICAL_MAXIMUM(8, 0x01), \ + HID_RI_REPORT_COUNT(8, Buttons), \ + HID_RI_REPORT_SIZE(8, 0x01), \ + HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ + HID_RI_REPORT_COUNT(8, 0x01), \ + HID_RI_REPORT_SIZE(8, (Buttons % 8) ? (8 - (Buttons % 8)) : 0), \ + HID_RI_INPUT(8, HID_IOF_CONSTANT), \ + HID_RI_USAGE_PAGE(8, 0x01), \ + HID_RI_USAGE(8, 0x30), \ + HID_RI_USAGE(8, 0x31), \ + HID_RI_LOGICAL_MINIMUM(16, MinAxisVal), \ + HID_RI_LOGICAL_MAXIMUM(16, MaxAxisVal), \ + HID_RI_PHYSICAL_MINIMUM(16, MinPhysicalVal), \ + HID_RI_PHYSICAL_MAXIMUM(16, MaxPhysicalVal), \ + HID_RI_REPORT_COUNT(8, 0x02), \ + HID_RI_REPORT_SIZE(8, (((MinAxisVal >= -128) && (MaxAxisVal <= 127)) ? 8 : 16)), \ + HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | (AbsoluteCoords ? HID_IOF_ABSOLUTE : HID_IOF_RELATIVE)), \ + HID_RI_END_COLLECTION(0), \ + HID_RI_END_COLLECTION(0) + + /** \hideinitializer + * A list of HID report item array elements that describe a typical Vendor Defined byte array HID report descriptor, + * used for transporting arbitrary data between the USB host and device via HID reports. The resulting report should be + * a \c uint8_t byte array of the specified length in both Device to Host (IN) and Host to Device (OUT) directions. + * + * \param[in] VendorPageNum Vendor Defined HID Usage Page index, ranging from 0x00 to 0xFF. + * \param[in] CollectionUsage Vendor Usage for the encompassing report IN and OUT collection, ranging from 0x00 to 0xFF. + * \param[in] DataINUsage Vendor Usage for the IN report data, ranging from 0x00 to 0xFF. + * \param[in] DataOUTUsage Vendor Usage for the OUT report data, ranging from 0x00 to 0xFF. + * \param[in] NumBytes Length of the data IN and OUT reports. + */ + #define HID_DESCRIPTOR_VENDOR(VendorPageNum, CollectionUsage, DataINUsage, DataOUTUsage, NumBytes) \ + HID_RI_USAGE_PAGE(16, (0xFF00 | VendorPageNum)), \ + HID_RI_USAGE(8, CollectionUsage), \ + HID_RI_COLLECTION(8, 0x01), \ + HID_RI_USAGE(8, DataINUsage), \ + HID_RI_LOGICAL_MINIMUM(8, 0x00), \ + HID_RI_LOGICAL_MAXIMUM(8, 0xFF), \ + HID_RI_REPORT_SIZE(8, 0x08), \ + HID_RI_REPORT_COUNT(8, NumBytes), \ + HID_RI_INPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), \ + HID_RI_USAGE(8, DataOUTUsage), \ + HID_RI_LOGICAL_MINIMUM(8, 0x00), \ + HID_RI_LOGICAL_MAXIMUM(8, 0xFF), \ + HID_RI_REPORT_SIZE(8, 0x08), \ + HID_RI_REPORT_COUNT(8, NumBytes), \ + HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE), \ + HID_RI_END_COLLECTION(0) + //@} + + /* Type Defines: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the HID + * device class. + */ + enum HID_Descriptor_ClassSubclassProtocol_t + { + HID_CSCP_HIDClass = 0x03, /**< Descriptor Class value indicating that the device or interface + * belongs to the HID class. + */ + HID_CSCP_NonBootSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface + * does not implement a HID boot protocol. + */ + HID_CSCP_BootSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface + * implements a HID boot protocol. + */ + HID_CSCP_NonBootProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface + * does not belong to a HID boot protocol. + */ + HID_CSCP_KeyboardBootProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Keyboard HID boot protocol. + */ + HID_CSCP_MouseBootProtocol = 0x02, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Mouse HID boot protocol. + */ + }; + + /** Enum for the HID class specific control requests that can be issued by the USB bus host. */ + enum HID_ClassRequests_t + { + HID_REQ_GetReport = 0x01, /**< HID class-specific Request to get the current HID report from the device. */ + HID_REQ_GetIdle = 0x02, /**< HID class-specific Request to get the current device idle count. */ + HID_REQ_GetProtocol = 0x03, /**< HID class-specific Request to get the current HID report protocol mode. */ + HID_REQ_SetReport = 0x09, /**< HID class-specific Request to set the current HID report to the device. */ + HID_REQ_SetIdle = 0x0A, /**< HID class-specific Request to set the device's idle count. */ + 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 different types of HID reports. */ + enum HID_ReportItemTypes_t + { + HID_REPORT_ITEM_In = 0, /**< Indicates that the item is an IN report type. */ + HID_REPORT_ITEM_Out = 1, /**< Indicates that the item is an OUT report type. */ + HID_REPORT_ITEM_Feature = 2, /**< Indicates that the item is a FEATURE report type. */ + }; + + /** \brief HID class-specific HID Descriptor (LUFA naming conventions). + * + * 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. + * + * \see \ref USB_HID_StdDescriptor_HID_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + 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. + * + * \see \ref VERSION_BCD() utility macro. + */ + 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. */ + uint16_t HIDReportLength; /**< Length of the associated HID report descriptor, in bytes. */ + } ATTR_PACKED USB_HID_Descriptor_HID_t; + + /** \brief HID class-specific HID Descriptor (USB-IF naming conventions). + * + * 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. + * + * \see \ref USB_HID_Descriptor_HID_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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. + * + * \see \ref VERSION_BCD() utility macro. + */ + 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. */ + uint16_t wDescriptorLength; /**< Length of the associated HID report descriptor, in bytes. */ + } ATTR_PACKED USB_HID_StdDescriptor_HID_t; + + /** \brief Standard HID Boot Protocol Mouse Report. + * + * Type define for a standard Boot Protocol Mouse report + */ + typedef struct + { + uint8_t Button; /**< Button mask for currently pressed buttons in the mouse. */ + int8_t X; /**< Current delta X movement of the mouse. */ + int8_t Y; /**< Current delta Y movement on the mouse. */ + } ATTR_PACKED USB_MouseReport_Data_t; + + /** \brief Standard HID Boot Protocol Keyboard Report. + * + * Type define for a standard Boot Protocol Keyboard report + */ + typedef struct + { + uint8_t Modifier; /**< Keyboard modifier byte, indicating pressed modifier keys (a combination of + * \c HID_KEYBOARD_MODIFER_* masks). + */ + uint8_t Reserved; /**< Reserved for OEM use, always set to 0. */ + uint8_t KeyCode[6]; /**< Key codes of the currently pressed keys. */ + } ATTR_PACKED USB_KeyboardReport_Data_t; + + /** Type define for the data type used to store HID report descriptor elements. */ + typedef uint8_t USB_Descriptor_HIDReport_Datatype_t; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDParser.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDParser.c new file mode 100644 index 0000000..d93508f --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDParser.c @@ -0,0 +1,389 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#define __INCLUDE_FROM_HID_DRIVER +#include "HIDParser.h" + +uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, + uint16_t ReportSize, + HID_ReportInfo_t* const ParserData) +{ + 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]; + uint16_t UsageList[HID_USAGE_STACK_DEPTH]; + uint8_t UsageListSize = 0; + HID_MinMax_t UsageMinMax = {0, 0}; + + memset(ParserData, 0x00, sizeof(HID_ReportInfo_t)); + memset(CurrStateTable, 0x00, sizeof(HID_StateTable_t)); + memset(CurrReportIDInfo, 0x00, sizeof(HID_ReportSizeInfo_t)); + + ParserData->TotalDeviceReports = 1; + + while (ReportSize) + { + uint8_t HIDReportItem = *ReportData; + uint32_t ReportItemData; + + ReportData++; + ReportSize--; + + switch (HIDReportItem & HID_RI_DATA_SIZE_MASK) + { + case HID_RI_DATA_BITS_32: + ReportItemData = (((uint32_t)ReportData[3] << 24) | ((uint32_t)ReportData[2] << 16) | + ((uint16_t)ReportData[1] << 8) | ReportData[0]); + ReportSize -= 4; + ReportData += 4; + break; + + case HID_RI_DATA_BITS_16: + ReportItemData = (((uint16_t)ReportData[1] << 8) | (ReportData[0])); + ReportSize -= 2; + ReportData += 2; + break; + + case HID_RI_DATA_BITS_8: + ReportItemData = ReportData[0]; + ReportSize -= 1; + ReportData += 1; + break; + + default: + ReportItemData = 0; + break; + } + + switch (HIDReportItem & (HID_RI_TYPE_MASK | HID_RI_TAG_MASK)) + { + case HID_RI_PUSH(0): + if (CurrStateTable == &StateTable[HID_STATETABLE_STACK_DEPTH - 1]) + return HID_PARSE_HIDStackOverflow; + + memcpy((CurrStateTable + 1), + CurrStateTable, + sizeof(HID_ReportItem_t)); + + CurrStateTable++; + break; + + case HID_RI_POP(0): + if (CurrStateTable == &StateTable[0]) + return HID_PARSE_HIDStackUnderflow; + + CurrStateTable--; + break; + + case HID_RI_USAGE_PAGE(0): + if ((HIDReportItem & HID_RI_DATA_SIZE_MASK) == HID_RI_DATA_BITS_32) + CurrStateTable->Attributes.Usage.Page = (ReportItemData >> 16); + + CurrStateTable->Attributes.Usage.Page = ReportItemData; + break; + + case HID_RI_LOGICAL_MINIMUM(0): + CurrStateTable->Attributes.Logical.Minimum = ReportItemData; + break; + + case HID_RI_LOGICAL_MAXIMUM(0): + CurrStateTable->Attributes.Logical.Maximum = ReportItemData; + break; + + case HID_RI_PHYSICAL_MINIMUM(0): + CurrStateTable->Attributes.Physical.Minimum = ReportItemData; + break; + + case HID_RI_PHYSICAL_MAXIMUM(0): + CurrStateTable->Attributes.Physical.Maximum = ReportItemData; + break; + + case HID_RI_UNIT_EXPONENT(0): + CurrStateTable->Attributes.Unit.Exponent = ReportItemData; + break; + + case HID_RI_UNIT(0): + CurrStateTable->Attributes.Unit.Type = ReportItemData; + break; + + case HID_RI_REPORT_SIZE(0): + CurrStateTable->Attributes.BitSize = ReportItemData; + break; + + case HID_RI_REPORT_COUNT(0): + CurrStateTable->ReportCount = ReportItemData; + break; + + case HID_RI_REPORT_ID(0): + CurrStateTable->ReportID = ReportItemData; + + if (ParserData->UsingReportIDs) + { + CurrReportIDInfo = NULL; + + for (uint8_t i = 0; i < ParserData->TotalDeviceReports; i++) + { + if (ParserData->ReportIDSizes[i].ReportID == CurrStateTable->ReportID) + { + CurrReportIDInfo = &ParserData->ReportIDSizes[i]; + 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 HID_RI_USAGE(0): + if (UsageListSize == HID_USAGE_STACK_DEPTH) + return HID_PARSE_UsageListOverflow; + + UsageList[UsageListSize++] = ReportItemData; + break; + + case HID_RI_USAGE_MINIMUM(0): + UsageMinMax.Minimum = ReportItemData; + break; + + case HID_RI_USAGE_MAXIMUM(0): + UsageMinMax.Maximum = ReportItemData; + break; + + case HID_RI_COLLECTION(0): + if (CurrCollectionPath == NULL) + { + CurrCollectionPath = &ParserData->CollectionPaths[0]; + } + 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 = 1; i < UsageListSize; i++) + UsageList[i - 1] = UsageList[i]; + + UsageListSize--; + } + else if (UsageMinMax.Minimum <= UsageMinMax.Maximum) + { + CurrCollectionPath->Usage.Usage = UsageMinMax.Minimum++; + } + + break; + + case HID_RI_END_COLLECTION(0): + if (CurrCollectionPath == NULL) + return HID_PARSE_UnexpectedEndCollection; + + CurrCollectionPath = CurrCollectionPath->Parent; + break; + + case HID_RI_INPUT(0): + case HID_RI_OUTPUT(0): + case HID_RI_FEATURE(0): + 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 = 1; i < UsageListSize; i++) + UsageList[i - 1] = UsageList[i]; + + UsageListSize--; + } + else if (UsageMinMax.Minimum <= UsageMinMax.Maximum) + { + NewReportItem.Attributes.Usage.Usage = UsageMinMax.Minimum++; + } + + uint8_t ItemTypeTag = (HIDReportItem & (HID_RI_TYPE_MASK | HID_RI_TAG_MASK)); + + if (ItemTypeTag == HID_RI_INPUT(0)) + NewReportItem.ItemType = HID_REPORT_ITEM_In; + else if (ItemTypeTag == HID_RI_OUTPUT(0)) + 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; + + ParserData->LargestReportSizeBits = MAX(ParserData->LargestReportSizeBits, CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType]); + + if (ParserData->TotalReportItems == HID_MAX_REPORTITEMS) + return HID_PARSE_InsufficientReportItems; + + memcpy(&ParserData->ReportItems[ParserData->TotalReportItems], + &NewReportItem, sizeof(HID_ReportItem_t)); + + if (!(ReportItemData & HID_IOF_CONSTANT) && CALLBACK_HIDParser_FilterHIDReportItem(&NewReportItem)) + ParserData->TotalReportItems++; + } + + break; + + default: + break; + } + + if ((HIDReportItem & HID_RI_TYPE_MASK) == HID_RI_TYPE_MAIN) + { + UsageMinMax.Minimum = 0; + UsageMinMax.Maximum = 0; + UsageListSize = 0; + } + } + + if (!(ParserData->TotalReportItems)) + return HID_PARSE_NoUnfilteredReportItems; + + return HID_PARSE_Successful; +} + +bool USB_GetHIDReportItemInfo(const uint8_t* ReportData, + HID_ReportItem_t* const ReportItem) +{ + if (ReportItem == NULL) + return false; + + 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; +} + +void USB_SetHIDReportItemInfo(uint8_t* ReportData, + HID_ReportItem_t* const ReportItem) +{ + if (ReportItem == NULL) + return; + + 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; + } +} + +uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, + const uint8_t ReportID, + const uint8_t ReportType) +{ + 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 / 8) + ((ReportSizeBits % 8) ? 1 : 0); + } + + return 0; +} + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDParser.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDParser.h new file mode 100644 index 0000000..1f84ef4 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDParser.h @@ -0,0 +1,364 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB Human Interface Device (HID) Class report descriptor parser. + * + * This file allows for the easy parsing of complex HID report descriptors, which describes the data that + * 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 + * \brief USB Human Interface Device (HID) Class report descriptor parser. + * + * \section Sec_HIDParser_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Host/HIDParser.c (Makefile source module name: LUFA_SRC_USB) + * + * \section Sec_HIDParser_ModDescription Module Description + * Human Interface Device (HID) class report descriptor parser. This module implements a parser than is + * capable of processing a complete HID report descriptor, and outputting a flat structure containing the + * contents of the report in an a more friendly format. The parsed data may then be further processed and used + * within an application to process sent and received HID reports to and from an attached HID device. + * + * A HID report descriptor consists of a set of HID report items, which describe the function and layout + * of data exchanged between a HID device and a host, including both the physical encoding of each item + * (such as a button, key press or joystick axis) in the sent and received data packets - known as "reports" - + * as well as other information about each item such as the usages, data range, physical location and other + * characteristics. In this way a HID device can retain a high degree of flexibility in its capabilities, as it + * is not forced to comply with a given report layout or feature-set. + * + * This module also contains routines for the processing of data in an actual HID report, using the parsed report + * descriptor data as a guide for the encoding. + * + * @{ + */ + +#ifndef __HIDPARSER_H__ +#define __HIDPARSER_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + + #include "HIDReportData.h" + #include "HIDClassCommon.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Macros: */ + #if !defined(HID_STATETABLE_STACK_DEPTH) || defined(__DOXYGEN__) + /** Constant indicating the maximum stack depth of the state table. A larger state table + * allows for more PUSH/POP report items to be nested, but consumes more memory. By default + * this is set to 2 levels (allowing non-nested PUSH items) but this can be overridden by + * defining \c HID_STATETABLE_STACK_DEPTH to another value in the user project makefile, passing the + * define to the compiler using the -D compiler switch. + */ + #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 + * one, but requires more stack space. By default this is set to 8 levels (allowing for a report + * item with a count of 8) but this can be overridden by defining \c HID_USAGE_STACK_DEPTH to another + * value in the user project makefile, passing the define to the compiler using the -D compiler + * switch. + */ + #define HID_USAGE_STACK_DEPTH 8 + #endif + + #if !defined(HID_MAX_COLLECTIONS) || defined(__DOXYGEN__) + /** Constant indicating the maximum number of COLLECTION items (nested or unnested) that can be + * processed in the report item descriptor. A large value allows for more COLLECTION items to be + * processed, but consumes more memory. By default this is set to 10 collections, but this can be + * overridden by defining \c HID_MAX_COLLECTIONS to another value in the user project makefile, passing + * the define to the compiler using the -D compiler switch. + */ + #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 + * 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, + * but this can be overridden by defining \c 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 + * allows for more report ID report sizes to be stored, but consumes more memory. By default this is set + * to 10 items, but this can be overridden by defining \c HID_MAX_REPORT_IDS to another value in the user project + * makefile, and passing the define to the compiler using the -D compiler switch. Note that IN, OUT and FEATURE + * items sharing the same report ID consume only one size item in the array. + */ + #define HID_MAX_REPORT_IDS 10 + #endif + + /** Returns the value a given HID report item (once its value has been fetched via \ref USB_GetHIDReportItemInfo()) + * left-aligned to the given data type. This allows for signed data to be interpreted correctly, by shifting the data + * leftwards until the data's sign bit is in the correct position. + * + * \param[in] ReportItem HID Report Item whose retrieved value is to be aligned. + * \param[in] Type Data type to align the HID report item's value to. + * + * \return Left-aligned data of the given report item's pre-retrieved value for the given datatype. + */ + #define HID_ALIGN_DATA(ReportItem, Type) ((Type)(ReportItem->Value << ((8 * sizeof(Type)) - ReportItem->Attributes.BitSize))) + + /* Public Interface - May be used in end-application: */ + /* 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_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. */ + HID_PARSE_InsufficientCollectionPaths = 5, /**< More than \ref HID_MAX_COLLECTIONS collections in the report. */ + HID_PARSE_UsageListOverflow = 6, /**< More than \ref HID_USAGE_STACK_DEPTH usages listed in a row. */ + 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: */ + /** \brief HID Parser Report Item Min/Max Structure. + * + * Type define for an attribute with both minimum and maximum values (e.g. Logical Min/Max). + */ + typedef struct + { + uint32_t Minimum; /**< Minimum value for the attribute. */ + uint32_t Maximum; /**< Maximum value for the attribute. */ + } HID_MinMax_t; + + /** \brief HID Parser Report Item Unit Structure. + * + * Type define for the Unit attributes of a report item. + */ + typedef struct + { + 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. + */ + typedef struct + { + uint16_t Page; /**< Usage page of the report item. */ + uint16_t Usage; /**< Usage of the report item. */ + } HID_Usage_t; + + /** \brief HID Parser Report Item Collection Path Structure. + * + * Type define for a COLLECTION object. Contains the collection attributes and a reference to the + * parent collection if any. + */ + typedef struct HID_CollectionPath + { + uint8_t Type; /**< Collection type (e.g. "Generic Desktop"). */ + HID_Usage_t Usage; /**< Collection usage. */ + struct HID_CollectionPath* Parent; /**< Reference to parent collection, or \c NULL if root collection. */ + } HID_CollectionPath_t; + + /** \brief HID Parser Report Item Attributes Structure. + * + * Type define for all the data attributes of a report item, except flags. + */ + 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. + */ + typedef struct + { + uint16_t BitOffset; /**< Bit offset in the IN, OUT or FEATURE report of the item. */ + uint8_t ItemType; /**< Report item type, a value in \ref HID_ReportItemTypes_t. */ + uint16_t ItemFlags; /**< Item data flags, a mask of \c HID_IOF_* constants. */ + uint8_t ReportID; /**< Report ID this item belongs to, or 0x00 if device has only one report */ + 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. */ + } 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. + */ + typedef struct + { + uint8_t ReportID; /**< Report ID of the report within the HID interface. */ + uint16_t ReportSizeBits[3]; /**< Total number of bits in each report type for the given Report ID, + * indexed by the \ref HID_ReportItemTypes_t enum. + */ + } HID_ReportSizeInfo_t; + + /** \brief HID Parser State Structure. + * + * Type define for a complete processed HID report, including all report item data and collections. + */ + typedef struct + { + uint8_t TotalReportItems; /**< Total number of report items stored in the \c ReportItems array. */ + HID_ReportItem_t ReportItems[HID_MAX_REPORTITEMS]; /**< Report items array, including all IN, OUT + * and FEATURE items. + */ + HID_CollectionPath_t CollectionPaths[HID_MAX_COLLECTIONS]; /**< All collection items, referenced + * by the report items. + */ + uint8_t TotalDeviceReports; /**< Number of reports within the HID interface */ + HID_ReportSizeInfo_t ReportIDSizes[HID_MAX_REPORT_IDS]; /**< Report sizes for each report in the interface */ + uint16_t LargestReportSizeBits; /**< Largest report that the attached device will generate, in bits */ + bool UsingReportIDs; /**< Indicates if the device has at least one REPORT ID + * 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. + * + * \param[in] ReportData Buffer containing the device's HID report table. + * \param[in] ReportSize Size in bytes of the HID report table. + * \param[out] ParserData Pointer to a \ref HID_ReportInfo_t instance for the parser output. + * + * \return A value in the \ref HID_Parse_ErrorCodes_t enum. + */ + uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, + uint16_t ReportSize, + HID_ReportInfo_t* const ParserData) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(3); + + /** 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 \c Value + * to its \c 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. + * + * \param[in] ReportData Buffer containing an IN or FEATURE report from an attached device. + * \param[in,out] ReportItem Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array. + * + * \returns Boolean \c true if the item to retrieve was located in the given report, \c false otherwise. + */ + bool USB_GetHIDReportItemInfo(const uint8_t* ReportData, + HID_ReportItem_t* const ReportItem) ATTR_NON_NULL_PTR_ARG(1); + + /** Retrieves the given report item's value out of the \c Value member of the report item's + * \ref HID_ReportItem_t structure and places it into the correct position in the HID report + * buffer. The report buffer is assumed to have the appropriate bits cleared before calling + * this function (i.e., the buffer should be explicitly cleared before report values are added). + * + * When called, this copies the report item's \c Value element to its \c PreviousValue element for easy + * checking to see if an item's value has changed before sending a report. + * + * If the device has multiple HID reports, the first byte in the report is set to the report ID of the given item. + * + * \param[out] ReportData Buffer holding the current OUT or FEATURE report data. + * \param[in] ReportItem Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array. + */ + void USB_SetHIDReportItemInfo(uint8_t* ReportData, + HID_ReportItem_t* const ReportItem) ATTR_NON_NULL_PTR_ARG(1); + + /** Retrieves the size of a given HID report in bytes from its Report ID. + * + * \param[in] ParserData Pointer to a \ref HID_ReportInfo_t instance containing the parser output. + * \param[in] ReportID Report ID of the report whose size is to be determined. + * \param[in] ReportType Type of the report whose size is to be determined, a value from the + * \ref HID_ReportItemTypes_t enum. + * + * \return Size of the report in bytes, or \c 0 if the report does not exist. + */ + uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, + const uint8_t ReportID, + const uint8_t ReportType) ATTR_CONST ATTR_NON_NULL_PTR_ARG(1); + + /** Callback routine for the HID Report Parser. This callback must be implemented by the user code when + * the parser is used, to determine what report IN, OUT and FEATURE item's information is stored into the user + * \ref HID_ReportInfo_t structure. This can be used to filter only those items the application will be using, so that + * no RAM is wasted storing the attributes for report items which will never be referenced by the application. + * + * Report item pointers passed to this callback function may be cached by the user application for later use + * when processing report items. This provides faster report processing in the user application than would + * a search of the entire parsed report item table for each received or sent report. + * + * \param[in] CurrentItem Pointer to the current report item for user checking. + * + * \return Boolean \c true if the item should be stored into the \ref HID_ReportInfo_t structure, \c false if + * it should be ignored. + */ + bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem); + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Type Defines: */ + typedef struct + { + HID_ReportItem_Attributes_t Attributes; + uint8_t ReportCount; + uint8_t ReportID; + } HID_StateTable_t; + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDReportData.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDReportData.h new file mode 100644 index 0000000..df4302c --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/HIDReportData.h @@ -0,0 +1,126 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Constants for HID report item attributes. + * + * HID report item constants for report item attributes. Refer to the HID specification for + * details on each flag's meaning when applied to an IN, OUT or FEATURE item. + */ + +/** \ingroup Group_HIDParser + * \defgroup Group_HIDReportItemConst HID Report Descriptor Item Constants + * + * General HID constant definitions for HID Report Descriptor elements. + * + * @{ + */ + +#ifndef __HIDREPORTDATA_H__ +#define __HIDREPORTDATA_H__ + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Macros: */ + #define HID_RI_DATA_SIZE_MASK 0x03 + #define HID_RI_TYPE_MASK 0x0C + #define HID_RI_TAG_MASK 0xF0 + + #define HID_RI_TYPE_MAIN 0x00 + #define HID_RI_TYPE_GLOBAL 0x04 + #define HID_RI_TYPE_LOCAL 0x08 + + #define HID_RI_DATA_BITS_0 0x00 + #define HID_RI_DATA_BITS_8 0x01 + #define HID_RI_DATA_BITS_16 0x02 + #define HID_RI_DATA_BITS_32 0x03 + #define HID_RI_DATA_BITS(DataBits) CONCAT_EXPANDED(HID_RI_DATA_BITS_, DataBits) + + #define _HID_RI_ENCODE_0(Data) + #define _HID_RI_ENCODE_8(Data) , (Data & 0xFF) + #define _HID_RI_ENCODE_16(Data) _HID_RI_ENCODE_8(Data) _HID_RI_ENCODE_8(Data >> 8) + #define _HID_RI_ENCODE_32(Data) _HID_RI_ENCODE_16(Data) _HID_RI_ENCODE_16(Data >> 16) + #define _HID_RI_ENCODE(DataBits, ...) CONCAT_EXPANDED(_HID_RI_ENCODE_, DataBits(__VA_ARGS__)) + + #define _HID_RI_ENTRY(Type, Tag, DataBits, ...) (Type | Tag | HID_RI_DATA_BITS(DataBits)) _HID_RI_ENCODE(DataBits, (__VA_ARGS__)) + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** \name HID Input, Output and Feature Report Descriptor Item Flags */ + //@{ + #define HID_IOF_CONSTANT (1 << 0) + #define HID_IOF_DATA (0 << 0) + #define HID_IOF_VARIABLE (1 << 1) + #define HID_IOF_ARRAY (0 << 1) + #define HID_IOF_RELATIVE (1 << 2) + #define HID_IOF_ABSOLUTE (0 << 2) + #define HID_IOF_WRAP (1 << 3) + #define HID_IOF_NO_WRAP (0 << 3) + #define HID_IOF_NON_LINEAR (1 << 4) + #define HID_IOF_LINEAR (0 << 4) + #define HID_IOF_NO_PREFERRED_STATE (1 << 5) + #define HID_IOF_PREFERRED_STATE (0 << 5) + #define HID_IOF_NULLSTATE (1 << 6) + #define HID_IOF_NO_NULL_POSITION (0 << 6) + #define HID_IOF_VOLATILE (1 << 7) + #define HID_IOF_NON_VOLATILE (0 << 7) + #define HID_IOF_BUFFERED_BYTES (1 << 8) + #define HID_IOF_BITFIELD (0 << 8) + //@} + + /** \name HID Report Descriptor Item Macros */ + //@{ + #define HID_RI_INPUT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0x80, DataBits, __VA_ARGS__) + #define HID_RI_OUTPUT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0x90, DataBits, __VA_ARGS__) + #define HID_RI_COLLECTION(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0xA0, DataBits, __VA_ARGS__) + #define HID_RI_FEATURE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0xB0, DataBits, __VA_ARGS__) + #define HID_RI_END_COLLECTION(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_MAIN , 0xC0, DataBits, __VA_ARGS__) + #define HID_RI_USAGE_PAGE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x00, DataBits, __VA_ARGS__) + #define HID_RI_LOGICAL_MINIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x10, DataBits, __VA_ARGS__) + #define HID_RI_LOGICAL_MAXIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x20, DataBits, __VA_ARGS__) + #define HID_RI_PHYSICAL_MINIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x30, DataBits, __VA_ARGS__) + #define HID_RI_PHYSICAL_MAXIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x40, DataBits, __VA_ARGS__) + #define HID_RI_UNIT_EXPONENT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x50, DataBits, __VA_ARGS__) + #define HID_RI_UNIT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x60, DataBits, __VA_ARGS__) + #define HID_RI_REPORT_SIZE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x70, DataBits, __VA_ARGS__) + #define HID_RI_REPORT_ID(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x80, DataBits, __VA_ARGS__) + #define HID_RI_REPORT_COUNT(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0x90, DataBits, __VA_ARGS__) + #define HID_RI_PUSH(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xA0, DataBits, __VA_ARGS__) + #define HID_RI_POP(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_GLOBAL, 0xB0, DataBits, __VA_ARGS__) + #define HID_RI_USAGE(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x00, DataBits, __VA_ARGS__) + #define HID_RI_USAGE_MINIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x10, DataBits, __VA_ARGS__) + #define HID_RI_USAGE_MAXIMUM(DataBits, ...) _HID_RI_ENTRY(HID_RI_TYPE_LOCAL , 0x20, DataBits, __VA_ARGS__) + //@} + +/** @} */ + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h new file mode 100644 index 0000000..3e601ea --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/MIDIClassCommon.h @@ -0,0 +1,363 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB MIDI Class driver. + * + * Common definitions and declarations for the library USB MIDI Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassMIDI + * \defgroup Group_USBClassMIDICommon Common Class Definitions + * + * \section Sec_USBClassMIDICommon_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * MIDI Class. + * + * @{ + */ + +#ifndef _MIDI_CLASS_COMMON_H_ +#define _MIDI_CLASS_COMMON_H_ + + /* Macros: */ + #define __INCLUDE_FROM_AUDIO_DRIVER + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + #include "AudioClassCommon.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_MIDI_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Macros: */ + /** \name MIDI Command Values + * See http://www.midi.org/techspecs/midimessages.php for more information. + */ + //@{ + /** MIDI command for System Exclusive (SysEx) single event that has one byte of data total. */ + #define MIDI_COMMAND_SYSEX_1BYTE MIDI_COMMAND_SYSEX_END_1BYTE + + /** MIDI command for System Exclusive (SysEx) single event that has two bytes of data total. */ + #define MIDI_COMMAND_SYSEX_2BYTE 0x20 + + /** MIDI command for System Exclusive (SysEx) single event that has three bytes of data total. */ + #define MIDI_COMMAND_SYSEX_3BYTE 0x30 + + /** MIDI command for System Exclusive (SysEx) stream event that has at least four bytes of data total. */ + #define MIDI_COMMAND_SYSEX_START_3BYTE 0x40 + + /** MIDI command for System Exclusive (SysEx) stream event terminator with one remaining data byte. */ + #define MIDI_COMMAND_SYSEX_END_1BYTE 0x50 + + /** MIDI command for System Exclusive (SysEx) stream event terminator with two remaining data bytes. */ + #define MIDI_COMMAND_SYSEX_END_2BYTE 0x60 + + /** MIDI command for System Exclusive (SysEx) stream event terminator with three remaining data bytes. */ + #define MIDI_COMMAND_SYSEX_END_3BYTE 0x70 + + /** MIDI command for a note off (deactivation) event. */ + #define MIDI_COMMAND_NOTE_OFF 0x80 + + /** MIDI command for a note on (activation) event. */ + #define MIDI_COMMAND_NOTE_ON 0x90 + + /** MIDI command for a note pressure change event. */ + #define MIDI_COMMAND_NOTE_PRESSURE 0xA0 + + /** MIDI command for a control change event. */ + #define MIDI_COMMAND_CONTROL_CHANGE 0xB0 + + /** MIDI command for a control change event. */ + #define MIDI_COMMAND_PROGRAM_CHANGE 0xC0 + + /** MIDI command for a channel pressure change event. */ + #define MIDI_COMMAND_CHANNEL_PRESSURE 0xD0 + + /** MIDI command for a pitch change event. */ + #define MIDI_COMMAND_PITCH_WHEEL_CHANGE 0xE0 + //@} + + /** 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. + * + * \return Constructed MIDI channel ID. + */ + #define MIDI_CHANNEL(channel) ((channel) - 1) + + /** Constructs a MIDI event ID from a given MIDI command and a virtual MIDI cable index. This can then be + * used to create and decode \ref MIDI_EventPacket_t MIDI event packets. + * + * \param[in] virtualcable Index of the virtual MIDI cable the event relates to + * \param[in] command MIDI command to send through the virtual MIDI cable + * + * \return Constructed MIDI event ID. + */ + #define MIDI_EVENT(virtualcable, command) ((virtualcable << 4) | (command >> 4)) + + /* Enums: */ + /** Enum for the possible MIDI jack types in a MIDI device jack descriptor. */ + 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). + * + * 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. + * + * \see \ref USB_MIDI_StdDescriptor_AudioInterface_AS_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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. + * + * \see \ref VERSION_BCD() utility macro. + */ + uint16_t TotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */ + } ATTR_PACKED 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 + * 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. + * + * \see \ref USB_MIDI_Descriptor_AudioInterface_AS_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 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. + * + * \see \ref VERSION_BCD() utility macro. + */ + uint16_t wTotalLength; /**< Total length of the Audio class-specific descriptors, including this descriptor. */ + } ATTR_PACKED USB_MIDI_StdDescriptor_AudioInterface_AS_t; + + /** \brief MIDI class-specific Input Jack Descriptor (LUFA naming conventions). + * + * Type define for an Audio class-specific MIDI IN jack. This gives information to the host on a MIDI input, either + * a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint). + * + * \see \ref USB_MIDI_StdDescriptor_InputJack_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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 JackType; /**< Type of jack, one of the \c 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. */ + } ATTR_PACKED USB_MIDI_Descriptor_InputJack_t; + + /** \brief MIDI class-specific Input Jack Descriptor (USB-IF naming conventions). + * + * Type define for an Audio class-specific MIDI IN jack. This gives information to the host on a MIDI input, either + * a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint). + * + * \see \ref USB_MIDI_Descriptor_InputJack_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + + uint8_t bJackType; /**< Type of jack, one of the \c 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. */ + } ATTR_PACKED USB_MIDI_StdDescriptor_InputJack_t; + + /** \brief MIDI class-specific Output Jack Descriptor (LUFA naming conventions). + * + * Type define for an Audio class-specific MIDI OUT jack. This gives information to the host on a MIDI output, either + * a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint). + * + * \see \ref USB_MIDI_StdDescriptor_OutputJack_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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 JackType; /**< Type of jack, one of the \c 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. */ + } ATTR_PACKED 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 + * a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint). + * + * \see \ref USB_MIDI_Descriptor_OutputJack_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + + uint8_t bJackType; /**< Type of jack, one of the \c 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. */ + } ATTR_PACKED USB_MIDI_StdDescriptor_OutputJack_t; + + /** \brief Audio class-specific Jack Endpoint Descriptor (LUFA naming conventions). + * + * 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. + * + * \see \ref USB_MIDI_StdDescriptor_Jack_Endpoint_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + 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 TotalEmbeddedJacks; /**< Total number of jacks inside this endpoint. */ + uint8_t AssociatedJackID[1]; /**< IDs of each jack inside the endpoint. */ + } ATTR_PACKED USB_MIDI_Descriptor_Jack_Endpoint_t; + + /** \brief Audio class-specific Jack Endpoint Descriptor (USB-IF naming conventions). + * + * 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. + * + * \see \ref USB_MIDI_Descriptor_Jack_Endpoint_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bDescriptorSubtype; /**< Sub type value used to distinguish between audio class-specific descriptors. */ + + uint8_t bNumEmbMIDIJack; /**< Total number of jacks inside this endpoint. */ + uint8_t bAssocJackID[1]; /**< IDs of each jack inside the endpoint. */ + } ATTR_PACKED USB_MIDI_StdDescriptor_Jack_Endpoint_t; + + /** \brief MIDI Class Driver Event Packet. + * + * Type define for a USB MIDI event packet, used to encapsulate sent and received MIDI messages from a USB MIDI interface. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t Event; /**< MIDI event type, constructed with the \ref MIDI_EVENT() macro. */ + + 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. */ + } ATTR_PACKED MIDI_EventPacket_t; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h new file mode 100644 index 0000000..8a12f31 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/MassStorageClassCommon.h @@ -0,0 +1,368 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB Mass Storage Class driver. + * + * Common definitions and declarations for the library USB Mass Storage Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassMS + * \defgroup Group_USBClassMSCommon Common Class Definitions + * + * \section Sec_USBClassMSCommon_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Mass Storage Class. + * + * @{ + */ + +#ifndef _MS_CLASS_COMMON_H_ +#define _MS_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_MS_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.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) + + /** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */ + #define MS_COMMAND_DIR_DATA_IN (1 << 7) + + /** \name SCSI Commands*/ + //@{ + /** SCSI Command Code for an INQUIRY command. */ + #define SCSI_CMD_INQUIRY 0x12 + + /** SCSI Command Code for a REQUEST SENSE command. */ + #define SCSI_CMD_REQUEST_SENSE 0x03 + + /** SCSI Command Code for a TEST UNIT READY command. */ + #define SCSI_CMD_TEST_UNIT_READY 0x00 + + /** SCSI Command Code for a READ CAPACITY (10) command. */ + #define SCSI_CMD_READ_CAPACITY_10 0x25 + + /** SCSI Command Code for a START STOP UNIT command. */ + #define SCSI_CMD_START_STOP_UNIT 0x1B + + /** SCSI Command Code for a SEND DIAGNOSTIC command. */ + #define SCSI_CMD_SEND_DIAGNOSTIC 0x1D + + /** SCSI Command Code for a PREVENT ALLOW MEDIUM REMOVAL command. */ + #define SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E + + /** SCSI Command Code for a WRITE (10) command. */ + #define SCSI_CMD_WRITE_10 0x2A + + /** SCSI Command Code for a READ (10) command. */ + #define SCSI_CMD_READ_10 0x28 + + /** SCSI Command Code for a WRITE (6) command. */ + #define SCSI_CMD_WRITE_6 0x0A + + /** SCSI Command Code for a READ (6) command. */ + #define SCSI_CMD_READ_6 0x08 + + /** SCSI Command Code for a VERIFY (10) command. */ + #define SCSI_CMD_VERIFY_10 0x2F + + /** SCSI Command Code for a MODE SENSE (6) command. */ + #define SCSI_CMD_MODE_SENSE_6 0x1A + + /** SCSI Command Code for a MODE SENSE (10) command. */ + #define SCSI_CMD_MODE_SENSE_10 0x5A + //@} + + /** \name SCSI Sense Key Values */ + //@{ + /** SCSI Sense Code to indicate no error has occurred. */ + #define SCSI_SENSE_KEY_GOOD 0x00 + + /** SCSI Sense Code to indicate that the device has recovered from an error. */ + #define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01 + + /** SCSI Sense Code to indicate that the device is not ready for a new command. */ + #define SCSI_SENSE_KEY_NOT_READY 0x02 + + /** SCSI Sense Code to indicate an error whilst accessing the medium. */ + #define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03 + + /** SCSI Sense Code to indicate a hardware error has occurred. */ + #define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04 + + /** SCSI Sense Code to indicate that an illegal request has been issued. */ + #define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05 + + /** SCSI Sense Code to indicate that the unit requires attention from the host to indicate + * a reset event, medium removal or other condition. + */ + #define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06 + + /** SCSI Sense Code to indicate that a write attempt on a protected block has been made. */ + #define SCSI_SENSE_KEY_DATA_PROTECT 0x07 + + /** SCSI Sense Code to indicate an error while trying to write to a write-once medium. */ + #define SCSI_SENSE_KEY_BLANK_CHECK 0x08 + + /** SCSI Sense Code to indicate a vendor specific error has occurred. */ + #define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09 + + /** SCSI Sense Code to indicate that an EXTENDED COPY command has aborted due to an error. */ + #define SCSI_SENSE_KEY_COPY_ABORTED 0x0A + + /** SCSI Sense Code to indicate that the device has aborted the issued command. */ + #define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B + + /** SCSI Sense Code to indicate an attempt to write past the end of a partition has been made. */ + #define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D + + /** SCSI Sense Code to indicate that the source data did not match the data read from the medium. */ + #define SCSI_SENSE_KEY_MISCOMPARE 0x0E + //@} + + /** \name SCSI Additional Sense Codes */ + //@{ + /** SCSI Additional Sense Code to indicate no additional sense information is available. */ + #define SCSI_ASENSE_NO_ADDITIONAL_INFORMATION 0x00 + + /** SCSI Additional Sense Code to indicate that the logical unit (LUN) addressed is not ready. */ + #define SCSI_ASENSE_LOGICAL_UNIT_NOT_READY 0x04 + + /** SCSI Additional Sense Code to indicate an invalid field was encountered while processing the issued command. */ + #define SCSI_ASENSE_INVALID_FIELD_IN_CDB 0x24 + + /** SCSI Additional Sense Code to indicate that a medium that was previously indicated as not ready has now + * become ready for use. + */ + #define SCSI_ASENSE_NOT_READY_TO_READY_CHANGE 0x28 + + /** SCSI Additional Sense Code to indicate that an attempt to write to a protected area was made. */ + #define SCSI_ASENSE_WRITE_PROTECTED 0x27 + + /** SCSI Additional Sense Code to indicate an error whilst formatting the device medium. */ + #define SCSI_ASENSE_FORMAT_ERROR 0x31 + + /** SCSI Additional Sense Code to indicate an invalid command was issued. */ + #define SCSI_ASENSE_INVALID_COMMAND 0x20 + + /** SCSI Additional Sense Code to indicate a write to a block out outside of the medium's range was issued. */ + #define SCSI_ASENSE_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE 0x21 + + /** SCSI Additional Sense Code to indicate that no removable medium is inserted into the device. */ + #define SCSI_ASENSE_MEDIUM_NOT_PRESENT 0x3A + //@} + + /** \name SCSI Additional Sense Key Code Qualifiers */ + //@{ + /** SCSI Additional Sense Qualifier Code to indicate no additional sense qualifier information is available. */ + #define SCSI_ASENSEQ_NO_QUALIFIER 0x00 + + /** SCSI Additional Sense Qualifier Code to indicate that a medium format command failed to complete. */ + #define SCSI_ASENSEQ_FORMAT_COMMAND_FAILED 0x01 + + /** SCSI Additional Sense Qualifier Code to indicate that an initializing command must be issued before the issued + * command can be executed. + */ + #define SCSI_ASENSEQ_INITIALIZING_COMMAND_REQUIRED 0x02 + + /** SCSI Additional Sense Qualifier Code to indicate that an operation is currently in progress. */ + #define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07 + //@} + + /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Mass + * Storage device class. + */ + enum MS_Descriptor_ClassSubclassProtocol_t + { + MS_CSCP_MassStorageClass = 0x08, /**< Descriptor Class value indicating that the device or interface + * belongs to the Mass Storage class. + */ + MS_CSCP_SCSITransparentSubclass = 0x06, /**< Descriptor Subclass value indicating that the device or interface + * belongs to the SCSI Transparent Command Set subclass of the Mass + * storage class. + */ + MS_CSCP_BulkOnlyTransportProtocol = 0x50, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Bulk Only Transport protocol of the Mass Storage class. + */ + }; + + /** Enum for the Mass Storage class specific control requests that can be issued by the USB bus host. */ + enum MS_ClassRequests_t + { + MS_REQ_GetMaxLUN = 0xFE, /**< Mass Storage class-specific request to retrieve the total number of Logical + * Units (drives) in the SCSI device. + */ + MS_REQ_MassStorageReset = 0xFF, /**< Mass Storage class-specific request to reset the Mass Storage interface, + * ready for the next command. + */ + }; + + /** Enum for the possible command status wrapper return status codes. */ + enum MS_CommandStatusCodes_t + { + MS_SCSI_COMMAND_Pass = 0, /**< Command completed with no error */ + MS_SCSI_COMMAND_Fail = 1, /**< Command failed to complete - host may check the exact error via a + * SCSI REQUEST SENSE command. + */ + MS_SCSI_COMMAND_PhaseError = 2, /**< Command failed due to being invalid in the current phase. */ + }; + + /* Type Defines: */ + /** \brief Mass Storage Class Command Block Wrapper. + * + * Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t Signature; /**< Command block signature, must be \ref MS_CBW_SIGNATURE to indicate a valid Command Block. */ + uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper. */ + uint32_t DataTransferLength; /**< Length of the optional data portion of the issued command, in bytes. */ + uint8_t Flags; /**< Command block flags, indicating command data direction. */ + uint8_t LUN; /**< Logical Unit number this command is issued to. */ + 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. */ + } ATTR_PACKED 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. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t Signature; /**< Status block signature, must be \ref MS_CSW_SIGNATURE to indicate a valid Command Status. */ + uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper. */ + 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. */ + } ATTR_PACKED 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 + * structure contents, refer to the SCSI specifications. + */ + typedef struct + { + uint8_t ResponseCode; + + uint8_t SegmentNumber; + + unsigned SenseKey : 4; + unsigned Reserved : 1; + unsigned ILI : 1; + unsigned EOM : 1; + unsigned FileMark : 1; + + uint8_t Information[4]; + uint8_t AdditionalLength; + uint8_t CmdSpecificInformation[4]; + uint8_t AdditionalSenseCode; + uint8_t AdditionalSenseQualifier; + uint8_t FieldReplaceableUnitCode; + uint8_t SenseKeySpecific[3]; + } ATTR_PACKED SCSI_Request_Sense_Response_t; + + /** \brief Mass Storage Class SCSI Inquiry Structure. + * + * Type define for a SCSI Inquiry structure. Structures of this type are filled out by the + * device via the \ref MS_Host_GetInquiryData() function, retrieving the attached device's + * information. + * + * For details of the structure contents, refer to the SCSI specifications. + */ + typedef struct + { + unsigned DeviceType : 5; + unsigned PeripheralQualifier : 3; + + unsigned Reserved : 7; + unsigned Removable : 1; + + uint8_t Version; + + unsigned ResponseDataFormat : 4; + unsigned Reserved2 : 1; + unsigned NormACA : 1; + unsigned TrmTsk : 1; + unsigned AERC : 1; + + uint8_t AdditionalLength; + uint8_t Reserved3[2]; + + unsigned SoftReset : 1; + unsigned CmdQue : 1; + unsigned Reserved4 : 1; + unsigned Linked : 1; + unsigned Sync : 1; + unsigned WideBus16Bit : 1; + unsigned WideBus32Bit : 1; + unsigned RelAddr : 1; + + uint8_t VendorID[8]; + uint8_t ProductID[16]; + uint8_t RevisionID[4]; + } ATTR_PACKED SCSI_Inquiry_Response_t; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h new file mode 100644 index 0000000..1edd1dd --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/PrinterClassCommon.h @@ -0,0 +1,119 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB Printer Class driver. + * + * Common definitions and declarations for the library USB Printer Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassPrinter + * \defgroup Group_USBClassPrinterCommon Common Class Definitions + * + * \section Sec_USBClassPrinterCommon_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Printer Class. + * + * @{ + */ + +#ifndef _PRINTER_CLASS_COMMON_H_ +#define _PRINTER_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_PRINTER_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Macros: */ + /** \name Virtual Printer Status Line Masks */ + //@{ + /** Port status mask for a printer device, indicating that an error has *not* occurred. */ + #define PRNT_PORTSTATUS_NOTERROR (1 << 3) + + /** Port status mask for a printer device, indicating that the device is currently selected. */ + #define PRNT_PORTSTATUS_SELECT (1 << 4) + + /** Port status mask for a printer device, indicating that the device is currently out of paper. */ + #define PRNT_PORTSTATUS_PAPEREMPTY (1 << 5) + //@} + + /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Printer + * device class. + */ + enum PRNT_Descriptor_ClassSubclassProtocol_t + { + PRNT_CSCP_PrinterClass = 0x07, /**< Descriptor Class value indicating that the device or interface + * belongs to the Printer class. + */ + PRNT_CSCP_PrinterSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface + * belongs to the Printer subclass. + */ + PRNT_CSCP_BidirectionalProtocol = 0x02, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Bidirectional protocol of the Printer class. + */ + }; + + /** Enum for the Printer class specific control requests that can be issued by the USB bus host. */ + enum PRNT_ClassRequests_t + { + PRNT_REQ_GetDeviceID = 0x00, /**< Printer class-specific request to retrieve the Unicode ID + * string of the device, containing the device's name, manufacturer + * and supported printer languages. + */ + PRNT_REQ_GetPortStatus = 0x01, /**< Printer class-specific request to get the current status of the + * virtual printer port, for device selection and ready states. + */ + PRNT_REQ_SoftReset = 0x02, /**< Printer class-specific request to reset the device, ready for new + * printer commands. + */ + }; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h new file mode 100644 index 0000000..5c6d3fd --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/RNDISClassCommon.h @@ -0,0 +1,414 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB RNDIS Class driver. + * + * Common definitions and declarations for the library USB RNDIS Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassRNDIS + * \defgroup Group_USBClassRNDISCommon Common Class Definitions + * + * \section Sec_USBClassRNDISCommon_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * RNDIS Class. + * + * @{ + */ + +#ifndef _RNDIS_CLASS_COMMON_H_ +#define _RNDIS_CLASS_COMMON_H_ + + /* Macros: */ + #define __INCLUDE_FROM_CDC_DRIVER + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + #include "CDCClassCommon.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_RNDIS_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Macros: */ + /** Additional error code for RNDIS functions when a device returns a logical command failure. */ + #define RNDIS_ERROR_LOGICAL_CMD_FAILED 0x80 + + /** Implemented RNDIS Version Major. */ + #define REMOTE_NDIS_VERSION_MAJOR 0x01 + + /** Implemented RNDIS Version Minor. */ + #define REMOTE_NDIS_VERSION_MINOR 0x00 + + /** \name RNDIS Message Values */ + //@{ + #define REMOTE_NDIS_PACKET_MSG 0x00000001UL + #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002UL + #define REMOTE_NDIS_HALT_MSG 0x00000003UL + #define REMOTE_NDIS_QUERY_MSG 0x00000004UL + #define REMOTE_NDIS_SET_MSG 0x00000005UL + #define REMOTE_NDIS_RESET_MSG 0x00000006UL + #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007UL + #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008UL + //@} + + /** \name RNDIS Response Values */ + //@{ + #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002UL + #define REMOTE_NDIS_QUERY_CMPLT 0x80000004UL + #define REMOTE_NDIS_SET_CMPLT 0x80000005UL + #define REMOTE_NDIS_RESET_CMPLT 0x80000006UL + #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008UL + //@} + + /** \name RNDIS Status Values */ + //@{ + #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 + //@} + + /** \name RNDIS Media States */ + //@{ + #define REMOTE_NDIS_MEDIA_STATE_CONNECTED 0x00000000UL + #define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED 0x00000001UL + //@} + + /** \name RNDIS Media Types */ + //@{ + #define REMOTE_NDIS_MEDIUM_802_3 0x00000000UL + //@} + + /** \name RNDIS Connection Types */ + //@{ + #define REMOTE_NDIS_DF_CONNECTIONLESS 0x00000001UL + #define REMOTE_NDIS_DF_CONNECTION_ORIENTED 0x00000002UL + //@} + + /** \name RNDIS Packet Types */ + //@{ + #define REMOTE_NDIS_PACKET_DIRECTED 0x00000001UL + #define REMOTE_NDIS_PACKET_MULTICAST 0x00000002UL + #define REMOTE_NDIS_PACKET_ALL_MULTICAST 0x00000004UL + #define REMOTE_NDIS_PACKET_BROADCAST 0x00000008UL + #define REMOTE_NDIS_PACKET_SOURCE_ROUTING 0x00000010UL + #define REMOTE_NDIS_PACKET_PROMISCUOUS 0x00000020UL + #define REMOTE_NDIS_PACKET_SMT 0x00000040UL + #define REMOTE_NDIS_PACKET_ALL_LOCAL 0x00000080UL + #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 + //@} + + /** \name RNDIS OID Values */ + //@{ + #define OID_GEN_SUPPORTED_LIST 0x00010101UL + #define OID_GEN_HARDWARE_STATUS 0x00010102UL + #define OID_GEN_MEDIA_SUPPORTED 0x00010103UL + #define OID_GEN_MEDIA_IN_USE 0x00010104UL + #define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106UL + #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL + #define OID_GEN_LINK_SPEED 0x00010107UL + #define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010AUL + #define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010BUL + #define OID_GEN_VENDOR_ID 0x0001010CUL + #define OID_GEN_VENDOR_DESCRIPTION 0x0001010DUL + #define OID_GEN_CURRENT_PACKET_FILTER 0x0001010EUL + #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111UL + #define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114UL + #define OID_GEN_PHYSICAL_MEDIUM 0x00010202UL + #define OID_GEN_XMIT_OK 0x00020101UL + #define OID_GEN_RCV_OK 0x00020102UL + #define OID_GEN_XMIT_ERROR 0x00020103UL + #define OID_GEN_RCV_ERROR 0x00020104UL + #define OID_GEN_RCV_NO_BUFFER 0x00020105UL + #define OID_802_3_PERMANENT_ADDRESS 0x01010101UL + #define OID_802_3_CURRENT_ADDRESS 0x01010102UL + #define OID_802_3_MULTICAST_LIST 0x01010103UL + #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104UL + #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101UL + #define OID_802_3_XMIT_ONE_COLLISION 0x01020102UL + #define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103UL + //@} + + /** 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 + { + 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 + { + RNDIS_Uninitialized = 0, /**< Adapter currently uninitialized. */ + RNDIS_Initialized = 1, /**< Adapter currently initialized but not ready for data transfers. */ + RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers. */ + }; + + /** Enum for the RNDIS class specific notification requests that can be issued by a RNDIS device to a host. */ + enum RNDIS_ClassNotifications_t + { + RNDIS_NOTIF_ResponseAvailable = 0x01, /**< Notification request value for a RNDIS Response Available notification. */ + }; + + /** Enum for the NDIS hardware states. */ + enum NDIS_Hardware_Status_t + { + NDIS_HardwareStatus_Ready, /**< Hardware Ready to accept commands from the host. */ + NDIS_HardwareStatus_Initializing, /**< Hardware busy initializing. */ + NDIS_HardwareStatus_Reset, /**< Hardware reset. */ + NDIS_HardwareStatus_Closing, /**< Hardware currently closing. */ + NDIS_HardwareStatus_NotReady /**< Hardware not ready to accept commands from the host. */ + }; + + /* Type Defines: */ + /** \brief MAC Address Structure. + * + * Type define for a physical MAC address of a device on a network. + */ + typedef struct + { + uint8_t Octets[6]; /**< Individual bytes of a MAC address */ + } ATTR_PACKED MAC_Address_t; + + /** \brief RNDIS Common Message Header Structure. + * + * Type define for a RNDIS message header, sent before RNDIS messages. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; /**< RNDIS message type, a \c REMOTE_NDIS_*_MSG constant */ + uint32_t MessageLength; /**< Total length of the RNDIS message, in bytes */ + } ATTR_PACKED RNDIS_Message_Header_t; + + /** \brief RNDIS Message Structure. + * + * Type define for a RNDIS packet message, used to encapsulate Ethernet packets sent to and from the adapter. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t DataOffset; + uint32_t DataLength; + uint32_t OOBDataOffset; + uint32_t OOBDataLength; + uint32_t NumOOBDataElements; + uint32_t PerPacketInfoOffset; + uint32_t PerPacketInfoLength; + uint32_t VcHandle; + uint32_t Reserved; + } ATTR_PACKED RNDIS_Packet_Message_t; + + /** \brief RNDIS Initialization Message Structure. + * + * Type define for a RNDIS Initialize command message. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + + uint32_t MajorVersion; + uint32_t MinorVersion; + uint32_t MaxTransferSize; + } ATTR_PACKED RNDIS_Initialize_Message_t; + + /** \brief RNDIS Initialize Complete Message Structure. + * + * Type define for a RNDIS Initialize Complete response message. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + uint32_t Status; + + uint32_t MajorVersion; + uint32_t MinorVersion; + uint32_t DeviceFlags; + uint32_t Medium; + uint32_t MaxPacketsPerTransfer; + uint32_t MaxTransferSize; + uint32_t PacketAlignmentFactor; + uint32_t AFListOffset; + uint32_t AFListSize; + } ATTR_PACKED RNDIS_Initialize_Complete_t; + + /** \brief RNDIS Keep Alive Message Structure. + * + * Type define for a RNDIS Keep Alive command message. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + } ATTR_PACKED RNDIS_KeepAlive_Message_t; + + /** \brief RNDIS Keep Alive Complete Message Structure. + * + * Type define for a RNDIS Keep Alive Complete response message. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + uint32_t Status; + } ATTR_PACKED RNDIS_KeepAlive_Complete_t; + + /** \brief RNDIS Reset Complete Message Structure. + * + * Type define for a RNDIS Reset Complete response message. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t Status; + + uint32_t AddressingReset; + } ATTR_PACKED RNDIS_Reset_Complete_t; + + /** \brief RNDIS OID Property Set Message Structure. + * + * Type define for a RNDIS OID Property Set command message. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + + uint32_t Oid; + uint32_t InformationBufferLength; + uint32_t InformationBufferOffset; + uint32_t DeviceVcHandle; + } ATTR_PACKED RNDIS_Set_Message_t; + + /** \brief RNDIS OID Property Set Complete Message Structure. + * + * Type define for a RNDIS OID Property Set Complete response message. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + uint32_t Status; + } ATTR_PACKED RNDIS_Set_Complete_t; + + /** \brief RNDIS OID Property Query Message Structure. + * + * Type define for a RNDIS OID Property Query command message. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + + uint32_t Oid; + uint32_t InformationBufferLength; + uint32_t InformationBufferOffset; + uint32_t DeviceVcHandle; + } ATTR_PACKED RNDIS_Query_Message_t; + + /** \brief RNDIS OID Property Query Complete Message Structure. + * + * Type define for a RNDIS OID Property Query Complete response message. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t MessageType; + uint32_t MessageLength; + uint32_t RequestId; + uint32_t Status; + + uint32_t InformationBufferLength; + uint32_t InformationBufferOffset; + } ATTR_PACKED RNDIS_Query_Complete_t; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h new file mode 100644 index 0000000..09a9eab --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Common/StillImageClassCommon.h @@ -0,0 +1,161 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common definitions and declarations for the library USB Still Image Class driver. + * + * Common definitions and declarations for the library USB Still Image Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassSI + * \defgroup Group_USBClassSICommon Common Class Definitions + * + * \section Sec_USBClassSICommon_ModDescription Module Description + * Constants, Types and Enum definitions that are common to both Device and Host modes for the USB + * Still Image Class. + * + * @{ + */ + +#ifndef _SI_CLASS_COMMON_H_ +#define _SI_CLASS_COMMON_H_ + + /* Includes: */ + #include "../../Core/StdDescriptors.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_SI_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Macros: */ + /** Length in bytes of a given Unicode string's character length. + * + * \param[in] Chars Total number of Unicode characters in the string. + * + * \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. + * + * \param[in] Params Number of parameters which are to be sent in the \c Param field of the container. + */ + #define PIMA_COMMAND_SIZE(Params) ((sizeof(PIMA_Container_t) - 12) + ((Params) * sizeof(uint32_t))) + + /** Used in the DataLength field of a PIMA container, to give the total container size in bytes for + * a data container. + * + * \param[in] DataLen Length in bytes of the data in the container. + */ + #define PIMA_DATA_SIZE(DataLen) ((sizeof(PIMA_Container_t) - 12) + (DataLen)) + + /* Enums: */ + /** Enum for the possible PIMA contains types. */ + enum PIMA_Container_Types_t + { + PIMA_CONTAINER_Undefined = 0, /**< Undefined container type. */ + PIMA_CONTAINER_CommandBlock = 1, /**< Command Block container type. */ + PIMA_CONTAINER_DataBlock = 2, /**< Data Block container type. */ + PIMA_CONTAINER_ResponseBlock = 3, /**< Response container type. */ + PIMA_CONTAINER_EventBlock = 4, /**< Event Block container type. */ + }; + + /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the + * Still Image device class. + */ + enum SI_Descriptor_ClassSubclassProtocol_t + { + SI_CSCP_StillImageClass = 0x06, /**< Descriptor Class value indicating that the device or interface + * belongs to the Still Image class. + */ + SI_CSCP_StillImageSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface + * belongs to the Still Image subclass. + */ + SI_CSCP_BulkOnlyProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Bulk Only Transport protocol of the Still Image class. + */ + }; + + /** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */ + enum PIMA_ResponseCodes_t + { + PIMA_RESPONSE_OK = 1, /**< Response code indicating no error in the issued command. */ + PIMA_RESPONSE_GeneralError = 2, /**< Response code indicating a general error while processing the + * issued command. + */ + PIMA_RESPONSE_SessionNotOpen = 3, /**< Response code indicating that the sent command requires an open + * session before being issued. + */ + PIMA_RESPONSE_InvalidTransaction = 4, /**< Response code indicating an invalid transaction occurred. */ + PIMA_RESPONSE_OperationNotSupported = 5, /**< Response code indicating that the issued command is not supported + * by the attached device. + */ + PIMA_RESPONSE_ParameterNotSupported = 6, /**< Response code indicating that one or more of the issued command's + * parameters are not supported by the device. + */ + }; + + /* Type Defines: */ + /** \brief PIMA Still Image Device Command/Response Container. + * + * Type define for a PIMA container, use to send commands and receive responses to and from an + * attached Still Image device. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint32_t DataLength; /**< Length of the container and data, in bytes. */ + uint16_t Type; /**< Container type, a value from the \ref PIMA_Container_Types_t enum. */ + uint16_t Code; /**< Command, event or response code of the container. */ + 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). */ + } ATTR_PACKED PIMA_Container_t; + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c new file mode 100644 index 0000000..f862ba7 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c @@ -0,0 +1,197 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "../../Core/USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#define __INCLUDE_FROM_AUDIO_DRIVER +#define __INCLUDE_FROM_AUDIO_DEVICE_C +#include "AudioClassDevice.h" + +void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) +{ + if (!(Endpoint_IsSETUPReceived())) + return; + + if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) + { + uint8_t InterfaceIndex = (USB_ControlRequest.wIndex & 0xFF); + + if ((InterfaceIndex != AudioInterfaceInfo->Config.ControlInterfaceNumber) && + (InterfaceIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber)) + { + return; + } + } + else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT) + { + uint8_t EndpointAddress = (USB_ControlRequest.wIndex & 0xFF); + + if ((EndpointAddress != AudioInterfaceInfo->Config.DataINEndpoint.Address) && + (EndpointAddress != AudioInterfaceInfo->Config.DataOUTEndpoint.Address)) + { + return; + } + } + + switch (USB_ControlRequest.bRequest) + { + case REQ_SetInterface: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + + AudioInterfaceInfo->State.InterfaceEnabled = ((USB_ControlRequest.wValue & 0xFF) != 0); + EVENT_Audio_Device_StreamStartStop(AudioInterfaceInfo); + } + + break; + case AUDIO_REQ_GetStatus: + if ((USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) || + (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_ENDPOINT))) + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + } + + break; + case AUDIO_REQ_SetCurrent: + case AUDIO_REQ_SetMinimum: + case AUDIO_REQ_SetMaximum: + case AUDIO_REQ_SetResolution: + if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT) + { + uint8_t EndpointProperty = USB_ControlRequest.bRequest; + uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; + uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); + + if (CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, + EndpointControl, NULL, NULL)) + { + uint16_t ValueLength = USB_ControlRequest.wLength; + uint8_t Value[ValueLength]; + + Endpoint_ClearSETUP(); + Endpoint_Read_Control_Stream_LE(Value, ValueLength); + Endpoint_ClearIN(); + + CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, + EndpointControl, &ValueLength, Value); + } + } + else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) + { + uint8_t Property = USB_ControlRequest.bRequest; + uint8_t Entity = (USB_ControlRequest.wIndex >> 8); + uint16_t Parameter = USB_ControlRequest.wValue; + + if (CALLBACK_Audio_Device_GetSetInterfaceProperty(AudioInterfaceInfo, Property, Entity, + Parameter, NULL, NULL)) + { + uint16_t ValueLength = USB_ControlRequest.wLength; + uint8_t Value[ValueLength]; + + Endpoint_ClearSETUP(); + Endpoint_Read_Control_Stream_LE(Value, ValueLength); + Endpoint_ClearIN(); + + CALLBACK_Audio_Device_GetSetInterfaceProperty(AudioInterfaceInfo, Property, Entity, + Parameter, &ValueLength, Value); + } + } + + break; + case AUDIO_REQ_GetCurrent: + case AUDIO_REQ_GetMinimum: + case AUDIO_REQ_GetMaximum: + case AUDIO_REQ_GetResolution: + if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT) + { + uint8_t EndpointProperty = USB_ControlRequest.bRequest; + uint8_t EndpointAddress = (uint8_t)USB_ControlRequest.wIndex; + uint8_t EndpointControl = (USB_ControlRequest.wValue >> 8); + uint16_t ValueLength = USB_ControlRequest.wLength; + uint8_t Value[ValueLength]; + + if (CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, + EndpointControl, &ValueLength, Value)) + { + Endpoint_ClearSETUP(); + Endpoint_Write_Control_Stream_LE(Value, ValueLength); + Endpoint_ClearOUT(); + } + } + else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) + { + uint8_t Property = USB_ControlRequest.bRequest; + uint8_t Entity = (USB_ControlRequest.wIndex >> 8); + uint16_t Parameter = USB_ControlRequest.wValue; + uint16_t ValueLength = USB_ControlRequest.wLength; + uint8_t Value[ValueLength]; + + if (CALLBACK_Audio_Device_GetSetInterfaceProperty(AudioInterfaceInfo, Property, Entity, + Parameter, &ValueLength, Value)) + { + Endpoint_ClearSETUP(); + Endpoint_Write_Control_Stream_LE(Value, ValueLength); + Endpoint_ClearOUT(); + } + } + + break; + } +} + +bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) +{ + memset(&AudioInterfaceInfo->State, 0x00, sizeof(AudioInterfaceInfo->State)); + + AudioInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_ISOCHRONOUS; + AudioInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_ISOCHRONOUS; + + if (!(Endpoint_ConfigureEndpointTable(&AudioInterfaceInfo->Config.DataINEndpoint, 1))) + return false; + + if (!(Endpoint_ConfigureEndpointTable(&AudioInterfaceInfo->Config.DataOUTEndpoint, 1))) + return false; + + return true; +} + +void Audio_Device_Event_Stub(void) +{ + +} + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h new file mode 100644 index 0000000..6cdf4db --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h @@ -0,0 +1,396 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Device mode driver for the library USB Audio 1.0 Class driver. + * + * Device mode driver for the library USB Audio 1.0 Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassAudio + * \defgroup Group_USBClassAudioDevice Audio 1.0 Class Device Mode Driver + * + * \section Sec_USBClassAudioDevice_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/AudioClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassAudioDevice_ModDescription Module Description + * Device Mode USB Class driver framework interface, for the Audio 1.0 USB Class driver. + * + * @{ + */ + +#ifndef _AUDIO_CLASS_DEVICE_H_ +#define _AUDIO_CLASS_DEVICE_H_ + + /* Includes: */ + #include "../../USB.h" + #include "../Common/AudioClassCommon.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_AUDIO_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Type Defines: */ + /** \brief Audio Class Device Mode Configuration and State Structure. + * + * Class state structure. An instance of this structure should be made for each Audio interface + * within the user application, and passed to each of the Audio class driver functions as the + * \c AudioInterfaceInfo parameter. This stores each Audio interface's configuration and state information. + */ + typedef struct + { + struct + { + uint8_t ControlInterfaceNumber; /**< Index of the Audio Control interface within the device this + * structure controls. + */ + uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this + * structure controls. + */ + + USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ + USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ + } Config; /**< Config data for the USB class interface within the device. All elements in this section + * must be set or the interface will fail to enumerate and operate correctly. + */ + struct + { + bool InterfaceEnabled; /**< Set and cleared by the class driver to indicate if the host has enabled the streaming endpoints + * of the Audio Streaming interface. + */ + } 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 + * given Audio interface is selected. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * + * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. + */ + bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Processes incoming control requests from the host, that are directed to the given Audio class interface. This should be + * linked to the library \ref EVENT_USB_Device_ControlRequest() event. + * + * \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); + + /** Audio class driver callback for the setting and retrieval of streaming endpoint properties. This callback must be implemented + * in the user application to handle property manipulations on streaming audio endpoints. + * + * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for + * the given endpoint index, and should return as fast as possible. When non-NULL, this value may be altered for GET operations + * to indicate the size of the retrieved data. + * + * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value + * of the \c DataLength parameter. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * \param[in] EndpointProperty Property of the endpoint to get or set, a value from \ref Audio_ClassRequests_t. + * \param[in] EndpointAddress Address of the streaming endpoint whose property is being referenced. + * \param[in] EndpointControl Parameter of the endpoint to get or set, a value from \ref Audio_EndpointControls_t. + * \param[in,out] DataLength For SET operations, the length of the parameter data to set. For GET operations, the maximum + * length of the retrieved data. When NULL, the function should return whether the given property + * and parameter is valid for the requested endpoint without reading or modifying the Data buffer. + * \param[in,out] Data Pointer to a location where the parameter data is stored for SET operations, or where + * the retrieved data is to be stored for GET operations. + * + * \return Boolean \c true if the property GET/SET was successful, \c false otherwise + */ + bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, + const uint8_t EndpointProperty, + const uint8_t EndpointAddress, + const uint8_t EndpointControl, + uint16_t* const DataLength, + uint8_t* Data) ATTR_NON_NULL_PTR_ARG(1); + + /** Audio class driver callback for the setting and retrieval of streaming interface properties. This callback must be implemented + * in the user application to handle property manipulations on streaming audio interfaces. + * + * When the DataLength parameter is NULL, this callback should only indicate whether the specified operation is valid for + * the given entity and should return as fast as possible. When non-NULL, this value may be altered for GET operations + * to indicate the size of the retrieved data. + * + * \note The length of the retrieved data stored into the Data buffer on GET operations should not exceed the initial value + * of the \c DataLength parameter. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * \param[in] Property Property of the interface to get or set, a value from \ref Audio_ClassRequests_t. + * \param[in] EntityAddress Address of the audio entity whose property is being referenced. + * \param[in] Parameter Parameter of the entity to get or set, specific to each type of entity (see USB Audio specification). + * \param[in,out] DataLength For SET operations, the length of the parameter data to set. For GET operations, the maximum + * length of the retrieved data. When NULL, the function should return whether the given property + * and parameter is valid for the requested endpoint without reading or modifying the Data buffer. + * \param[in,out] Data Pointer to a location where the parameter data is stored for SET operations, or where + * the retrieved data is to be stored for GET operations. + * + * \return Boolean \c true if the property GET/SET was successful, \c false otherwise + */ + bool CALLBACK_Audio_Device_GetSetInterfaceProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, + const uint8_t Property, + const uint8_t EntityAddress, + const uint16_t Parameter, + uint16_t* const DataLength, + uint8_t* Data) ATTR_NON_NULL_PTR_ARG(1); + + /** Audio class driver event for an Audio Stream start/stop change. This event fires each time the device receives a stream enable or + * disable control request from the host, to start and stop the audio stream. The current state of the stream can be determined by the + * State.InterfaceEnabled value inside the Audio interface structure passed as a parameter. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + */ + void EVENT_Audio_Device_StreamStartStop(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo); + + /* 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(). + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + */ + static inline void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline void Audio_Device_USBTask(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + { + (void)AudioInterfaceInfo; + } + + /** Determines if the given audio interface is ready for a sample to be read from it, and selects the streaming + * OUT endpoint ready for reading. + * + * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or + * the call will fail. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * + * \return Boolean \c true if the given Audio interface has a sample to be read, \c false otherwise. + */ + static inline bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline bool Audio_Device_IsSampleReceived(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + { + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled)) + return false; + + Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataOUTEndpoint.Address); + return Endpoint_IsOUTReceived(); + } + + /** Determines if the given audio interface is ready to accept the next sample to be written to it, and selects + * the streaming IN endpoint ready for writing. + * + * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or + * the call will fail. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * + * \return Boolean \c true if the given Audio interface is ready to accept the next sample, \c false otherwise. + */ + static inline bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + { + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(AudioInterfaceInfo->State.InterfaceEnabled)) + return false; + + Endpoint_SelectEndpoint(AudioInterfaceInfo->Config.DataINEndpoint.Address); + return Endpoint_IsINReady(); + } + + /** Reads the next 8-bit audio sample from the current audio interface. + * + * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure + * that the correct endpoint is selected and ready for data. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * + * \return Signed 8-bit audio sample from the audio interface. + */ + static inline int8_t Audio_Device_ReadSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline int8_t Audio_Device_ReadSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + { + int8_t Sample; + + (void)AudioInterfaceInfo; + + Sample = Endpoint_Read_8(); + + if (!(Endpoint_BytesInEndpoint())) + Endpoint_ClearOUT(); + + return Sample; + } + + /** Reads the next 16-bit audio sample from the current audio interface. + * + * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure + * that the correct endpoint is selected and ready for data. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * + * \return Signed 16-bit audio sample from the audio interface. + */ + static inline int16_t Audio_Device_ReadSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline int16_t Audio_Device_ReadSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + { + int16_t Sample; + + (void)AudioInterfaceInfo; + + Sample = (int16_t)Endpoint_Read_16_LE(); + + if (!(Endpoint_BytesInEndpoint())) + Endpoint_ClearOUT(); + + return Sample; + } + + /** Reads the next 24-bit audio sample from the current audio interface. + * + * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsSampleReceived() function to ensure + * that the correct endpoint is selected and ready for data. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * + * \return Signed 24-bit audio sample from the audio interface. + */ + static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + { + int32_t Sample; + + (void)AudioInterfaceInfo; + + Sample = (((uint32_t)Endpoint_Read_8() << 16) | Endpoint_Read_16_LE()); + + if (!(Endpoint_BytesInEndpoint())) + Endpoint_ClearOUT(); + + return Sample; + } + + /** Writes the next 8-bit audio sample to the current audio interface. + * + * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to + * ensure that the correct endpoint is selected and ready for data. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * \param[in] Sample Signed 8-bit audio sample. + */ + static inline void Audio_Device_WriteSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, + const int8_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline void Audio_Device_WriteSample8(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, + const int8_t Sample) + { + Endpoint_Write_8(Sample); + + if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size) + Endpoint_ClearIN(); + } + + /** Writes the next 16-bit audio sample to the current audio interface. + * + * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to + * ensure that the correct endpoint is selected and ready for data. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * \param[in] Sample Signed 16-bit audio sample. + */ + static inline void Audio_Device_WriteSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, + const int16_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline void Audio_Device_WriteSample16(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, + const int16_t Sample) + { + Endpoint_Write_16_LE(Sample); + + if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size) + Endpoint_ClearIN(); + } + + /** Writes the next 24-bit audio sample to the current audio interface. + * + * \pre This should be preceded immediately by a call to the \ref Audio_Device_IsReadyForNextSample() function to + * ensure that the correct endpoint is selected and ready for data. + * + * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. + * \param[in] Sample Signed 24-bit audio sample. + */ + static inline void Audio_Device_WriteSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, + const int32_t Sample) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline void Audio_Device_WriteSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, + const int32_t Sample) + { + Endpoint_Write_16_LE(Sample); + Endpoint_Write_8(Sample >> 16); + + if (Endpoint_BytesInEndpoint() == AudioInterfaceInfo->Config.DataINEndpoint.Size) + Endpoint_ClearIN(); + } + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Function Prototypes: */ + #if defined(__INCLUDE_FROM_AUDIO_DEVICE_C) + void Audio_Device_Event_Stub(void) ATTR_CONST; + + void EVENT_Audio_Device_StreamStartStop(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) + ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(Audio_Device_Event_Stub); + #endif + + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c new file mode 100644 index 0000000..f4e74cf --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c @@ -0,0 +1,341 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "../../Core/USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#define __INCLUDE_FROM_CDC_DRIVER +#define __INCLUDE_FROM_CDC_DEVICE_C +#include "CDCClassDevice.h" + +void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + if (!(Endpoint_IsSETUPReceived())) + return; + + if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber) + return; + + switch (USB_ControlRequest.bRequest) + { + case CDC_REQ_GetLineEncoding: + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + + while (!(Endpoint_IsINReady())); + + Endpoint_Write_32_LE(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS); + Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.CharFormat); + Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.ParityType); + Endpoint_Write_8(CDCInterfaceInfo->State.LineEncoding.DataBits); + + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + } + + break; + case CDC_REQ_SetLineEncoding: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + + while (!(Endpoint_IsOUTReceived())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + + CDCInterfaceInfo->State.LineEncoding.BaudRateBPS = Endpoint_Read_32_LE(); + CDCInterfaceInfo->State.LineEncoding.CharFormat = Endpoint_Read_8(); + CDCInterfaceInfo->State.LineEncoding.ParityType = Endpoint_Read_8(); + CDCInterfaceInfo->State.LineEncoding.DataBits = Endpoint_Read_8(); + + Endpoint_ClearOUT(); + Endpoint_ClearStatusStage(); + + EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo); + } + + break; + case CDC_REQ_SetControlLineState: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + + CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue; + + EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo); + } + + break; + case CDC_REQ_SendBreak: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + + EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue); + } + + break; + } +} + +bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + memset(&CDCInterfaceInfo->State, 0x00, sizeof(CDCInterfaceInfo->State)); + + CDCInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; + CDCInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; + CDCInterfaceInfo->Config.NotificationEndpoint.Type = EP_TYPE_INTERRUPT; + + if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.DataINEndpoint, 1))) + return false; + + if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.DataOUTEndpoint, 1))) + return false; + + if (!(Endpoint_ConfigureEndpointTable(&CDCInterfaceInfo->Config.NotificationEndpoint, 1))) + return false; + + return true; +} + +void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + return; + + #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); + + if (Endpoint_IsINReady()) + CDC_Device_Flush(CDCInterfaceInfo); + #endif +} + +uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + const char* const String) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); + return Endpoint_Write_Stream_LE(String, strlen(String), NULL); +} + +uint8_t CDC_Device_SendData(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + const void* const Buffer, + const uint16_t Length) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); + return Endpoint_Write_Stream_LE(Buffer, Length, NULL); +} + +uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + const uint8_t Data) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); + + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearIN(); + + uint8_t ErrorCode; + + if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) + return ErrorCode; + } + + Endpoint_Write_8(Data); + return ENDPOINT_READYWAIT_NoError; +} + +uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + uint8_t ErrorCode; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpoint.Address); + + if (!(Endpoint_BytesInEndpoint())) + return ENDPOINT_READYWAIT_NoError; + + bool BankFull = !(Endpoint_IsReadWriteAllowed()); + + Endpoint_ClearIN(); + + if (BankFull) + { + if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) + return ErrorCode; + + Endpoint_ClearIN(); + } + + return ENDPOINT_READYWAIT_NoError; +} + +uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + return 0; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpoint.Address); + + if (Endpoint_IsOUTReceived()) + { + if (!(Endpoint_BytesInEndpoint())) + { + Endpoint_ClearOUT(); + return 0; + } + else + { + return Endpoint_BytesInEndpoint(); + } + } + else + { + return 0; + } +} + +int16_t CDC_Device_ReceiveByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + return -1; + + int16_t ReceivedByte = -1; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataOUTEndpoint.Address); + + if (Endpoint_IsOUTReceived()) + { + if (Endpoint_BytesInEndpoint()) + ReceivedByte = Endpoint_Read_8(); + + if (!(Endpoint_BytesInEndpoint())) + Endpoint_ClearOUT(); + } + + return ReceivedByte; +} + +void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS)) + return; + + Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.NotificationEndpoint.Address); + + USB_Request_Header_t Notification = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), + .bRequest = CDC_NOTIF_SerialState, + .wValue = CPU_TO_LE16(0), + .wIndex = CPU_TO_LE16(0), + .wLength = CPU_TO_LE16(sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost)), + }; + + Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL); + Endpoint_Write_Stream_LE(&CDCInterfaceInfo->State.ControlLineStates.DeviceToHost, + sizeof(CDCInterfaceInfo->State.ControlLineStates.DeviceToHost), + NULL); + Endpoint_ClearIN(); +} + +#if defined(FDEV_SETUP_STREAM) +void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + FILE* const Stream) +{ + *Stream = (FILE)FDEV_SETUP_STREAM(CDC_Device_putchar, CDC_Device_getchar, _FDEV_SETUP_RW); + fdev_set_udata(Stream, CDCInterfaceInfo); +} + +void CDC_Device_CreateBlockingStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + FILE* const Stream) +{ + *Stream = (FILE)FDEV_SETUP_STREAM(CDC_Device_putchar, CDC_Device_getchar_Blocking, _FDEV_SETUP_RW); + fdev_set_udata(Stream, CDCInterfaceInfo); +} + +static int CDC_Device_putchar(char c, + FILE* Stream) +{ + return CDC_Device_SendByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0; +} + +static int CDC_Device_getchar(FILE* Stream) +{ + int16_t ReceivedByte = CDC_Device_ReceiveByte((USB_ClassInfo_CDC_Device_t*)fdev_get_udata(Stream)); + + if (ReceivedByte < 0) + return _FDEV_EOF; + + return ReceivedByte; +} + +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(); + } + + return ReceivedByte; +} +#endif + +void CDC_Device_Event_Stub(void) +{ + +} + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h new file mode 100644 index 0000000..05c0fdd --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h @@ -0,0 +1,352 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Device mode driver for the library USB CDC Class driver. + * + * Device mode driver for the library USB CDC Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassCDC + * \defgroup Group_USBClassCDCDevice CDC Class Device Mode Driver + * + * \section Sec_USBClassCDCDevice_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/CDCClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassCDCDevice_ModDescription Module Description + * Device Mode USB Class driver framework interface, for the CDC USB Class driver. + * + * \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. This is because each interface will be loaded into a separate driver + * instance, causing the two interfaces be become unlinked. To prevent this, you + * should use the "Interface Association Descriptor" addendum to the USB 2.0 standard + * which is available on most OSes when creating Composite devices. + * + * Another major oversight is that there is no mechanism for the host to notify the + * device that there is a data sink on the host side ready to accept data. This + * means that the device may try to send data while the host isn't listening, causing + * lengthy blocking timeouts in the transmission routines. It is thus highly recommended + * that the virtual serial line DTR (Data Terminal Ready) signal be used where possible + * to determine if a host application is ready for data. + * + * @{ + */ + +#ifndef _CDC_CLASS_DEVICE_H_ +#define _CDC_CLASS_DEVICE_H_ + + /* Includes: */ + #include "../../USB.h" + #include "../Common/CDCClassCommon.h" + + #include + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_CDC_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Type Defines: */ + /** \brief CDC Class Device Mode Configuration and State Structure. + * + * Class state structure. An instance of this structure should be made for each CDC interface + * within the user application, and passed to each of the CDC class driver functions as the + * CDCInterfaceInfo parameter. This stores each CDC interface's configuration and state information. + */ + typedef struct + { + struct + { + uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device. */ + + USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ + USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ + USB_Endpoint_Table_t NotificationEndpoint; /**< Notification IN Endpoint configuration table. */ + } Config; /**< Config data for the USB class interface within the device. All elements in this section + * must be set or the interface will fail to enumerate and operate correctly. + */ + struct + { + struct + { + uint16_t HostToDevice; /**< Control line states from the host to device, as a set of \c CDC_CONTROL_LINE_OUT_* + * masks. This value is updated each time \ref CDC_Device_USBTask() is called. + */ + uint16_t DeviceToHost; /**< Control line states from the device to host, as a set of \c CDC_CONTROL_LINE_IN_* + * masks - to notify the host of changes to these values, call the + * \ref CDC_Device_SendControlLineStateChange() function. + */ + } ControlLineStates; /**< Current states of the virtual serial port's control lines between the device and host. */ + + CDC_LineEncoding_t 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: */ + /** 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. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * + * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. + */ + bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Processes incoming control requests from the host, that are directed to the given CDC class interface. This should be + * linked to the library \ref EVENT_USB_Device_ControlRequest() event. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + */ + void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** General management task for a given CDC 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] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + */ + void CDC_Device_USBTask(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** CDC class driver event for a line encoding change on a CDC interface. This event fires each time the host requests a + * line encoding change (containing the serial parity, baud and other configuration information) and may be hooked in the + * user program by declaring a handler function with the same name and parameters listed here. The new line encoding + * settings are available in the \c LineEncoding structure inside the CDC interface structure passed as a parameter. + * + * \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 + * are available in the \c ControlLineStates.HostToDevice value inside the CDC interface structure passed as a parameter, set as + * a mask of \c CDC_CONTROL_LINE_OUT_* masks. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + */ + void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** CDC class driver event for a send break request sent to the device from the host. This is generally used to separate + * data or to indicate a special condition to the receiving device. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * \param[in] Duration Duration of the break that has been sent by the host, in milliseconds. + */ + void EVENT_CDC_Device_BreakSent(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + const uint8_t Duration) ATTR_NON_NULL_PTR_ARG(1); + + /** Sends a given data buffer 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 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 + * the call will fail. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * \param[in] Buffer Pointer to a buffer containing the data to send to the device. + * \param[in] Length Length of the data to send to the host. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t CDC_Device_SendData(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + const void* const Buffer, + const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + /** Sends a given null terminated 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 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 + * the call will fail. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * \param[in] String Pointer to the null terminated string to send to the host. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t CDC_Device_SendString(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + const char* const String) 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 + * 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 + * the call will fail. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * \param[in] Data Byte of data to send to the host. + * + * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. + */ + 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 + * bank will not be released back to the USB controller until all bytes are read. + * + * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or + * the call will fail. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * + * \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 + * function which are guaranteed to succeed. + * + * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or + * the call will fail. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * + * \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 + * the call will fail. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * + * \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 + * \c 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 + * the call will fail. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + */ + void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + #if defined(FDEV_SETUP_STREAM) || defined(__DOXYGEN__) + /** Creates a standard character stream for the given CDC Device instance so that it can be used with all the regular + * functions in the standard library that accept a \c FILE stream as a destination (e.g. \c fprintf()). The created + * stream is bidirectional and can be used for both input and output functions. + * + * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single + * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may + * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own + * line buffering. + * + * \note The created stream can be given as \c stdout if desired to direct the standard output from all \c functions + * to the given CDC interface. + * \n\n + * + * \note This function is not available on all microcontroller architectures. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. + */ + void CDC_Device_CreateStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + /** Identical to \ref CDC_Device_CreateStream(), except that reads are blocking until the calling stream function terminates + * the transfer. While blocking, the USB and CDC service tasks are called repeatedly to maintain USB communications. + * + * \note This function is not available on all microcontroller architectures. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. + * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. + */ + void CDC_Device_CreateBlockingStream(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Function Prototypes: */ + #if defined(__INCLUDE_FROM_CDC_DEVICE_C) + #if defined(FDEV_SETUP_STREAM) + static int CDC_Device_putchar(char c, + 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); + #endif + + void CDC_Device_Event_Stub(void) ATTR_CONST; + + 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); + void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) + ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(CDC_Device_Event_Stub); + void EVENT_CDC_Device_BreakSent(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, + const uint8_t Duration) ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) + ATTR_ALIAS(CDC_Device_Event_Stub); + #endif + + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c new file mode 100644 index 0000000..e46330f --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c @@ -0,0 +1,207 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "../../Core/USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#define __INCLUDE_FROM_HID_DRIVER +#define __INCLUDE_FROM_HID_DEVICE_C +#include "HIDClassDevice.h" + +void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) +{ + if (!(Endpoint_IsSETUPReceived())) + return; + + if (USB_ControlRequest.wIndex != HIDInterfaceInfo->Config.InterfaceNumber) + return; + + switch (USB_ControlRequest.bRequest) + { + case HID_REQ_GetReport: + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + { + uint16_t ReportSize = 0; + uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF); + uint8_t ReportType = (USB_ControlRequest.wValue >> 8) - 1; + uint8_t ReportData[HIDInterfaceInfo->Config.PrevReportINBufferSize]; + + 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); + } + + Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); + + Endpoint_ClearSETUP(); + Endpoint_Write_Control_Stream_LE(ReportData, ReportSize); + Endpoint_ClearOUT(); + } + + break; + case HID_REQ_SetReport: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + uint16_t ReportSize = USB_ControlRequest.wLength; + uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF); + uint8_t ReportType = (USB_ControlRequest.wValue >> 8) - 1; + uint8_t ReportData[ReportSize]; + + Endpoint_ClearSETUP(); + Endpoint_Read_Control_Stream_LE(ReportData, ReportSize); + Endpoint_ClearIN(); + + CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType, + &ReportData[ReportID ? 1 : 0], ReportSize - (ReportID ? 1 : 0)); + } + + break; + case HID_REQ_GetProtocol: + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + while (!(Endpoint_IsINReady())); + Endpoint_Write_8(HIDInterfaceInfo->State.UsingReportProtocol); + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + } + + break; + case HID_REQ_SetProtocol: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + + HIDInterfaceInfo->State.UsingReportProtocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00); + } + + break; + case HID_REQ_SetIdle: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + + 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(); + while (!(Endpoint_IsINReady())); + Endpoint_Write_8(HIDInterfaceInfo->State.IdleCount >> 2); + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + } + + break; + } +} + +bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) +{ + memset(&HIDInterfaceInfo->State, 0x00, sizeof(HIDInterfaceInfo->State)); + HIDInterfaceInfo->State.UsingReportProtocol = true; + HIDInterfaceInfo->State.IdleCount = 500; + + HIDInterfaceInfo->Config.ReportINEndpoint.Type = EP_TYPE_INTERRUPT; + + if (!(Endpoint_ConfigureEndpointTable(&HIDInterfaceInfo->Config.ReportINEndpoint, 1))) + return false; + + return true; +} + +void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return; + + if (HIDInterfaceInfo->State.PrevFrameNum == USB_Device_GetFrameNumber()) + { + #if defined(USB_DEVICE_OPT_LOWSPEED) + if (!(USB_Options & USB_DEVICE_OPT_LOWSPEED)) + return; + #else + return; + #endif + } + + Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address); + + if (Endpoint_IsReadWriteAllowed()) + { + uint8_t ReportINData[HIDInterfaceInfo->Config.PrevReportINBufferSize]; + uint8_t ReportID = 0; + uint16_t ReportINSize = 0; + + memset(ReportINData, 0, sizeof(ReportINData)); + + bool ForceSend = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, HID_REPORT_ITEM_In, + 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); + memcpy(HIDInterfaceInfo->Config.PrevReportINBuffer, ReportINData, HIDInterfaceInfo->Config.PrevReportINBufferSize); + } + + if (ReportINSize && (ForceSend || StatesChanged || IdlePeriodElapsed)) + { + HIDInterfaceInfo->State.IdleMSRemaining = HIDInterfaceInfo->State.IdleCount; + + Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address); + + if (ReportID) + Endpoint_Write_8(ReportID); + + Endpoint_Write_Stream_LE(ReportINData, ReportINSize, NULL); + + Endpoint_ClearIN(); + } + + HIDInterfaceInfo->State.PrevFrameNum = USB_Device_GetFrameNumber(); + } +} + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h new file mode 100644 index 0000000..f373cf0 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h @@ -0,0 +1,210 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Device mode driver for the library USB HID Class driver. + * + * Device mode driver for the library USB HID Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassHID + * \defgroup Group_USBClassHIDDevice HID Class Device Mode Driver + * + * \section Sec_USBClassHIDDevice_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/HIDClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassHIDDevice_ModDescription Module Description + * Device Mode USB Class driver framework interface, for the HID USB Class driver. + * + * @{ + */ + +#ifndef _HID_CLASS_DEVICE_H_ +#define _HID_CLASS_DEVICE_H_ + + /* Includes: */ + #include "../../USB.h" + #include "../Common/HIDClassCommon.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_HID_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Type Defines: */ + /** \brief HID Class Device Mode Configuration and State Structure. + * + * Class state structure. An instance of this structure should be made for each HID interface + * within the user application, and passed to each of the HID class driver functions as the + * \c HIDInterfaceInfo parameter. This stores each HID interface's configuration and state information. + * + * \note Due to technical limitations, the HID device class driver does not utilize a separate OUT + * endpoint for host->device communications. Instead, the host->device data (if any) is sent to + * the device via the control endpoint. + */ + typedef struct + { + struct + { + uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device. */ + + USB_Endpoint_Table_t ReportINEndpoint; /**< Data IN HID report endpoint configuration table. */ + + 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 \c 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 + * subsequent reports with identical report IDs. In multiple report devices, + * this buffer should be set to \c NULL and the decision to send reports made + * by the user application instead. + */ + uint8_t PrevReportINBufferSize; /**< Size in bytes of the given input report buffer. This is used to create a + * second buffer of the same size within the driver so that subsequent reports + * can be compared. If the user app is to determine when reports are to be sent + * exclusively (i.e. \c PrevReportINBuffer is \c NULL) this value must still be + * set to the size of the largest report the device can issue to the host. + */ + } Config; /**< Config data for the USB class interface within the device. All elements in this section + * must 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 PrevFrameNum; /**< Frame number of the previous HID report packet opportunity. */ + 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. */ + } 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 + * containing the given HID interface is selected. + * + * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. + * + * \return Boolean \c true if the endpoints were successfully configured, \c 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_ControlRequest() 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 + * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). + * + * \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, + * 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. + * \param[out] ReportData Pointer to a buffer where the generated HID report should be stored. + * \param[out] ReportSize Number of bytes in the generated input report, or zero if no report is to be sent. + * + * \return Boolean \c true to force the sending of the report even if it is identical to the previous report and still within + * the idle period (useful for devices which report relative movement), \c false otherwise. + */ + bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, + uint8_t* const ReportID, + const uint8_t ReportType, + 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. + * + * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. + * \param[in] ReportID Report ID of the received output report. If multiple reports are not received via the given HID + * interface, this parameter should be ignored. + * \param[in] ReportType Type of received HID report, either \ref HID_REPORT_ITEM_Out or \ref HID_REPORT_ITEM_Feature. + * \param[in] ReportData Pointer to a buffer where the received HID report is stored. + * \param[in] ReportSize Size in bytes of the received report from the host. + */ + void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, + const uint8_t ReportID, + const uint8_t ReportType, + const void* ReportData, + const uint16_t ReportSize) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(4); + + /* Inline Functions: */ + /** Indicates that a millisecond of idle time has elapsed on the given HID interface, and the interface's idle count should be + * decremented. This should be called once per millisecond so that hardware key-repeats function correctly. It is recommended + * that this be called by the \ref EVENT_USB_Device_StartOfFrame() event, once SOF events have been enabled via + * \ref USB_Device_EnableSOFEvents(). + * + * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. + */ + static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_ALWAYS_INLINE ATTR_NON_NULL_PTR_ARG(1); + static inline void HID_Device_MillisecondElapsed(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) + { + if (HIDInterfaceInfo->State.IdleMSRemaining) + HIDInterfaceInfo->State.IdleMSRemaining--; + } + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c new file mode 100644 index 0000000..b002525 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c @@ -0,0 +1,131 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "../../Core/USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#define __INCLUDE_FROM_MIDI_DRIVER +#define __INCLUDE_FROM_MIDI_DEVICE_C +#include "MIDIClassDevice.h" + +bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) +{ + memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State)); + + MIDIInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; + MIDIInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; + + if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataINEndpoint, 1))) + return false; + + if (!(Endpoint_ConfigureEndpointTable(&MIDIInterfaceInfo->Config.DataOUTEndpoint, 1))) + return false; + + return true; +} + +void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return; + + #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) + Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address); + + if (Endpoint_IsINReady()) + MIDI_Device_Flush(MIDIInterfaceInfo); + #endif +} + +uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, + const MIDI_EventPacket_t* const Event) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + uint8_t ErrorCode; + + Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataINEndpoint.Address); + + if ((ErrorCode = Endpoint_Write_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL)) != ENDPOINT_RWSTREAM_NoError) + return ErrorCode; + + if (!(Endpoint_IsReadWriteAllowed())) + Endpoint_ClearIN(); + + return ENDPOINT_RWSTREAM_NoError; +} + +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.DataINEndpoint.Address); + + if (Endpoint_BytesInEndpoint()) + { + Endpoint_ClearIN(); + + if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) + return ErrorCode; + } + + return ENDPOINT_READYWAIT_NoError; +} + +bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, + MIDI_EventPacket_t* const Event) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return false; + + Endpoint_SelectEndpoint(MIDIInterfaceInfo->Config.DataOUTEndpoint.Address); + + if (!(Endpoint_IsOUTReceived())) + return false; + + if (!(Endpoint_IsReadWriteAllowed())) + return false; + + Endpoint_Read_Stream_LE(Event, sizeof(MIDI_EventPacket_t), NULL); + + if (!(Endpoint_IsReadWriteAllowed())) + Endpoint_ClearOUT(); + + return true; +} + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h new file mode 100644 index 0000000..70eb442 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h @@ -0,0 +1,175 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Device mode driver for the library USB MIDI Class driver. + * + * Device mode driver for the library USB MIDI Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassMIDI + * \defgroup Group_USBClassMIDIDevice MIDI Class Device Mode Driver + * + * \section Sec_USBClassMIDIDevice_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassMIDIDevice_ModDescription Module Description + * Device Mode USB Class driver framework interface, for the MIDI USB Class driver. + * + * @{ + */ + +#ifndef _MIDI_CLASS_DEVICE_H_ +#define _MIDI_CLASS_DEVICE_H_ + + /* Includes: */ + #include "../../USB.h" + #include "../Common/MIDIClassCommon.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_MIDI_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Type Define: */ + /** \brief MIDI Class Device Mode Configuration and State Structure. + * + * Class state structure. An instance of this structure should be made for each MIDI interface + * within the user application, and passed to each of the MIDI class driver functions as the + * \c MIDIInterfaceInfo parameter. This stores each MIDI interface's configuration and state information. + */ + typedef struct + { + struct + { + uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls. */ + + USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ + USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ + } Config; /**< Config data for the USB class interface within the device. All elements in this section + * must be set or the interface will fail to enumerate and operate correctly. + */ + + struct + { + uint8_t RESERVED; // 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; + + /* 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 + * containing the given MIDI interface is selected. + * + * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. + * + * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. + */ + bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** General management task for a given MIDI 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] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. + */ + void MIDI_Device_USBTask(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. + * + * \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. + * + * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. + * \param[in] Event Pointer to a populated \ref MIDI_EventPacket_t structure containing the MIDI event to send. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t MIDI_Device_SendEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, + const MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + + /** Flushes the MIDI send buffer, sending any queued MIDI events to the host. This should be called to override the + * \ref MIDI_Device_SendEventPacket() function's packing behavior, to flush queued events. + * + * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. + * + * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. + */ + uint8_t MIDI_Device_Flush(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Receives a MIDI event packet from the host. Events are unpacked from the endpoint, thus if the endpoint bank contains + * multiple MIDI events from the host in the one packet, multiple calls to this function will return each individual event. + * + * \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. + * + * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. + * \param[out] Event Pointer to a USB_MIDI_EventPacket_t structure where the received MIDI event is to be placed. + * + * \return Boolean \c true if a MIDI event packet was received, \c false otherwise. + */ + bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo, + MIDI_EventPacket_t* const Event) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + /* Inline Functions: */ + /** 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_ControlRequest() 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) + { + (void)MIDIInterfaceInfo; + } + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c new file mode 100644 index 0000000..d090796 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c @@ -0,0 +1,215 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "../../Core/USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#define __INCLUDE_FROM_MS_DRIVER +#define __INCLUDE_FROM_MASSSTORAGE_DEVICE_C +#include "MassStorageClassDevice.h" + +void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) +{ + if (!(Endpoint_IsSETUPReceived())) + return; + + if (USB_ControlRequest.wIndex != MSInterfaceInfo->Config.InterfaceNumber) + return; + + switch (USB_ControlRequest.bRequest) + { + case MS_REQ_MassStorageReset: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + + MSInterfaceInfo->State.IsMassStoreReset = true; + } + + break; + case MS_REQ_GetMaxLUN: + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + while (!(Endpoint_IsINReady())); + Endpoint_Write_8(MSInterfaceInfo->Config.TotalLUNs - 1); + Endpoint_ClearIN(); + Endpoint_ClearStatusStage(); + } + + break; + } +} + +bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) +{ + memset(&MSInterfaceInfo->State, 0x00, sizeof(MSInterfaceInfo->State)); + + MSInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; + MSInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; + + if (!(Endpoint_ConfigureEndpointTable(&MSInterfaceInfo->Config.DataINEndpoint, 1))) + return false; + + if (!(Endpoint_ConfigureEndpointTable(&MSInterfaceInfo->Config.DataOUTEndpoint, 1))) + return false; + + return true; +} + +void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return; + + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); + + if (Endpoint_IsOUTReceived()) + { + if (MS_Device_ReadInCommandBlock(MSInterfaceInfo)) + { + if (MSInterfaceInfo->State.CommandBlock.Flags & MS_COMMAND_DIR_DATA_IN) + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); + + bool SCSICommandResult = CALLBACK_MS_Device_SCSICommandReceived(MSInterfaceInfo); + + MSInterfaceInfo->State.CommandStatus.Status = (SCSICommandResult) ? MS_SCSI_COMMAND_Pass : MS_SCSI_COMMAND_Fail; + MSInterfaceInfo->State.CommandStatus.Signature = CPU_TO_LE32(MS_CSW_SIGNATURE); + MSInterfaceInfo->State.CommandStatus.Tag = MSInterfaceInfo->State.CommandBlock.Tag; + MSInterfaceInfo->State.CommandStatus.DataTransferResidue = MSInterfaceInfo->State.CommandBlock.DataTransferLength; + + if (!(SCSICommandResult) && (le32_to_cpu(MSInterfaceInfo->State.CommandStatus.DataTransferResidue))) + Endpoint_StallTransaction(); + + MS_Device_ReturnCommandStatus(MSInterfaceInfo); + } + } + + if (MSInterfaceInfo->State.IsMassStoreReset) + { + Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); + Endpoint_ResetEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); + + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); + Endpoint_ClearStall(); + Endpoint_ResetDataToggle(); + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); + Endpoint_ClearStall(); + Endpoint_ResetDataToggle(); + + MSInterfaceInfo->State.IsMassStoreReset = false; + } +} + +static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) +{ + uint16_t BytesProcessed; + + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); + + BytesProcessed = 0; + while (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock, + (sizeof(MS_CommandBlockWrapper_t) - 16), &BytesProcessed) == + ENDPOINT_RWSTREAM_IncompleteTransfer) + { + if (MSInterfaceInfo->State.IsMassStoreReset) + return false; + } + + if ((MSInterfaceInfo->State.CommandBlock.Signature != CPU_TO_LE32(MS_CBW_SIGNATURE)) || + (MSInterfaceInfo->State.CommandBlock.LUN >= MSInterfaceInfo->Config.TotalLUNs) || + (MSInterfaceInfo->State.CommandBlock.Flags & 0x1F) || + (MSInterfaceInfo->State.CommandBlock.SCSICommandLength == 0) || + (MSInterfaceInfo->State.CommandBlock.SCSICommandLength > 16)) + { + Endpoint_StallTransaction(); + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); + Endpoint_StallTransaction(); + + return false; + } + + BytesProcessed = 0; + while (Endpoint_Read_Stream_LE(&MSInterfaceInfo->State.CommandBlock.SCSICommandData, + MSInterfaceInfo->State.CommandBlock.SCSICommandLength, &BytesProcessed) == + ENDPOINT_RWSTREAM_IncompleteTransfer) + { + if (MSInterfaceInfo->State.IsMassStoreReset) + return false; + } + + Endpoint_ClearOUT(); + + return true; +} + +static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) +{ + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpoint.Address); + + while (Endpoint_IsStalled()) + { + #if !defined(INTERRUPT_CONTROL_ENDPOINT) + USB_USBTask(); + #endif + + if (MSInterfaceInfo->State.IsMassStoreReset) + return; + } + + Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpoint.Address); + + while (Endpoint_IsStalled()) + { + #if !defined(INTERRUPT_CONTROL_ENDPOINT) + USB_USBTask(); + #endif + + if (MSInterfaceInfo->State.IsMassStoreReset) + return; + } + + uint16_t BytesProcessed = 0; + while (Endpoint_Write_Stream_LE(&MSInterfaceInfo->State.CommandStatus, + sizeof(MS_CommandStatusWrapper_t), &BytesProcessed) == + ENDPOINT_RWSTREAM_IncompleteTransfer) + { + if (MSInterfaceInfo->State.IsMassStoreReset) + return; + } + + Endpoint_ClearIN(); +} + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h new file mode 100644 index 0000000..5132213 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h @@ -0,0 +1,161 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Device mode driver for the library USB Mass Storage Class driver. + * + * Device mode driver for the library USB Mass Storage Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassMS + * \defgroup Group_USBClassMSDevice Mass Storage Class Device Mode Driver + * + * \section Sec_USBClassMSDevice_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassMSDevice_ModDescription Module Description + * Device Mode USB Class driver framework interface, for the Mass Storage USB Class driver. + * + * @{ + */ + +#ifndef _MS_CLASS_DEVICE_H_ +#define _MS_CLASS_DEVICE_H_ + + /* Includes: */ + #include "../../USB.h" + #include "../Common/MassStorageClassCommon.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_MS_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* 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 + * within the user application, and passed to each of the Mass Storage class driver functions as the + * \c MSInterfaceInfo parameter. This stores each Mass Storage interface's configuration and state information. + */ + typedef struct + { + struct + { + uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device. */ + + USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ + USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ + + uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface. */ + } Config; /**< Config data for the USB class interface within the device. All elements in this section + * must be set or the interface will fail to enumerate and operate correctly. + */ + struct + { + MS_CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, stores the received SCSI + * command from the host which is to be processed. + */ + MS_CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, set elements to indicate + * the issued command's success or failure to the host. + */ + volatile bool IsMassStoreReset; /**< Flag indicating that the host has requested that the Mass Storage interface be reset + * and that all current Mass Storage operations should immediately abort. + */ + } 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_MS_Device_t; + + /* Function Prototypes: */ + /** Configures the endpoints of a given Mass Storage 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 Mass Storage interface is selected. + * + * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. + * + * \return Boolean \c true if the endpoints were successfully configured, \c 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_ControlRequest() 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 + * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). + * + * \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 + * inside the Mass Storage class state structure passed as a parameter to the callback function. + * + * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. + * + * \return Boolean \c true if the SCSI command was successfully processed, \c 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: */ + #if defined(__INCLUDE_FROM_MASSSTORAGE_DEVICE_C) + static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + #endif + + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.c new file mode 100644 index 0000000..fd3454b --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.c @@ -0,0 +1,314 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "../../Core/USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#define __INCLUDE_FROM_PRINTER_DRIVER +#define __INCLUDE_FROM_PRINTER_DEVICE_C +#include "PrinterClassDevice.h" + +void PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) +{ + if (!(Endpoint_IsSETUPReceived())) + return; + + if (USB_ControlRequest.wIndex != PRNTInterfaceInfo->Config.InterfaceNumber) + return; + + switch (USB_ControlRequest.bRequest) + { + case PRNT_REQ_GetDeviceID: + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + + while (!(Endpoint_IsINReady())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + + uint16_t IEEEStringLen = strlen(PRNTInterfaceInfo->Config.IEEE1284String); + Endpoint_Write_16_BE(IEEEStringLen); + Endpoint_Write_Control_Stream_LE(PRNTInterfaceInfo->Config.IEEE1284String, IEEEStringLen); + Endpoint_ClearStatusStage(); + } + + break; + case PRNT_REQ_GetPortStatus: + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + + while (!(Endpoint_IsINReady())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + + Endpoint_Write_8(PRNTInterfaceInfo->State.PortStatus); + Endpoint_ClearStatusStage(); + } + + break; + case PRNT_REQ_SoftReset: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + Endpoint_ClearStatusStage(); + + PRNTInterfaceInfo->State.IsPrinterReset = true; + + EVENT_PRNT_Device_SoftReset(PRNTInterfaceInfo); + } + + break; + } +} + +bool PRNT_Device_ConfigureEndpoints(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) +{ + memset(&PRNTInterfaceInfo->State, 0x00, sizeof(PRNTInterfaceInfo->State)); + PRNTInterfaceInfo->State.PortStatus = PRNT_PORTSTATUS_NOTERROR | PRNT_PORTSTATUS_SELECT; + + PRNTInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; + PRNTInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; + + if (!(Endpoint_ConfigureEndpointTable(&PRNTInterfaceInfo->Config.DataINEndpoint, 1))) + return false; + + if (!(Endpoint_ConfigureEndpointTable(&PRNTInterfaceInfo->Config.DataOUTEndpoint, 1))) + return false; + + return true; +} + +void PRNT_Device_USBTask(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return; + + #if !defined(NO_CLASS_DRIVER_AUTOFLUSH) + Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); + + if (Endpoint_IsINReady()) + PRNT_Device_Flush(PRNTInterfaceInfo); + #endif + + if (PRNTInterfaceInfo->State.IsPrinterReset) + { + Endpoint_ResetEndpoint(PRNTInterfaceInfo->Config.DataOUTEndpoint.Address); + Endpoint_ResetEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); + + Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataOUTEndpoint.Address); + Endpoint_ClearStall(); + Endpoint_ResetDataToggle(); + Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); + Endpoint_ClearStall(); + Endpoint_ResetDataToggle(); + + PRNTInterfaceInfo->State.IsPrinterReset = false; + } +} + +uint8_t PRNT_Device_SendString(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + const char* const String) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); + return Endpoint_Write_Stream_LE(String, strlen(String), NULL); +} + +uint8_t PRNT_Device_SendData(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + const void* const Buffer, + const uint16_t Length) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); + return Endpoint_Write_Stream_LE(Buffer, Length, NULL); +} + +uint8_t PRNT_Device_SendByte(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + const uint8_t Data) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); + + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearIN(); + + uint8_t ErrorCode; + + if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) + return ErrorCode; + } + + Endpoint_Write_8(Data); + return ENDPOINT_READYWAIT_NoError; +} + +uint8_t PRNT_Device_Flush(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return ENDPOINT_RWSTREAM_DeviceDisconnected; + + uint8_t ErrorCode; + + Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataINEndpoint.Address); + + if (!(Endpoint_BytesInEndpoint())) + return ENDPOINT_READYWAIT_NoError; + + bool BankFull = !(Endpoint_IsReadWriteAllowed()); + + Endpoint_ClearIN(); + + if (BankFull) + { + if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) + return ErrorCode; + + Endpoint_ClearIN(); + } + + return ENDPOINT_READYWAIT_NoError; +} + +uint16_t PRNT_Device_BytesReceived(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return 0; + + Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataOUTEndpoint.Address); + + if (Endpoint_IsOUTReceived()) + { + if (!(Endpoint_BytesInEndpoint())) + { + Endpoint_ClearOUT(); + return 0; + } + else + { + return Endpoint_BytesInEndpoint(); + } + } + else + { + return 0; + } +} + +int16_t PRNT_Device_ReceiveByte(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return -1; + + int16_t ReceivedByte = -1; + + Endpoint_SelectEndpoint(PRNTInterfaceInfo->Config.DataOUTEndpoint.Address); + + if (Endpoint_IsOUTReceived()) + { + if (Endpoint_BytesInEndpoint()) + ReceivedByte = Endpoint_Read_8(); + + if (!(Endpoint_BytesInEndpoint())) + Endpoint_ClearOUT(); + } + + return ReceivedByte; +} + +#if defined(FDEV_SETUP_STREAM) +void PRNT_Device_CreateStream(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + FILE* const Stream) +{ + *Stream = (FILE)FDEV_SETUP_STREAM(PRNT_Device_putchar, PRNT_Device_getchar, _FDEV_SETUP_RW); + fdev_set_udata(Stream, PRNTInterfaceInfo); +} + +void PRNT_Device_CreateBlockingStream(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + FILE* const Stream) +{ + *Stream = (FILE)FDEV_SETUP_STREAM(PRNT_Device_putchar, PRNT_Device_getchar_Blocking, _FDEV_SETUP_RW); + fdev_set_udata(Stream, PRNTInterfaceInfo); +} + +static int PRNT_Device_putchar(char c, + FILE* Stream) +{ + return PRNT_Device_SendByte((USB_ClassInfo_PRNT_Device_t*)fdev_get_udata(Stream), c) ? _FDEV_ERR : 0; +} + +static int PRNT_Device_getchar(FILE* Stream) +{ + int16_t ReceivedByte = PRNT_Device_ReceiveByte((USB_ClassInfo_PRNT_Device_t*)fdev_get_udata(Stream)); + + if (ReceivedByte < 0) + return _FDEV_EOF; + + return ReceivedByte; +} + +static int PRNT_Device_getchar_Blocking(FILE* Stream) +{ + int16_t ReceivedByte; + + while ((ReceivedByte = PRNT_Device_ReceiveByte((USB_ClassInfo_PRNT_Device_t*)fdev_get_udata(Stream))) < 0) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return _FDEV_EOF; + + PRNT_Device_USBTask((USB_ClassInfo_PRNT_Device_t*)fdev_get_udata(Stream)); + USB_USBTask(); + } + + return ReceivedByte; +} +#endif + +void PRNT_Device_Event_Stub(void) +{ + +} + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h new file mode 100644 index 0000000..d9d9644 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h @@ -0,0 +1,293 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Device mode driver for the library USB Printer Class driver. + * + * Device mode driver for the library USB Printer Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassPrinter + * \defgroup Group_USBClassPrinterDevice Printer Class Device Mode Driver + * + * \section Sec_USBClassPrinterDevice_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/PrinterClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassPrinterDevice_ModDescription Module Description + * Device Mode USB Class driver framework interface, for the Printer USB Class driver. + * + * @{ + */ + +#ifndef _PRINTER_CLASS_DEVICE_H_ +#define _PRINTER_CLASS_DEVICE_H_ + + /* Includes: */ + #include "../../USB.h" + #include "../Common/PrinterClassCommon.h" + + #include + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_PRINTER_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Type Defines: */ + /** \brief Printer Class Device Mode Configuration and State Structure. + * + * Class state structure. An instance of this structure should be made for each Printer interface + * within the user application, and passed to each of the Printer class driver functions as the + * PRNTInterfaceInfo parameter. This stores each Printer interface's configuration and state information. + */ + typedef struct + { + struct + { + uint8_t InterfaceNumber; /**< Interface number of the Printer interface within the device. */ + + USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ + USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ + + char* IEEE1284String; /**< IEEE 1284 identification string, sent to the host during enumeration + * to identify the printer model, manufacturer and other characteristics. + */ + } Config; /**< Config data for the USB class interface within the device. All elements in this section + * must be set or the interface will fail to enumerate and operate correctly. + */ + struct + { + uint8_t PortStatus; /**< Current status of the Printer virtual port, a collection of \c PRNT_PORTSTATUS_* + * bitmask values. + */ + + volatile bool IsPrinterReset; /**< Flag indicating that the host has requested that the Printer interface be reset + * and that all current Mass Storage operations should immediately abort. + */ + } 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_PRNT_Device_t; + + /* Function Prototypes: */ + /** Configures the endpoints of a given Printer 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 Printer interface is selected. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + * + * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. + */ + bool PRNT_Device_ConfigureEndpoints(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Processes incoming control requests from the host, that are directed to the given Printer class interface. This should be + * linked to the library \ref EVENT_USB_Device_ControlRequest() event. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + */ + void PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** General management task for a given Printer 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] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + */ + void PRNT_Device_USBTask(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Printer class driver event for a soft reset request on a Printer interface. This event fires each time the host + * requests a reset of the printer interface's internal state, and may be hooked in the user program by declaring a + * handler function with the same name and parameters listed here. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + */ + void EVENT_PRNT_Device_SoftReset(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Sends a given data buffer 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 PRNT_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 + * the call will fail. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + * \param[in] Buffer Pointer to a buffer containing the data to send to the device. + * \param[in] Length Length of the data to send to the host. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t PRNT_Device_SendData(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + const void* const Buffer, + const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + /** Sends a given null terminated 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 PRNT_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 + * the call will fail. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + * \param[in] String Pointer to the null terminated string to send to the host. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t PRNT_Device_SendString(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + const char* const String) 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 PRNT_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 + * the call will fail. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + * \param[in] Data Byte of data to send to the host. + * + * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. + */ + uint8_t PRNT_Device_SendByte(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1); + + /** Determines the number of bytes received by the Printer 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 PRNT_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 + * bank will not be released back to the USB controller until all bytes are read. + * + * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or + * the call will fail. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + * + * \return Total number of buffered bytes received from the host. + */ + uint16_t PRNT_Device_BytesReceived(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) 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 PRNT_Device_BytesReceived() function may be queried in advance to determine how many + * bytes are currently buffered in the Printer interface's data receive endpoint bank, and thus how many repeated calls to this + * function which are guaranteed to succeed. + * + * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or + * the call will fail. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + * + * \return Next received byte from the host, or a negative value if no data received. + */ + int16_t PRNT_Device_ReceiveByte(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) 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 + * the call will fail. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + * + * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. + */ + uint8_t PRNT_Device_Flush(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + #if defined(FDEV_SETUP_STREAM) || defined(__DOXYGEN__) + /** Creates a standard character stream for the given Printer Device instance so that it can be used with all the regular + * functions in the standard library that accept a \c FILE stream as a destination (e.g. \c fprintf()). The created + * stream is bidirectional and can be used for both input and output functions. + * + * Reading data from this stream is non-blocking, i.e. in most instances, complete strings cannot be read in by a single + * fetch, as the endpoint will not be ready at some point in the transmission, aborting the transfer. However, this may + * be used when the read data is processed byte-per-bye (via \c getc()) or when the user application will implement its own + * line buffering. + * + * \note The created stream can be given as \c stdout if desired to direct the standard output from all \c functions + * to the given Printer interface. + * \n\n + * + * \note This function is not available on all microcontroller architectures. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. + */ + void PRNT_Device_CreateStream(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + /** Identical to \ref PRNT_Device_CreateStream(), except that reads are blocking until the calling stream function terminates + * the transfer. While blocking, the USB and Printer service tasks are called repeatedly to maintain USB communications. + * + * \note This function is not available on all microcontroller architectures. + * + * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. + * \param[in,out] Stream Pointer to a FILE structure where the created stream should be placed. + */ + void PRNT_Device_CreateBlockingStream(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo, + FILE* const Stream) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Function Prototypes: */ + #if defined(__INCLUDE_FROM_PRINTER_DEVICE_C) + #if defined(FDEV_SETUP_STREAM) + static int PRNT_Device_putchar(char c, + FILE* Stream) ATTR_NON_NULL_PTR_ARG(2); + static int PRNT_Device_getchar(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); + static int PRNT_Device_getchar_Blocking(FILE* Stream) ATTR_NON_NULL_PTR_ARG(1); + #endif + + void PRNT_Device_Event_Stub(void) ATTR_CONST; + + void EVENT_PRNT_Device_SoftReset(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) + ATTR_WEAK ATTR_NON_NULL_PTR_ARG(1) ATTR_ALIAS(PRNT_Device_Event_Stub); + + #endif + + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c new file mode 100644 index 0000000..061f1b2 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c @@ -0,0 +1,502 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "../../Core/USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#define __INCLUDE_FROM_RNDIS_DRIVER +#define __INCLUDE_FROM_RNDIS_DEVICE_C +#include "RNDISClassDevice.h" + +static const uint32_t PROGMEM AdapterSupportedOIDList[] = + { + CPU_TO_LE32(OID_GEN_SUPPORTED_LIST), + CPU_TO_LE32(OID_GEN_PHYSICAL_MEDIUM), + CPU_TO_LE32(OID_GEN_HARDWARE_STATUS), + CPU_TO_LE32(OID_GEN_MEDIA_SUPPORTED), + CPU_TO_LE32(OID_GEN_MEDIA_IN_USE), + CPU_TO_LE32(OID_GEN_MAXIMUM_FRAME_SIZE), + CPU_TO_LE32(OID_GEN_MAXIMUM_TOTAL_SIZE), + CPU_TO_LE32(OID_GEN_LINK_SPEED), + CPU_TO_LE32(OID_GEN_TRANSMIT_BLOCK_SIZE), + CPU_TO_LE32(OID_GEN_RECEIVE_BLOCK_SIZE), + CPU_TO_LE32(OID_GEN_VENDOR_ID), + CPU_TO_LE32(OID_GEN_VENDOR_DESCRIPTION), + CPU_TO_LE32(OID_GEN_CURRENT_PACKET_FILTER), + CPU_TO_LE32(OID_GEN_MAXIMUM_TOTAL_SIZE), + CPU_TO_LE32(OID_GEN_MEDIA_CONNECT_STATUS), + CPU_TO_LE32(OID_GEN_XMIT_OK), + CPU_TO_LE32(OID_GEN_RCV_OK), + CPU_TO_LE32(OID_GEN_XMIT_ERROR), + CPU_TO_LE32(OID_GEN_RCV_ERROR), + CPU_TO_LE32(OID_GEN_RCV_NO_BUFFER), + CPU_TO_LE32(OID_802_3_PERMANENT_ADDRESS), + CPU_TO_LE32(OID_802_3_CURRENT_ADDRESS), + CPU_TO_LE32(OID_802_3_MULTICAST_LIST), + CPU_TO_LE32(OID_802_3_MAXIMUM_LIST_SIZE), + CPU_TO_LE32(OID_802_3_RCV_ERROR_ALIGNMENT), + CPU_TO_LE32(OID_802_3_XMIT_ONE_COLLISION), + CPU_TO_LE32(OID_802_3_XMIT_MORE_COLLISIONS), + }; + +void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) +{ + if (!(Endpoint_IsSETUPReceived())) + return; + + if (USB_ControlRequest.wIndex != RNDISInterfaceInfo->Config.ControlInterfaceNumber) + return; + + switch (USB_ControlRequest.bRequest) + { + case RNDIS_REQ_SendEncapsulatedCommand: + if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) + { + Endpoint_ClearSETUP(); + Endpoint_Read_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, USB_ControlRequest.wLength); + Endpoint_ClearIN(); + + RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo); + } + + break; + case RNDIS_REQ_GetEncapsulatedResponse: + if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE)) + { + RNDIS_Message_Header_t* MessageHeader = (RNDIS_Message_Header_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; + + if (!(MessageHeader->MessageLength)) + { + RNDISInterfaceInfo->State.RNDISMessageBuffer[0] = 0; + MessageHeader->MessageLength = CPU_TO_LE32(1); + } + + Endpoint_ClearSETUP(); + Endpoint_Write_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, le32_to_cpu(MessageHeader->MessageLength)); + Endpoint_ClearOUT(); + + MessageHeader->MessageLength = CPU_TO_LE32(0); + } + + break; + } +} + +bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) +{ + memset(&RNDISInterfaceInfo->State, 0x00, sizeof(RNDISInterfaceInfo->State)); + + RNDISInterfaceInfo->Config.DataINEndpoint.Type = EP_TYPE_BULK; + RNDISInterfaceInfo->Config.DataOUTEndpoint.Type = EP_TYPE_BULK; + RNDISInterfaceInfo->Config.NotificationEndpoint.Type = EP_TYPE_INTERRUPT; + + if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.DataINEndpoint, 1))) + return false; + + if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.DataOUTEndpoint, 1))) + return false; + + if (!(Endpoint_ConfigureEndpointTable(&RNDISInterfaceInfo->Config.NotificationEndpoint, 1))) + return false; + + return true; +} + +void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) +{ + if (USB_DeviceState != DEVICE_STATE_Configured) + return; + + Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.NotificationEndpoint.Address); + + if (Endpoint_IsINReady() && RNDISInterfaceInfo->State.ResponseReady) + { + USB_Request_Header_t Notification = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE), + .bRequest = RNDIS_NOTIF_ResponseAvailable, + .wValue = CPU_TO_LE16(0), + .wIndex = CPU_TO_LE16(0), + .wLength = CPU_TO_LE16(0), + }; + + Endpoint_Write_Stream_LE(&Notification, sizeof(USB_Request_Header_t), NULL); + + Endpoint_ClearIN(); + + RNDISInterfaceInfo->State.ResponseReady = false; + } +} + +void RNDIS_Device_ProcessRNDISControlMessage(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) +{ + /* Note: Only a single buffer is used for both the received message and its response to save SRAM. Because of + this, response bytes should be filled in order so that they do not clobber unread data in the buffer. */ + + RNDIS_Message_Header_t* MessageHeader = (RNDIS_Message_Header_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; + + switch (le32_to_cpu(MessageHeader->MessageType)) + { + 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 = CPU_TO_LE32(REMOTE_NDIS_INITIALIZE_CMPLT); + INITIALIZE_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_Initialize_Complete_t)); + INITIALIZE_Response->RequestId = INITIALIZE_Message->RequestId; + INITIALIZE_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS); + + INITIALIZE_Response->MajorVersion = CPU_TO_LE32(REMOTE_NDIS_VERSION_MAJOR); + INITIALIZE_Response->MinorVersion = CPU_TO_LE32(REMOTE_NDIS_VERSION_MINOR); + INITIALIZE_Response->DeviceFlags = CPU_TO_LE32(REMOTE_NDIS_DF_CONNECTIONLESS); + INITIALIZE_Response->Medium = CPU_TO_LE32(REMOTE_NDIS_MEDIUM_802_3); + INITIALIZE_Response->MaxPacketsPerTransfer = CPU_TO_LE32(1); + INITIALIZE_Response->MaxTransferSize = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) + ETHERNET_FRAME_SIZE_MAX); + INITIALIZE_Response->PacketAlignmentFactor = CPU_TO_LE32(0); + INITIALIZE_Response->AFListOffset = CPU_TO_LE32(0); + INITIALIZE_Response->AFListSize = CPU_TO_LE32(0); + + RNDISInterfaceInfo->State.CurrRNDISState = RNDIS_Initialized; + break; + case REMOTE_NDIS_HALT_MSG: + RNDISInterfaceInfo->State.ResponseReady = false; + + MessageHeader->MessageLength = CPU_TO_LE32(0); + + RNDISInterfaceInfo->State.CurrRNDISState = RNDIS_Uninitialized; + 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 = CPU_TO_LE32(QUERY_Message->Oid); + + void* QueryData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) + + le32_to_cpu(QUERY_Message->InformationBufferOffset)]; + void* ResponseData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Query_Complete_t)]; + uint16_t ResponseSize; + + QUERY_Response->MessageType = CPU_TO_LE32(REMOTE_NDIS_QUERY_CMPLT); + + if (RNDIS_Device_ProcessNDISQuery(RNDISInterfaceInfo, Query_Oid, QueryData, le32_to_cpu(QUERY_Message->InformationBufferLength), + ResponseData, &ResponseSize)) + { + QUERY_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS); + QUERY_Response->MessageLength = cpu_to_le32(sizeof(RNDIS_Query_Complete_t) + ResponseSize); + + QUERY_Response->InformationBufferLength = CPU_TO_LE32(ResponseSize); + QUERY_Response->InformationBufferOffset = CPU_TO_LE32(sizeof(RNDIS_Query_Complete_t) - sizeof(RNDIS_Message_Header_t)); + } + else + { + QUERY_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_NOT_SUPPORTED); + QUERY_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_Query_Complete_t)); + + QUERY_Response->InformationBufferLength = CPU_TO_LE32(0); + QUERY_Response->InformationBufferOffset = CPU_TO_LE32(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 = le32_to_cpu(SET_Message->Oid); + + SET_Response->MessageType = CPU_TO_LE32(REMOTE_NDIS_SET_CMPLT); + SET_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_Set_Complete_t)); + SET_Response->RequestId = SET_Message->RequestId; + + void* SetData = &RNDISInterfaceInfo->State.RNDISMessageBuffer[sizeof(RNDIS_Message_Header_t) + + le32_to_cpu(SET_Message->InformationBufferOffset)]; + + SET_Response->Status = RNDIS_Device_ProcessNDISSet(RNDISInterfaceInfo, SET_Oid, SetData, + le32_to_cpu(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 = CPU_TO_LE32(REMOTE_NDIS_RESET_CMPLT); + RESET_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_Reset_Complete_t)); + RESET_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS); + RESET_Response->AddressingReset = CPU_TO_LE32(0); + + 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 = + (RNDIS_KeepAlive_Complete_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer; + + KEEPALIVE_Response->MessageType = CPU_TO_LE32(REMOTE_NDIS_KEEPALIVE_CMPLT); + KEEPALIVE_Response->MessageLength = CPU_TO_LE32(sizeof(RNDIS_KeepAlive_Complete_t)); + KEEPALIVE_Response->RequestId = KEEPALIVE_Message->RequestId; + KEEPALIVE_Response->Status = CPU_TO_LE32(REMOTE_NDIS_STATUS_SUCCESS); + + break; + } +} + +static bool RNDIS_Device_ProcessNDISQuery(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, + const uint32_t OId, + void* const QueryData, + const uint16_t QuerySize, + void* ResponseData, + uint16_t* const ResponseSize) +{ + (void)QueryData; + (void)QuerySize; + + switch (OId) + { + 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) = CPU_TO_LE32(0); + + return true; + case OID_GEN_HARDWARE_STATUS: + *ResponseSize = sizeof(uint32_t); + + *((uint32_t*)ResponseData) = CPU_TO_LE32(NDIS_HardwareStatus_Ready); + + return true; + case OID_GEN_MEDIA_SUPPORTED: + case OID_GEN_MEDIA_IN_USE: + *ResponseSize = sizeof(uint32_t); + + *((uint32_t*)ResponseData) = CPU_TO_LE32(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) = CPU_TO_LE32(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) = CPU_TO_LE32(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) = CPU_TO_LE32(REMOTE_NDIS_MEDIA_STATE_CONNECTED); + + return true; + case OID_GEN_LINK_SPEED: + *ResponseSize = sizeof(uint32_t); + + /* Indicate 10Mb/s link speed */ + *((uint32_t*)ResponseData) = CPU_TO_LE32(100000); + + return true; + 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) = CPU_TO_LE32(1); + + return true; + case OID_GEN_CURRENT_PACKET_FILTER: + *ResponseSize = sizeof(uint32_t); + + *((uint32_t*)ResponseData) = cpu_to_le32(RNDISInterfaceInfo->State.CurrPacketFilter); + + return true; + case OID_GEN_XMIT_OK: + case OID_GEN_RCV_OK: + case OID_GEN_XMIT_ERROR: + case OID_GEN_RCV_ERROR: + case OID_GEN_RCV_NO_BUFFER: + case OID_802_3_RCV_ERROR_ALIGNMENT: + 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) = CPU_TO_LE32(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) = CPU_TO_LE32(RNDIS_MESSAGE_BUFFER_SIZE + ETHERNET_FRAME_SIZE_MAX); + + return true; + default: + return false; + } +} + +static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, + const uint32_t OId, + const void* SetData, + const uint16_t SetSize) +{ + (void)SetSize; + + switch (OId) + { + case OID_GEN_CURRENT_PACKET_FILTER: + RNDISInterfaceInfo->State.CurrPacketFilter = le32_to_cpu(*((uint32_t*)SetData)); + RNDISInterfaceInfo->State.CurrRNDISState = (RNDISInterfaceInfo->State.CurrPacketFilter) ? RNDIS_Data_Initialized : RNDIS_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; + } +} + +bool RNDIS_Device_IsPacketReceived(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || + (RNDISInterfaceInfo->State.CurrRNDISState != RNDIS_Data_Initialized)) + { + return false; + } + + Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpoint.Address); + return Endpoint_IsOUTReceived(); +} + +uint8_t RNDIS_Device_ReadPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, + void* Buffer, + uint16_t* const PacketLength) +{ + if ((USB_DeviceState != DEVICE_STATE_Configured) || + (RNDISInterfaceInfo->State.CurrRNDISState != RNDIS_Data_Initialized)) + { + return ENDPOINT_RWSTREAM_DeviceDisconnected; + } + + Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataOUTEndpoint.Address); + + *PacketLength = 0; + + if (!(Endpoint_IsOUTReceived())) + return ENDPOINT_RWSTREAM_NoError; + + RNDIS_Packet_Message_t RNDISPacketHeader; + Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL); + + if (le32_to_cpu(RNDISPacketHeader.DataLength) > ETHERNET_FRAME_SIZE_MAX) + { + Endpoint_StallTransaction(); + + return RNDIS_ERROR_LOGICAL_CMD_FAILED; + } + + *PacketLength = (uint16_t)le32_to_cpu(RNDISPacketHeader.DataLength); + + Endpoint_Read_Stream_LE(Buffer, *PacketLength, NULL); + Endpoint_ClearOUT(); + + return ENDPOINT_RWSTREAM_NoError; +} + +uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, + void* Buffer, + const uint16_t PacketLength) +{ + uint8_t ErrorCode; + + if ((USB_DeviceState != DEVICE_STATE_Configured) || + (RNDISInterfaceInfo->State.CurrRNDISState != RNDIS_Data_Initialized)) + { + return ENDPOINT_RWSTREAM_DeviceDisconnected; + } + + Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.DataINEndpoint.Address); + + if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError) + return ErrorCode; + + RNDIS_Packet_Message_t RNDISPacketHeader; + + memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t)); + + RNDISPacketHeader.MessageType = CPU_TO_LE32(REMOTE_NDIS_PACKET_MSG); + RNDISPacketHeader.MessageLength = cpu_to_le32(sizeof(RNDIS_Packet_Message_t) + PacketLength); + RNDISPacketHeader.DataOffset = CPU_TO_LE32(sizeof(RNDIS_Packet_Message_t) - sizeof(RNDIS_Message_Header_t)); + RNDISPacketHeader.DataLength = cpu_to_le32(PacketLength); + + Endpoint_Write_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL); + Endpoint_Write_Stream_LE(Buffer, PacketLength, NULL); + Endpoint_ClearIN(); + + return ENDPOINT_RWSTREAM_NoError; +} + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h new file mode 100644 index 0000000..4ba729a --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h @@ -0,0 +1,203 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Device mode driver for the library USB RNDIS Class driver. + * + * Device mode driver for the library USB RNDIS Class driver. + * + * \note This file should not be included directly. It is automatically included as needed by the USB module driver + * dispatch header located in LUFA/Drivers/USB.h. + */ + +/** \ingroup Group_USBClassRNDIS + * \defgroup Group_USBClassRNDISDevice RNDIS Class Device Mode Driver + * + * \section Sec_USBClassRNDISDevice_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassRNDISDevice_ModDescription Module Description + * Device Mode USB Class driver framework interface, for the RNDIS USB Class driver. + * + * @{ + */ + +#ifndef _RNDIS_CLASS_DEVICE_H_ +#define _RNDIS_CLASS_DEVICE_H_ + + /* Includes: */ + #include "../../USB.h" + #include "../Common/RNDISClassCommon.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_RNDIS_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* 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 + * within the user application, and passed to each of the RNDIS class driver functions as the + * \c RNDISInterfaceInfo parameter. This stores each RNDIS interface's configuration and state information. + */ + typedef struct + { + struct + { + uint8_t ControlInterfaceNumber; /**< Interface number of the RNDIS control interface within the device. */ + + USB_Endpoint_Table_t DataINEndpoint; /**< Data IN endpoint configuration table. */ + USB_Endpoint_Table_t DataOUTEndpoint; /**< Data OUT endpoint configuration table. */ + USB_Endpoint_Table_t NotificationEndpoint; /**< Notification IN Endpoint configuration table. */ + + 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 + * must be set or the interface will fail to enumerate and operate correctly. + */ + struct + { + uint8_t RNDISMessageBuffer[RNDIS_MESSAGE_BUFFER_SIZE]; /**< Buffer to hold RNDIS messages to and from the host, + * managed by the class driver. + */ + bool ResponseReady; /**< Internal flag indicating if a RNDIS message is waiting to be returned to the host. */ + uint8_t CurrRNDISState; /**< Current RNDIS state of the adapter, a value from the \ref RNDIS_States_t enum. */ + uint32_t CurrPacketFilter; /**< Current packet filter mode, used internally by the class driver. */ + } 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_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 + * containing the given RNDIS interface is selected. + * + * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state. + * + * \return Boolean \c true if the endpoints were successfully configured, \c false otherwise. + */ + bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + + /** Processes incoming control requests from the host, that are directed to the given RNDIS class interface. This should be + * linked to the library \ref EVENT_USB_Device_ControlRequest() 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 RNDIS 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); + + /** Determines if a packet is currently waiting for the device to read in and process. + * + * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or the + * call will fail. + * + * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class configuration and state. + * + * \return Boolean \c true if a packet is waiting to be read in by the host, \c false otherwise. + */ + bool RNDIS_Device_IsPacketReceived(USB_ClassInfo_RNDIS_Device_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 device in the nominated buffer. + * + * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or the + * call will fail. + * + * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class configuration and state. + * \param[out] Buffer Pointer to a buffer where the packer data is to be written to. + * \param[out] PacketLength Pointer to where the length in bytes of the read packet is to be stored. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t RNDIS_Device_ReadPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, + void* Buffer, + uint16_t* const PacketLength) ATTR_NON_NULL_PTR_ARG(1); + + /** Sends the given packet to the attached RNDIS device, after adding a RNDIS packet message header. + * + * \pre This function must only be called when the Device state machine is in the \ref DEVICE_STATE_Configured state or the + * call will fail. + * + * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing an RNDIS Class configuration and state. + * \param[in] Buffer Pointer to a buffer where the packer data is to be read from. + * \param[in] PacketLength Length in bytes of the packet to send. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t RNDIS_Device_SendPacket(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, + void* Buffer, + const uint16_t PacketLength) ATTR_NON_NULL_PTR_ARG(1); + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Function Prototypes: */ + #if defined(__INCLUDE_FROM_RNDIS_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, + const uint32_t OId, + void* const QueryData, + const uint16_t QuerySize, + void* ResponseData, + uint16_t* const ResponseSize) ATTR_NON_NULL_PTR_ARG(1) + ATTR_NON_NULL_PTR_ARG(5) ATTR_NON_NULL_PTR_ARG(6); + static bool RNDIS_Device_ProcessNDISSet(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo, + const uint32_t OId, + const void* SetData, + 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/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/HIDClass.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/HIDClass.h new file mode 100644 index 0000000..d2eea75 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/HIDClass.h @@ -0,0 +1,82 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB HID Class driver. + * + * Master include file for the library USB HID Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassHID HID Class Driver + * \brief USB class driver for the USB-IF Human Interface Device (HID) class standard. + * + * \section Sec_USBClassHID_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/HIDClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * - LUFA/Drivers/USB/Class/Host/HIDClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * - LUFA/Drivers/USB/Class/Host/HIDParser.c (Makefile source module name: LUFA_SRC_USB) + * + * \section Sec_USBClassHID_ModDescription 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 + * 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 + * Hosts or Devices using the USB HID Class. + * + * @{ + */ + +#ifndef _HID_CLASS_H_ +#define _HID_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_HID_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_DEVICE) + #include "Device/HIDClassDevice.h" + #endif + + #if defined(USB_CAN_BE_HOST) + #include "Host/HIDClassHost.h" + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/MIDIClass.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/MIDIClass.h new file mode 100644 index 0000000..7e6ba1c --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/MIDIClass.h @@ -0,0 +1,84 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB MIDI Class driver. + * + * Master include file for the library USB MIDI Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassMIDI MIDI Class Driver + * \brief USB class driver for the USB-IF MIDI class standard. + * + * \section Sec_USBClassMIDI_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/MIDIClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * - LUFA/Drivers/USB/Class/Host/MIDIClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassMIDI_ModDescription Module Description + * MIDI Class Driver module. This module contains an internal implementation of the USB MIDI Class, for both Device + * and Host USB modes. User applications can use this class driver instead of implementing the MIDI 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 + * Hosts or Devices using the USB MIDI Class. + * + * \note The USB MIDI class is actually a special case of the regular Audio class, thus this module depends on + * structure definitions from the \ref Group_USBClassAudioDevice class driver module. + * + * @{ + */ + +#ifndef _MIDI_CLASS_H_ +#define _MIDI_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_MIDI_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_DEVICE) + #include "Device/MIDIClassDevice.h" + #endif + + #if defined(USB_CAN_BE_HOST) + #include "Host/MIDIClassHost.h" + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/MassStorageClass.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/MassStorageClass.h new file mode 100644 index 0000000..79a0521 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/MassStorageClass.h @@ -0,0 +1,81 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB Mass Storage Class driver. + * + * Master include file for the library USB Mass Storage Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassMS Mass Storage Class Driver + * \brief USB class driver for the USB-IF Bulk-Only Transport Mass Storage class standard. + * + * \section Sec_USBClassMS_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * - LUFA/Drivers/USB/Class/Host/MassStorageClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassMS_ModDescription Module Description + * Mass Storage Class Driver module. This module contains an internal implementation of the USB Mass Storage Class, for both + * Device and Host USB modes. User applications can use this class driver instead of implementing the Mass Storage 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 + * Hosts or Devices using the USB Mass Storage Class. + * + * @{ + */ + +#ifndef _MS_CLASS_H_ +#define _MS_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_MS_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_DEVICE) + #include "Device/MassStorageClassDevice.h" + #endif + + #if defined(USB_CAN_BE_HOST) + #include "Host/MassStorageClassHost.h" + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/PrinterClass.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/PrinterClass.h new file mode 100644 index 0000000..91121b5 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/PrinterClass.h @@ -0,0 +1,83 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB Printer Class driver. + * + * Master include file for the library USB Printer Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassPrinter Printer Class Driver + * \brief USB class driver for the USB-IF Printer class standard. + * + * \section Sec_USBClassPrinter_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Host/PrinterClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * - LUFA/Drivers/USB/Class/Host/PrinterClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassPrinter_ModDescription Module Description + * Printer Class Driver module. This module contains an internal implementation of the USB Printer Class, for the base + * USB Printer transport layer for USB Host mode only. Note that printers are free to implement whatever printer language + * they choose on top of this (e.g. Postscript), and so this driver exposes low level data transport functions only rather + * than high level raster or text functions. User applications can use this class driver instead of implementing the Printer + * 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 + * Devices using the USB Printer Class. + * + * @{ + */ + +#ifndef _PRINTER_CLASS_H_ +#define _PRINTER_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_PRINTER_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_DEVICE) + #include "Device/PrinterClassDevice.h" + #endif + + #if defined(USB_CAN_BE_HOST) + #include "Host/PrinterClassHost.h" + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/RNDISClass.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/RNDISClass.h new file mode 100644 index 0000000..1555f0d --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/RNDISClass.h @@ -0,0 +1,81 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB RNDIS Class driver. + * + * Master include file for the library USB RNDIS Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassRNDIS RNDIS (Networking) Class Driver + * \brief USB class driver for the Microsoft Remote Network Driver Interface Specification (RNDIS) class standard. + * + * \section Sec_USBClassRNDIS_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c (Makefile source module name: LUFA_SRC_USBCLASS) + * - LUFA/Drivers/USB/Class/Host/RNDISClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassRNDIS_ModDescription Module Description + * RNDIS Class Driver module. This module contains an internal implementation of the Microsoft USB RNDIS Networking + * Class, for both Device and Host USB modes. User applications can use this class driver instead of implementing the + * RNDIS 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 + * Hosts using the USB RNDIS Class. + * + * @{ + */ + +#ifndef _RNDIS_CLASS_H_ +#define _RNDIS_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_RNDIS_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_DEVICE) + #include "Device/RNDISClassDevice.h" + #endif + + #if defined(USB_CAN_BE_HOST) + #include "Host/RNDISClassHost.h" + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/StillImageClass.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/StillImageClass.h new file mode 100644 index 0000000..f2ec37b --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Class/StillImageClass.h @@ -0,0 +1,76 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB Still Image Class driver. + * + * Master include file for the library USB Still Image Class driver, for both host and device modes, where available. + * + * This file should be included in all user projects making use of this optional class driver, instead of + * including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories. + */ + +/** \ingroup Group_USBClassDrivers + * \defgroup Group_USBClassSI Still Image Class Driver + * \brief USB class driver for the USB-IF Still Image (PIMA-compliant) class standard. + * + * \section Sec_USBClassSI_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Class/Host/StillImageClassHost.c (Makefile source module name: LUFA_SRC_USBCLASS) + * + * \section Sec_USBClassSI_ModDescription Module Description + * Still Image Class Driver module. This module contains an internal implementation of the USB Still Image Class, + * for USB Host mode only. User applications can use this class driver instead of implementing the Still Image 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 + * Devices using the USB Still Image Class. + * + * @{ + */ + +#ifndef _SI_CLASS_H_ +#define _SI_CLASS_H_ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + #define __INCLUDE_FROM_SI_DRIVER + + /* Includes: */ + #include "../Core/USBMode.h" + + #if defined(USB_CAN_BE_HOST) + #include "Host/StillImageClassHost.h" + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/ConfigDescriptors.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/ConfigDescriptors.c new file mode 100644 index 0000000..da6812a --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/ConfigDescriptors.c @@ -0,0 +1,146 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "ConfigDescriptors.h" + +#if defined(USB_CAN_BE_HOST) +uint8_t USB_Host_GetDeviceConfigDescriptor(const uint8_t ConfigNumber, + uint16_t* const ConfigSizePtr, + void* const BufferPtr, + const uint16_t BufferSize) +{ + uint8_t ErrorCode; + uint8_t ConfigHeader[sizeof(USB_Descriptor_Configuration_Header_t)]; + + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), + .bRequest = REQ_GetDescriptor, + .wValue = ((DTYPE_Configuration << 8) | (ConfigNumber - 1)), + .wIndex = 0, + .wLength = sizeof(USB_Descriptor_Configuration_Header_t), + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + if ((ErrorCode = USB_Host_SendControlRequest(ConfigHeader)) != HOST_SENDCONTROL_Successful) + return ErrorCode; + + *ConfigSizePtr = le16_to_cpu(DESCRIPTOR_PCAST(ConfigHeader, USB_Descriptor_Configuration_Header_t)->TotalConfigurationSize); + + 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 + +void USB_GetNextDescriptorOfType(uint16_t* const BytesRem, + void** const CurrConfigLoc, + const uint8_t Type) +{ + while (*BytesRem) + { + USB_GetNextDescriptor(BytesRem, CurrConfigLoc); + + if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type) + return; + } +} + +void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem, + void** const CurrConfigLoc, + const uint8_t Type, + const uint8_t BeforeType) +{ + while (*BytesRem) + { + USB_GetNextDescriptor(BytesRem, CurrConfigLoc); + + if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type) + { + return; + } + else if (DESCRIPTOR_TYPE(*CurrConfigLoc) == BeforeType) + { + *BytesRem = 0; + return; + } + } +} + +void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem, + void** const CurrConfigLoc, + const uint8_t Type, + 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) + { + *CurrConfigLoc = PrevDescLoc; + *BytesRem = PrevBytesRem; + } + + return ErrorCode; + } + } + + return DESCRIPTOR_SEARCH_COMP_EndOfDescriptor; +} + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/ConfigDescriptors.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/ConfigDescriptors.h new file mode 100644 index 0000000..b4a9788 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/ConfigDescriptors.h @@ -0,0 +1,287 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB Configuration Descriptor definitions. + * \copydetails Group_ConfigDescriptorParser + * + * \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_StdDescriptors + * \defgroup Group_ConfigDescriptorParser Configuration Descriptor Parser + * \brief USB Configuration Descriptor definitions. + * + * This section of the library gives a friendly API which can be used in host applications to easily + * parse an attached device's configuration descriptor so that endpoint, interface and other descriptor + * data can be extracted and used as needed. + * + * @{ + */ + +#ifndef __CONFIGDESCRIPTORS_H__ +#define __CONFIGDESCRIPTORS_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + #include "HostStandardReq.h" + #include "StdDescriptors.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /** Casts a pointer to a descriptor inside the configuration descriptor into a pointer to the given + * descriptor type. + * + * Usage Example: + * \code + * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header + * USB_Descriptor_Configuration_Header_t* ConfigHeaderPtr = DESCRIPTOR_PCAST(CurrDescriptor, + * USB_Descriptor_Configuration_Header_t); + * + * // Can now access elements of the configuration header struct using the -> indirection operator + * \endcode + */ + #define DESCRIPTOR_PCAST(DescriptorPtr, Type) ((Type*)(DescriptorPtr)) + + /** Casts a pointer to a descriptor inside the configuration descriptor into the given descriptor + * type (as an actual struct instance rather than a pointer to a struct). + * + * Usage Example: + * \code + * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header + * USB_Descriptor_Configuration_Header_t ConfigHeader = DESCRIPTOR_CAST(CurrDescriptor, + * USB_Descriptor_Configuration_Header_t); + * + * // Can now access elements of the configuration header struct using the . operator + * \endcode + */ + #define DESCRIPTOR_CAST(DescriptorPtr, Type) (*DESCRIPTOR_PCAST(DescriptorPtr, Type)) + + /** Returns the descriptor's type, expressed as the 8-bit type value in the header of the descriptor. + * This value's meaning depends on the descriptor's placement in the descriptor, but standard type + * values can be accessed in the \ref USB_DescriptorTypes_t enum. + */ + #define DESCRIPTOR_TYPE(DescriptorPtr) DESCRIPTOR_PCAST(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_PCAST(DescriptorPtr, USB_Descriptor_Header_t)->Size + + /* Type Defines: */ + /** Type define for a Configuration Descriptor comparator function (function taking a pointer to an array + * of type void, returning a uint8_t value). + * + * \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 + { + HOST_GETCONFIG_Successful = 0, /**< No error occurred while retrieving the configuration descriptor. */ + HOST_GETCONFIG_DeviceDisconnect = 1, /**< The attached device was disconnected while retrieving the configuration + * descriptor. + */ + HOST_GETCONFIG_PipeError = 2, /**< An error occurred in the pipe while sending the request. */ + HOST_GETCONFIG_SetupStalled = 3, /**< The attached device stalled the request to retrieve the configuration + * descriptor. + */ + HOST_GETCONFIG_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */ + HOST_GETCONFIG_BuffOverflow = 5, /**< The device's configuration descriptor is too large to fit into the allocated + * buffer. + */ + 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 + { + DESCRIPTOR_SEARCH_Found = 0, /**< Current descriptor matches comparator criteria. */ + DESCRIPTOR_SEARCH_Fail = 1, /**< No further descriptor could possibly match criteria, fail the search. */ + DESCRIPTOR_SEARCH_NotFound = 2, /**< Current descriptor does not match comparator criteria. */ + }; + + /** Enum for return values of \ref USB_GetNextDescriptorComp(). */ + enum DSearch_Comp_Return_ErrorCodes_t + { + DESCRIPTOR_SEARCH_COMP_Found = 0, /**< Configuration descriptor now points to descriptor which matches + * search criteria of the given comparator function. */ + DESCRIPTOR_SEARCH_COMP_Fail = 1, /**< Comparator function returned \ref 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. + * + * \param[in] ConfigNumber Device configuration descriptor number to fetch from the device (usually set to 1 for + * single configuration devices). + * \param[in,out] ConfigSizePtr Pointer to a location for storing the retrieved configuration descriptor size. + * \param[out] BufferPtr Pointer to the buffer for storing the configuration descriptor data. + * \param[out] BufferSize Size of the allocated buffer where the configuration descriptor is to be stored. + * + * \return A value from the \ref USB_Host_GetConfigDescriptor_ErrorCodes_t enum. + */ + uint8_t USB_Host_GetDeviceConfigDescriptor(const uint8_t ConfigNumber, + uint16_t* const ConfigSizePtr, + void* const BufferPtr, + const uint16_t BufferSize) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3); + + /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value. + * The bytes remaining value is automatically decremented. + * + * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor. + * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor. + * \param[in] Type Descriptor type value to search for. + */ + void USB_GetNextDescriptorOfType(uint16_t* const BytesRem, + void** const CurrConfigLoc, + const uint8_t Type) + ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value, + * which must come before a descriptor of the second given type value. If the BeforeType type + * descriptor is reached first, the number of bytes remaining to process is set to zero and the + * function exits. The bytes remaining value is automatically decremented. + * + * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor. + * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor. + * \param[in] Type Descriptor type value to search for. + * \param[in] BeforeType Descriptor type value which must not be reached before the given Type descriptor. + */ + void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem, + void** const CurrConfigLoc, + const uint8_t Type, + const uint8_t BeforeType) + ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value, + * which must come after a descriptor of the second given type value. The bytes remaining value is + * automatically decremented. + * + * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor. + * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor. + * \param[in] Type Descriptor type value to search for. + * \param[in] AfterType Descriptor type value which must be reached before the given Type descriptor. + */ + void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem, + void** const CurrConfigLoc, + const uint8_t Type, + const uint8_t AfterType) + ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); + + /** Searches for the next descriptor in the given configuration descriptor using a pre-made comparator + * function. The routine updates the position and remaining configuration descriptor bytes values + * automatically. If a comparator routine fails a search, the descriptor pointer is retreated back + * so that the next descriptor search invocation will start from the descriptor which first caused the + * original search to fail. This behavior allows for one comparator to be used immediately after another + * has failed, starting the second search from the descriptor which failed the first. + * + * Comparator functions should be standard functions which accept a pointer to the header of the current + * descriptor inside the configuration descriptor which is being compared, and should return a value from + * the \ref DSearch_Return_ErrorCodes_t enum as a uint8_t value. + * + * \note This function is available in USB Host mode only. + * + * \param[in,out] BytesRem Pointer to an int storing the remaining bytes in the configuration descriptor. + * \param[in,out] CurrConfigLoc Pointer to the current position in the configuration descriptor. + * \param[in] ComparatorRoutine Name of the comparator search function to use on the configuration descriptor. + * + * \return Value of one of the members of the \ref DSearch_Comp_Return_ErrorCodes_t enum. + * + * Usage Example: + * \code + * uint8_t EndpointSearcher(void* CurrentDescriptor); // Comparator Prototype + * + * uint8_t EndpointSearcher(void* CurrentDescriptor) + * { + * if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint) + * return DESCRIPTOR_SEARCH_Found; + * else + * return DESCRIPTOR_SEARCH_NotFound; + * } + * + * //... + * + * // After retrieving configuration descriptor: + * if (USB_Host_GetNextDescriptorComp(&BytesRemaining, &CurrentConfigLoc, EndpointSearcher) == + * Descriptor_Search_Comp_Found) + * { + * // Do something with the endpoint descriptor + * } + * \endcode + */ + uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, + void** const CurrConfigLoc, + ConfigComparatorPtr_t const ComparatorRoutine) ATTR_NON_NULL_PTR_ARG(1) + ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3); + + /* Inline Functions: */ + /** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then + points to the next sub-descriptor. The bytes remaining value is automatically decremented. + * + * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor. + * \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); + static inline void USB_GetNextDescriptor(uint16_t* const BytesRem, + void** CurrConfigLoc) + { + uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size; + + if (*BytesRem < CurrDescriptorSize) + CurrDescriptorSize = *BytesRem; + + *CurrConfigLoc = (void*)((uintptr_t)*CurrConfigLoc + CurrDescriptorSize); + *BytesRem -= CurrDescriptorSize; + } + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Device.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Device.h new file mode 100644 index 0000000..10d739f --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Device.h @@ -0,0 +1,159 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common USB Device definitions for all architectures. + * \copydetails Group_Device + * + * \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_Device Device Management + * \brief USB Device management definitions for USB device mode. + * + * USB Device mode related definitions common to all architectures. This module contains definitions which + * are used when the USB controller is initialized in device mode. + * + * @{ + */ + +#ifndef __USBDEVICE_H__ +#define __USBDEVICE_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + #include "StdDescriptors.h" + #include "USBInterrupt.h" + #include "Endpoint.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* Enums: */ + /** Enum for the various states of the USB Device state machine. Only some states are + * implemented in the LUFA library - other states are left to the user to implement. + * + * For information on each possible USB device state, refer to the USB 2.0 specification. + * + * \see \ref USB_DeviceState, which stores the current device state machine state. + */ + enum USB_Device_States_t + { + DEVICE_STATE_Unattached = 0, /**< Internally implemented by the library. This state indicates + * that the device is not currently connected to a host. + */ + DEVICE_STATE_Powered = 1, /**< Internally implemented by the library. This state indicates + * that the device is connected to a host, but enumeration has not + * yet begun. + */ + DEVICE_STATE_Default = 2, /**< Internally implemented by the library. This state indicates + * that the device's USB bus has been reset by the host and it is + * now waiting for the host to begin the enumeration process. + */ + DEVICE_STATE_Addressed = 3, /**< Internally implemented by the library. This state indicates + * that the device has been addressed by the USB Host, but is not + * yet configured. + */ + DEVICE_STATE_Configured = 4, /**< May be implemented by the user project. This state indicates + * that the device has been enumerated by the host and is ready + * for USB communications to begin. + */ + DEVICE_STATE_Suspended = 5, /**< May be implemented by the user project. This state indicates + * that the USB bus has been suspended by the host, and the device + * should power down to a minimal power level until the bus is + * resumed. + */ + }; + + /* 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 + * 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 + * 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. + * \param[in] wIndex The language ID of the string to return if the \c wValue type indicates + * \ref DTYPE_String, otherwise zero for standard descriptors, or as defined in a + * class-specific standards. + * \param[out] DescriptorAddress Pointer to the descriptor in memory. This should be set by the routine to + * the address of the descriptor. + * \param[out] DescriptorMemorySpace A value from the \ref USB_DescriptorMemorySpaces_t enum to indicate the memory + * space in which the descriptor is stored. This parameter does not exist when one + * of the \c USE_*_DESCRIPTORS compile time options is used, or on architectures which + * use a unified address space. + * + * \note By default, the library expects all descriptors to be located in flash memory via the \c 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 \c USE_RAM_DESCRIPTORS or the + * \c USE_EEPROM_DESCRIPTORS tokens may be defined in the project makefile and passed to the compiler by the -D + * switch. + * + * \return Size in bytes of the descriptor if it exists, zero or \ref NO_DESCRIPTOR otherwise. + */ + uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress + #if (defined(ARCH_HAS_MULTI_ADDRESS_SPACE) || defined(__DOXYGEN__)) && \ + !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) + , uint8_t* const DescriptorMemorySpace + #endif + ) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); + + /* Architecture Includes: */ + #if (ARCH == ARCH_AVR8) + #include "AVR8/Device_AVR8.h" + #elif (ARCH == ARCH_UC3) + #include "UC3/Device_UC3.h" + #elif (ARCH == ARCH_XMEGA) + #include "XMEGA/Device_XMEGA.h" + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/DeviceStandardReq.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/DeviceStandardReq.c new file mode 100644 index 0000000..382083e --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/DeviceStandardReq.c @@ -0,0 +1,380 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#define __INCLUDE_FROM_DEVICESTDREQ_C +#include "DeviceStandardReq.h" + +uint8_t USB_Device_ConfigurationNumber; + +#if !defined(NO_DEVICE_SELF_POWER) +bool USB_Device_CurrentlySelfPowered; +#endif + +#if !defined(NO_DEVICE_REMOTE_WAKEUP) +bool USB_Device_RemoteWakeupEnabled; +#endif + +void USB_Device_ProcessControlRequest(void) +{ + #if defined(ARCH_BIG_ENDIAN) + USB_ControlRequest.bmRequestType = Endpoint_Read_8(); + USB_ControlRequest.bRequest = Endpoint_Read_8(); + USB_ControlRequest.wValue = Endpoint_Read_16_LE(); + USB_ControlRequest.wIndex = Endpoint_Read_16_LE(); + USB_ControlRequest.wLength = Endpoint_Read_16_LE(); + #else + uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest; + + for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++) + *(RequestHeader++) = Endpoint_Read_8(); + #endif + + EVENT_USB_Device_ControlRequest(); + + if (Endpoint_IsSETUPReceived()) + { + uint8_t bmRequestType = USB_ControlRequest.bmRequestType; + + switch (USB_ControlRequest.bRequest) + { + case REQ_GetStatus: + if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) || + (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT))) + { + USB_Device_GetStatus(); + } + + break; + case REQ_ClearFeature: + case REQ_SetFeature: + if ((bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) || + (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_ENDPOINT))) + { + USB_Device_ClearSetFeature(); + } + + break; + case REQ_SetAddress: + if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) + USB_Device_SetAddress(); + + break; + case REQ_GetDescriptor: + if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) || + (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE))) + { + USB_Device_GetDescriptor(); + } + + break; + case REQ_GetConfiguration: + if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) + USB_Device_GetConfiguration(); + + break; + case REQ_SetConfiguration: + if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) + USB_Device_SetConfiguration(); + + break; + + default: + break; + } + } + + if (Endpoint_IsSETUPReceived()) + { + Endpoint_ClearSETUP(); + Endpoint_StallTransaction(); + } +} + +static void USB_Device_SetAddress(void) +{ + uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F); + + USB_Device_SetDeviceAddress(DeviceAddress); + + Endpoint_ClearSETUP(); + + Endpoint_ClearStatusStage(); + + while (!(Endpoint_IsINReady())); + + USB_Device_EnableDeviceAddress(DeviceAddress); + + USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default; +} + +static void USB_Device_SetConfiguration(void) +{ + #if defined(FIXED_NUM_CONFIGURATIONS) + if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS) + return; + #else + USB_Descriptor_Device_t* DevDescriptorPtr; + + #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) + #if defined(USE_FLASH_DESCRIPTORS) + #define MemoryAddressSpace MEMSPACE_FLASH + #elif defined(USE_EEPROM_DESCRIPTORS) + #define MemoryAddressSpace MEMSPACE_EEPROM + #elif defined(USE_SRAM_DESCRIPTORS) + #define MemoryAddressSpace MEMSPACE_SRAM + #else + uint8_t MemoryAddressSpace; + #endif + #endif + + if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DevDescriptorPtr + #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ + !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) + , &MemoryAddressSpace + #endif + ) == NO_DESCRIPTOR) + { + return; + } + + #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) + if (MemoryAddressSpace == MEMSPACE_FLASH) + { + if (((uint8_t)USB_ControlRequest.wValue > pgm_read_byte_far(&DevDescriptorPtr->NumberOfConfigurations))) + return; + } + else if (MemoryAddressSpace == MEMSPACE_EEPROM) + { + if (((uint8_t)USB_ControlRequest.wValue > eeprom_read_byte(&DevDescriptorPtr->NumberOfConfigurations))) + return; + } + else + { + if ((uint8_t)USB_ControlRequest.wValue > DevDescriptorPtr->NumberOfConfigurations) + return; + } + #else + if ((uint8_t)USB_ControlRequest.wValue > DevDescriptorPtr->NumberOfConfigurations) + return; + #endif + #endif + + Endpoint_ClearSETUP(); + + USB_Device_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue; + + Endpoint_ClearStatusStage(); + + if (USB_Device_ConfigurationNumber) + USB_DeviceState = DEVICE_STATE_Configured; + else + USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered; + + EVENT_USB_Device_ConfigurationChanged(); +} + +static void USB_Device_GetConfiguration(void) +{ + Endpoint_ClearSETUP(); + + Endpoint_Write_8(USB_Device_ConfigurationNumber); + Endpoint_ClearIN(); + + Endpoint_ClearStatusStage(); +} + +#if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR) +static void USB_Device_GetInternalSerialDescriptor(void) +{ + struct + { + USB_Descriptor_Header_t Header; + uint16_t UnicodeString[INTERNAL_SERIAL_LENGTH_BITS / 4]; + } SignatureDescriptor; + + SignatureDescriptor.Header.Type = DTYPE_String; + SignatureDescriptor.Header.Size = USB_STRING_LEN(INTERNAL_SERIAL_LENGTH_BITS / 4); + + USB_Device_GetSerialString(SignatureDescriptor.UnicodeString); + + Endpoint_ClearSETUP(); + + Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor)); + Endpoint_ClearOUT(); +} +#endif + +static void USB_Device_GetDescriptor(void) +{ + const void* DescriptorPointer; + uint16_t DescriptorSize; + + #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ + !(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)) + { + USB_Device_GetInternalSerialDescriptor(); + return; + } + #endif + + if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex, + &DescriptorPointer + #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ + !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) + , &DescriptorAddressSpace + #endif + )) == NO_DESCRIPTOR) + { + return; + } + + Endpoint_ClearSETUP(); + + #if defined(USE_RAM_DESCRIPTORS) || !defined(ARCH_HAS_MULTI_ADDRESS_SPACE) + Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize); + #elif defined(USE_EEPROM_DESCRIPTORS) + Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize); + #elif defined(USE_FLASH_DESCRIPTORS) + Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize); + #else + if (DescriptorAddressSpace == MEMSPACE_FLASH) + 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); + #endif + + Endpoint_ClearOUT(); +} + +static void USB_Device_GetStatus(void) +{ + uint8_t CurrentStatus = 0; + + switch (USB_ControlRequest.bmRequestType) + { + case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE): + #if !defined(NO_DEVICE_SELF_POWER) + if (USB_Device_CurrentlySelfPowered) + CurrentStatus |= FEATURE_SELFPOWERED_ENABLED; + #endif + + #if !defined(NO_DEVICE_REMOTE_WAKEUP) + if (USB_Device_RemoteWakeupEnabled) + CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED; + #endif + break; + case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT): + #if !defined(CONTROL_ONLY_DEVICE) + Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK); + + CurrentStatus = Endpoint_IsStalled(); + + Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); + #endif + + break; + default: + return; + } + + Endpoint_ClearSETUP(); + + Endpoint_Write_16_LE(CurrentStatus); + Endpoint_ClearIN(); + + Endpoint_ClearStatusStage(); +} + +static void USB_Device_ClearSetFeature(void) +{ + switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) + { + #if !defined(NO_DEVICE_REMOTE_WAKEUP) + case REQREC_DEVICE: + if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup) + USB_Device_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature); + else + return; + + break; + #endif + #if !defined(CONTROL_ONLY_DEVICE) + case REQREC_ENDPOINT: + if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt) + { + 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(); + } + else + { + Endpoint_ClearStall(); + Endpoint_ResetEndpoint(EndpointIndex); + Endpoint_ResetDataToggle(); + } + } + } + + break; + #endif + default: + return; + } + + Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); + + Endpoint_ClearSETUP(); + + Endpoint_ClearStatusStage(); +} + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/DeviceStandardReq.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/DeviceStandardReq.h new file mode 100644 index 0000000..396e205 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/DeviceStandardReq.h @@ -0,0 +1,158 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB device standard request management. + * + * This file contains the function prototypes necessary for the processing of incoming standard control requests + * when the library is in USB device mode. + * + * \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 __DEVICESTDREQ_H__ +#define __DEVICESTDREQ_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + #include "StdDescriptors.h" + #include "Events.h" + #include "StdRequestType.h" + #include "USBTask.h" + #include "USBController.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* Enums: */ + #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) || defined(__DOXYGEN__) + /** Enum for the possible descriptor memory spaces, for the \c MemoryAddressSpace parameter of the + * \ref CALLBACK_USB_GetDescriptor() function. This can be used when none of the \c USE_*_DESCRIPTORS + * compile time options are used, to indicate in which memory space the descriptor is stored. + * + * \ingroup Group_Device + */ + enum USB_DescriptorMemorySpaces_t + { + #if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) || defined(__DOXYGEN__) + MEMSPACE_FLASH = 0, /**< Indicates the requested descriptor is located in FLASH memory. */ + #endif + #if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) || defined(__DOXYGEN__) + MEMSPACE_EEPROM = 1, /**< Indicates the requested descriptor is located in EEPROM memory. */ + #endif + 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 + * value, or 0 if no configuration has been selected. + * + * \attention This variable should be treated as read-only in the user application, and never manually + * changed in value. + * + * \ingroup Group_Device + */ + extern uint8_t USB_Device_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. + * + * \attention This variable should be treated as read-only in the user application, and never manually + * changed in value. + * + * \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 + * \c NO_DEVICE_REMOTE_WAKEUP token in the project makefile and passing it to the compiler via + * the -D switch. + * + * \ingroup Group_Device + */ + extern bool USB_Device_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 + * support self powered mode, as indicated in the device descriptors. + * + * \ingroup Group_Device + */ + extern bool USB_Device_CurrentlySelfPowered; + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + #if defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) + #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. + #elif defined(USE_RAM_DESCRIPTORS) && defined(USE_FLASH_DESCRIPTORS) + #error USE_RAM_DESCRIPTORS and USE_FLASH_DESCRIPTORS are mutually exclusive. + #elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) + #error USE_FLASH_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. + #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); + static void USB_Device_GetConfiguration(void); + 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 void USB_Device_GetInternalSerialDescriptor(void); + #endif + #endif + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Endpoint.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Endpoint.h new file mode 100644 index 0000000..bf41376 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Endpoint.h @@ -0,0 +1,130 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB Endpoint definitions for all architectures. + * \copydetails Group_EndpointManagement + * + * \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_EndpointManagement + * \defgroup Group_EndpointRW Endpoint Data Reading and Writing + * \brief Endpoint data read/write definitions. + * + * 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 + * \brief Endpoint data primitive read/write definitions. + * + * 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 + * \brief USB Endpoint package management definitions. + * + * Functions, macros, variables, enums and types related to packet management of endpoints. + */ + +/** \ingroup Group_USB + * \defgroup Group_EndpointManagement Endpoint Management + * \brief Endpoint management definitions. + * + * Functions, macros and enums related to endpoint management when in USB Device mode. This + * module contains the endpoint management macros, as well as endpoint interrupt and data + * send/receive functions for various data types. + * + * @{ + */ + +#ifndef __ENDPOINT_H__ +#define __ENDPOINT_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* Type Defines: */ + /** Type define for a endpoint table entry, used to configure endpoints in groups via + * \ref Endpoint_ConfigureEndpointTable(). + */ + typedef struct + { + uint8_t Address; /**< Address of the endpoint to configure, or zero if the table entry is to be unused. */ + uint16_t Size; /**< Size of the endpoint bank, in bytes. */ + uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */ + uint8_t Banks; /**< Number of hardware banks to use for the endpoint. */ + } USB_Endpoint_Table_t; + + /* Macros: */ + /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's + * numerical address in the device. + */ + #define ENDPOINT_EPNUM_MASK 0x0F + + /** 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 + + /* Architecture Includes: */ + #if (ARCH == ARCH_AVR8) + #include "AVR8/Endpoint_AVR8.h" + #elif (ARCH == ARCH_UC3) + #include "UC3/Endpoint_UC3.h" + #elif (ARCH == ARCH_XMEGA) + #include "XMEGA/Endpoint_XMEGA.h" + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/EndpointStream.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/EndpointStream.h new file mode 100644 index 0000000..5675c32 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/EndpointStream.h @@ -0,0 +1,124 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Endpoint data stream transmission and reception management. + * \copydetails Group_EndpointStreamRW + * + * \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_EndpointRW + * \defgroup Group_EndpointStreamRW Read/Write of Multi-Byte Streams + * \brief Endpoint data stream transmission and reception management. + * + * Functions, macros, variables, enums and types related to data reading and writing of data streams from + * and to endpoints. + * + * @{ + */ + +#ifndef __ENDPOINT_STREAM_H__ +#define __ENDPOINT_STREAM_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* Enums: */ + /** Enum for the possible error return codes of the \c Endpoint_*_Stream_* functions. */ + enum Endpoint_Stream_RW_ErrorCodes_t + { + ENDPOINT_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */ + ENDPOINT_RWSTREAM_EndpointStalled = 1, /**< The endpoint was stalled during the stream + * transfer by the host or device. + */ + ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during + * the transfer. + */ + ENDPOINT_RWSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and + * no USB endpoint traffic can occur until the bus + * has resumed. + */ + ENDPOINT_RWSTREAM_Timeout = 4, /**< The host failed to accept or send the next packet + * within the software timeout period set by the + * \ref USB_STREAM_TIMEOUT_MS macro. + */ + ENDPOINT_RWSTREAM_IncompleteTransfer = 5, /**< Indicates that the endpoint bank became full or empty before + * the complete contents of the current stream could be + * transferred. The endpoint stream function should be called + * again to process the next chunk of data in the transfer. + */ + }; + + /** Enum for the possible error return codes of the \c Endpoint_*_Control_Stream_* functions. */ + enum Endpoint_ControlStream_RW_ErrorCodes_t + { + ENDPOINT_RWCSTREAM_NoError = 0, /**< Command completed successfully, no error. */ + ENDPOINT_RWCSTREAM_HostAborted = 1, /**< The aborted the transfer prematurely. */ + ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during + * the transfer. + */ + ENDPOINT_RWCSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and + * no USB endpoint traffic can occur until the bus + * has resumed. + */ + }; + + /* Architecture Includes: */ + #if (ARCH == ARCH_AVR8) + #include "AVR8/EndpointStream_AVR8.h" + #elif (ARCH == ARCH_UC3) + #include "UC3/EndpointStream_UC3.h" + #elif (ARCH == ARCH_XMEGA) + #include "XMEGA/EndpointStream_XMEGA.h" + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Events.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Events.c new file mode 100644 index 0000000..a63b002 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Events.c @@ -0,0 +1,39 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_EVENTS_C +#define __INCLUDE_FROM_USB_DRIVER +#include "Events.h" + +void USB_Event_Stub(void) +{ + +} + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Events.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Events.h new file mode 100644 index 0000000..9c85112 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Events.h @@ -0,0 +1,372 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB Event management definitions. + * \copydetails Group_Events + * + * \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_Events USB Events + * \brief USB Event management definitions. + * + * This module contains macros and functions relating to the management of library events, which are small + * pieces of code similar to ISRs which are run when a given condition is met. Each event can be fired from + * multiple places in the user or library code, which may or may not be inside an ISR, thus each handler + * should be written to be as small and fast as possible to prevent possible problems. + * + * Events can be hooked by the user application by declaring a handler function with the same name and parameters + * listed here. If an event with no user-associated handler is fired within the library, it by default maps to an + * internal empty stub function. + * + * Each event must only have one associated event handler, but can be raised by multiple sources by calling the + * event handler function (with any required event parameters). + * + * @{ + */ + +#ifndef __USBEVENTS_H__ +#define __USBEVENTS_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* 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 + * mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires + * before the mode is switched to the newly indicated mode but after the \ref EVENT_USB_Device_Disconnect + * event has fired (if disconnected before the role change). + * + * \note This event only exists on microcontrollers that support dual role USB modes. + * \n\n + * + * \note This event does not exist if the \c USB_DEVICE_ONLY or \c USB_HOST_ONLY tokens have been supplied + * to the compiler (see \ref Group_USBManagement documentation). + */ + void EVENT_USB_UIDChange(void); + + /** Event for USB host error. This event fires when a hardware fault has occurred whilst the USB + * interface is in host mode. + * + * \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t. + * + * \note This event only exists on microcontrollers that supports USB host mode. + * \n\n + * + * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see + * \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 + * management task to reduce CPU consumption. + * + * \note This event only exists on microcontrollers that supports USB host mode. + * \n\n + * + * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + * + * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage. + */ + void EVENT_USB_Host_DeviceAttached(void); + + /** Event for USB device removal. This event fires when a the USB interface is in host mode, and + * a USB device has been removed the USB interface whether or not it has been enumerated. This + * can be used to programmatically stop the USB management task to reduce CPU consumption. + * + * \note This event only exists on microcontrollers that supports USB host mode. + * \n\n + * + * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + * + * \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 + * \ref USB_Host_EnumerationErrorCodes_t. + * + * \param[in] SubErrorCode Sub error code indicating the reason for failure - for example, if the + * ErrorCode parameter indicates a control error, this will give the error + * code returned by the \ref USB_Host_SendControlRequest() function. + * + * \note This event only exists on microcontrollers that supports USB host mode. + * \n\n + * + * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + */ + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, + const uint8_t SubErrorCode); + + /** Event for USB device enumeration completion. This event fires when a the USB interface is + * in host mode and an attached USB device has been completely enumerated and is ready to be + * controlled by the user application. + * + * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around + * 1 second) when a transaction is waiting to be processed by the device will prevent break communications + * and cause the host to reset the USB bus. + * + * \note This event only exists on microcontrollers that supports USB host mode. + * \n\n + * + * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + */ + void EVENT_USB_Host_DeviceEnumerationComplete(void); + + /** Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB + * frame, once per millisecond, and is synchronized to the USB bus. This can be used as an accurate + * millisecond timer source when the USB bus is not suspended while in host mode. + * + * This event is time-critical; it is run once per millisecond and thus long handlers will significantly + * degrade device performance. This event should only be enabled when needed to reduce device wake-ups. + * + * \note This event is not normally active - it must be manually enabled and disabled via the + * \ref USB_Host_EnableSOFEvents() and \ref USB_Host_DisableSOFEvents() commands after enumeration of + * a USB device. + * \n\n + * + * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + */ + void EVENT_USB_Host_StartOfFrame(void); + + /** Event for USB device connection. This event fires when the microcontroller is in USB Device mode + * and the device is connected to a USB host, beginning the enumeration process measured by a rising + * level on the microcontroller's VBUS sense pin. + * + * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around + * two seconds) will prevent the device from enumerating correctly. + * + * \attention This event may fire multiple times during device enumeration on the microcontrollers with limited USB controllers + * if \c NO_LIMITED_CONTROLLER_CONNECT is not defined. + * + * \note For the microcontrollers with limited USB controller functionality, VBUS sensing is not available. + * this means that the current connection state is derived from the bus suspension and wake up events by default, + * which is not always accurate (host may suspend the bus while still connected). If the actual connection state + * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behavior turned off by + * passing the \c NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection + * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. + * \n\n + * + * \see \ref Group_USBManagement for more information on the USB management task and reducing CPU usage. + */ + void EVENT_USB_Device_Connect(void); + + /** Event for USB device disconnection. This event fires when the microcontroller is in USB Device mode and the device is + * disconnected from a host, measured by a falling level on the microcontroller's VBUS sense pin. + * + * \attention This event may fire multiple times during device enumeration on the microcontrollers with limited USB controllers + * if \c NO_LIMITED_CONTROLLER_CONNECT is not defined. + * + * \note For the microcontrollers with limited USB controllers, VBUS sense is not available to the USB controller. + * this means that the current connection state is derived from the bus suspension and wake up events by default, + * which is not always accurate (host may suspend the bus while still connected). If the actual connection state + * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behavior turned off by + * passing the \c NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection + * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually. + * \n\n + * + * \see \ref Group_USBManagement for more information on the USB management task and reducing CPU usage. + */ + void EVENT_USB_Device_Disconnect(void); + + /** Event for control requests. This event fires when a the USB host issues a control request + * to the mandatory device control endpoint (of address 0). This may either be a standard + * request that the library may have a handler code for internally, or a class specific request + * issued to the device which must be handled appropriately. If a request is not processed in the + * user application via this event, it will be passed to the library for processing internally + * if a suitable handler exists. + * + * This event is time-critical; each packet within the request transaction must be acknowledged or + * sent within 50ms or the host will abort the transfer. + * + * The library internally handles all standard control requests with the exceptions of SYNC FRAME, + * SET DESCRIPTOR and SET INTERFACE. These and all other non-standard control requests will be left + * for the user to process via this event if desired. If not handled in the user application or by + * the library internally, unknown requests are automatically STALLed. + * + * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + * \n\n + * + * \note Requests should be handled in the same manner as described in the USB 2.0 Specification, + * or appropriate class specification. In all instances, the library has already read the + * request SETUP parameters into the \ref USB_ControlRequest structure which should then be used + * by the application to determine how to handle the issued request. + */ + void EVENT_USB_Device_ControlRequest(void); + + /** Event for USB configuration number changed. This event fires when a the USB host changes the + * selected configuration number while in device mode. This event should be hooked in device + * applications to create the endpoints and configure the device for the selected configuration. + * + * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around + * one second) will prevent the device from enumerating correctly. + * + * This event fires after the value of \ref USB_Device_ConfigurationNumber has been changed. + * + * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + */ + void EVENT_USB_Device_ConfigurationChanged(void); + + /** Event for USB suspend. This event fires when a the USB host suspends the device by halting its + * transmission of Start Of Frame pulses to the device. This is generally hooked in order to move + * the device over to a low power state until the host wakes up the device. If the USB interface is + * enumerated with the \ref USB_OPT_AUTO_PLL option set, the library will automatically suspend the + * USB PLL before the event is fired to save power. + * + * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + * \n\n + * + * \note This event does not exist on the microcontrollers with limited USB VBUS sensing abilities + * when the \c NO_LIMITED_CONTROLLER_CONNECT compile time token is not set - see + * \ref EVENT_USB_Device_Disconnect. + * + * \see \ref EVENT_USB_Device_WakeUp() event for accompanying Wake Up event. + */ + void EVENT_USB_Device_Suspend(void); + + /** Event for USB wake up. This event fires when a the USB interface is suspended while in device + * mode, and the host wakes up the device by supplying Start Of Frame pulses. This is generally + * hooked to pull the user application out of a low power state and back into normal operating + * mode. If the USB interface is enumerated with the \ref USB_OPT_AUTO_PLL option set, the library + * will automatically restart the USB PLL before the event is fired. + * + * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + * \n\n + * + * \note This event does not exist on the microcontrollers with limited USB VBUS sensing abilities + * when the \c NO_LIMITED_CONTROLLER_CONNECT compile time token is not set - see + * \ref EVENT_USB_Device_Disconnect. + * + * \see \ref EVENT_USB_Device_Suspend() event for accompanying Suspend event. + */ + void EVENT_USB_Device_WakeUp(void); + + /** Event for USB interface reset. This event fires when the USB interface is in device mode, and + * a the USB host requests that the device reset its interface. This event fires after the control + * endpoint has been automatically configured by the library. + * + * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around + * two seconds) will prevent the device from enumerating correctly. + * + * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + */ + void EVENT_USB_Device_Reset(void); + + /** Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB + * frame, once per millisecond, and is synchronized to the USB bus. This can be used as an accurate + * millisecond timer source when the USB bus is enumerated in device mode to a USB host. + * + * This event is time-critical; it is run once per millisecond and thus long handlers will significantly + * degrade device performance. This event should only be enabled when needed to reduce device wake-ups. + * + * \pre This event is not normally active - it must be manually enabled and disabled via the + * \ref USB_Device_EnableSOFEvents() and \ref USB_Device_DisableSOFEvents() commands after enumeration. + * \n\n + * + * \note This event does not exist if the \c USB_HOST_ONLY token is supplied to the compiler (see + * \ref Group_USBManagement documentation). + */ + 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); + void EVENT_USB_Host_DeviceUnattached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Host_DeviceEnumerationComplete(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, + const uint8_t SubErrorCode) + ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Host_StartOfFrame(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + #endif + + #if defined(USB_CAN_BE_DEVICE) + void EVENT_USB_Device_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_ControlRequest(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + void EVENT_USB_Device_StartOfFrame(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub); + #endif + #endif + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Host.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Host.h new file mode 100644 index 0000000..6146cc5 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Host.h @@ -0,0 +1,139 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common USB Host definitions for all architectures. + * \copydetails Group_Host + * + * \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_Host Host Management + * \brief USB Host management definitions for USB host mode. + * + * USB Host mode related macros and enums. This module contains macros and enums which are used when + * the USB controller is initialized in host mode. + * + * @{ + */ + +#ifndef __USBHOST_H__ +#define __USBHOST_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* Enums: */ + /** Enum for the various states of the USB Host state machine. + * + * For information on each possible USB host state, refer to the USB 2.0 specification. + * Several of the USB host states are broken up further into multiple smaller sub-states, + * so that they can be internally implemented inside the library in an efficient manner. + * + * \see \ref USB_HostState, which stores the current host state machine state. + */ + enum USB_Host_States_t + { + HOST_STATE_WaitForDevice = 0, /**< This state indicates that the stack is waiting for an interval + * to elapse before continuing with the next step of the device + * enumeration process. + */ + HOST_STATE_Unattached = 1, /**< This state indicates that the host state machine is waiting for + * a device to be attached so that it can start the enumeration process. + */ + HOST_STATE_Powered = 2, /**< This state indicates that a device has been attached, and the + * library's internals are being configured to begin the enumeration + * process. + */ + HOST_STATE_Powered_WaitForDeviceSettle = 3, /**< This state indicates that the stack is waiting for the initial + * settling period to elapse before beginning the enumeration process. + */ + HOST_STATE_Powered_WaitForConnect = 4, /**< 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. + */ + HOST_STATE_Powered_DoReset = 5, /**< This state indicates that a valid USB device has been attached, and that + * it will now be reset to ensure it is ready for enumeration. + */ + HOST_STATE_Powered_ConfigPipe = 6, /**< This state indicates that the attached device is currently powered and + * reset, and that the control pipe is now being configured by the stack. + */ + HOST_STATE_Default = 7, /**< 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. + */ + HOST_STATE_Default_PostReset = 8, /**< 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. + */ + HOST_STATE_Default_PostAddressSet = 9, /**< This state indicates that the device's address has now been set, and the + * stack is has now completed the device enumeration process. This state causes + * the stack to change the current USB device address to that set for the + * connected device, before progressing to the \ref HOST_STATE_Addressed state + * ready for use in the user application. + */ + HOST_STATE_Addressed = 10, /**< Indicates that the device has been enumerated and addressed, and is now waiting + * for the user application to configure the device ready for use. + */ + HOST_STATE_Configured = 11, /**< Indicates that the device has been configured into a valid device configuration, + * ready for general use by the user application. + */ + }; + + /* Architecture Includes: */ + #if (ARCH == ARCH_AVR8) + #include "AVR8/Host_AVR8.h" + #elif (ARCH == ARCH_UC3) + #include "UC3/Host_UC3.h" + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/HostStandardReq.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/HostStandardReq.c new file mode 100644 index 0000000..4a21ce7 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/HostStandardReq.c @@ -0,0 +1,322 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "USBMode.h" + +#if defined(USB_CAN_BE_HOST) + +#define __INCLUDE_FROM_HOSTSTDREQ_C +#include "HostStandardReq.h" + +uint8_t USB_Host_ConfigurationNumber; + +static uint8_t USB_Host_SendControlRequest_PRV(void* const BufferPtr) +{ + uint8_t* DataStream = (uint8_t*)BufferPtr; + uint8_t ReturnStatus = HOST_SENDCONTROL_Successful; + uint16_t DataLen = USB_ControlRequest.wLength; + + USB_Host_ResumeBus(); + + if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful) + return ReturnStatus; + + Pipe_SetPipeToken(PIPE_TOKEN_SETUP); + Pipe_ClearError(); + + Pipe_Unfreeze(); + + #if defined(ARCH_BIG_ENDIAN) + Pipe_Write_8(USB_ControlRequest.bmRequestType); + Pipe_Write_8(USB_ControlRequest.bRequest); + Pipe_Write_16_LE(USB_ControlRequest.wValue); + Pipe_Write_16_LE(USB_ControlRequest.wIndex); + Pipe_Write_16_LE(USB_ControlRequest.wLength); + #else + uint8_t* HeaderStream = (uint8_t*)&USB_ControlRequest; + + for (uint8_t HeaderByte = 0; HeaderByte < sizeof(USB_Request_Header_t); HeaderByte++) + Pipe_Write_8(*(HeaderStream++)); + #endif + + Pipe_ClearSETUP(); + + if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_SetupSent)) != HOST_SENDCONTROL_Successful) + return ReturnStatus; + + Pipe_Freeze(); + + if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful) + return ReturnStatus; + + if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_DIRECTION) == REQDIR_DEVICETOHOST) + { + Pipe_SetPipeToken(PIPE_TOKEN_IN); + + if (DataStream != NULL) + { + while (DataLen) + { + Pipe_Unfreeze(); + + if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful) + return ReturnStatus; + + if (!(Pipe_BytesInPipe())) + DataLen = 0; + + while (Pipe_BytesInPipe() && DataLen) + { + *(DataStream++) = Pipe_Read_8(); + DataLen--; + } + + Pipe_Freeze(); + Pipe_ClearIN(); + } + } + + Pipe_SetPipeToken(PIPE_TOKEN_OUT); + Pipe_Unfreeze(); + + if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful) + return ReturnStatus; + + Pipe_ClearOUT(); + + if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful) + return ReturnStatus; + } + else + { + if (DataStream != NULL) + { + Pipe_SetPipeToken(PIPE_TOKEN_OUT); + Pipe_Unfreeze(); + + while (DataLen) + { + if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful) + return ReturnStatus; + + while (DataLen && (Pipe_BytesInPipe() < USB_Host_ControlPipeSize)) + { + Pipe_Write_8(*(DataStream++)); + DataLen--; + } + + Pipe_ClearOUT(); + } + + if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful) + return ReturnStatus; + + Pipe_Freeze(); + } + + Pipe_SetPipeToken(PIPE_TOKEN_IN); + Pipe_Unfreeze(); + + if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful) + return ReturnStatus; + + Pipe_ClearIN(); + } + + return ReturnStatus; +} + +static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType) +{ + #if (USB_HOST_TIMEOUT_MS < 0xFF) + 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()))) + { + uint8_t ErrorCode; + + if ((ErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful) + return ErrorCode; + + if (!(TimeoutCounter--)) + return HOST_SENDCONTROL_SoftwareTimeOut; + } + + return HOST_SENDCONTROL_Successful; +} + +uint8_t USB_Host_SendControlRequest(void* const BufferPtr) +{ + bool BusSuspended = USB_Host_IsBusSuspended(); + uint8_t ReturnStatus = USB_Host_SendControlRequest_PRV(BufferPtr); + + Pipe_Freeze(); + + if (BusSuspended) + USB_Host_SuspendBus(); + + Pipe_ResetPipe(PIPE_CONTROLPIPE); + + return ReturnStatus; +} + +uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber) +{ + uint8_t ErrorCode; + + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE), + .bRequest = REQ_SetConfiguration, + .wValue = ConfigNumber, + .wIndex = 0, + .wLength = 0, + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + if ((ErrorCode = USB_Host_SendControlRequest(NULL)) == HOST_SENDCONTROL_Successful) + { + USB_Host_ConfigurationNumber = ConfigNumber; + USB_HostState = (ConfigNumber) ? HOST_STATE_Configured : HOST_STATE_Addressed; + } + + return ErrorCode; +} + +uint8_t USB_Host_GetDeviceConfiguration(uint8_t* const ConfigNumber) +{ + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), + .bRequest = REQ_GetConfiguration, + .wValue = 0, + .wIndex = 0, + .wLength = sizeof(uint8_t), + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + return USB_Host_SendControlRequest(ConfigNumber); +} + +uint8_t USB_Host_GetDescriptor(const uint8_t Type, + const uint8_t Index, + void* const Buffer, + const uint8_t BufferLength) +{ + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), + .bRequest = REQ_GetDescriptor, + .wValue = (((uint16_t)Type << 8) | Index), + .wIndex = 0, + .wLength = BufferLength, + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + return USB_Host_SendControlRequest(Buffer); +} + +uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus) +{ + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE), + .bRequest = REQ_GetStatus, + .wValue = 0, + .wIndex = 0, + .wLength = 0, + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + return USB_Host_SendControlRequest(FeatureStatus); +} + +uint8_t USB_Host_ClearEndpointStall(const uint8_t EndpointAddress) +{ + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_ENDPOINT), + .bRequest = REQ_ClearFeature, + .wValue = FEATURE_SEL_EndpointHalt, + .wIndex = EndpointAddress, + .wLength = 0, + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + return USB_Host_SendControlRequest(NULL); +} + +uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceIndex, + const uint8_t AltSetting) +{ + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE), + .bRequest = REQ_SetInterface, + .wValue = AltSetting, + .wIndex = InterfaceIndex, + .wLength = 0, + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + return USB_Host_SendControlRequest(NULL); +} + +uint8_t USB_Host_GetInterfaceAltSetting(const uint8_t InterfaceIndex, + uint8_t* const AltSetting) +{ + USB_ControlRequest = (USB_Request_Header_t) + { + .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE), + .bRequest = REQ_GetInterface, + .wValue = 0, + .wIndex = InterfaceIndex, + .wLength = sizeof(uint8_t), + }; + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + return USB_Host_SendControlRequest(AltSetting); +} + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/HostStandardReq.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/HostStandardReq.h new file mode 100644 index 0000000..bd67bcb --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/HostStandardReq.h @@ -0,0 +1,292 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB host standard request management. + * + * This file contains the function prototypes necessary for the issuing of outgoing standard control requests + * when the library is in USB host mode. + * + * \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 __HOSTSTDREQ_H__ +#define __HOSTSTDREQ_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + #include "StdRequestType.h" + #include "USBController.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + #if !defined(USB_HOST_TIMEOUT_MS) || defined(__DOXYGEN__) + /** Constant for the maximum software timeout period of sent USB control transactions to an attached + * 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 + * \ref USB_HOST_TIMEOUT_MS token, and passed to the compiler using the -D switch. + */ + #define USB_HOST_TIMEOUT_MS 1000 + #endif + + /* Enums: */ + /** Enum for the \ref USB_Host_SendControlRequest() return code, indicating the reason for the error + * if the transfer of the request is unsuccessful. + * + * \ingroup Group_PipeControlReq + */ + enum USB_Host_SendControlErrorCodes_t + { + HOST_SENDCONTROL_Successful = 0, /**< No error occurred in the request transfer. */ + HOST_SENDCONTROL_DeviceDisconnected = 1, /**< The attached device was disconnected during the + * request transfer. + */ + HOST_SENDCONTROL_PipeError = 2, /**< An error occurred in the pipe while sending the request. */ + HOST_SENDCONTROL_SetupStalled = 3, /**< The attached device stalled the request, usually + * indicating that the request is unsupported on the device. + */ + HOST_SENDCONTROL_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */ + }; + + /* Global Variables: */ + /** Indicates the currently set configuration number of the attached device. This indicates the currently + * selected configuration value if one has been set successfully, or 0 if no configuration has been selected. + * + * To set a device configuration, call the \ref USB_Host_SetDeviceConfiguration() function. + * + * \attention This variable should be treated as read-only in the user application, and never manually + * changed in value. + * + * \ingroup Group_Host + */ + extern uint8_t USB_Host_ConfigurationNumber; + + /* 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 + * as requested. The transfer is made on the currently selected pipe. + * + * \ingroup Group_PipeControlReq + * + * \param[in] BufferPtr Pointer to the start of the data buffer if the request has a data stage, or + * \c NULL if the request transfers no data to or from the device. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_SendControlRequest(void* const BufferPtr); + + /** Sends a SET CONFIGURATION standard request to the attached device, with the given configuration index. + * + * This routine will automatically update the \ref USB_HostState and \ref USB_Host_ConfigurationNumber + * state variables according to the given function parameters and the result of the request. + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[in] ConfigNumber Configuration index to send to the device. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_SetDeviceConfiguration(const uint8_t ConfigNumber); + + /** Sends a GET CONFIGURATION standard request to the attached device, to retrieve the currently selected + * device configuration index. + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[out] ConfigNumber Pointer to a location where the retrieved configuration index should be stored. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_GetDeviceConfiguration(uint8_t* const ConfigNumber) ATTR_NON_NULL_PTR_ARG(1); + + /** Sends a GET DESCRIPTOR standard request to the attached device, requesting the descriptor of the + * specified type and index. + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[in] Type Type of descriptor to retrieve, a value from the \ref USB_DescriptorTypes_t enum. + * \param[in] Index Index of the descriptor to retrieve. + * \param[out] Buffer Pointer to the destination buffer where the retrieved string descriptor is to be stored. + * \param[in] BufferLength Maximum size of the string descriptor which can be stored into the buffer. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_GetDescriptor(const uint8_t Type, + const uint8_t Index, + void* const Buffer, + const uint8_t BufferLength) ATTR_NON_NULL_PTR_ARG(3); + + /** Retrieves the current feature status of the attached device, via a GET STATUS standard request. The + * retrieved feature status can then be examined by masking the retrieved value with the various + * \c FEATURE_* masks for bus/self power information and remote wakeup support. + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[out] FeatureStatus Location where the retrieved feature status should be stored. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_GetDeviceStatus(uint8_t* const FeatureStatus) ATTR_NON_NULL_PTR_ARG(1); + + /** Clears a stall condition on the given pipe, via a CLEAR FEATURE standard request to the attached device. + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[in] EndpointAddress Address of the endpoint to clear, including the endpoint's direction. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_ClearEndpointStall(const uint8_t EndpointAddress); + + /** Selects a given alternative setting for the specified interface, via a SET INTERFACE standard request to + * the attached device. + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[in] InterfaceIndex Index of the interface whose alternative setting is to be altered. + * \param[in] AltSetting Index of the interface's alternative setting which is to be selected. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_SetInterfaceAltSetting(const uint8_t InterfaceIndex, + const uint8_t AltSetting); + + + /** Retrieves the current alternative setting for the specified interface, via a GET INTERFACE standard request to + * the attached device. + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[in] InterfaceIndex Index of the interface whose alternative setting is to be altered. + * \param[out] AltSetting Pointer to a location where the retrieved alternative setting value should be stored. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + uint8_t USB_Host_GetInterfaceAltSetting(const uint8_t InterfaceIndex, + uint8_t* const AltSetting) ATTR_NON_NULL_PTR_ARG(2); + + /* Inline Functions: */ + /** Sends a GET DESCRIPTOR 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. This is a convenience wrapper for \ref USB_Host_GetDescriptor(). + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[out] DeviceDescriptorPtr Pointer to the destination device descriptor structure where + * the read data is to be stored. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + static inline uint8_t USB_Host_GetDeviceDescriptor(USB_Descriptor_Device_t* const DeviceDescriptorPtr) ATTR_NON_NULL_PTR_ARG(1); + static inline uint8_t USB_Host_GetDeviceDescriptor(USB_Descriptor_Device_t* const DeviceDescriptorPtr) + { + return USB_Host_GetDescriptor(DTYPE_Device, 0, DeviceDescriptorPtr, sizeof(USB_Descriptor_Device_t)); + } + + /** Sends a GET DESCRIPTOR 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 Device or Configuration descriptors. This is a convenience + * wrapper for \ref USB_Host_GetDescriptor(). + * + * \note After this routine returns, the control pipe will be selected. + * + * \ingroup Group_PipeControlReq + * + * \param[in] Index Index of the string descriptor to retrieve. + * \param[out] Buffer Pointer to the destination buffer where the retrieved string descriptor is + * to be stored. + * \param[in] BufferLength Maximum size of the string descriptor which can be stored into the buffer. + * + * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result. + */ + static inline uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, + void* const Buffer, + const uint8_t BufferLength) ATTR_NON_NULL_PTR_ARG(2); + static inline uint8_t USB_Host_GetDeviceStringDescriptor(const uint8_t Index, + void* const Buffer, + const uint8_t BufferLength) + { + return USB_Host_GetDescriptor(DTYPE_String, Index, Buffer, BufferLength); + } + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Enums: */ + enum USB_WaitForTypes_t + { + USB_HOST_WAITFOR_SetupSent, + USB_HOST_WAITFOR_InReceived, + USB_HOST_WAITFOR_OutReady, + }; + + /* Function Prototypes: */ + #if defined(__INCLUDE_FROM_HOSTSTDREQ_C) + static uint8_t USB_Host_SendControlRequest_PRV(void* const BufferPtr); + static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType); + #endif + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/OTG.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/OTG.h new file mode 100644 index 0000000..58d47ba --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/OTG.h @@ -0,0 +1,80 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common USB OTG definitions for all architectures. + * \copydetails Group_OTG + * + * \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_OTG USB On The Go (OTG) Management + * \brief USB OTG management definitions. + * + * This module contains macros for embedded USB hosts with dual role On The Go capabilities, for managing role + * exchange. OTG is a way for two USB dual role devices to talk to one another directly without fixed device/host + * roles. + * + * @{ + */ + +#ifndef __USBOTG_H__ +#define __USBOTG_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + /* Architecture Includes: */ + #if (ARCH == ARCH_AVR8) + #include "AVR8/OTG_AVR8.h" + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Pipe.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Pipe.h new file mode 100644 index 0000000..ca3fdbe --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/Pipe.h @@ -0,0 +1,144 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common USB Pipe definitions for all architectures. + * \copydetails Group_PipeManagement + * + * \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 + * \brief Pipe data read/write definitions. + * + * Functions, macros, variables, enums and types related to data reading and writing from and to pipes. + */ + +/** \ingroup Group_PipeRW + * \defgroup Group_PipePrimitiveRW Read/Write of Primitive Data Types + * \brief Pipe data primitive read/write definitions. + * + * 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 + * \brief Pipe packet management definitions. + * + * Functions, macros, variables, enums and types related to packet management of pipes. + */ + +/** \ingroup Group_PipeManagement + * \defgroup Group_PipeControlReq Pipe Control Request Management + * \brief Pipe control request definitions. + * + * Module for host mode request processing. This module allows for the transmission of standard, class and + * 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 + * \brief Pipe management definitions. + * + * This module contains functions, macros and enums related to pipe management when in USB Host mode. This + * module contains the pipe management macros, as well as pipe interrupt and data send/receive functions + * for various data types. + * + * @{ + */ + +#ifndef __PIPE_H__ +#define __PIPE_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* Type Defines: */ + /** Type define for a pipe table entry, used to configure pipes in groups via + * \ref Pipe_ConfigurePipeTable(). + */ + typedef struct + { + uint8_t Address; /**< Address of the pipe to configure, or zero if the table entry is to be unused. */ + uint16_t Size; /**< Size of the pipe bank, in bytes. */ + uint8_t EndpointAddress; /**< Address of the endpoint in the connected device. */ + uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */ + uint8_t Banks; /**< Number of hardware banks to use for the pipe. */ + } USB_Pipe_Table_t; + + /* Macros: */ + /** 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 + + /** Pipe number mask, for masking against pipe addresses to retrieve the pipe's numerical address + * in the device. + */ + #define PIPE_PIPENUM_MASK 0x0F + + /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's + * numerical address in the attached device. + */ + #define PIPE_EPNUM_MASK 0x0F + + /* Architecture Includes: */ + #if (ARCH == ARCH_AVR8) + #include "AVR8/Pipe_AVR8.h" + #elif (ARCH == ARCH_UC3) + #include "UC3/Pipe_UC3.h" + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/PipeStream.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/PipeStream.h new file mode 100644 index 0000000..2399696 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/PipeStream.h @@ -0,0 +1,100 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Pipe data stream transmission and reception management. + * \copydetails Group_PipeStreamRW + * + * \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_PipeRW + * \defgroup Group_PipeStreamRW Read/Write of Multi-Byte Streams + * \brief Pipe data stream transmission and reception management. + * + * Functions, macros, variables, enums and types related to data reading and writing of data streams from + * and to pipes. + * + * @{ + */ + +#ifndef __PIPE_STREAM_H__ +#define __PIPE_STREAM_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* Enums: */ + /** Enum for the possible error return codes of the Pipe_*_Stream_* functions. */ + enum Pipe_Stream_RW_ErrorCodes_t + { + PIPE_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */ + PIPE_RWSTREAM_PipeStalled = 1, /**< The device stalled the pipe during the transfer. */ + PIPE_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during + * the transfer. + */ + PIPE_RWSTREAM_Timeout = 3, /**< The device failed to accept or send the next packet + * within the software timeout period set by the + * \ref USB_STREAM_TIMEOUT_MS macro. + */ + PIPE_RWSTREAM_IncompleteTransfer = 4, /**< Indicates that the pipe bank became full/empty before the + * complete contents of the stream could be transferred. + */ + }; + + /* Architecture Includes: */ + #if (ARCH == ARCH_AVR8) + #include "AVR8/PipeStream_AVR8.h" + #elif (ARCH == ARCH_UC3) + #include "UC3/PipeStream_UC3.h" + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/StdDescriptors.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/StdDescriptors.h new file mode 100644 index 0000000..e0a1a37 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/StdDescriptors.h @@ -0,0 +1,765 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common standard USB Descriptor definitions for all architectures. + * \copydetails Group_StdDescriptors + * + * \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_StdDescriptors USB Descriptors + * \brief Standard USB Descriptor definitions. + * + * Standard USB device descriptor defines and retrieval routines, for USB devices. This module contains + * structures and macros for the easy creation of standard USB descriptors in USB device projects. + * + * @{ + */ + +#ifndef __USBDESCRIPTORS_H__ +#define __USBDESCRIPTORS_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + #include "Events.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors + * for string descriptor indexes, or may be use as a return value for GetDescriptor when the specified + * descriptor does not exist. + */ + #define NO_DESCRIPTOR 0 + + /** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes. + * + * \param[in] mA Maximum number of milliamps the device consumes when the given configuration is selected. + */ + #define USB_CONFIG_POWER_MA(mA) ((mA) >> 1) + + /** Macro to calculate the Unicode length of a string with a given number of Unicode characters. + * Should be used in string descriptor's headers for giving the string descriptor's byte length. + * + * \param[in] UnicodeChars Number of Unicode characters in the string text. + */ + #define USB_STRING_LEN(UnicodeChars) (sizeof(USB_Descriptor_Header_t) + ((UnicodeChars) << 1)) + + /** Convenience macro to easily create \ref USB_Descriptor_String_t instances from a wide character string. + * + * \note This macro is for little-endian systems only. + * + * \param[in] String String to initialize a USB String Descriptor structure with. + */ + #define USB_STRING_DESCRIPTOR(String) { .Header = {.Size = sizeof(USB_Descriptor_Header_t) + (sizeof(String) - 2), .Type = DTYPE_String}, .UnicodeString = String } + + /** Convenience macro to easily create \ref USB_Descriptor_String_t instances from an array of characters. + * + * \param[in] ... Characters to initialize a USB String Descriptor structure with. + */ + #define USB_STRING_DESCRIPTOR_ARRAY(...) { .Header = {.Size = sizeof(USB_Descriptor_Header_t) + sizeof((uint16_t){__VA_ARGS__}), .Type = DTYPE_String}, .UnicodeString = {__VA_ARGS__} } + + /** Macro to encode a given major/minor/revision version number into Binary Coded Decimal format for descriptor + * fields requiring BCD encoding, such as the USB version number in the standard device descriptor. + * + * \note This value is automatically converted into Little Endian, suitable for direct use inside device + * descriptors on all architectures without endianness conversion macros. + * + * \param[in] Major Major version number to encode. + * \param[in] Minor Minor version number to encode. + * \param[in] Revision Revision version number to encode. + */ + #define VERSION_BCD(Major, Minor, Revision) \ + CPU_TO_LE16( ((Major & 0xFF) << 8) | \ + ((Minor & 0x0F) << 4) | \ + (Revision & 0x0F) ) + + /** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors + * to indicate that the English language is supported by the device in its string descriptors. + */ + #define LANGUAGE_ID_ENG 0x0409 + + /** \name USB Configuration Descriptor Attribute Masks */ + //@{ + /** Mask for the reserved bit in the Configuration Descriptor's \c ConfigAttributes field, which must be set on all + * devices for historical purposes. + */ + #define USB_CONFIG_ATTR_RESERVED 0x80 + + /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t + * descriptor's \c ConfigAttributes value to indicate that the specified configuration can draw its power + * from the device's own power source. + */ + #define USB_CONFIG_ATTR_SELFPOWERED 0x40 + + /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t + * descriptor's \c ConfigAttributes value to indicate that the specified configuration supports the + * remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon + * request. + */ + #define USB_CONFIG_ATTR_REMOTEWAKEUP 0x20 + //@} + + /** \name Endpoint Descriptor Attribute Masks */ + //@{ + /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's + * \c Attributes value to indicate that the specified endpoint is not synchronized. + * + * \see The USB specification for more details on the possible Endpoint attributes. + */ + #define ENDPOINT_ATTR_NO_SYNC (0 << 2) + + /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's + * \c Attributes value to indicate that the specified endpoint is asynchronous. + * + * \see The USB specification for more details on the possible Endpoint attributes. + */ + #define ENDPOINT_ATTR_ASYNC (1 << 2) + + /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's + * \c Attributes value to indicate that the specified endpoint is adaptive. + * + * \see The USB specification for more details on the possible Endpoint attributes. + */ + #define ENDPOINT_ATTR_ADAPTIVE (2 << 2) + + /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's + * \c Attributes value to indicate that the specified endpoint is synchronized. + * + * \see The USB specification for more details on the possible Endpoint attributes. + */ + #define ENDPOINT_ATTR_SYNC (3 << 2) + //@} + + /** \name Endpoint Descriptor Usage Masks */ + //@{ + /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's + * \c Attributes value to indicate that the specified endpoint is used for data transfers. + * + * \see The USB specification for more details on the possible Endpoint usage attributes. + */ + #define ENDPOINT_USAGE_DATA (0 << 4) + + /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's + * \c Attributes value to indicate that the specified endpoint is used for feedback. + * + * \see The USB specification for more details on the possible Endpoint usage attributes. + */ + #define ENDPOINT_USAGE_FEEDBACK (1 << 4) + + /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's + * \c Attributes value to indicate that the specified endpoint is used for implicit feedback. + * + * \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 + { + DTYPE_Device = 0x01, /**< Indicates that the descriptor is a device descriptor. */ + DTYPE_Configuration = 0x02, /**< Indicates that the descriptor is a configuration descriptor. */ + DTYPE_String = 0x03, /**< Indicates that the descriptor is a string descriptor. */ + DTYPE_Interface = 0x04, /**< Indicates that the descriptor is an interface descriptor. */ + DTYPE_Endpoint = 0x05, /**< Indicates that the descriptor is an endpoint descriptor. */ + DTYPE_DeviceQualifier = 0x06, /**< Indicates that the descriptor is a device qualifier descriptor. */ + DTYPE_Other = 0x07, /**< Indicates that the descriptor is of other type. */ + DTYPE_InterfacePower = 0x08, /**< Indicates that the descriptor is an interface power descriptor. */ + DTYPE_InterfaceAssociation = 0x0B, /**< Indicates that the descriptor is an interface association descriptor. */ + DTYPE_CSInterface = 0x24, /**< Indicates that the descriptor is a class specific interface descriptor. */ + DTYPE_CSEndpoint = 0x25, /**< Indicates that the descriptor is a class specific endpoint descriptor. */ + }; + + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors. */ + enum USB_Descriptor_ClassSubclassProtocol_t + { + USB_CSCP_NoDeviceClass = 0x00, /**< Descriptor Class value indicating that the device does not belong + * to a particular class at the device level. + */ + USB_CSCP_NoDeviceSubclass = 0x00, /**< Descriptor Subclass value indicating that the device does not belong + * to a particular subclass at the device level. + */ + USB_CSCP_NoDeviceProtocol = 0x00, /**< Descriptor Protocol value indicating that the device does not belong + * to a particular protocol at the device level. + */ + USB_CSCP_VendorSpecificClass = 0xFF, /**< Descriptor Class value indicating that the device/interface belongs + * to a vendor specific class. + */ + USB_CSCP_VendorSpecificSubclass = 0xFF, /**< Descriptor Subclass value indicating that the device/interface belongs + * to a vendor specific subclass. + */ + USB_CSCP_VendorSpecificProtocol = 0xFF, /**< Descriptor Protocol value indicating that the device/interface belongs + * to a vendor specific protocol. + */ + USB_CSCP_IADDeviceClass = 0xEF, /**< Descriptor Class value indicating that the device belongs to the + * Interface Association Descriptor class. + */ + USB_CSCP_IADDeviceSubclass = 0x02, /**< Descriptor Subclass value indicating that the device belongs to the + * Interface Association Descriptor subclass. + */ + USB_CSCP_IADDeviceProtocol = 0x01, /**< Descriptor Protocol value indicating that the device belongs to the + * Interface Association Descriptor protocol. + */ + }; + + /* Type Defines: */ + /** \brief Standard USB Descriptor Header (LUFA naming conventions). + * + * Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure + * uses LUFA-specific element names to make each element's purpose clearer. + * + * \see \ref USB_StdDescriptor_Header_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t Size; /**< Size of the descriptor, in bytes. */ + uint8_t Type; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value + * given by the specific class. + */ + } ATTR_PACKED 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 + * uses the relevant standard's given element names to ensure compatibility with the standard. + * + * \see \ref USB_Descriptor_Header_t for the version of this type with non-standard LUFA specific element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value + * given by the specific class. + */ + } ATTR_PACKED 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 + * element's purpose clearer. + * + * \see \ref USB_StdDescriptor_Device_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ + + uint16_t USBSpecification; /**< BCD of the supported USB specification. + * + * \see \ref VERSION_BCD() utility macro. + */ + 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. + * + * \see \ref VERSION_BCD() utility macro. + */ + 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. + * + * \note If no string supplied, use \ref NO_DESCRIPTOR. + */ + uint8_t ProductStrIndex; /**< String index for the product name/details. + * + * \see ManufacturerStrIndex structure entry. + */ + uint8_t SerialNumStrIndex; /**< String index for the product's globally unique hexadecimal + * serial number, in uppercase Unicode ASCII. + * + * \note On some microcontroller models, there is an embedded serial number + * in the chip which can be used for the device serial number. + * To use this serial number, set this to \c USE_INTERNAL_SERIAL. + * On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR + * and will cause the host to generate a pseudo-unique value for the + * device upon insertion. + * + * \see \c ManufacturerStrIndex structure entry. + */ + uint8_t NumberOfConfigurations; /**< Total number of configurations supported by + * the device. + */ + } ATTR_PACKED USB_Descriptor_Device_t; + + /** \brief Standard USB Device Descriptor (USB-IF naming conventions). + * + * Type define for a standard Device Descriptor. This structure uses the relevant standard's given element names + * to ensure compatibility with the standard. + * + * \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bcdUSB; /**< BCD of the supported USB specification. + * + * \see \ref VERSION_BCD() utility macro. + */ + uint8_t bDeviceClass; /**< USB device class. */ + uint8_t bDeviceSubClass; /**< USB device subclass. */ + uint8_t bDeviceProtocol; /**< USB device protocol. */ + uint8_t bMaxPacketSize0; /**< Size of the control (address 0) endpoint's bank in bytes. */ + uint16_t idVendor; /**< Vendor ID for the USB product. */ + uint16_t idProduct; /**< Unique product ID for the USB product. */ + uint16_t bcdDevice; /**< Product release (version) number. + * + * \see \ref VERSION_BCD() utility macro. + */ + uint8_t iManufacturer; /**< String index for the manufacturer's name. The + * host will request this string via a separate + * control request for the string descriptor. + * + * \note If no string supplied, use \ref NO_DESCRIPTOR. + */ + uint8_t iProduct; /**< String index for the product name/details. + * + * \see ManufacturerStrIndex structure entry. + */ + uint8_t iSerialNumber; /**< String index for the product's globally unique hexadecimal + * serial number, in uppercase Unicode ASCII. + * + * \note On some microcontroller models, there is an embedded serial number + * in the chip which can be used for the device serial number. + * To use this serial number, set this to \c USE_INTERNAL_SERIAL. + * On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR + * and will cause the host to generate a pseudo-unique value for the + * device upon insertion. + * + * \see \c ManufacturerStrIndex structure entry. + */ + uint8_t bNumConfigurations; /**< Total number of configurations supported by + * the device. + */ + } ATTR_PACKED USB_StdDescriptor_Device_t; + + /** \brief Standard USB Device Qualifier Descriptor (LUFA naming conventions). + * + * Type define for a standard Device Qualifier Descriptor. This structure uses LUFA-specific element names + * to make each element's purpose clearer. + * + * \see \ref USB_StdDescriptor_DeviceQualifier_t for the version of this type with standard element names. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ + + uint16_t USBSpecification; /**< BCD of the supported USB specification. + * + * \see \ref VERSION_BCD() utility macro. + */ + 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. */ + uint8_t NumberOfConfigurations; /**< Total number of configurations supported by + * the device. + */ + uint8_t Reserved; /**< Reserved for future use, must be 0. */ + } ATTR_PACKED USB_Descriptor_DeviceQualifier_t; + + /** \brief Standard USB Device Qualifier Descriptor (USB-IF naming conventions). + * + * Type define for a standard Device Qualifier Descriptor. This structure uses the relevant standard's given element names + * to ensure compatibility with the standard. + * + * \see \ref USB_Descriptor_DeviceQualifier_t for the version of this type with non-standard LUFA specific element names. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bcdUSB; /**< BCD of the supported USB specification. + * + * \see \ref VERSION_BCD() utility macro. + */ + uint8_t bDeviceClass; /**< USB device class. */ + uint8_t bDeviceSubClass; /**< USB device subclass. */ + uint8_t bDeviceProtocol; /**< USB device protocol. */ + uint8_t bMaxPacketSize0; /**< Size of the control (address 0) endpoint's bank in bytes. */ + uint8_t bNumConfigurations; /**< Total number of configurations supported by + * the device. + */ + uint8_t bReserved; /**< Reserved for future use, must be 0. */ + } ATTR_PACKED USB_StdDescriptor_DeviceQualifier_t; + + /** \brief Standard USB Configuration Descriptor (LUFA naming conventions). + * + * Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names + * to make each element's purpose clearer. + * + * \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + 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. + */ + uint8_t TotalInterfaces; /**< Total number of interfaces in the configuration. */ + + 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 \c USB_CONFIG_ATTR_* masks. + * On all devices, this should include USB_CONFIG_ATTR_RESERVED at a minimum. + */ + + uint8_t MaxPowerConsumption; /**< Maximum power consumption of the device while in the + * current configuration, calculated by the \ref USB_CONFIG_POWER_MA() + * macro. + */ + } ATTR_PACKED 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 + * to ensure compatibility with the standard. + * + * \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 wTotalLength; /**< Size of the configuration descriptor header, + * and all sub descriptors inside the configuration. + */ + uint8_t bNumInterfaces; /**< Total number of interfaces in the configuration. */ + uint8_t bConfigurationValue; /**< Configuration index of the current configuration. */ + uint8_t iConfiguration; /**< Index of a string descriptor describing the configuration. */ + uint8_t bmAttributes; /**< Configuration attributes, comprised of a mask of \c USB_CONFIG_ATTR_* masks. + * On all devices, this should include USB_CONFIG_ATTR_RESERVED at a minimum. + */ + uint8_t bMaxPower; /**< Maximum power consumption of the device while in the + * current configuration, calculated by the \ref USB_CONFIG_POWER_MA() + * macro. + */ + } ATTR_PACKED USB_StdDescriptor_Configuration_Header_t; + + /** \brief Standard USB Interface Descriptor (LUFA naming conventions). + * + * Type define for a standard Interface Descriptor. This structure uses LUFA-specific element names + * to make each element's purpose clearer. + * + * \see \ref USB_StdDescriptor_Interface_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ + + uint8_t InterfaceNumber; /**< Index of the interface in the current configuration. */ + uint8_t AlternateSetting; /**< Alternate setting for the interface number. The same + * interface number can have multiple alternate settings + * with different endpoint configurations, which can be + * 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. */ + } ATTR_PACKED 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 + * to ensure compatibility with the standard. + * + * \see \ref USB_Descriptor_Interface_t for the version of this type with non-standard LUFA specific element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bInterfaceNumber; /**< Index of the interface in the current configuration. */ + uint8_t bAlternateSetting; /**< Alternate setting for the interface number. The same + * interface number can have multiple alternate settings + * with different endpoint configurations, which can be + * selected by the host. + */ + uint8_t bNumEndpoints; /**< Total number of endpoints in the interface. */ + uint8_t bInterfaceClass; /**< Interface class ID. */ + uint8_t bInterfaceSubClass; /**< Interface subclass ID. */ + uint8_t bInterfaceProtocol; /**< Interface protocol ID. */ + uint8_t iInterface; /**< Index of the string descriptor describing the + * interface. + */ + } ATTR_PACKED USB_StdDescriptor_Interface_t; + + /** \brief Standard USB Interface Association Descriptor (LUFA naming conventions). + * + * Type define for a standard Interface Association Descriptor. This structure uses LUFA-specific element names + * to make each element's purpose clearer. + * + * This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at + * http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf. It allows composite + * devices with multiple interfaces related to the same function to have the multiple interfaces bound + * together at the point of enumeration, loading one generic driver for all the interfaces in the single + * function. Read the ECN for more information. + * + * \see \ref USB_StdDescriptor_Interface_Association_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + 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. */ + + uint8_t Class; /**< Interface class ID. */ + uint8_t SubClass; /**< Interface subclass ID. */ + uint8_t Protocol; /**< Interface protocol ID. */ + + uint8_t IADStrIndex; /**< Index of the string descriptor describing the + * interface association. + */ + } ATTR_PACKED 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 + * element names to ensure compatibility with the standard. + * + * This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at + * http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf. It allows composite + * devices with multiple interfaces related to the same function to have the multiple interfaces bound + * together at the point of enumeration, loading one generic driver for all the interfaces in the single + * function. Read the ECN for more information. + * + * \see \ref USB_Descriptor_Interface_Association_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bFirstInterface; /**< Index of the first associated interface. */ + uint8_t bInterfaceCount; /**< Total number of associated interfaces. */ + uint8_t bFunctionClass; /**< Interface class ID. */ + uint8_t bFunctionSubClass; /**< Interface subclass ID. */ + uint8_t bFunctionProtocol; /**< Interface protocol ID. */ + uint8_t iFunction; /**< Index of the string descriptor describing the + * interface association. + */ + } ATTR_PACKED USB_StdDescriptor_Interface_Association_t; + + /** \brief Standard USB Endpoint Descriptor (LUFA naming conventions). + * + * Type define for a standard Endpoint Descriptor. This structure uses LUFA-specific element names + * to make each element's purpose clearer. + * + * \see \ref USB_StdDescriptor_Endpoint_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ + + uint8_t EndpointAddress; /**< Logical address of the endpoint within the device for the current + * configuration, including direction mask. + */ + uint8_t Attributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*) + * and attributes (ENDPOINT_ATTR_*) masks. + */ + uint16_t EndpointSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet + * size that the endpoint can receive at a time. + */ + uint8_t PollingIntervalMS; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT + * or ISOCHRONOUS type. + */ + } ATTR_PACKED 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 + * element names to ensure compatibility with the standard. + * + * \see \ref USB_Descriptor_Endpoint_t for the version of this type with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 + * configuration, including direction mask. + */ + 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 + * that the endpoint can receive at a time. + */ + uint8_t bInterval; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or + * ISOCHRONOUS type. + */ + } ATTR_PACKED USB_StdDescriptor_Endpoint_t; + + /** \brief Standard USB String Descriptor (LUFA naming conventions). + * + * Type define for a standard string descriptor. Unlike other standard descriptors, the length + * of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() + * macro rather than by the size of the descriptor structure, as the length is not fixed. + * + * This structure should also be used for string index 0, which contains the supported language IDs for + * the device as an array. + * + * This structure uses LUFA-specific element names to make each element's purpose clearer. + * + * \see \ref USB_StdDescriptor_String_t for the version of this type with standard element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */ + + #if (((ARCH == ARCH_AVR8) || (ARCH == ARCH_XMEGA)) && !defined(__DOXYGEN__)) + wchar_t UnicodeString[]; + #else + uint16_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 + * rather than a normal C string so that they are widened to + * Unicode size. + * + * Under GCC, strings prefixed with the "L" character (before + * the opening string quotation mark) are considered to be + * Unicode strings, and may be used instead of an explicit + * array of ASCII characters on little endian devices with + * UTF-16-LE \c wchar_t encoding. + */ + #endif + } ATTR_PACKED USB_Descriptor_String_t; + + /** \brief Standard USB String Descriptor (USB-IF naming conventions). + * + * Type define for a standard string descriptor. Unlike other standard descriptors, the length + * of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN() + * macro rather than by the size of the descriptor structure, as the length is not fixed. + * + * This structure should also be used for string index 0, which contains the supported language IDs for + * the device as an array. + * + * This structure uses the relevant standard's given element names to ensure compatibility with the standard. + * + * \see \ref USB_Descriptor_String_t for the version of this type with with non-standard LUFA specific + * element names. + * + * \note Regardless of CPU architecture, these values should be stored as little endian. + */ + typedef struct + { + uint8_t bLength; /**< Size of the descriptor, in bytes. */ + 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 bString[]; /**< 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 rather than a normal C string so that they are widened to + * Unicode size. + * + * Under GCC, strings prefixed with the "L" character (before the opening string + * quotation mark) are considered to be Unicode strings, and may be used instead + * of an explicit array of ASCII characters. + */ + } ATTR_PACKED USB_StdDescriptor_String_t; + + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/StdRequestType.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/StdRequestType.h new file mode 100644 index 0000000..b2506cd --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/StdRequestType.h @@ -0,0 +1,258 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB control endpoint request definitions. + * \copydetails Group_StdRequest + * + * \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 + * \brief USB control endpoint request definitions. + * + * This module contains definitions for the various control request parameters, so that the request + * details (such as data direction, request recipient, etc.) can be extracted via masking. + * + * @{ + */ + +#ifndef __STDREQTYPE_H__ +#define __STDREQTYPE_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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 request type parameter, to indicate the direction of the request data (Host to Device + * or Device to Host). The result of this mask should then be compared to the request direction masks. + * + * \see \c REQDIR_* macros for masks indicating the request data direction. + */ + #define CONTROL_REQTYPE_DIRECTION 0x80 + + /** Mask for the request type parameter, to indicate the type of request (Device, Class or Vendor + * Specific). The result of this mask should then be compared to the request type masks. + * + * \see \c REQTYPE_* macros for masks indicating the request type. + */ + #define CONTROL_REQTYPE_TYPE 0x60 + + /** Mask for the request type parameter, to indicate the recipient of the request (Device, Interface + * Endpoint or Other). The result of this mask should then be compared to the request recipient + * masks. + * + * \see \c REQREC_* macros for masks indicating the request recipient. + */ + #define CONTROL_REQTYPE_RECIPIENT 0x1F + + /** \name Control Request Data Direction Masks */ + //@{ + /** Request data direction mask, indicating that the request data will flow from host to device. + * + * \see \ref CONTROL_REQTYPE_DIRECTION macro. + */ + #define REQDIR_HOSTTODEVICE (0 << 7) + + /** Request data direction mask, indicating that the request data will flow from device to host. + * + * \see \ref CONTROL_REQTYPE_DIRECTION macro. + */ + #define REQDIR_DEVICETOHOST (1 << 7) + //@} + + /** \name Control Request Type Masks */ + //@{ + /** Request type mask, indicating that the request is a standard request. + * + * \see \ref CONTROL_REQTYPE_TYPE macro. + */ + #define REQTYPE_STANDARD (0 << 5) + + /** Request type mask, indicating that the request is a class-specific request. + * + * \see \ref CONTROL_REQTYPE_TYPE macro. + */ + #define REQTYPE_CLASS (1 << 5) + + /** Request type mask, indicating that the request is a vendor specific request. + * + * \see \ref CONTROL_REQTYPE_TYPE macro. + */ + #define REQTYPE_VENDOR (2 << 5) + //@} + + /** \name Control Request Recipient Masks */ + //@{ + /** Request recipient mask, indicating that the request is to be issued to the device as a whole. + * + * \see \ref CONTROL_REQTYPE_RECIPIENT macro. + */ + #define REQREC_DEVICE (0 << 0) + + /** Request recipient mask, indicating that the request is to be issued to an interface in the + * currently selected configuration. + * + * \see \ref CONTROL_REQTYPE_RECIPIENT macro. + */ + #define REQREC_INTERFACE (1 << 0) + + /** Request recipient mask, indicating that the request is to be issued to an endpoint in the + * currently selected configuration. + * + * \see \ref CONTROL_REQTYPE_RECIPIENT macro. + */ + #define REQREC_ENDPOINT (2 << 0) + + /** Request recipient mask, indicating that the request is to be issued to an unspecified element + * in the currently selected configuration. + * + * \see \ref CONTROL_REQTYPE_RECIPIENT macro. + */ + #define REQREC_OTHER (3 << 0) + //@} + + /* Type Defines: */ + /** \brief Standard USB Control Request + * + * Type define for a standard USB control request. + * + * \see The USB 2.0 specification for more information on standard control requests. + */ + typedef struct + { + uint8_t bmRequestType; /**< Type of the request. */ + uint8_t bRequest; /**< Request command code. */ + uint16_t wValue; /**< wValue parameter of the request. */ + uint16_t wIndex; /**< wIndex parameter of the request. */ + uint16_t wLength; /**< Length of the data to transfer in bytes. */ + } ATTR_PACKED USB_Request_Header_t; + + /* Enums: */ + /** Enumeration for the various standard request commands. These commands are applicable when the + * request type is \ref REQTYPE_STANDARD (with the exception of \ref REQ_GetDescriptor, which is always + * handled regardless of the request type value). + * + * \see Chapter 9 of the USB 2.0 Specification. + */ + enum USB_Control_Request_t + { + REQ_GetStatus = 0, /**< Implemented in the library for device and endpoint recipients. Passed + * to the user application for other recipients via the + * \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_ClearFeature = 1, /**< Implemented in the library for device and endpoint recipients. Passed + * to the user application for other recipients via the + * \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_SetFeature = 3, /**< Implemented in the library for device and endpoint recipients. Passed + * to the user application for other recipients via the + * \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed + * to the user application for other recipients via the + * \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_GetDescriptor = 6, /**< Implemented in the library for device and interface recipients. Passed to the + * user application for other recipients via the + * \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_SetDescriptor = 7, /**< Not implemented in the library, passed to the user application + * via the \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_GetConfiguration = 8, /**< Implemented in the library for the device recipient. Passed + * to the user application for other recipients via the + * \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_SetConfiguration = 9, /**< Implemented in the library for the device recipient. Passed + * to the user application for other recipients via the + * \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_GetInterface = 10, /**< Not implemented in the library, passed to the user application + * via the \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_SetInterface = 11, /**< Not implemented in the library, passed to the user application + * via the \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + REQ_SynchFrame = 12, /**< Not implemented in the library, passed to the user application + * via the \ref EVENT_USB_Device_ControlRequest() event when received in + * device mode. */ + }; + + /** Feature Selector values for Set Feature and Clear Feature standard control requests directed to the device, interface + * and endpoint recipients. + */ + enum USB_Feature_Selectors_t + { + FEATURE_SEL_EndpointHalt = 0x00, /**< Feature selector for Clear Feature or Set Feature commands. When + * used in a Set Feature or Clear Feature request this indicates that an + * endpoint (whose address is given elsewhere in the request) should have + * its stall condition changed. + */ + FEATURE_SEL_DeviceRemoteWakeup = 0x01, /**< Feature selector for Device level Remote Wakeup enable set or clear. + * This feature can be controlled by the host on devices which indicate + * remote wakeup support in their descriptors to selectively disable or + * enable remote wakeup. + */ + FEATURE_SEL_TestMode = 0x02, /**< Feature selector for Test Mode features, used to test the USB controller + * to check for incorrect operation. + */ + }; + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Macros: */ + #define FEATURE_SELFPOWERED_ENABLED (1 << 0) + #define FEATURE_REMOTE_WAKEUP_ENABLED (1 << 1) + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBController.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBController.h new file mode 100644 index 0000000..c1d74c3 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBController.h @@ -0,0 +1,165 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Common USB Controller definitions for all architectures. + * \copydetails Group_USBManagement + * + * \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 + * \brief USB Controller definitions for general USB controller management. + * + * Functions, macros, variables, enums and types related to the setup and management of the USB interface. + * + * @{ + */ + +#ifndef __USBCONTROLLER_H__ +#define __USBCONTROLLER_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks and Defines: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + /* Defines: */ + /** \name Endpoint Direction Masks */ + //@{ + /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's + * direction for comparing with the \c ENDPOINT_DIR_* masks. + */ + #define ENDPOINT_DIR_MASK 0x80 + + /** Endpoint address direction mask for an OUT direction (Host to Device) endpoint. This may be ORed with + * the index of the address within a device to obtain the full endpoint address. + */ + #define ENDPOINT_DIR_OUT 0x00 + + /** Endpoint address direction mask for an IN direction (Device to Host) endpoint. This may be ORed with + * the index of the address within a device to obtain the full endpoint address. + */ + #define ENDPOINT_DIR_IN 0x80 + //@} + + /** \name Pipe Direction Masks */ + //@{ + /** Pipe direction mask, for masking against pipe addresses to retrieve the pipe's + * direction for comparing with the \c PIPE_DIR_* masks. + */ + #define PIPE_DIR_MASK 0x80 + + /** Endpoint address direction mask for an OUT direction (Host to Device) endpoint. This may be ORed with + * the index of the address within a device to obtain the full endpoint address. + */ + #define PIPE_DIR_OUT 0x00 + + /** Endpoint address direction mask for an IN direction (Device to Host) endpoint. This may be ORed with + * the index of the address within a device to obtain the full endpoint address. + */ + #define PIPE_DIR_IN 0x80 + //@} + + /** \name Endpoint/Pipe Type Masks */ + //@{ + /** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared + * with the \c EP_TYPE_* masks to determine the exact type of the endpoint. + */ + #define EP_TYPE_MASK 0x03 + + /** Mask for a CONTROL type endpoint or pipe. + * + * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. + */ + #define EP_TYPE_CONTROL 0x00 + + /** Mask for an ISOCHRONOUS type endpoint or pipe. + * + * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. + */ + #define EP_TYPE_ISOCHRONOUS 0x01 + + /** Mask for a BULK type endpoint or pipe. + * + * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. + */ + #define EP_TYPE_BULK 0x02 + + /** Mask for an INTERRUPT type endpoint or pipe. + * + * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. + */ + #define EP_TYPE_INTERRUPT 0x03 + //@} + + /* Enums: */ + /** Enum for the possible USB controller modes, for initialization via \ref USB_Init() and indication back to the + * user application via \ref USB_CurrentMode. + */ + enum USB_Modes_t + { + USB_MODE_None = 0, /**< Indicates that the controller is currently not initialized in any specific USB mode. */ + USB_MODE_Device = 1, /**< Indicates that the controller is currently initialized in USB Device mode. */ + USB_MODE_Host = 2, /**< Indicates that the controller is currently initialized in USB Host mode. */ + USB_MODE_UID = 3, /**< Indicates that the controller should determine the USB mode from the UID pin of the + * USB connector. + */ + }; + + /* Architecture Includes: */ + #if (ARCH == ARCH_AVR8) + #include "AVR8/USBController_AVR8.h" + #elif (ARCH == ARCH_UC3) + #include "UC3/USBController_UC3.h" + #elif (ARCH == ARCH_XMEGA) + #include "XMEGA/USBController_XMEGA.h" + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBInterrupt.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBInterrupt.h new file mode 100644 index 0000000..3dcfd5f --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBInterrupt.h @@ -0,0 +1,73 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB controller interrupt service routine management. + * + * This file contains definitions required for the correct handling of low level USB service routine interrupts + * from the USB controller. + * + * \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__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + /* Architecture Includes: */ + #if (ARCH == ARCH_AVR8) + #include "AVR8/USBInterrupt_AVR8.h" + #elif (ARCH == ARCH_UC3) + #include "UC3/USBInterrupt_UC3.h" + #elif (ARCH == ARCH_XMEGA) + #include "XMEGA/USBInterrupt_XMEGA.h" + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBMode.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBMode.h new file mode 100644 index 0000000..09cf307 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBMode.h @@ -0,0 +1,283 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB mode and feature support definitions. + * \copydetails Group_USBMode + * + * \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_USBMode USB Mode Tokens + * \brief USB mode and feature support definitions. + * + * This file defines macros indicating the type of USB controller the library is being compiled for, and its + * capabilities. These macros may then be referenced in the user application to selectively enable or disable + * code sections depending on if they are defined or not. + * + * After the inclusion of the master USB driver header, one or more of the following tokens may be defined, to + * allow the user code to conditionally enable or disable code based on the USB controller family and allowable + * USB modes. These tokens may be tested against to eliminate code relating to a USB mode which is not enabled for + * the given compilation. + * + * @{ + */ + +#ifndef __USBMODE_H__ +#define __USBMODE_H__ + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + /* Includes: */ + #include "../../../Common/Common.h" + + /* Public Interface - May be used in end-application: */ + #if defined(__DOXYGEN__) + /** Indicates that the target AVR microcontroller belongs to the Series 2 AVR8 USB controller + * (i.e. AT90USBxxx2 or ATMEGAxxU2) when defined. + */ + #define USB_SERIES_2_AVR + + /** Indicates that the target AVR microcontroller belongs to the Series 4 AVR8 USB controller + * (i.e. ATMEGAxxU4) when defined. + */ + #define USB_SERIES_4_AVR + + /** Indicates that the target AVR microcontroller belongs to the Series 6 AVR8 USB controller + * (i.e. AT90USBxxx6) when defined. + */ + #define USB_SERIES_6_AVR + + /** Indicates that the target AVR microcontroller belongs to the Series 7 AVR8 USB controller + * (i.e. AT90USBxxx7) when defined. + */ + #define USB_SERIES_7_AVR + + /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A0 Series USB controller + * (i.e. AT32UC3A0*) when defined. + */ + #define USB_SERIES_UC3A0_AVR + + /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A1 Series USB controller + * (i.e. AT32UC3A1*) when defined. + */ + #define USB_SERIES_UC3A1_AVR + + /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A3 Series USB controller + * (i.e. AT32UC3A3*) when defined. + */ + #define USB_SERIES_UC3A3_AVR + + /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A4 Series USB controller + * (i.e. AT32UC3A4*) when defined. + */ + #define USB_SERIES_UC3A4_AVR + + /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B0 Series USB controller + * (i.e. AT32UC3B0*) when defined. + */ + #define USB_SERIES_UC3B0_AVR + + /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B1 Series USB controller + * (i.e. AT32UC3B1*) when defined. + */ + #define USB_SERIES_UC3B1_AVR + + /** Indicates that the target AVR microcontroller belongs to the XMEGA A1U Series USB controller + * (i.e. ATXMEGA*A1U) when defined. + */ + #define USB_SERIES_A1U_XMEGA + + /** Indicates that the target AVR microcontroller belongs to the XMEGA A3U Series USB controller + * (i.e. ATXMEGA*A3U) when defined. + */ + #define USB_SERIES_A3U_XMEGA + + /** Indicates that the target AVR microcontroller belongs to the XMEGA A4U Series USB controller + * (i.e. ATXMEGA*A4U) when defined. + */ + #define USB_SERIES_A4U_XMEGA + + /** Indicates that the target AVR microcontroller belongs to the XMEGA B1 Series USB controller + * (i.e. ATXMEGA*B1) when defined. + */ + #define USB_SERIES_B1_XMEGA + + /** Indicates that the target AVR microcontroller belongs to the XMEGA B3 Series USB controller + * (i.e. ATXMEGA*B3) when defined. + */ + #define USB_SERIES_B3_XMEGA + + /** Indicates that the target AVR microcontroller belongs to the XMEGA C3 Series USB controller + * (i.e. ATXMEGA*C3) when defined. + */ + #define USB_SERIES_C3_XMEGA + + /** Indicates that the target AVR microcontroller belongs to the XMEGA C4 Series USB controller + * (i.e. ATXMEGA*C4) when defined. + */ + #define USB_SERIES_C4_XMEGA + + /** Indicates that the target microcontroller and compilation settings allow for the + * target to be configured in USB Device mode when defined. + */ + #define USB_CAN_BE_DEVICE + + /** Indicates that the target microcontroller and compilation settings allow for the + * target to be configured in USB Host mode when defined. + */ + #define USB_CAN_BE_HOST + + /** Indicates that the target microcontroller and compilation settings allow for the + * target to be configured in either USB Device or Host mode when defined. + */ + #define USB_CAN_BE_BOTH + #else + /* Macros: */ + #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \ + defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)) + #define USB_SERIES_2_AVR + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)) + #define USB_SERIES_4_AVR + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)) + #define USB_SERIES_6_AVR + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__)) + #define USB_SERIES_7_AVR + #define USB_CAN_BE_DEVICE + #define USB_CAN_BE_HOST + #elif (defined(__AVR32_UC3A0512__) || defined(__AVR32_UC3A0256__) || \ + defined(__AVR32_UC3A0128__) || defined(__AVR32_UC3A064__)) + #define USB_SERIES_UC3A0_AVR32 + #define USB_CAN_BE_DEVICE + #define USB_CAN_BE_HOST + #elif (defined(__AVR32_UC3A1512__) || defined(__AVR32_UC3A1256__) || \ + defined(__AVR32_UC3A1128__) || defined(__AVR32_UC3A164__)) + #define USB_SERIES_UC3A1_AVR32 + #define USB_CAN_BE_DEVICE + #define USB_CAN_BE_HOST + #elif (defined(__AVR32_UC3A3256__) || defined(__AVR32_UC3A3256S__) || \ + defined(__AVR32_UC3A3128__) || defined(__AVR32_UC3A3128S__) || \ + defined(__AVR32_UC3A364__) || defined(__AVR32_UC3A364S__)) + #define USB_SERIES_UC3A3_AVR32 + #define USB_CAN_BE_DEVICE + #define USB_CAN_BE_HOST + #elif (defined(__AVR32_UC3A4256__) || defined(__AVR32_UC3A4256S__) || \ + defined(__AVR32_UC3A4128__) || defined(__AVR32_UC3A4128S__) || \ + defined(__AVR32_UC3A464__) || defined(__AVR32_UC3A464S__)) + #define USB_SERIES_UC3A4_AVR32 + #define USB_CAN_BE_DEVICE + #define USB_CAN_BE_HOST + #elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B0256__) || \ + defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B064__)) + #define USB_SERIES_UC3B0_AVR32 + #define USB_CAN_BE_DEVICE + #define USB_CAN_BE_HOST + #elif (defined(__AVR32_UC3B1512__) || defined(__AVR32_UC3B1256__) || \ + defined(__AVR32_UC3B1128__) || defined(__AVR32_UC3B164__)) + #define USB_SERIES_UC3B1_AVR32 + #define USB_CAN_BE_DEVICE + #define USB_CAN_BE_HOST + #elif (defined(__AVR_ATxmega128A1U__) || defined(__AVR_ATxmega64A1U__)) + #define USB_SERIES_A1U_XMEGA + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_ATxmega64A3U__) || defined(__AVR_ATxmega128A3U__) || \ + defined(__AVR_ATxmega192A3U__) || defined(__AVR_ATxmega256A3U__)) + #define USB_SERIES_A3U_XMEGA + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_ATxmega256A3BU__)) + #define USB_SERIES_A3BU_XMEGA + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_ATxmega16A4U__) || defined(__AVR_ATxmega32A4U__) || \ + defined(__AVR_ATxmega64A4U__) || defined(__AVR_ATxmega128A4U__)) + #define USB_SERIES_A4U_XMEGA + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_ATxmega128B1__) || defined(__AVR_ATxmega64B1__)) + #define USB_SERIES_B1_XMEGA + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_ATxmega128B3__) || defined(__AVR_ATxmega64B3__)) + #define USB_SERIES_B3_XMEGA + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_ATxmega128C3__) || defined(__AVR_ATxmega64C3__) || \ + defined(__AVR_ATxmega192C3__) || defined(__AVR_ATxmega256C3__) || \ + defined(__AVR_ATxmega384C3__)) + #define USB_SERIES_C3_XMEGA + #define USB_CAN_BE_DEVICE + #elif (defined(__AVR_ATxmega16C4__) || defined(__AVR_ATxmega32C4__)) + #define USB_SERIES_C4_XMEGA + #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. + #elif defined(USB_HOST_ONLY) + #if !defined(USB_CAN_BE_HOST) + #error USB_HOST_ONLY is not available for the currently selected microcontroller model. + #else + #undef USB_CAN_BE_DEVICE + #endif + #elif defined(USB_DEVICE_ONLY) + #if !defined(USB_CAN_BE_DEVICE) + #error USB_DEVICE_ONLY is not available for the currently selected microcontroller model. + #else + #undef USB_CAN_BE_HOST + #endif + #endif + + #if (defined(USB_CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST)) + #define USB_CAN_BE_BOTH + #endif + + #if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST)) + #error The currently selected device, USB mode or architecture is not supported. + #endif + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBTask.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBTask.c new file mode 100644 index 0000000..30a3cd6 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBTask.c @@ -0,0 +1,89 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USBTASK_C +#define __INCLUDE_FROM_USB_DRIVER +#include "USBTask.h" + +volatile bool USB_IsInitialized; +USB_Request_Header_t USB_ControlRequest; + +#if defined(USB_CAN_BE_HOST) && !defined(HOST_STATE_AS_GPIOR) +volatile uint8_t USB_HostState; +#endif + +#if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR) +volatile uint8_t USB_DeviceState; +#endif + +void USB_USBTask(void) +{ + #if defined(USB_CAN_BE_BOTH) + if (USB_CurrentMode == USB_MODE_Device) + USB_DeviceTask(); + else if (USB_CurrentMode == USB_MODE_Host) + USB_HostTask(); + #elif defined(USB_CAN_BE_HOST) + USB_HostTask(); + #elif defined(USB_CAN_BE_DEVICE) + USB_DeviceTask(); + #endif +} + +#if defined(USB_CAN_BE_DEVICE) +static void USB_DeviceTask(void) +{ + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + + uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint(); + + Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP); + + if (Endpoint_IsSETUPReceived()) + USB_Device_ProcessControlRequest(); + + Endpoint_SelectEndpoint(PrevEndpoint); +} +#endif + +#if defined(USB_CAN_BE_HOST) +static void USB_HostTask(void) +{ + uint8_t PrevPipe = Pipe_GetCurrentPipe(); + + Pipe_SelectPipe(PIPE_CONTROLPIPE); + + USB_Host_ProcessNextHostState(); + + Pipe_SelectPipe(PrevPipe); +} +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBTask.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBTask.h new file mode 100644 index 0000000..7c0917f --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/USBTask.h @@ -0,0 +1,200 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Main USB service task management. + * + * This file contains the function definitions required for the main USB service task, which must be called + * from the user application to ensure that the USB connection to or from a connected USB device is maintained. + * + * \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 __USBTASK_H__ +#define __USBTASK_H__ + + /* Includes: */ + #include "../../../Common/Common.h" + #include "USBMode.h" + #include "USBController.h" + #include "Events.h" + #include "StdRequestType.h" + #include "StdDescriptors.h" + + #if defined(USB_CAN_BE_DEVICE) + #include "DeviceStandardReq.h" + #endif + + #if defined(USB_CAN_BE_HOST) + #include "HostStandardReq.h" + #endif + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* Global Variables: */ + /** Indicates if the USB interface is currently initialized but not necessarily connected to a host + * or device (i.e. if \ref USB_Init() has been run). If this is false, all other library globals related + * to the USB driver are invalid. + * + * \attention This variable should be treated as read-only in the user application, and never manually + * changed in value. + * + * \ingroup Group_USBManagement + */ + extern volatile bool USB_IsInitialized; + + /** Structure containing the last received Control request when in Device mode (for use in user-applications + * inside of the \ref EVENT_USB_Device_ControlRequest() event, or for filling up with a control request to + * issue when in Host mode before calling \ref USB_Host_SendControlRequest(). + * + * \note The contents of this structure is automatically endian-corrected for the current CPU architecture. + * + * \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 + * via one of the values of the \ref USB_Host_States_t enum values. + * + * This value should not be altered by the user application as it is handled automatically by the + * library. + * + * To reduce program size and speed up checks of this global on the AVR8 architecture, it can be + * placed into one of the AVR's \c GPIOR hardware registers instead of RAM by defining the + * \c 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. + * + * \note This global is only present if the user application can be a USB host. + * + * \see \ref USB_Host_States_t for a list of possible device states. + * + * \ingroup Group_Host + */ + extern volatile uint8_t USB_HostState; + #else + #define USB_HostState CONCAT_EXPANDED(GPIOR, HOST_STATE_AS_GPIOR) + #endif + #endif + + #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) + #if !defined(DEVICE_STATE_AS_GPIOR) || defined(__DOXYGEN__) + /** Indicates the current device state machine state. When in device mode, this indicates the state + * via one of the values of the \ref USB_Device_States_t enum values. + * + * This value should not be altered by the user application as it is handled automatically by the + * library. The only exception to this rule is if the NO_LIMITED_CONTROLLER_CONNECT token is used + * (see \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events). + * + * To reduce program size and speed up checks of this global on the AVR8 architecture, it can be + * placed into one of the AVR's \c GPIOR hardware registers instead of RAM by defining the + * \c 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. + * + * \attention This variable should be treated as read-only in the user application, and never manually + * changed in value except in the circumstances outlined above. + * + * \note This global is only present if the user application can be a USB device. + * \n\n + * + * \see \ref USB_Device_States_t for a list of possible device states. + * + * \ingroup Group_Device + */ + extern volatile uint8_t USB_DeviceState; + #else + #define USB_DeviceState CONCAT_EXPANDED(GPIOR, DEVICE_STATE_AS_GPIOR) + #endif + #endif + + /* Function Prototypes: */ + /** This is the main USB management task. The USB driver requires this task to be executed + * continuously when the USB system is active (device attached in host mode, or attached to a host + * in device mode) in order to manage USB communications. This task may be executed inside an RTOS, + * fast timer ISR or the main user application loop. + * + * 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() + * 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() + * event and disabled again on the firing of the \ref EVENT_USB_Host_DeviceEnumerationComplete() or + * \ref EVENT_USB_Host_DeviceEnumerationFailed() events. + * + * If in device mode (only), the control endpoint can instead be managed via interrupts entirely by the library + * by defining the INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch. + * + * \see \ref Group_Events for more information on the USB events. + * + * \ingroup Group_USBManagement + */ + void USB_USBTask(void); + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Function Prototypes: */ + #if defined(__INCLUDE_FROM_USBTASK_C) + #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/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c new file mode 100644 index 0000000..10c3279 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.c @@ -0,0 +1,49 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#include "../Device.h" + +void USB_Device_SendRemoteWakeup(void) +{ + USB.CTRLB |= USB_RWAKEUP_bm; +} + +#endif + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h new file mode 100644 index 0000000..6458c69 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Device_XMEGA.h @@ -0,0 +1,266 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB Device definitions for the AVR XMEGA microcontrollers. + * \copydetails Group_Device_XMEGA + * + * \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_Device + * \defgroup Group_Device_XMEGA Device Management (XMEGA) + * \brief USB Device definitions for the AVR XMEGA microcontrollers. + * + * Architecture specific USB Device definitions for the Atmel AVR XMEGA microcontrollers. + * + * @{ + */ + +#ifndef __USBDEVICE_XMEGA_H__ +#define __USBDEVICE_XMEGA_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + #include "../USBController.h" + #include "../StdDescriptors.h" + #include "../USBInterrupt.h" + #include "../Endpoint.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + #if (defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)) + #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. + #endif + + #if (defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)) + #error USE_FLASH_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. + #endif + + #if (defined(USE_FLASH_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS)) + #error USE_FLASH_DESCRIPTORS and USE_RAM_DESCRIPTORS are mutually exclusive. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** \name USB Device Mode Option Masks */ + //@{ + /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the + * USB interface should be initialized in low speed (1.5Mb/s) mode. + * + * \note Low Speed mode is not available on all USB AVR models. + * \n + * + * \note Restrictions apply on the number, size and type of endpoints which can be used + * when running in low speed mode - refer to the USB 2.0 specification. + */ + #define USB_DEVICE_OPT_LOWSPEED (1 << 0) + + #if (F_USB > 6000000) + /** 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. + */ + #define USB_DEVICE_OPT_FULLSPEED (0 << 0) + #endif + //@} + + #if (!defined(NO_INTERNAL_SERIAL) || defined(__DOXYGEN__)) + /** String descriptor index for the device's unique serial number string descriptor within the device. + * This unique serial number is used by the host to associate resources to the device (such as drivers or COM port + * number allocations) to a device regardless of the port it is plugged in to on the host. Some microcontrollers contain + * a unique serial number internally, and setting the device descriptors serial number string index to this value + * will cause it to use the internal serial number. + * + * On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR and so will force the host to create a pseudo-serial + * number for the device. + */ + #define USE_INTERNAL_SERIAL 0xDC + + /** Length of the device's unique internal serial number, in bits, if present on the selected microcontroller + * model. + */ + #define INTERNAL_SERIAL_LENGTH_BITS (8 * (1 + (offsetof(NVM_PROD_SIGNATURES_t, COORDY1) - offsetof(NVM_PROD_SIGNATURES_t, LOTNUM0)))) + + /** Start address of the internal serial number, in the appropriate address space, if present on the selected microcontroller + * model. + */ + #define INTERNAL_SERIAL_START_ADDRESS offsetof(NVM_PROD_SIGNATURES_t, LOTNUM0) + #else + #define USE_INTERNAL_SERIAL NO_DESCRIPTOR + + #define INTERNAL_SERIAL_LENGTH_BITS 0 + #define INTERNAL_SERIAL_START_ADDRESS 0 + #endif + + /* Function Prototypes: */ + /** Sends a Remote Wakeup request to the host. This signals to the host that the device should + * be taken out of suspended mode, and communications should resume. + * + * Typically, this is implemented so that HID devices (mice, keyboards, etc.) can wake up the + * host computer when the host has suspended all USB devices to enter a low power state. + * + * \note This function should only be used if the device has indicated to the host that it + * supports the Remote Wakeup feature in the device descriptors, and should only be + * issued if the host is currently allowing remote wakeup events from the device (i.e., + * the \ref USB_Device_RemoteWakeupEnabled flag is set). When the \c NO_DEVICE_REMOTE_WAKEUP + * compile time option is used, this function is unavailable. + * \n\n + * + * \note The USB clock must be running for this function to operate. If the stack is initialized with + * the \ref USB_OPT_MANUAL_PLL option enabled, the user must ensure that the PLL is running + * before attempting to call this function. + * + * \see \ref Group_StdDescriptors for more information on the RMWAKEUP feature and device descriptors. + */ + void USB_Device_SendRemoteWakeup(void); + + /* 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. + * + * \return Current USB frame number from the USB controller. + */ + static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; + static inline uint16_t USB_Device_GetFrameNumber(void) + { + return ((USB_EndpointTable_t*)USB.EPPTR)->FrameNum; + } + + #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, + * at the start of each USB frame when enumerated in device mode. + * + * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. + */ + static inline void USB_Device_EnableSOFEvents(void) ATTR_ALWAYS_INLINE; + static inline void USB_Device_EnableSOFEvents(void) + { + USB.INTCTRLA |= USB_SOFIE_bm; + } + + /** 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. + * + * \note This function is not available when the \c NO_SOF_EVENTS compile time token is defined. + */ + static inline void USB_Device_DisableSOFEvents(void) ATTR_ALWAYS_INLINE; + static inline void USB_Device_DisableSOFEvents(void) + { + USB.INTCTRLA &= ~USB_SOFIE_bm; + } + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Inline Functions: */ + static inline void USB_Device_SetLowSpeed(void) ATTR_ALWAYS_INLINE; + static inline void USB_Device_SetLowSpeed(void) + { + USB.CTRLA &= ~USB_SPEED_bm; + } + + static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE; + static inline void USB_Device_SetFullSpeed(void) + { + USB.CTRLA |= USB_SPEED_bm; + } + + static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; + static inline void USB_Device_SetDeviceAddress(const uint8_t Address) + { + (void)Address; + + /* No implementation for XMEGA architecture */ + } + + static inline void USB_Device_EnableDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; + static inline void USB_Device_EnableDeviceAddress(const uint8_t Address) + { + USB.ADDR = Address; + } + + static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; + static inline bool USB_Device_IsAddressSet(void) + { + return ((USB.ADDR != 0) ? true : false); + } + + static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) ATTR_NON_NULL_PTR_ARG(1); + static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) + { + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); + + uint8_t SigReadAddress = INTERNAL_SERIAL_START_ADDRESS; + + for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++) + { + uint8_t SerialByte; + + NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc; + SerialByte = pgm_read_byte_far(SigReadAddress); + NVM.CMD = 0; + + if (SerialCharNum & 0x01) + { + SerialByte >>= 4; + SigReadAddress++; + } + + SerialByte &= 0x0F; + + UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ? + (('A' - 10) + SerialByte) : ('0' + SerialByte)); + } + + SetGlobalInterruptMask(CurrentGlobalInt); + } + + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c new file mode 100644 index 0000000..0306149 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c @@ -0,0 +1,275 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#include "EndpointStream_XMEGA.h" + +#if !defined(CONTROL_ONLY_DEVICE) +uint8_t Endpoint_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearOUT(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return ENDPOINT_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + } + else + { + Endpoint_Discard_8(); + + Length--; + BytesInTransfer++; + } + } + + return ENDPOINT_RWSTREAM_NoError; +} + +uint8_t Endpoint_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t ErrorCode; + uint16_t BytesInTransfer = 0; + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + Length -= *BytesProcessed; + + while (Length) + { + if (!(Endpoint_IsReadWriteAllowed())) + { + Endpoint_ClearIN(); + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return ENDPOINT_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + } + else + { + Endpoint_Write_8(0); + + Length--; + BytesInTransfer++; + } + } + + return ENDPOINT_RWSTREAM_NoError; +} + +/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations, + * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */ + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE +#define TEMPLATE_BUFFER_TYPE const void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_RW.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE +#define TEMPLATE_BUFFER_TYPE void* +#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_RW.c" + +#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte_far(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte_far(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" +#endif + +#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE + #define TEMPLATE_BUFFER_TYPE const void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE + #define TEMPLATE_BUFFER_TYPE void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_RW.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE + #define TEMPLATE_BUFFER_TYPE void* + #define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_RW.c" +#endif + +#endif + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_Control_W.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) +#include "Template/Template_Endpoint_Control_W.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE +#define TEMPLATE_BUFFER_OFFSET(Length) 0 +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_Control_R.c" + +#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE +#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) +#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount +#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() +#include "Template/Template_Endpoint_Control_R.c" + +#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" +#endif + +#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) + #include "Template/Template_Endpoint_Control_W.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE + #define TEMPLATE_BUFFER_OFFSET(Length) 0 + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_Control_R.c" + + #define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE + #define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) + #define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount + #define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) + #include "Template/Template_Endpoint_Control_R.c" +#endif + +#endif + +#endif diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h new file mode 100644 index 0000000..cba6537 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.h @@ -0,0 +1,658 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Endpoint data stream transmission and reception management for the AVR XMEGA microcontrollers. + * \copydetails Group_EndpointStreamRW_XMEGA + * + * \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_EndpointStreamRW + * \defgroup Group_EndpointStreamRW_XMEGA Read/Write of Multi-Byte Streams (XMEGA) + * \brief Endpoint data stream transmission and reception management for the Atmel AVR XMEGA architecture. + * + * Functions, macros, variables, enums and types related to data reading and writing of data streams from + * and to endpoints. + * + * @{ + */ + +#ifndef __ENDPOINT_STREAM_XMEGA_H__ +#define __ENDPOINT_STREAM_XMEGA_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + #include "../USBMode.h" + #include "../USBTask.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + /* Function Prototypes: */ + /** \name Stream functions for null data */ + //@{ + + /** Reads and discards the given number of bytes from the currently selected endpoint's bank, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Length Number of bytes to discard via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Discard_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + /** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending + * full packets to the host as needed. The last packet is not automatically sent once the + * remaining bytes have been written; the user is responsible for manually sending the last + * packet to the host via the \ref Endpoint_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Length Number of zero bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Null_Stream(uint16_t Length, + uint16_t* const BytesProcessed); + + //@} + + /** \name Stream functions for RAM source/destination data */ + //@{ + + /** Writes the given number of bytes to the endpoint from the given buffer in little endian, + * sending full packets to the host as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Endpoint_ClearIN() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes full while there is still data to process (and after the current + * packet transmission has been initiated) the BytesProcessed location will be updated with the + * total number of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the endpoint from the given buffer in big endian, + * sending full packets to the host as needed. The last packet filled is not automatically sent; + * the user is responsible for manually sending the last written packet to the host via the + * \ref Endpoint_ClearIN() macro. + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the endpoint from the given buffer in little endian, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, + * failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid + * storage location, the transfer will instead be performed as a series of chunks. Each time + * the endpoint bank becomes empty while there is still data to process (and after the current + * packet has been acknowledged) the BytesProcessed location will be updated with the total number + * of bytes processed in the stream, and the function will exit with an error code of + * \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed + * in the user code - to continue the transfer, call the function again with identical parameters + * and it will resume until the BytesProcessed value reaches the total transfer length. + * + * Single Stream Transfer Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * + * if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), + * NULL)) != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * Partial Stream Transfers Example: + * \code + * uint8_t DataStream[512]; + * uint8_t ErrorCode; + * uint16_t BytesProcessed; + * + * BytesProcessed = 0; + * while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), + * &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) + * { + * // Stream not yet complete - do other actions here, abort if required + * } + * + * if (ErrorCode != ENDPOINT_RWSTREAM_NoError) + * { + * // Stream failed to complete - check ErrorCode here + * } + * \endcode + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Stream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the endpoint from the given buffer in big endian, + * discarding fully read packets from the host as needed. The last packet is not automatically + * discarded once the remaining bytes has been read; the user is responsible for manually + * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. + * + * \note This routine should not be used on CONTROL type endpoints. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Stream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian, + * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared + * in both failure and success states; the user is responsible for manually clearing the status OUT packet + * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian, + * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared + * in both failure and success states; the user is responsible for manually clearing the status OUT packet + * to finalize the transfer's status stage via the \ref Endpoint_ClearOUT() macro. + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian, + * discarding fully read packets from the host as needed. The device IN acknowledgement is not + * automatically sent after success or failure states; the user is responsible for manually sending the + * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian, + * discarding fully read packets from the host as needed. The device IN acknowledgement is not + * automatically sent after success or failure states; the user is responsible for manually sending the + * status IN packet to finalize the transfer's status stage via the \ref Endpoint_ClearIN() macro. + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /** \name Stream functions for EEPROM source/destination data */ + //@{ + + /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_EStream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE(). + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_EStream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE(). + * + * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_EStream_LE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE(). + * + * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be read at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_EStream_BE(void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE. + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE(). + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE(). + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE(). + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[out] Buffer Pointer to the destination data buffer to write to. + * \param[in] Length Number of bytes to send via the currently selected endpoint. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /** \name Stream functions for PROGMEM source/destination data */ + //@{ + + /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_PStream_LE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current + * transaction should be updated, \c NULL if the entire stream should be written at once. + * + * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_PStream_BE(const void* const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + + /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE(). + * + * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. + * + * \note This function automatically sends the last packet in the data stage of the transaction; when the + * function returns, the user is responsible for clearing the status stage of the transaction. + * Note that the status stage packet is sent or received in the opposite direction of the data flow. + * \n\n + * + * \note This routine should only be used on CONTROL type endpoints. + * \n\n + * + * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained + * together; i.e. the entire stream data must be read or written at the one time. + * + * \param[in] Buffer Pointer to the source data buffer to read from. + * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. + * + * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. + */ + uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer, + uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); + //@} + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c new file mode 100644 index 0000000..8155ecf --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.c @@ -0,0 +1,268 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_DEVICE) + +#include "../Endpoint.h" + +#if !defined(FIXED_CONTROL_ENDPOINT_SIZE) +uint8_t USB_Device_ControlEndpointSize = ENDPOINT_CONTROLEP_DEFAULT_SIZE; +#endif + +Endpoint_FIFOPair_t USB_Endpoint_FIFOs[ENDPOINT_TOTAL_ENDPOINTS]; + +volatile uint8_t USB_Endpoint_SelectedEndpoint; +volatile USB_EP_t* USB_Endpoint_SelectedHandle; +volatile Endpoint_FIFO_t* USB_Endpoint_SelectedFIFO; + +bool Endpoint_IsINReady(void) +{ + Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN); + + return ((USB_Endpoint_SelectedHandle->STATUS & USB_EP_BUSNACK0_bm) ? true : false); +} + +bool Endpoint_IsOUTReceived(void) +{ + Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN); + + if (USB_Endpoint_SelectedHandle->STATUS & USB_EP_TRNCOMPL0_bm) + { + USB_Endpoint_SelectedFIFO->Length = USB_Endpoint_SelectedHandle->CNT; + return true; + } + + return false; +} + +bool Endpoint_IsSETUPReceived(void) +{ + Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN); + + if (USB_Endpoint_SelectedHandle->STATUS & USB_EP_SETUP_bm) + { + USB_Endpoint_SelectedFIFO->Length = USB_Endpoint_SelectedHandle->CNT; + return true; + } + + return false; +} + +void Endpoint_ClearSETUP(void) +{ + Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN); + USB_Endpoint_SelectedHandle->STATUS &= ~(USB_EP_SETUP_bm | USB_EP_TRNCOMPL0_bm | USB_EP_BUSNACK0_bm | USB_EP_OVF_bm); + USB_Endpoint_SelectedHandle->STATUS |= USB_EP_TOGGLE_bm; + USB_Endpoint_SelectedFIFO->Position = 0; + + Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN); + USB_Endpoint_SelectedHandle->STATUS |= USB_EP_TOGGLE_bm; + USB_Endpoint_SelectedFIFO->Position = 0; +} + +void Endpoint_ClearIN(void) +{ + USB_Endpoint_SelectedHandle->CNT = USB_Endpoint_SelectedFIFO->Position; + USB_Endpoint_SelectedHandle->STATUS &= ~(USB_EP_TRNCOMPL0_bm | USB_EP_BUSNACK0_bm | USB_EP_OVF_bm); + USB_Endpoint_SelectedFIFO->Position = 0; +} + +void Endpoint_ClearOUT(void) +{ + USB_Endpoint_SelectedHandle->STATUS &= ~(USB_EP_TRNCOMPL0_bm | USB_EP_BUSNACK0_bm | USB_EP_OVF_bm); + USB_Endpoint_SelectedFIFO->Position = 0; +} + +void Endpoint_StallTransaction(void) +{ + USB_Endpoint_SelectedHandle->CTRL |= USB_EP_STALL_bm; + + if ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_TYPE_gm) == USB_EP_TYPE_CONTROL_gc) + { + Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint ^ ENDPOINT_DIR_IN); + USB_Endpoint_SelectedHandle->CTRL |= USB_EP_STALL_bm; + } +} + +uint8_t Endpoint_Read_8(void) +{ + return USB_Endpoint_SelectedFIFO->Data[USB_Endpoint_SelectedFIFO->Position++]; +} + +void Endpoint_Write_8(const uint8_t Data) +{ + USB_Endpoint_SelectedFIFO->Data[USB_Endpoint_SelectedFIFO->Position++] = Data; +} + +void Endpoint_SelectEndpoint(const uint8_t Address) +{ + uint8_t EndpointNumber = (Address & ENDPOINT_EPNUM_MASK); + + USB_Endpoint_SelectedEndpoint = Address; + + Endpoint_FIFOPair_t* EndpointFIFOPair = &USB_Endpoint_FIFOs[EndpointNumber]; + USB_EndpointTable_t* EndpointTable = (USB_EndpointTable_t*)USB.EPPTR; + + if (Address & ENDPOINT_DIR_IN) + { + USB_Endpoint_SelectedFIFO = &EndpointFIFOPair->IN; + USB_Endpoint_SelectedHandle = &EndpointTable->Endpoints[EndpointNumber].IN; + } + else + { + USB_Endpoint_SelectedFIFO = &EndpointFIFOPair->OUT; + USB_Endpoint_SelectedHandle = &EndpointTable->Endpoints[EndpointNumber].OUT; + } +} + +bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, + const uint8_t Entries) +{ + for (uint8_t i = 0; i < Entries; i++) + { + if (!(Table[i].Address)) + continue; + + if (!(Endpoint_ConfigureEndpoint(Table[i].Address, Table[i].Type, Table[i].Size, Table[i].Banks))) + { + return false; + } + } + + return true; +} + +bool Endpoint_ConfigureEndpoint_PRV(const uint8_t Address, + const uint8_t Config, + const uint8_t Size) +{ + Endpoint_SelectEndpoint(Address); + + USB_Endpoint_SelectedHandle->CTRL = 0; + USB_Endpoint_SelectedHandle->STATUS = (Address & ENDPOINT_DIR_IN) ? USB_EP_BUSNACK0_bm : 0; + USB_Endpoint_SelectedHandle->CTRL = Config; + USB_Endpoint_SelectedHandle->CNT = 0; + USB_Endpoint_SelectedHandle->DATAPTR = (intptr_t)USB_Endpoint_SelectedFIFO->Data; + + USB_Endpoint_SelectedFIFO->Length = (Address & ENDPOINT_DIR_IN) ? Size : 0; + USB_Endpoint_SelectedFIFO->Position = 0; + + return true; +} + +void Endpoint_ClearEndpoints(void) +{ + for (uint8_t EPNum = 0; EPNum < ENDPOINT_TOTAL_ENDPOINTS; EPNum++) + { + ((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].IN.CTRL = 0; + ((USB_EndpointTable_t*)USB.EPPTR)->Endpoints[EPNum].OUT.CTRL = 0; + } +} + +void Endpoint_ClearStatusStage(void) +{ + if (USB_ControlRequest.bmRequestType & REQDIR_DEVICETOHOST) + { + while (!(Endpoint_IsOUTReceived())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + + Endpoint_ClearOUT(); + } + else + { + while (!(Endpoint_IsINReady())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + + Endpoint_ClearIN(); + } +} + +#if !defined(CONTROL_ONLY_DEVICE) +uint8_t Endpoint_WaitUntilReady(void) +{ + #if (USB_STREAM_TIMEOUT_MS < 0xFF) + uint8_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; + #else + uint16_t TimeoutMSRem = USB_STREAM_TIMEOUT_MS; + #endif + + uint16_t PreviousFrameNumber = USB_Device_GetFrameNumber(); + + for (;;) + { + if (Endpoint_GetEndpointDirection() == ENDPOINT_DIR_IN) + { + if (Endpoint_IsINReady()) + return ENDPOINT_READYWAIT_NoError; + } + else + { + 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; + else if (Endpoint_IsStalled()) + return ENDPOINT_READYWAIT_EndpointStalled; + + uint16_t CurrentFrameNumber = USB_Device_GetFrameNumber(); + + if (CurrentFrameNumber != PreviousFrameNumber) + { + PreviousFrameNumber = CurrentFrameNumber; + + if (!(TimeoutMSRem--)) + return ENDPOINT_READYWAIT_Timeout; + } + } +} +#endif + +#endif + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h new file mode 100644 index 0000000..42c476b --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h @@ -0,0 +1,689 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB Endpoint definitions for the AVR XMEGA microcontrollers. + * \copydetails Group_EndpointManagement_XMEGA + * + * \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_EndpointRW + * \defgroup Group_EndpointRW_XMEGA Endpoint Data Reading and Writing (XMEGA) + * \brief Endpoint data read/write definitions for the Atmel AVR XMEGA architecture. + * + * Functions, macros, variables, enums and types related to data reading and writing from and to endpoints. + */ + +/** \ingroup Group_EndpointPrimitiveRW + * \defgroup Group_EndpointPrimitiveRW_XMEGA Read/Write of Primitive Data Types (XMEGA) + * \brief Endpoint primitive read/write definitions for the Atmel AVR XMEGA architecture. + * + * Functions, macros, variables, enums and types related to data reading and writing of primitive data types + * from and to endpoints. + */ + +/** \ingroup Group_EndpointPacketManagement + * \defgroup Group_EndpointPacketManagement_XMEGA Endpoint Packet Management (XMEGA) + * \brief Endpoint packet management definitions for the Atmel AVR XMEGA architecture. + * + * Functions, macros, variables, enums and types related to packet management of endpoints. + */ + +/** \ingroup Group_EndpointManagement + * \defgroup Group_EndpointManagement_XMEGA Endpoint Management (XMEGA) + * \brief Endpoint management definitions for the Atmel AVR XMEGA architecture. + * + * Functions, macros and enums related to endpoint management when in USB Device mode. This + * module contains the endpoint management macros, as well as endpoint interrupt and data + * send/receive functions for various data types. + * + * @{ + */ + +#ifndef __ENDPOINT_XMEGA_H__ +#define __ENDPOINT_XMEGA_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + #include "../USBTask.h" + #include "../USBInterrupt.h" + #include "../USBController.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* 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: */ + #if (!defined(MAX_ENDPOINT_INDEX) && !defined(CONTROL_ONLY_DEVICE)) || defined(__DOXYGEN__) + /** Total number of endpoints (including the default control endpoint at address 0) which may + * be used in the device. Different USB AVR models support different amounts of endpoints, + * this value reflects the maximum number of endpoints for the currently selected AVR model. + */ + #define ENDPOINT_TOTAL_ENDPOINTS 16 + #else + #if defined(CONTROL_ONLY_DEVICE) + #define ENDPOINT_TOTAL_ENDPOINTS 1 + #else + #define ENDPOINT_TOTAL_ENDPOINTS (MAX_ENDPOINT_INDEX + 1) + #endif + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Type Defines: */ + typedef struct + { + uint8_t Data[64]; + + uint8_t Length; + uint8_t Position; + } Endpoint_FIFO_t; + + typedef struct + { + Endpoint_FIFO_t OUT; + Endpoint_FIFO_t IN; + } Endpoint_FIFOPair_t; + + /* External Variables: */ + extern Endpoint_FIFOPair_t USB_Endpoint_FIFOs[ENDPOINT_TOTAL_ENDPOINTS]; + extern volatile uint8_t USB_Endpoint_SelectedEndpoint; + extern volatile USB_EP_t* USB_Endpoint_SelectedHandle; + extern volatile Endpoint_FIFO_t* USB_Endpoint_SelectedFIFO; + + /* Inline Functions: */ + static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST + ATTR_ALWAYS_INLINE; + static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) + { + uint8_t MaskVal = 0; + uint16_t CheckBytes = 8; + + while (CheckBytes < Bytes) + { + MaskVal++; + CheckBytes <<= 1; + } + + return (MaskVal << USB_EP_BUFSIZE_gp); + } + + /* Function Prototypes: */ + bool Endpoint_ConfigureEndpoint_PRV(const uint8_t Address, + const uint8_t Config, + const uint8_t Size); + void Endpoint_ClearEndpoints(void); + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + #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 + * value in the device descriptor. Not available if the \c FIXED_CONTROL_ENDPOINT_SIZE token is defined. + */ + #define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8 + #endif + + /* Enums: */ + /** Enum for the possible error return codes of the \ref Endpoint_WaitUntilReady() function. + * + * \ingroup Group_EndpointRW_XMEGA + */ + enum Endpoint_WaitUntilReady_ErrorCodes_t + { + ENDPOINT_READYWAIT_NoError = 0, /**< Endpoint is ready for next packet, no error. */ + ENDPOINT_READYWAIT_EndpointStalled = 1, /**< The endpoint was stalled during the stream + * transfer by the host or device. + */ + ENDPOINT_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while + * waiting for the endpoint to become ready. + */ + ENDPOINT_READYWAIT_BusSuspended = 3, /**< The USB bus has been suspended by the host and + * no USB endpoint traffic can occur until the bus + * has resumed. + */ + ENDPOINT_READYWAIT_Timeout = 4, /**< The host failed to accept or send the next packet + * within the software timeout period set by the + * \ref USB_STREAM_TIMEOUT_MS macro. + */ + }; + + /* Inline Functions: */ + /** Selects the given endpoint address. + * + * Any endpoint operations which do not require the endpoint address to be indicated will operate on + * the currently selected endpoint. + * + * \param[in] Address Endpoint address to select. + */ + void Endpoint_SelectEndpoint(const uint8_t Address); + + /** Configures the specified endpoint address with the given endpoint type, bank size and number of hardware + * banks. Once configured, the endpoint may be read from or written to, depending on its direction. + * + * \param[in] Address Endpoint address to configure. + * + * \param[in] Type Type of endpoint to configure, a \c EP_TYPE_* mask. Not all endpoint types + * are available on Low Speed USB devices - refer to the USB 2.0 specification. + * + * \param[in] Size Size of the endpoint's bank, where packets are stored before they are transmitted + * to the USB host, or after they have been received from the USB host (depending on + * the endpoint's data direction). The bank size must indicate the maximum packet size + * that the endpoint can handle. + * + * \param[in] Banks Number of hardware banks to use for the endpoint being configured. + * + * \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 + * + * \note This routine will automatically select the specified endpoint. + * + * \return Boolean \c true if the configuration succeeded, \c false otherwise. + */ + static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address, + const uint8_t Type, + const uint16_t Size, + const uint8_t Banks) ATTR_ALWAYS_INLINE; + static inline bool Endpoint_ConfigureEndpoint(const uint8_t Address, + const uint8_t Type, + const uint16_t Size, + const uint8_t Banks) + { + uint8_t EPConfigMask = (USB_EP_INTDSBL_bm | ((Banks > 1) ? USB_EP_PINGPONG_bm : 0) | Endpoint_BytesToEPSizeMask(Size)); + + if ((Address & ENDPOINT_EPNUM_MASK) >= ENDPOINT_TOTAL_ENDPOINTS) + return false; + + // TODO - Fix once limitations are lifted + EPConfigMask &= ~USB_EP_PINGPONG_bm; + if (Size > 64) + return false; + + switch (Type) + { + case EP_TYPE_CONTROL: + EPConfigMask |= USB_EP_TYPE_CONTROL_gc; + break; + case EP_TYPE_ISOCHRONOUS: + EPConfigMask |= USB_EP_TYPE_ISOCHRONOUS_gc; + break; + default: + EPConfigMask |= USB_EP_TYPE_BULK_gc; + break; + } + + if (Type == EP_TYPE_CONTROL) + Endpoint_ConfigureEndpoint_PRV(Address ^ ENDPOINT_DIR_IN, EPConfigMask, Size); + + return Endpoint_ConfigureEndpoint_PRV(Address, EPConfigMask, Size); + } + + /** Indicates the number of bytes currently stored in the current endpoint's selected bank. + * + * \ingroup Group_EndpointRW_XMEGA + * + * \return Total number of bytes in the currently selected Endpoint's FIFO buffer. + */ + static inline uint16_t Endpoint_BytesInEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint16_t Endpoint_BytesInEndpoint(void) + { + if (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN) + return USB_Endpoint_SelectedFIFO->Position; + else + return (USB_Endpoint_SelectedFIFO->Length - USB_Endpoint_SelectedFIFO->Position); + } + + /** Get the endpoint address of the currently selected endpoint. This is typically used to save + * the currently selected endpoint so that it can be restored after another endpoint has been + * manipulated. + * + * \return Index of the currently selected endpoint. + */ + static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint8_t Endpoint_GetCurrentEndpoint(void) + { + return USB_Endpoint_SelectedEndpoint; + } + + /** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's + * data In and Out pointers to the bank's contents. + * + * \param[in] Address Endpoint address whose FIFO buffers are to be reset. + */ + static inline void Endpoint_ResetEndpoint(const uint8_t Address) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ResetEndpoint(const uint8_t Address) + { + if (Address & ENDPOINT_DIR_IN) + USB_Endpoint_FIFOs[Address & ENDPOINT_EPNUM_MASK].IN.Position = 0; + else + USB_Endpoint_FIFOs[Address & ENDPOINT_EPNUM_MASK].OUT.Position = 0; + } + + /** Determines if the currently selected endpoint is enabled, but not necessarily configured. + * + * \return Boolean \c true if the currently selected endpoint is enabled, \c false otherwise. + */ + static inline bool Endpoint_IsEnabled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsEnabled(void) + { + return true; + } + + /** Aborts all pending IN transactions on the currently selected endpoint, once the bank + * has been queued for transmission to the host via \ref Endpoint_ClearIN(). This function + * will terminate all queued transactions, resetting the endpoint banks ready for a new + * packet. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + */ + static inline void Endpoint_AbortPendingIN(void) + { + USB_Endpoint_SelectedHandle->STATUS |= USB_EP_BUSNACK0_bm; + } + + /** 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 + * is an OUT direction and no packet (or an empty packet) has been received, or if the endpoint is an IN + * direction and the endpoint bank is full. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + * + * \return Boolean \c true if the currently selected endpoint may be read from or written to, depending + * on its direction. + */ + static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsReadWriteAllowed(void) + { + return (USB_Endpoint_SelectedFIFO->Position < USB_Endpoint_SelectedFIFO->Length); + } + + /** Determines if the currently selected endpoint is configured. + * + * \return Boolean \c true if the currently selected endpoint has been configured, \c false otherwise. + */ + static inline bool Endpoint_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsConfigured(void) + { + return ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_TYPE_gm) ? true : false); + } + + /** Determines if the selected IN endpoint is ready for a new packet to be sent to the host. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + * + * \return Boolean \c true if the current endpoint is ready for an IN packet, \c false otherwise. + */ + bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT; + + /** Determines if the selected OUT endpoint has received new packet from the host. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + * + * \return Boolean \c true if current endpoint is has received an OUT packet, \c false otherwise. + */ + bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT; + + /** Determines if the current CONTROL type endpoint has received a SETUP packet. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + * + * \return Boolean \c true if the selected endpoint has received a SETUP packet, \c false otherwise. + */ + bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT; + + /** Clears a received SETUP packet on the currently selected CONTROL type endpoint, freeing up the + * endpoint for the next packet. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + * + * \note This is not applicable for non CONTROL type endpoints. + */ + void Endpoint_ClearSETUP(void); + + /** 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. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + */ + void Endpoint_ClearIN(void); + + /** 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. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + */ + void Endpoint_ClearOUT(void); + + /** 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 + * aborted and the host can begin its own recovery sequence. + * + * The currently selected endpoint remains stalled until either the \ref Endpoint_ClearStall() macro + * is called, or the host issues a CLEAR FEATURE request to the device for the currently selected + * endpoint. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + */ + void Endpoint_StallTransaction(void); + + /** Clears the STALL condition on the currently selected endpoint. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + */ + static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_ClearStall(void) + { + USB_Endpoint_SelectedHandle->CTRL &= ~USB_EP_STALL_bm; + } + + /** Determines if the currently selected endpoint is stalled, \c false otherwise. + * + * \ingroup Group_EndpointPacketManagement_XMEGA + * + * \return Boolean \c true if the currently selected endpoint is stalled, \c false otherwise. + */ + static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline bool Endpoint_IsStalled(void) + { + return ((USB_Endpoint_SelectedHandle->CTRL & USB_EP_STALL_bm) ? 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) + { + USB_Endpoint_SelectedHandle->STATUS &= ~USB_EP_TOGGLE_bm; + } + + /** Determines the currently selected endpoint's direction. + * + * \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask. + */ + static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint8_t Endpoint_GetEndpointDirection(void) + { + return (USB_Endpoint_SelectedEndpoint & ENDPOINT_DIR_IN); + } + + /** Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \return Next byte in the currently selected endpoint's FIFO buffer. + */ + uint8_t Endpoint_Read_8(void) ATTR_WARN_UNUSED_RESULT; + + /** Writes one byte to the currently selected endpoint's bank, for IN direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \param[in] Data Data to write into the the currently selected endpoint's FIFO buffer. + */ + void Endpoint_Write_8(const uint8_t Data); + + /** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + */ + static inline void Endpoint_Discard_8(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Discard_8(void) + { + USB_Endpoint_SelectedFIFO->Position++; + } + + /** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT + * direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \return Next two bytes in the currently selected endpoint's FIFO buffer. + */ + static inline uint16_t Endpoint_Read_16_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint16_t Endpoint_Read_16_LE(void) + { + uint16_t Byte0 = Endpoint_Read_8(); + uint16_t Byte1 = Endpoint_Read_8(); + + return ((Byte1 << 8) | Byte0); + } + + /** Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT + * direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \return Next two bytes in the currently selected endpoint's FIFO buffer. + */ + static inline uint16_t Endpoint_Read_16_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint16_t Endpoint_Read_16_BE(void) + { + uint16_t Byte0 = Endpoint_Read_8(); + uint16_t Byte1 = Endpoint_Read_8(); + + return ((Byte0 << 8) | Byte1); + } + + /** Writes two bytes to the currently selected endpoint's bank in little endian format, for IN + * direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. + */ + static inline void Endpoint_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Write_16_LE(const uint16_t Data) + { + Endpoint_Write_8(Data & 0xFF); + Endpoint_Write_8(Data >> 8); + } + + /** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN + * direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. + */ + static inline void Endpoint_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Write_16_BE(const uint16_t Data) + { + Endpoint_Write_8(Data >> 8); + Endpoint_Write_8(Data & 0xFF); + } + + /** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + */ + static inline void Endpoint_Discard_16(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Discard_16(void) + { + Endpoint_Discard_8(); + Endpoint_Discard_8(); + } + + /** Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT + * direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \return Next four bytes in the currently selected endpoint's FIFO buffer. + */ + static inline uint32_t Endpoint_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint32_t Endpoint_Read_32_LE(void) + { + uint32_t Byte0 = Endpoint_Read_8(); + uint32_t Byte1 = Endpoint_Read_8(); + uint32_t Byte2 = Endpoint_Read_8(); + uint32_t Byte3 = Endpoint_Read_8(); + + return ((Byte3 << 24) | (Byte2 << 16) | (Byte1 << 8) | Byte0); + } + + /** Reads four bytes from the currently selected endpoint's bank in big endian format, for OUT + * direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \return Next four bytes in the currently selected endpoint's FIFO buffer. + */ + static inline uint32_t Endpoint_Read_32_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; + static inline uint32_t Endpoint_Read_32_BE(void) + { + uint32_t Byte0 = Endpoint_Read_8(); + uint32_t Byte1 = Endpoint_Read_8(); + uint32_t Byte2 = Endpoint_Read_8(); + uint32_t Byte3 = Endpoint_Read_8(); + + return ((Byte0 << 24) | (Byte1 << 16) | (Byte2 << 8) | Byte3); + } + + /** Writes four bytes to the currently selected endpoint's bank in little endian format, for IN + * direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. + */ + static inline void Endpoint_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Write_32_LE(const uint32_t Data) + { + Endpoint_Write_8(Data & 0xFF); + Endpoint_Write_8(Data >> 8); + Endpoint_Write_8(Data >> 16); + Endpoint_Write_8(Data >> 24); + } + + /** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN + * direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + * + * \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. + */ + static inline void Endpoint_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Write_32_BE(const uint32_t Data) + { + Endpoint_Write_8(Data >> 24); + Endpoint_Write_8(Data >> 16); + Endpoint_Write_8(Data >> 8); + Endpoint_Write_8(Data & 0xFF); + } + + /** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints. + * + * \ingroup Group_EndpointPrimitiveRW_XMEGA + */ + static inline void Endpoint_Discard_32(void) ATTR_ALWAYS_INLINE; + static inline void Endpoint_Discard_32(void) + { + Endpoint_Discard_8(); + Endpoint_Discard_8(); + Endpoint_Discard_8(); + Endpoint_Discard_8(); + } + + /* External Variables: */ + /** Global indicating the maximum packet size of the default control endpoint located at address + * 0 in the device. This value is set to the value indicated in the device descriptor in the user + * project once the USB interface is initialized into device mode. + * + * If space is an issue, it is possible to fix this to a static value by defining the control + * endpoint size in the \c FIXED_CONTROL_ENDPOINT_SIZE token passed to the compiler in the makefile + * via the -D switch. When a fixed control endpoint size is used, the size is no longer dynamically + * read from the descriptors at runtime and instead fixed to the given value. When used, it is + * important that the descriptor control endpoint size value matches the size given as the + * \c FIXED_CONTROL_ENDPOINT_SIZE token - it is recommended that the \c FIXED_CONTROL_ENDPOINT_SIZE token + * be used in the device descriptors to ensure this. + * + * \attention This variable should be treated as read-only in the user application, and never manually + * changed in value. + */ + #if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) + extern uint8_t USB_Device_ControlEndpointSize; + #else + #define USB_Device_ControlEndpointSize FIXED_CONTROL_ENDPOINT_SIZE + #endif + + /* Function Prototypes: */ + /** Configures a table of endpoint descriptions, in sequence. This function can be used to configure multiple + * endpoints at the same time. + * + * \note Endpoints with a zero address will be ignored, thus this function cannot be used to configure the + * control endpoint. + * + * \param[in] Table Pointer to a table of endpoint descriptions. + * \param[in] Entries Number of entries in the endpoint table to configure. + * + * \return Boolean \c true if all endpoints configured successfully, \c false otherwise. + */ + bool Endpoint_ConfigureEndpointTable(const USB_Endpoint_Table_t* const Table, + const uint8_t Entries); + + /** Completes the status stage of a control transfer on a CONTROL type endpoint automatically, + * with respect to the data direction. This is a convenience function which can be used to + * simplify user control request handling. + * + * \note This routine should not be called on non CONTROL type endpoints. + */ + void Endpoint_ClearStatusStage(void); + + /** Spin-loops until the currently selected non-control endpoint is ready for the next packet of data + * to be read or written to it. + * + * \note This routine should not be called on CONTROL type endpoints. + * + * \ingroup Group_EndpointRW_XMEGA + * + * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. + */ + uint8_t Endpoint_WaitUntilReady(void); + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c new file mode 100644 index 0000000..c467733 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Host_XMEGA.c @@ -0,0 +1,41 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_HOST) + +#endif + +#endif diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c new file mode 100644 index 0000000..c467733 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/PipeStream_XMEGA.c @@ -0,0 +1,41 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_HOST) + +#endif + +#endif diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c new file mode 100644 index 0000000..69f369e --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Pipe_XMEGA.c @@ -0,0 +1,37 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBMode.h" + +#if defined(USB_CAN_BE_HOST) + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c new file mode 100644 index 0000000..0bd3843 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_R.c @@ -0,0 +1,86 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#if defined(TEMPLATE_FUNC_NAME) + +uint8_t TEMPLATE_FUNC_NAME (void* const Buffer, + uint16_t Length) +{ + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + + Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint & ~ENDPOINT_DIR_IN); + + if (!(Length)) + Endpoint_ClearOUT(); + + while (Length) + { + 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) + return ENDPOINT_RWCSTREAM_BusSuspended; + else if (Endpoint_IsSETUPReceived()) + return ENDPOINT_RWCSTREAM_HostAborted; + + if (Endpoint_IsOUTReceived()) + { + while (Length && Endpoint_BytesInEndpoint()) + { + TEMPLATE_TRANSFER_BYTE(DataStream); + TEMPLATE_BUFFER_MOVE(DataStream, 1); + Length--; + } + + Endpoint_ClearOUT(); + } + } + + while (!(Endpoint_IsINReady())) + { + 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) + return ENDPOINT_RWCSTREAM_BusSuspended; + } + + return ENDPOINT_RWCSTREAM_NoError; +} + +#undef TEMPLATE_BUFFER_OFFSET +#undef TEMPLATE_BUFFER_MOVE +#undef TEMPLATE_FUNC_NAME +#undef TEMPLATE_TRANSFER_BYTE + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c new file mode 100644 index 0000000..5bd4092 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_Control_W.c @@ -0,0 +1,95 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#if defined(TEMPLATE_FUNC_NAME) + +uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer, + uint16_t Length) +{ + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + bool LastPacketFull = false; + + Endpoint_SelectEndpoint(USB_Endpoint_SelectedEndpoint | ENDPOINT_DIR_IN); + + if (Length > USB_ControlRequest.wLength) + Length = USB_ControlRequest.wLength; + else if (!(Length)) + Endpoint_ClearIN(); + + 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) + return ENDPOINT_RWCSTREAM_BusSuspended; + else if (Endpoint_IsSETUPReceived()) + return ENDPOINT_RWCSTREAM_HostAborted; + else if (Endpoint_IsOUTReceived()) + break; + + if (Endpoint_IsINReady()) + { + uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); + + while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize)) + { + TEMPLATE_TRANSFER_BYTE(DataStream); + TEMPLATE_BUFFER_MOVE(DataStream, 1); + Length--; + BytesInEndpoint++; + } + + LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize); + Endpoint_ClearIN(); + } + } + + while (!(Endpoint_IsOUTReceived())) + { + 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) + return ENDPOINT_RWCSTREAM_BusSuspended; + } + + return ENDPOINT_RWCSTREAM_NoError; +} + +#undef TEMPLATE_BUFFER_OFFSET +#undef TEMPLATE_BUFFER_MOVE +#undef TEMPLATE_FUNC_NAME +#undef TEMPLATE_TRANSFER_BYTE + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c new file mode 100644 index 0000000..d51afdf --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/Template/Template_Endpoint_RW.c @@ -0,0 +1,89 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#if defined(TEMPLATE_FUNC_NAME) + +uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE const Buffer, + uint16_t Length, + uint16_t* const BytesProcessed) +{ + uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); + uint16_t BytesInTransfer = 0; + uint8_t ErrorCode; + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + + if (BytesProcessed != NULL) + { + Length -= *BytesProcessed; + TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed); + } + + while (Length) + { + if (!(Endpoint_IsReadWriteAllowed())) + { + TEMPLATE_CLEAR_ENDPOINT(); + + #if !defined(INTERRUPT_CONTROL_ENDPOINT) + USB_USBTask(); + #endif + + if (BytesProcessed != NULL) + { + *BytesProcessed += BytesInTransfer; + return ENDPOINT_RWSTREAM_IncompleteTransfer; + } + + if ((ErrorCode = Endpoint_WaitUntilReady())) + return ErrorCode; + } + else + { + TEMPLATE_TRANSFER_BYTE(DataStream); + TEMPLATE_BUFFER_MOVE(DataStream, 1); + Length--; + BytesInTransfer++; + } + } + + return ENDPOINT_RWSTREAM_NoError; +} + +#undef TEMPLATE_FUNC_NAME +#undef TEMPLATE_BUFFER_TYPE +#undef TEMPLATE_TRANSFER_BYTE +#undef TEMPLATE_CLEAR_ENDPOINT +#undef TEMPLATE_BUFFER_OFFSET +#undef TEMPLATE_BUFFER_MOVE + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c new file mode 100644 index 0000000..f88fa6b --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c @@ -0,0 +1,193 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + +#define __INCLUDE_FROM_USB_DRIVER +#define __INCLUDE_FROM_USB_CONTROLLER_C +#include "../USBController.h" + +#if defined(USB_CAN_BE_BOTH) +volatile uint8_t USB_CurrentMode = USB_MODE_None; +#endif + +#if !defined(USE_STATIC_OPTIONS) +volatile uint8_t USB_Options; +#endif + +/* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for the 8-bit AVR-GCC toolchain */ +uint8_t USB_EndpointTable[sizeof(USB_EndpointTable_t) + 1]; + +void USB_Init( + #if defined(USB_CAN_BE_BOTH) + const uint8_t Mode + #endif + + #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) + , + #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) + void + #endif + + #if !defined(USE_STATIC_OPTIONS) + const uint8_t Options + #endif + ) +{ + #if !defined(USE_STATIC_OPTIONS) + USB_Options = Options; + #endif + + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); + + NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc; + USB.CAL0 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL0)); + USB.CAL1 = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBCAL1)); + NVM.CMD = NVM_CMD_NO_OPERATION_gc; + + /* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for the 8-bit AVR-GCC toolchain */ + USB.EPPTR = ((intptr_t)&USB_EndpointTable[1] & ~(1 << 0)); + USB.CTRLA = (USB_STFRNUM_bm | ((ENDPOINT_TOTAL_ENDPOINTS - 1) << USB_MAXEP_gp)); + + if ((USB_Options & USB_OPT_BUSEVENT_PRIHIGH) == USB_OPT_BUSEVENT_PRIHIGH) + USB.INTCTRLA = (3 << USB_INTLVL_gp); + else if ((USB_Options & USB_OPT_BUSEVENT_PRIMED) == USB_OPT_BUSEVENT_PRIMED) + USB.INTCTRLA = (2 << USB_INTLVL_gp); + else + USB.INTCTRLA = (1 << USB_INTLVL_gp); + + SetGlobalInterruptMask(CurrentGlobalInt); + + #if defined(USB_CAN_BE_BOTH) + USB_CurrentMode = Mode; + #endif + + USB_IsInitialized = true; + + USB_ResetInterface(); +} + +void USB_Disable(void) +{ + USB_INT_DisableAllInterrupts(); + USB_INT_ClearAllInterrupts(); + + USB_Detach(); + USB_Controller_Disable(); + + USB_IsInitialized = false; +} + +void USB_ResetInterface(void) +{ + #if defined(USB_DEVICE_OPT_FULLSPEED) + if (USB_Options & USB_DEVICE_OPT_LOWSPEED) + CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp); + else + CLK.USBCTRL = (((F_USB / 48000000) - 1) << CLK_USBPSDIV_gp); + #else + CLK.USBCTRL = (((F_USB / 6000000) - 1) << CLK_USBPSDIV_gp); + #endif + + if (USB_Options & USB_OPT_PLLCLKSRC) + CLK.USBCTRL |= (CLK_USBSRC_PLL_gc | CLK_USBSEN_bm); + else + CLK.USBCTRL |= (CLK_USBSRC_RC32M_gc | CLK_USBSEN_bm); + + USB_Device_SetDeviceAddress(0); + + USB_INT_DisableAllInterrupts(); + USB_INT_ClearAllInterrupts(); + + USB_Controller_Reset(); + USB_Init_Device(); +} + +#if defined(USB_CAN_BE_DEVICE) +static void USB_Init_Device(void) +{ + USB_DeviceState = DEVICE_STATE_Unattached; + USB_Device_ConfigurationNumber = 0; + + #if !defined(NO_DEVICE_REMOTE_WAKEUP) + USB_Device_RemoteWakeupEnabled = false; + #endif + + #if !defined(NO_DEVICE_SELF_POWER) + USB_Device_CurrentlySelfPowered = false; + #endif + + #if !defined(FIXED_CONTROL_ENDPOINT_SIZE) + USB_Descriptor_Device_t* DeviceDescriptorPtr; + + #if defined(ARCH_HAS_MULTI_ADDRESS_SPACE) && \ + !(defined(USE_FLASH_DESCRIPTORS) || defined(USE_EEPROM_DESCRIPTORS) || defined(USE_RAM_DESCRIPTORS)) + uint8_t DescriptorAddressSpace; + + if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr, &DescriptorAddressSpace) != NO_DESCRIPTOR) + { + if (DescriptorAddressSpace == MEMSPACE_FLASH) + USB_Device_ControlEndpointSize = pgm_read_byte_far(&DeviceDescriptorPtr->Endpoint0Size); + else if (DescriptorAddressSpace == MEMSPACE_EEPROM) + USB_Device_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + else + USB_Device_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; + } + #else + if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR) + { + #if defined(USE_RAM_DESCRIPTORS) + USB_Device_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size; + #elif defined(USE_EEPROM_DESCRIPTORS) + USB_Device_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size); + #else + USB_Device_ControlEndpointSize = pgm_read_byte_far(&DeviceDescriptorPtr->Endpoint0Size); + #endif + } + #endif + #endif + + if (USB_Options & USB_DEVICE_OPT_LOWSPEED) + USB_Device_SetLowSpeed(); + else + USB_Device_SetFullSpeed(); + + Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, + USB_Device_ControlEndpointSize, 1); + + USB_INT_Enable(USB_INT_BUSEVENTI); + + USB_Attach(); +} +#endif + +#endif diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h new file mode 100644 index 0000000..15d4eec --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h @@ -0,0 +1,313 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB Controller definitions for the AVR XMEGA microcontrollers. + * \copydetails Group_USBManagement_XMEGA + * + * \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_USBManagement + * \defgroup Group_USBManagement_XMEGA USB Interface Management (XMEGA) + * \brief USB Controller definitions for the AVR XMEGA microcontrollers. + * + * Functions, macros, variables, enums and types related to the setup and management of the USB interface. + * + * @{ + */ + +#ifndef __USBCONTROLLER_XMEGA_H__ +#define __USBCONTROLLER_XMEGA_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + #include "../USBMode.h" + #include "../Events.h" + #include "../USBTask.h" + #include "../USBInterrupt.h" + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Macros: */ + #if defined(MAX_ENDPOINT_INDEX) + #define ENDPOINT_TABLE_COUNT (MAX_ENDPOINT_INDEX + 1) + #else + #define ENDPOINT_TABLE_COUNT 16 + #endif + + /* Type Defines: */ + typedef struct + { + struct + { + USB_EP_t OUT; + USB_EP_t IN; + } Endpoints[ENDPOINT_TABLE_COUNT]; + uint16_t FrameNum; + } ATTR_PACKED USB_EndpointTable_t; + + /* External Variables: */ + extern uint8_t USB_EndpointTable[]; + #endif + + /* Includes: */ + #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) + #include "../Device.h" + #include "../Endpoint.h" + #include "../DeviceStandardReq.h" + #include "../EndpointStream.h" + #endif + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks and Defines: */ + #if !defined(__INCLUDE_FROM_USB_DRIVER) + #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. + #endif + + #if !defined(F_USB) + #error F_USB is not defined. You must define F_USB to the frequency of the unprescaled USB controller clock in your project makefile. + #endif + + #if ((F_USB % 6000000) || (F_USB < 6000000)) + #error Invalid F_USB specified. F_USB must be a multiple of 6MHz for USB Low Speed operation, and a multiple of 48MHz for Full Speed operation. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** \name USB Controller Option Masks */ + //@{ + /** Sets the USB bus interrupt priority level to be low priority. The USB bus interrupt is used for Start of Frame events, bus suspend + * and resume events, bus reset events and other events related to the management of the USB bus. + */ + #define USB_OPT_BUSEVENT_PRILOW ((0 << 2) | (0 << 1)) + + /** Sets the USB bus interrupt priority level to be medium priority. The USB bus interrupt is used for Start of Frame events, bus suspend + * and resume events, bus reset events and other events related to the management of the USB bus. + */ + #define USB_OPT_BUSEVENT_PRIMED ((0 << 2) | (1 << 1)) + + /** Sets the USB bus interrupt priority level to be high priority. The USB bus interrupt is used for Start of Frame events, bus suspend + * and resume events, bus reset events and other events related to the management of the USB bus. + */ + #define USB_OPT_BUSEVENT_PRIHIGH ((1 << 2) | (0 << 1)) + + /** Sets the USB controller to source its clock from the internal RC 32MHz clock, once it has been DFLL calibrated to 48MHz. */ + #define USB_OPT_RC32MCLKSRC (0 << 3) + + /** Sets the USB controller to source its clock from the internal PLL. */ + #define USB_OPT_PLLCLKSRC (1 << 3) + //@} + + #if !defined(USB_STREAM_TIMEOUT_MS) || defined(__DOXYGEN__) + /** Constant for the maximum software timeout period of the USB data stream transfer functions + * (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 + * \ref USB_STREAM_TIMEOUT_MS token, and passed to the compiler using the -D switch. + */ + #define USB_STREAM_TIMEOUT_MS 100 + #endif + + /* Inline Functions: */ + /** Detaches the device from the USB bus. This has the effect of removing the device from any + * attached host, ceasing USB communications. If no host is present, this prevents any host from + * enumerating the device once attached until \ref USB_Attach() is called. + */ + static inline void USB_Detach(void) ATTR_ALWAYS_INLINE; + static inline void USB_Detach(void) + { + USB.CTRLB &= ~USB_ATTACH_bm; + } + + /** Attaches the device to the USB bus. This announces the device's presence to any attached + * USB host, starting the enumeration process. If no host is present, attaching the device + * will allow for enumeration once a host is connected to the device. + * + * This is inexplicably also required for proper operation while in host mode, to enable the + * attachment of a device to the host. This is despite the bit being located in the device-mode + * register and despite the datasheet making no mention of its requirement in host mode. + */ + static inline void USB_Attach(void) ATTR_ALWAYS_INLINE; + static inline void USB_Attach(void) + { + USB.CTRLB |= USB_ATTACH_bm; + } + + /* Function Prototypes: */ + /** Main function to initialize and start the USB interface. Once active, the USB interface will + * allow for device connection to a host when in device mode, or for device enumeration while in + * host mode. + * + * As the USB library relies on interrupts for the device and host mode enumeration processes, + * the user must enable global interrupts before or shortly after this function is called. In + * device mode, interrupts must be enabled within 500ms of this function being called to ensure + * that the host does not time out whilst enumerating the device. In host mode, interrupts may be + * enabled at the application's leisure however enumeration will not begin of an attached device + * until after this has occurred. + * + * Calling this function when the USB interface is already initialized will cause a complete USB + * interface reset and re-enumeration. + * + * \param[in] Mode Mask indicating what mode the USB interface is to be initialized to, a value + * from the \ref USB_Modes_t enum. + * \note This parameter does not exist on devices with only one supported USB + * mode (device or host). + * + * \param[in] Options Mask indicating the options which should be used when initializing the USB + * interface to control the USB interface's behavior. This should be comprised of + * a \c USB_OPT_REG_* mask to control the regulator, a \c USB_OPT_*_PLL mask to control the + * PLL, and a \c 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, + * the mode can be statically set in the project makefile by defining the token \c USB_DEVICE_ONLY + * (for device mode) or \c 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 required, + * 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 \c 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 + * AVR models which only implement the USB device mode in hardware. + * + * \see \ref Group_Device for the \c USB_DEVICE_OPT_* masks. + */ + void USB_Init( + #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) + const uint8_t Mode + #endif + + #if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) || defined(__DOXYGEN__) + , + #elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) + void + #endif + + #if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) + 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. + */ + void USB_Disable(void); + + /** Resets the interface, when already initialized. This will re-enumerate the device if already connected + * to a host, or re-enumerate an already attached device when in host mode. + */ + void USB_ResetInterface(void); + + /* Global Variables: */ + #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) + /** Indicates the mode that the USB interface is currently initialized to, a value from the + * \ref USB_Modes_t enum. + * + * \attention This variable should be treated as read-only in the user application, and never manually + * changed in value. + * + * \note When the controller is initialized into UID auto-detection mode, this variable will hold the + * currently selected USB mode (i.e. \ref USB_MODE_Device or \ref USB_MODE_Host). If the controller + * is fixed into a specific mode (either through the \c USB_DEVICE_ONLY or \c USB_HOST_ONLY compile time + * options, or a limitation of the USB controller in the chosen device model) this will evaluate to + * a constant of the appropriate value and will never evaluate to \ref USB_MODE_None even when the + * USB interface is not initialized. + */ + extern volatile uint8_t USB_CurrentMode; + #elif defined(USB_CAN_BE_HOST) + #define USB_CurrentMode USB_MODE_Host + #elif defined(USB_CAN_BE_DEVICE) + #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 \c USB_MODE_* masks defined elsewhere in this module. + * + * \attention This variable should be treated as read-only in the user application, and never manually + * changed in value. + */ + extern volatile uint8_t USB_Options; + #elif defined(USE_STATIC_OPTIONS) + #define USB_Options USE_STATIC_OPTIONS + #endif + + /* Private Interface - For use in library only: */ + #if !defined(__DOXYGEN__) + /* Function Prototypes: */ + #if defined(__INCLUDE_FROM_USB_CONTROLLER_C) + static void USB_Init_Device(void); + #endif + + /* Inline Functions: */ + static inline void USB_Controller_Enable(void) ATTR_ALWAYS_INLINE; + static inline void USB_Controller_Enable(void) + { + USB.CTRLA |= USB_ENABLE_bm; + } + + static inline void USB_Controller_Disable(void) ATTR_ALWAYS_INLINE; + static inline void USB_Controller_Disable(void) + { + USB.CTRLA &= ~USB_ENABLE_bm; + } + + static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE; + static inline void USB_Controller_Reset(void) + { + USB.CTRLA &= ~USB_ENABLE_bm; + USB.CTRLA |= USB_ENABLE_bm; + } + + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c new file mode 100644 index 0000000..f4115b0 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.c @@ -0,0 +1,108 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +#include "../../../../Common/Common.h" +#if (ARCH == ARCH_XMEGA) + +#define __INCLUDE_FROM_USB_DRIVER +#include "../USBInterrupt.h" + +void USB_INT_DisableAllInterrupts(void) +{ + USB.INTCTRLA &= USB_INTLVL_gm; + USB.INTCTRLB = 0; +} + +void USB_INT_ClearAllInterrupts(void) +{ + USB.INTFLAGSACLR = 0xFF; + USB.INTFLAGSBCLR = 0xFF; +} + +ISR(USB_BUSEVENT_vect) +{ + #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 + + if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Suspend)) + { + USB_INT_Clear(USB_INT_BUSEVENTI_Suspend); + + #if !defined(NO_LIMITED_CONTROLLER_CONNECT) + USB_DeviceState = DEVICE_STATE_Unattached; + EVENT_USB_Device_Disconnect(); + #else + USB_DeviceState = DEVICE_STATE_Suspended; + EVENT_USB_Device_Suspend(); + #endif + } + + if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Resume)) + { + + USB_INT_Clear(USB_INT_BUSEVENTI_Resume); + + if (USB_Device_ConfigurationNumber) + USB_DeviceState = DEVICE_STATE_Configured; + else + USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Addressed : DEVICE_STATE_Powered; + + #if !defined(NO_LIMITED_CONTROLLER_CONNECT) + EVENT_USB_Device_Connect(); + #else + EVENT_USB_Device_WakeUp(); + #endif + } + + if (USB_INT_HasOccurred(USB_INT_BUSEVENTI_Reset)) + { + + USB_INT_Clear(USB_INT_BUSEVENTI_Reset); + + USB_DeviceState = DEVICE_STATE_Default; + USB_Device_ConfigurationNumber = 0; + + USB_Device_EnableDeviceAddress(0); + + Endpoint_ClearEndpoints(); + Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL, + USB_Device_ControlEndpointSize, 1); + + EVENT_USB_Device_Reset(); + } +} + +#endif diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h new file mode 100644 index 0000000..e224e22 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/Core/XMEGA/USBInterrupt_XMEGA.h @@ -0,0 +1,172 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief USB Controller Interrupt definitions for the AVR XMEGA microcontrollers. + * + * This file contains definitions required for the correct handling of low level USB service routine interrupts + * from the USB controller. + * + * \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_XMEGA_H__ +#define __USBINTERRUPT_XMEGA_H__ + + /* Includes: */ + #include "../../../../Common/Common.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #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__) + /* Enums: */ + enum USB_Interrupts_t + { + USB_INT_BUSEVENTI = 1, + USB_INT_BUSEVENTI_Suspend = 2, + USB_INT_BUSEVENTI_Resume = 3, + USB_INT_BUSEVENTI_Reset = 4, + USB_INT_SOFI = 5, + }; + + /* Inline Functions: */ + static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; + static inline void USB_INT_Enable(const uint8_t Interrupt) + { + switch (Interrupt) + { + case USB_INT_BUSEVENTI: + USB.INTCTRLA |= USB_BUSEVIE_bm; + break; + case USB_INT_SOFI: + USB.INTCTRLA |= USB_SOFIE_bm; + break; + default: + break; + } + } + + static inline void USB_INT_Disable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; + static inline void USB_INT_Disable(const uint8_t Interrupt) + { + switch (Interrupt) + { + case USB_INT_BUSEVENTI: + USB.INTCTRLA &= ~USB_BUSEVIE_bm; + break; + case USB_INT_SOFI: + USB.INTCTRLA &= ~USB_SOFIE_bm; + break; + default: + break; + } + } + + static inline void USB_INT_Clear(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; + static inline void USB_INT_Clear(const uint8_t Interrupt) + { + switch (Interrupt) + { + case USB_INT_BUSEVENTI_Suspend: + USB.INTFLAGSACLR = USB_SUSPENDIF_bm; + break; + case USB_INT_BUSEVENTI_Resume: + USB.INTFLAGSACLR = USB_RESUMEIF_bm; + break; + case USB_INT_BUSEVENTI_Reset: + USB.INTFLAGSACLR = USB_RSTIF_bm; + break; + case USB_INT_SOFI: + USB.INTFLAGSACLR = USB_SOFIF_bm; + break; + default: + break; + } + } + + static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; + static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) + { + switch (Interrupt) + { + case USB_INT_BUSEVENTI: + return ((USB.INTCTRLA & USB_BUSEVIE_bm) ? true : false); + case USB_INT_SOFI: + return ((USB.INTCTRLA & USB_SOFIE_bm) ? true : false); + default: + return false; + } + } + + static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; + static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) + { + switch (Interrupt) + { + case USB_INT_BUSEVENTI_Suspend: + return ((USB.INTFLAGSACLR & USB_SUSPENDIF_bm) ? true : false); + case USB_INT_BUSEVENTI_Resume: + return ((USB.INTFLAGSACLR & USB_RESUMEIF_bm) ? true : false); + case USB_INT_BUSEVENTI_Reset: + return ((USB.INTFLAGSACLR & USB_RSTIF_bm) ? true : false); + case USB_INT_SOFI: + return ((USB.INTFLAGSACLR & USB_SOFIF_bm) ? true : false); + default: + return false; + } + } + + /* Includes: */ + #include "../USBMode.h" + #include "../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/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/USB.h b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/USB.h new file mode 100644 index 0000000..a8df26f --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Drivers/USB/USB.h @@ -0,0 +1,422 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Master include file for the library USB functionality. + * + * Master include file for the library USB functionality. + * + * This file should be included in all user projects making use of the USB portions of the library, instead of + * the individual USB driver submodule headers. + */ + +/** \defgroup Group_USB USB Core - LUFA/Drivers/USB/USB.h + * + * \brief Core driver for the microcontroller hardware USB module + * + * \section Sec_USB_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - LUFA/Drivers/USB/Core/ConfigDescriptors.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/DeviceStandardReq.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/Events.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/HostStandardReq.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/USBTask.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/ARCH/Device_ARCH.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/ARCH/Endpoint_ARCH.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/ARCH/EndpointStream_ARCH.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/ARCH/Host_ARCH.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/ARCH/Pipe_ARCH.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/ARCH/PipeStream_ARCH.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/ARCH/USBController_ARCH.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Core/ARCH/USBInterrupt_ARCH.c (Makefile source module name: LUFA_SRC_USB) + * - LUFA/Drivers/USB/Class/Common/HIDParser.c (Makefile source module name: LUFA_SRC_USB) + * + * \section Sec_USB_ModDescription Module Description + * Driver and framework for the USB controller of the selected architecture and microcontroller model. This module + * consists of many submodules, and is designed to provide an easy way to configure and control USB host, device + * or OTG mode USB applications. + * + * The USB stack requires the sole control over the USB controller in the microcontroller only; i.e. it does not + * require any additional timers or other peripherals to operate. This ensures that the USB stack requires as few + * resources as possible. + * + * The USB stack can be used in Device Mode for connections to USB Hosts (see \ref Group_Device), in Host mode for + * hosting of other USB devices (see \ref Group_Host), or as a dual role device which can either act as a USB host + * or device depending on what peripheral is connected (see \ref Group_OTG). Both modes also require a common set + * of USB management functions found \ref Group_USBManagement. + */ + +/** \defgroup Group_USBClassDrivers USB Class Drivers + * + * \brief Drivers for the various standardized USB device classes + * + * Drivers for both host and device mode of the standard USB classes, for rapid application development. + * Class drivers give a framework which sits on top of the low level library API, allowing for standard + * USB classes to be implemented in a project with minimal user code. These drivers can be used in + * conjunction with the library low level APIs to implement interfaces both via the class drivers and via + * the standard library APIs. + * + * Multiple device mode class drivers can be used within a project, including multiple instances of the + * same class driver. In this way, USB Hosts and Devices can be made quickly using the internal class drivers + * so that more time and effort can be put into the end application instead of the USB protocol. + * + * The available class drivers and their modes are listed below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
USB ClassDevice ModeHost Mode
Android Open AccessoryNoYes
Audio 1.0YesYes
CDC-ACMYesYes
HIDYesYes
MIDIYesYes
Mass StorageYesYes
PrinterYesYes
RNDISYesYes
Still ImageNoYes
+ * + * + * \section Sec_USB_UsingClassDrivers Using the Class Drivers + * To make the Class drivers easy to integrate into a user application, they all implement a standardized + * design with similarly named/used function, enums, defines and types. The two different modes are implemented + * slightly differently, and thus will be explained separately. For information on a specific class driver, read + * the class driver's module documentation. + * + * \subsection Sec_USB_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 + * similar manner between classes, that of USB_ClassInfo_{Class Name}_Device_t, 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 \c USB_ClassInfo_* + * structure. + * + * Inside the ClassInfo structure lies two sections, a \c Config section, and a \c State section. The \c Config + * section contains the instance's configuration parameters, and must have all fields set by the user application + * before the class driver is used. Each Device mode Class driver typically contains a set of configuration parameters + * for the endpoint size/number of the associated logical USB interface, plus any class-specific configuration parameters. + * + * The following is an example of a properly initialized instance of the Audio Class Driver structure: + * + * \code + * USB_ClassInfo_Audio_Device_t My_Audio_Interface = + * { + * .Config = + * { + * .StreamingInterfaceNumber = 1, + * .DataINEndpoint = + * { + * .Address = (ENDPOINT_DIR_IN | 1), + * .Size = 64, + * .Banks = 1, + * }, + * }, + * }; + * \endcode + * + * \note The class driver's configuration parameters should match those used in the device's descriptors that are + * sent to the host. + * + * To initialize the Class driver instance, the driver's {Class Name}_Device_ConfigureEndpoints() function + * should be called in response to the \ref EVENT_USB_Device_ConfigurationChanged() event. This function will return a + * boolean true value if the driver successfully initialized the instance. 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 like this: + * + * \code + * 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 + * {Class Name}_Device_USBTask() 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 + * instance. Again, this function uses the address of the instance to operate on, and thus needs to be called for each + * separate instance, just like the main USB maintenance routine \ref USB_USBTask(): + * + * \code + * int main(void) + * { + * SetupHardware(); + * + * LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + * + * for (;;) + * { + * if (USB_DeviceState != DEVICE_STATE_Configured) + * Create_And_Process_Samples(); + * + * Audio_Device_USBTask(&My_Audio_Interface); + * USB_USBTask(); + * } + * } + * \endcode + * + * The final standardized Device Class Driver function is the Control Request handler function + * {Class Name}_Device_ProcessControlRequest(), which should be called when the + * \ref EVENT_USB_Device_ControlRequest() event fires. This function should also be called for + * each class driver instance, using the address of the instance to operate on as the function's + * parameter. The request handler will abort if it is determined that the current request is not + * targeted at the given class driver instance, thus these methods can safely be called + * one-after-another in the event handler with no form of error checking: + * + * \code + * void EVENT_USB_Device_ControlRequest(void) + * { + * Audio_Device_ProcessControlRequest(&My_Audio_Interface); + * } + * \endcode + * + * Each class driver may also define a set of callback functions (which are prefixed by \c CALLBACK_* + * in the function's name) which must also be added to the user application - refer to each + * individual class driver's documentation for mandatory callbacks. In addition, each class driver may + * also define a set of events (identifiable by their prefix of \c EVENT_* in the function's name), which + * the user application may choose to implement, or ignore if not needed. + * + * The individual Device Mode Class Driver documentation contains more information on the non-standardized, + * class-specific functions which the user application can then use on the driver instances, such as data + * read and write routines. See each driver's individual documentation for more information on the + * class-specific functions. + * + * \subsection Sec_USB_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 + * similar manner between classes, that of USB_ClassInfo_{Class Name}_Host_t, 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 \c USB_ClassInfo_* + * structure. + * + * Inside the \c USB_ClassInfo_* structure lies two sections, a \c Config section, and a \c State section. The \c Config + * section contains the instance's configuration parameters, and must have all fields set by the user application + * before the class driver is used. Each Device mode Class driver typically contains a set of configuration parameters + * for the endpoint size/number of the associated logical USB interface, plus any class-specific configuration parameters. + * + * The following is an example of a properly initialized instance of the MIDI Host Class Driver structure: + * + * \code + * USB_ClassInfo_MIDI_Host_t My_MIDI_Interface = + * { + * .Config = + * { + * .DataINPipe = + * { + * .Address = (PIPE_DIR_IN | 1), + * .Size = 64, + * .Banks = 1, + * }, + * .DataOUTPipe = + * { + * .Address = (PIPE_DIR_OUT | 2), + * .Size = 64, + * .Banks = 1, + * }, + * }, + * }; + * \endcode + * + * To initialize the Class driver instance, the driver's {Class Name}_Host_ConfigurePipes() function + * should be called in response to the \c EVENT_USB_Host_DeviceEnumerationComplete() event firing. This function will + * will return an error code from the class driver's {Class Name}_EnumerationFailure_ErrorCodes_t 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 - + * 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: + * + * \code + * void EVENT_USB_Host_DeviceEnumerationComplete(void) + * { + * LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); + * + * uint16_t ConfigDescriptorSize; + * uint8_t ConfigDescriptorData[512]; + * + * if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData, + * sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful) + * { + * LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + * return; + * } + * + * if (MIDI_Host_ConfigurePipes(&Keyboard_MIDI_Interface, + * ConfigDescriptorSize, ConfigDescriptorData) != MIDI_ENUMERROR_NoError) + * { + * LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + * return; + * } + * + * if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful) + * { + * LEDs_SetAllLEDs(LEDMASK_USB_ERROR); + * return; + * } + * + * LEDs_SetAllLEDs(LEDMASK_USB_READY); + * } + * \endcode + * + * Note that the function also requires the device's configuration descriptor so that it can determine which interface + * in the device to bind to - this can be retrieved as shown in the above fragment using the + * \ref USB_Host_GetDeviceConfigDescriptor() function. If the device does not implement the interface the class driver + * is looking for, if all the matching interfaces are already bound to class driver instances or if an error occurs while + * binding to a device interface (for example, a device endpoint bank larger that the maximum supported bank size is used) + * the configuration will fail. + * + * To complete the device enumeration after binding the host mode Class Drivers to the attached device, a call to + * \c USB_Host_SetDeviceConfiguration() must be made. If the device configuration is not set within the + * \c EVENT_USB_Host_DeviceEnumerationComplete() event, the host still will assume the device enumeration has failed. + * + * Once initialized, it is important to maintain the class driver's state by repeatedly calling the Class Driver's + * {Class Name}_Host_USBTask() 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 + * instance. Again, this function uses the address of the instance to operate on, and thus needs to be called for each + * separate instance, just like the main USB maintenance routine \ref USB_USBTask(): + * + * \code + * int main(void) + * { + * SetupHardware(); + * + * LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); + * + * for (;;) + * { + * if (USB_HostState != HOST_STATE_Configured) + * Create_And_Process_Samples(); + * + * MIDI_Host_USBTask(&My_Audio_Interface); + * USB_USBTask(); + * } + * } + * \endcode + * + * Each class driver may also define a set of callback functions (which are prefixed by \c CALLBACK_* + * in the function's name) which must also be added to the user application - refer to each + * individual class driver's documentation for mandatory callbacks. In addition, each class driver may + * also define a set of events (identifiable by their prefix of \c EVENT_* in the function's name), which + * the user application may choose to implement, or ignore if not needed. + * + * The individual Host Mode Class Driver documentation contains more information on the non-standardized, + * class-specific functions which the user application can then use on the driver instances, such as data + * read and write routines. See each driver's individual documentation for more information on the + * class-specific functions. + */ + +#ifndef __USB_H__ +#define __USB_H__ + + /* Macros: */ + #define __INCLUDE_FROM_USB_DRIVER + + /* Includes: */ + #include "../../Common/Common.h" + #include "Core/USBMode.h" + + /* Includes: */ + #include "Core/USBTask.h" + #include "Core/Events.h" + #include "Core/StdDescriptors.h" + #include "Core/ConfigDescriptors.h" + #include "Core/USBController.h" + #include "Core/USBInterrupt.h" + + #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__) + #include "Core/Host.h" + #include "Core/Pipe.h" + #include "Core/HostStandardReq.h" + #include "Core/PipeStream.h" + #endif + + #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) + #include "Core/Device.h" + #include "Core/Endpoint.h" + #include "Core/DeviceStandardReq.h" + #include "Core/EndpointStream.h" + #endif + + #if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) + #include "Core/OTG.h" + #endif + + #include "Class/AndroidAccessoryClass.h" + #include "Class/AudioClass.h" + #include "Class/CDCClass.h" + #include "Class/HIDClass.h" + #include "Class/MassStorageClass.h" + #include "Class/MIDIClass.h" + #include "Class/PrinterClass.h" + #include "Class/RNDISClass.h" + #include "Class/StillImageClass.h" + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Platform/Platform.h b/leaf-can-bridge-3-port-CCS/LUFA/Platform/Platform.h new file mode 100644 index 0000000..a9eedeb --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Platform/Platform.h @@ -0,0 +1,80 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Architecture Specific Hardware Platform Drivers. + * + * This file is the master dispatch header file for the device-specific hardware platform drivers, for low level + * hardware configuration and management. The platform drivers are a set of drivers which are designed to provide + * a high level management layer for the various low level system functions such as clock control and interrupt + * management. + * + * User code may choose to either include this master dispatch header file to include all available platform + * driver header files for the current architecture, or may choose to only include the specific platform driver + * modules required for a particular application. + */ + +/** \defgroup Group_PlatformDrivers System Platform Drivers - LUFA/Platform/Platform.h + * \brief Hardware platform drivers. + * + * \section Sec_PlatformDrivers_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - UC3 Architecture Only: LUFA/Platform/UC3/InterruptManagement.c (Makefile source module name: LUFA_SRC_PLATFORM) + * - UC3 Architecture Only: LUFA/Platform/UC3/Exception.S (Makefile source module name: LUFA_SRC_PLATFORM) + * + * \section Sec_PlatformDrivers_ModDescription Module Description + * Device-specific hardware platform drivers, for low level hardware configuration and management. The platform + * drivers are a set of drivers which are designed to provide a high level management layer for the various low level + * system functions such as clock control and interrupt management. + * + * User code may choose to either include this master dispatch header file to include all available platform + * driver header files for the current architecture, or may choose to only include the specific platform driver + * modules required for a particular application. + * + * \note The exact APIs and availability of sub-modules within the platform driver group may vary depending on the + * target used - see individual target module documentation for the API specific to your target processor. + */ + +#ifndef __LUFA_PLATFORM_H__ +#define __LUFA_PLATFORM_H__ + + /* Includes: */ + #include "../Common/Common.h" + + /* Includes: */ + #if (ARCH == ARCH_UC3) + #include "UC3/ClockManagement.h" + #include "UC3/InterruptManagement.h" + #elif (ARCH == ARCH_XMEGA) + #include "XMEGA/ClockManagement.h" + #endif + +#endif + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/Platform/XMEGA/ClockManagement.h b/leaf-can-bridge-3-port-CCS/LUFA/Platform/XMEGA/ClockManagement.h new file mode 100644 index 0000000..744c4ec --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/Platform/XMEGA/ClockManagement.h @@ -0,0 +1,398 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2014. + + dean [at] fourwalledcubicle [dot] com + www.lufa-lib.org +*/ + +/* + Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaims all warranties with regard to this + software, including all implied warranties of merchantability + and fitness. In no event shall the author be liable for any + special, indirect or consequential damages or any damages + 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. +*/ + +/** \file + * \brief Module Clock Driver for the AVR USB XMEGA microcontrollers. + * + * Clock management driver for the AVR USB XMEGA microcontrollers. This driver allows for the configuration + * of the various clocks within the device to clock the various peripherals. + */ + +/** \ingroup Group_PlatformDrivers_XMEGA + * \defgroup Group_PlatformDrivers_XMEGAClocks Clock Management Driver - LUFA/Platform/XMEGA/ClockManagement.h + * \brief Module Clock Driver for the AVR USB XMEGA microcontrollers. + * + * \section Sec_PlatformDrivers_XMEGAClocks_Dependencies Module Source Dependencies + * The following files must be built with any user project that uses this module: + * - None + * + * \section Sec_PlatformDrivers_XMEGAClocks_ModDescription Module Description + * Clock management driver for the AVR USB XMEGA microcontrollers. This driver allows for the configuration + * of the various clocks within the device to clock the various peripherals. + * + * Usage Example: + * \code + * #include + * + * void main(void) + * { + * // Start the PLL to multiply the 2MHz RC oscillator to F_CPU and switch the CPU core to run from it + * XMEGACLK_StartPLL(CLOCK_SRC_INT_RC2MHZ, 2000000, F_CPU); + * XMEGACLK_SetCPUClockSource(CLOCK_SRC_PLL); + * + * // Start the 32MHz internal RC oscillator and start the DFLL to increase it to F_USB using the USB SOF as a reference + * XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ); + * XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, F_USB); + * } + * \endcode + * + * @{ + */ + +#ifndef _XMEGA_CLOCK_MANAGEMENT_H_ +#define _XMEGA_CLOCK_MANAGEMENT_H_ + + /* Includes: */ + #include "../../Common/Common.h" + + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** Enum for the possible external oscillator frequency ranges. */ + enum XMEGA_Extern_OSC_ClockFrequency_t + { + EXOSC_FREQ_2MHZ_MAX = OSC_FRQRANGE_04TO2_gc, /**< External crystal oscillator equal to or slower than 2MHz. */ + EXOSC_FREQ_9MHZ_MAX = OSC_FRQRANGE_2TO9_gc, /**< External crystal oscillator equal to or slower than 9MHz. */ + EXOSC_FREQ_12MHZ_MAX = OSC_FRQRANGE_9TO12_gc, /**< External crystal oscillator equal to or slower than 12MHz. */ + EXOSC_FREQ_16MHZ_MAX = OSC_FRQRANGE_12TO16_gc, /**< External crystal oscillator equal to or slower than 16MHz. */ + }; + + /** Enum for the possible external oscillator startup times. */ + enum XMEGA_Extern_OSC_ClockStartup_t + { + EXOSC_START_6CLK = OSC_XOSCSEL_EXTCLK_gc, /**< Wait 6 clock cycles before startup (external clock). */ + EXOSC_START_32KCLK = OSC_XOSCSEL_32KHz_gc, /**< Wait 32K clock cycles before startup (32.768KHz crystal). */ + EXOSC_START_256CLK = OSC_XOSCSEL_XTAL_256CLK_gc, /**< Wait 256 clock cycles before startup. */ + EXOSC_START_1KCLK = OSC_XOSCSEL_XTAL_1KCLK_gc, /**< Wait 1K clock cycles before startup. */ + EXOSC_START_16KCLK = OSC_XOSCSEL_XTAL_16KCLK_gc, /**< Wait 16K clock cycles before startup. */ + }; + + /** Enum for the possible module clock sources. */ + enum XMEGA_System_ClockSource_t + { + CLOCK_SRC_INT_RC2MHZ = 0, /**< Clock sourced from the Internal 2MHz RC Oscillator clock. */ + CLOCK_SRC_INT_RC32MHZ = 1, /**< Clock sourced from the Internal 32MHz RC Oscillator clock. */ + CLOCK_SRC_INT_RC32KHZ = 2, /**< Clock sourced from the Internal 32KHz RC Oscillator clock. */ + CLOCK_SRC_XOSC = 3, /**< Clock sourced from the External Oscillator clock. */ + CLOCK_SRC_PLL = 4, /**< Clock sourced from the Internal PLL clock. */ + }; + + /** Enum for the possible DFLL clock reference sources. */ + enum XMEGA_System_DFLLReference_t + { + DFLL_REF_INT_RC32KHZ = 0, /**< Reference clock sourced from the Internal 32KHz RC Oscillator clock. */ + DFLL_REF_EXT_RC32KHZ = 1, /**< Reference clock sourced from the External 32KHz RC Oscillator clock connected to TOSC pins. */ + DFLL_REF_INT_USBSOF = 2, /**< Reference clock sourced from the USB Start Of Frame packets. */ + }; + + /* Inline Functions: */ + /** Write a value to a location protected by the XMEGA CCP protection mechanism. This function uses inline assembly to ensure that + * the protected address is written to within four clock cycles of the CCP key being written. + * + * \param[in] Address Address to write to, a memory address protected by the CCP mechanism + * \param[in] Value Value to write to the protected location + */ + static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE; + static inline void XMEGACLK_CCP_Write(volatile void* Address, const uint8_t Value) + { + __asm__ __volatile__ ( + "out %0, __zero_reg__" "\n\t" /* Zero RAMPZ using fixed zero value register */ + "movw r30, %1" "\n\t" /* Copy address to Z register pair */ + "out %2, %3" "\n\t" /* Write key to CCP register */ + "st Z, %4" "\n\t" /* Indirectly write value to address */ + "out %0, 2" "\n\t" /* reset RAMPZ to 2 */ + : /* No output operands */ + : /* Input operands: */ "m" (RAMPZ), "e" (Address), "m" (CCP), "r" (CCP_IOREG_gc), "r" (Value) + : /* Clobbered registers: */ "r30", "r31" + ); + } + + /** Starts the external oscillator of the XMEGA microcontroller, with the given options. This routine blocks until + * the oscillator is ready for use. + * + * \param[in] FreqRange Frequency range of the external oscillator, a value from \ref XMEGA_Extern_OSC_ClockFrequency_t. + * \param[in] Startup Startup time of the external oscillator, a value from \ref XMEGA_Extern_OSC_ClockStartup_t. + * + * \return Boolean \c true if the external oscillator was successfully started, \c false if invalid parameters specified. + */ + static inline bool XMEGACLK_StartExternalOscillator(const uint8_t FreqRange, + const uint8_t Startup) ATTR_ALWAYS_INLINE; + static inline bool XMEGACLK_StartExternalOscillator(const uint8_t FreqRange, + const uint8_t Startup) + { + OSC.XOSCCTRL = (FreqRange | ((Startup == EXOSC_START_32KCLK) ? OSC_X32KLPM_bm : 0) | Startup); + OSC.CTRL |= OSC_XOSCEN_bm; + + while (!(OSC.STATUS & OSC_XOSCRDY_bm)); + return true; + } + + /** Stops the external oscillator of the XMEGA microcontroller. */ + static inline void XMEGACLK_StopExternalOscillator(void) ATTR_ALWAYS_INLINE; + static inline void XMEGACLK_StopExternalOscillator(void) + { + OSC.CTRL &= ~OSC_XOSCEN_bm; + } + + /** Starts the given internal oscillator of the XMEGA microcontroller, with the given options. This routine blocks until + * the oscillator is ready for use. + * + * \param[in] Source Internal oscillator to start, a value from \ref XMEGA_System_ClockSource_t. + * + * \return Boolean \c true if the internal oscillator was successfully started, \c false if invalid parameters specified. + */ + static inline uint8_t XMEGACLK_StartInternalOscillator(const uint8_t Source) ATTR_ALWAYS_INLINE; + static inline uint8_t XMEGACLK_StartInternalOscillator(const uint8_t Source) + { + switch (Source) + { + case CLOCK_SRC_INT_RC2MHZ: + OSC.CTRL |= OSC_RC2MEN_bm; + while (!(OSC.STATUS & OSC_RC2MRDY_bm)); + return true; + case CLOCK_SRC_INT_RC32MHZ: + OSC.CTRL |= OSC_RC32MEN_bm; + while (!(OSC.STATUS & OSC_RC32MRDY_bm)); + return true; + case CLOCK_SRC_INT_RC32KHZ: + OSC.CTRL |= OSC_RC32KEN_bm; + while (!(OSC.STATUS & OSC_RC32KRDY_bm)); + return true; + default: + return false; + } + } + + /** Stops the given internal oscillator of the XMEGA microcontroller. + * + * \param[in] Source Internal oscillator to stop, a value from \ref XMEGA_System_ClockSource_t. + * + * \return Boolean \c true if the internal oscillator was successfully stopped, \c false if invalid parameters specified. + */ + static inline bool XMEGACLK_StopInternalOscillator(const uint8_t Source) ATTR_ALWAYS_INLINE; + static inline bool XMEGACLK_StopInternalOscillator(const uint8_t Source) + { + switch (Source) + { + case CLOCK_SRC_INT_RC2MHZ: + OSC.CTRL &= ~OSC_RC2MEN_bm; + return true; + case CLOCK_SRC_INT_RC32MHZ: + OSC.CTRL &= ~OSC_RC32MEN_bm; + return true; + case CLOCK_SRC_INT_RC32KHZ: + OSC.CTRL &= ~OSC_RC32KEN_bm; + return true; + default: + return false; + } + } + + /** Starts the PLL of the XMEGA microcontroller, with the given options. This routine blocks until the PLL is ready for use. + * + * \attention The output frequency must be equal to or greater than the source frequency. + * + * \param[in] Source Clock source for the PLL, a value from \ref XMEGA_System_ClockSource_t. + * \param[in] SourceFreq Frequency of the PLL's clock source, in Hz. + * \param[in] Frequency Target frequency of the PLL's output. + * + * \return Boolean \c true if the PLL was successfully started, \c false if invalid parameters specified. + */ + static inline bool XMEGACLK_StartPLL(const uint8_t Source, + const uint32_t SourceFreq, + const uint32_t Frequency) ATTR_ALWAYS_INLINE; + static inline bool XMEGACLK_StartPLL(const uint8_t Source, + const uint32_t SourceFreq, + const uint32_t Frequency) + { + uint8_t MulFactor = (Frequency / SourceFreq); + + if (SourceFreq > Frequency) + return false; + + if (MulFactor > 31) + return false; + + switch (Source) + { + case CLOCK_SRC_INT_RC2MHZ: + OSC.PLLCTRL = (OSC_PLLSRC_RC2M_gc | MulFactor); + break; + case CLOCK_SRC_INT_RC32MHZ: + OSC.PLLCTRL = (OSC_PLLSRC_RC32M_gc | MulFactor); + break; + case CLOCK_SRC_XOSC: + OSC.PLLCTRL = (OSC_PLLSRC_XOSC_gc | MulFactor); + break; + default: + return false; + } + + OSC.CTRL |= OSC_PLLEN_bm; + + while (!(OSC.STATUS & OSC_PLLRDY_bm)); + return true; + } + + /** Stops the PLL of the XMEGA microcontroller. */ + static inline void XMEGACLK_StopPLL(void) ATTR_ALWAYS_INLINE; + static inline void XMEGACLK_StopPLL(void) + { + OSC.CTRL &= ~OSC_PLLEN_bm; + } + + /** Starts the DFLL of the XMEGA microcontroller, with the given options. + * + * \param[in] Source RC Clock source for the DFLL, a value from \ref XMEGA_System_ClockSource_t. + * \param[in] Reference Reference clock source for the DFLL, an value from \ref XMEGA_System_DFLLReference_t. + * \param[in] Frequency Target frequency of the DFLL's output. + * + * \return Boolean \c true if the DFLL was successfully started, \c false if invalid parameters specified. + */ + static inline bool XMEGACLK_StartDFLL(const uint8_t Source, + const uint8_t Reference, + const uint32_t Frequency) ATTR_ALWAYS_INLINE; + static inline bool XMEGACLK_StartDFLL(const uint8_t Source, + const uint8_t Reference, + const uint32_t Frequency) + { + uint16_t DFLLCompare = (Frequency / 1000); + + switch (Source) + { + case CLOCK_SRC_INT_RC2MHZ: + OSC.DFLLCTRL |= (Reference << OSC_RC2MCREF_bp); + DFLLRC2M.COMP1 = (DFLLCompare & 0xFF); + DFLLRC2M.COMP2 = (DFLLCompare >> 8); + DFLLRC2M.CTRL = DFLL_ENABLE_bm; + break; + case CLOCK_SRC_INT_RC32MHZ: + OSC.DFLLCTRL |= (Reference << OSC_RC32MCREF_gp); + DFLLRC32M.COMP1 = (DFLLCompare & 0xFF); + DFLLRC32M.COMP2 = (DFLLCompare >> 8); + + if (Reference == DFLL_REF_INT_USBSOF) + { + NVM.CMD = NVM_CMD_READ_CALIB_ROW_gc; + DFLLRC32M.CALA = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBRCOSCA)); + DFLLRC32M.CALB = pgm_read_byte(offsetof(NVM_PROD_SIGNATURES_t, USBRCOSC)); + NVM.CMD = 0; + } + + DFLLRC32M.CTRL = DFLL_ENABLE_bm; + break; + default: + return false; + } + + return true; + } + + /** Stops the given DFLL of the XMEGA microcontroller. + * + * \param[in] Source RC Clock source for the DFLL to be stopped, a value from \ref XMEGA_System_ClockSource_t. + * + * \return Boolean \c true if the DFLL was successfully stopped, \c false if invalid parameters specified. + */ + static inline bool XMEGACLK_StopDFLL(const uint8_t Source) ATTR_ALWAYS_INLINE; + static inline bool XMEGACLK_StopDFLL(const uint8_t Source) + { + switch (Source) + { + case CLOCK_SRC_INT_RC2MHZ: + DFLLRC2M.CTRL = 0; + break; + case CLOCK_SRC_INT_RC32MHZ: + DFLLRC32M.CTRL = 0; + break; + default: + return false; + } + + return true; + } + + /** Sets the clock source for the main microcontroller core. The given clock source should be configured + * and ready for use before this function is called. + * + * \param[in] Source Clock source for the CPU core, a value from \ref XMEGA_System_ClockSource_t. + * + * \return Boolean \c true if the CPU core clock was successfully altered, \c false if invalid parameters specified. + */ + static inline bool XMEGACLK_SetCPUClockSource(const uint8_t Source) ATTR_ALWAYS_INLINE; + static inline bool XMEGACLK_SetCPUClockSource(const uint8_t Source) + { + uint8_t ClockSourceMask = 0; + + switch (Source) + { + case CLOCK_SRC_INT_RC2MHZ: + ClockSourceMask = CLK_SCLKSEL_RC2M_gc; + break; + case CLOCK_SRC_INT_RC32MHZ: + ClockSourceMask = CLK_SCLKSEL_RC32M_gc; + break; + case CLOCK_SRC_INT_RC32KHZ: + ClockSourceMask = CLK_SCLKSEL_RC32K_gc; + break; + case CLOCK_SRC_XOSC: + ClockSourceMask = CLK_SCLKSEL_XOSC_gc; + break; + case CLOCK_SRC_PLL: + ClockSourceMask = CLK_SCLKSEL_PLL_gc; + break; + default: + return false; + } + + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); + + XMEGACLK_CCP_Write(&CLK.CTRL, ClockSourceMask); + + SetGlobalInterruptMask(CurrentGlobalInt); + + Delay_MS(1); + return (CLK.CTRL == ClockSourceMask); + } + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif + +/** @} */ + diff --git a/leaf-can-bridge-3-port-CCS/LUFA/makefile b/leaf-can-bridge-3-port-CCS/LUFA/makefile new file mode 100644 index 0000000..88449a9 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/LUFA/makefile @@ -0,0 +1,53 @@ +# +# LUFA Library +# Copyright (C) Dean Camera, 2014. +# +# dean [at] fourwalledcubicle [dot] com +# www.lufa-lib.org +# +# --------------------------------------- +# Makefile for the LUFA library itself. +# --------------------------------------- + +LUFA_VERSION_NUM = $(shell grep LUFA_VERSION_STRING $(LUFA_PATH)/Version.h | cut -d'"' -f2) +EXCLUDE_FROM_EXPORT := Documentation DoxygenPages CodeTemplates Build StudioIntegration doxyfile *.tar *.o *.d *.lss *.lst *.hex *.elf *.hex *.eep *.map *.bin + +# Default target - no default action when attempting to build the core directly +all: + +# Export the library core as a TAR archive for importing into an IDE +export_tar: + @echo Exporting LUFA library to a TAR archive... + @tar -cf LUFA_$(LUFA_VERSION_NUM).tar --directory=. $(EXCLUDE_FROM_EXPORT:%=--exclude=%) * + @tar -cf LUFA_$(LUFA_VERSION_NUM)_Code_Templates.tar CodeTemplates + @echo Export LUFA_$(LUFA_VERSION_NUM).tar complete. + +# Display the LUFA version of this library copy +version: + @echo "LUFA $(LUFA_VERSION_NUM)" + +# Check if this is being included from a legacy or non LUFA build system makefile +ifneq ($(LUFA_PATH),) + LUFA_ROOT_PATH = $(patsubst %/,%,$(LUFA_PATH))/LUFA/ + + include $(patsubst %/,%,$(LUFA_PATH))/LUFA/Build/lufa_sources.mk +else + LUFA_BUILD_MODULES += MASTER + LUFA_BUILD_TARGETS += export_tar version + + LUFA_PATH = . + ARCH = {AVR8,UC3,XMEGA} + DOXYGEN_OVERRIDE_PARAMS = QUIET=YES PROJECT_NUMBER=$(LUFA_VERSION_NUM) + + # Remove all object and associated files from the LUFA library core + clean: + rm -f $(LUFA_SRC_ALL_FILES:%.c=%.o) + rm -f $(LUFA_SRC_ALL_FILES:%.c=%.d) + rm -f $(LUFA_SRC_ALL_FILES:%.c=%.lst) + + include Build/lufa_core.mk + include Build/lufa_sources.mk + include Build/lufa_doxygen.mk +endif + +.PHONY: all export_tar version clean diff --git a/leaf-can-bridge-3-port-CCS/can-bridge-ccs.atsln b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.atsln new file mode 100644 index 0000000..9e60b84 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.atsln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Atmel Studio Solution File, Format Version 11.00 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "can-bridge-inverter", "can-bridge-inverter.cproj", "{42D3B1F0-734C-43EE-8086-170013B1EC8C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {42D3B1F0-734C-43EE-8086-170013B1EC8C}.Debug|AVR.ActiveCfg = Debug|AVR + {42D3B1F0-734C-43EE-8086-170013B1EC8C}.Debug|AVR.Build.0 = Debug|AVR + {42D3B1F0-734C-43EE-8086-170013B1EC8C}.Release|AVR.ActiveCfg = Release|AVR + {42D3B1F0-734C-43EE-8086-170013B1EC8C}.Release|AVR.Build.0 = Release|AVR + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/leaf-can-bridge-3-port-CCS/can-bridge-ccs.c b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.c new file mode 100644 index 0000000..ffcd9be --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.c @@ -0,0 +1,431 @@ + +/* +CCS ADD-ON FIRMWARE +When fitted between the LIM, QC-CAN and EV-CAN, this CAN-bridge firmware allows for CCS charging. +*/ + +/* Optional functionality */ +//#define USB_SERIAL +#define ENABLE_CAN3 //Used for EV-CAN (Might be unecessary) + +#include "can-bridge-ccs.h" + +//General variables +volatile uint8_t can_LIM = 1; //Define LIM-CAN-bus channel +volatile uint8_t can_QC = 2; //Define QC-CAN-bus channel +volatile uint8_t can_EV = 3; //Define EV-CAN-bus channel +volatile uint8_t can_busy = 0; //Tracks whether the can_handler() subroutine is running +volatile uint16_t sec_timer = 1; //Counts down from 1000 +volatile uint16_t ms_timer_100 = 1; //Increments on every TCC0 overflow (ever ms) + +//Because the MCP25625 transmit buffers seem to be able to corrupt messages (see errata), we're implementing +//our own buffering. This is an array of frames-to-be-sent, FIFO. Messages are appended to buffer_end++ as they +//come in and handled according to buffer_pos until buffer_pos == buffer_end, at which point both pointers reset +//the buffer size should be well in excess of what this device will ever see +can_frame_t tx0_buffer[TXBUFFER_SIZE]; +uint8_t tx0_buffer_pos = 0; +uint8_t tx0_buffer_end = 0; + +can_frame_t tx2_buffer[TXBUFFER_SIZE]; +uint8_t tx2_buffer_pos = 0; +uint8_t tx2_buffer_end = 0; + +can_frame_t tx3_buffer[5]; //TODO: Since this is the first time channel 3 will be properly used, set to TXBUFFER_SIZE? +uint8_t tx3_buffer_pos = 0; +uint8_t tx3_buffer_end = 0; + +#ifdef USB_SERIAL +#include "usb-hub-sensor.h" +uint8_t ReadCalibrationByte( uint8_t index ); +void ProcessCDCCommand(void); + +uint8_t configSuccess = false; //tracks whether device successfully enumerated +static FILE USBSerialStream; //fwrite target for CDC +uint8_t signature[11]; //signature bytes +//print variables +volatile uint8_t print_char_limit = 0; +#endif + +void hw_init(void){ + uint8_t caninit; + + /* Start the 32MHz internal RC oscillator and start the DFLL to increase it to 48MHz using the USB SOF as a reference */ + XMEGACLK_StartInternalOscillator(CLOCK_SRC_INT_RC32MHZ); + XMEGACLK_StartDFLL(CLOCK_SRC_INT_RC32MHZ, DFLL_REF_INT_USBSOF, 48000000); + + //turn off everything we don' t use + PR.PRGEN = PR_AES_bm | PR_RTC_bm | PR_DMA_bm; + PR.PRPA = PR_ADC_bm | PR_AC_bm; + PR.PRPC = PR_TWI_bm | PR_USART0_bm | PR_HIRES_bm; + PR.PRPD = PR_TWI_bm | PR_USART0_bm | PR_TC0_bm | PR_TC1_bm; + PR.PRPE = PR_TWI_bm | PR_USART0_bm; + + //blink output + PORTB.DIRSET = 3; + + //start 16MHz crystal and PLL it up to 48MHz + OSC.XOSCCTRL = OSC_FRQRANGE_12TO16_gc | //16MHz crystal + OSC_XOSCSEL_XTAL_16KCLK_gc; //16kclk startup + OSC.CTRL |= OSC_XOSCEN_bm; //enable crystal + while(!(OSC.STATUS & OSC_XOSCRDY_bm)); //wait until ready + OSC.PLLCTRL = OSC_PLLSRC_XOSC_gc | 2; //XTAL->PLL, 2x multiplier (32MHz) + OSC.CTRL |= OSC_PLLEN_bm; //start PLL + while (!(OSC.STATUS & OSC_PLLRDY_bm)); //wait until ready + CCP = CCP_IOREG_gc; //allow changing CLK.CTRL + CLK.CTRL = CLK_SCLKSEL_PLL_gc; //use PLL output as system clock + + //output 16MHz clock to MCP25625 chips (PE0) + //next iteration: put this on some other port, pin 4 or 7, so we can use the event system + TCE0.CTRLA = TC0_CLKSEL_DIV1_gc; //clkper/1 + TCE0.CTRLB = TC0_CCAEN_bm | TC0_WGMODE_SINGLESLOPE_bm; //enable CCA, single-slope PWM + TCE0.CCA = 1; //compare value + TCE0.PER = 1; //period of 1, generates 24MHz output + + PORTE.DIRSET = PIN0_bm; //set CLKOUT pin to output + + //setup CAN pin interrupts + PORTC.INTCTRL = PORT_INT0LVL_HI_gc; + PORTD.INTCTRL = PORT_INT0LVL_HI_gc | PORT_INT1LVL_HI_gc; + + PORTD.INT0MASK = PIN0_bm; //PORTD0 has can1 interrupt + PORTD.PIN0CTRL = PORT_OPC_PULLUP_gc | PORT_ISC_LEVEL_gc; + + PORTD.INT1MASK = PIN5_bm; //PORTD5 has can2 interrupt + PORTD.PIN5CTRL = PORT_OPC_PULLUP_gc | PORT_ISC_LEVEL_gc; + + #ifdef ENABLE_CAN3 + PORTC.INT0MASK = PIN2_bm; //PORTC2 has can3 interrupt + PORTC.PIN0CTRL = PORT_OPC_PULLUP_gc | PORT_ISC_LEVEL_gc; + #endif + + //buffer checking interrupt + TCC1.CTRLA = TC0_CLKSEL_DIV1_gc; //32M/1/3200 ~ 100usec + TCC1.PER = 3200; + TCC1.INTCTRLA = TC0_OVFINTLVL_HI_gc; //same priority as can interrupts + + //we want to optimize performance, so we're going to time stuff + //48MHz/48=1us timer, which we just freerun and reset whenever we want to start timing something + //frame time timer + TCC0.CTRLA = TC0_CLKSEL_DIV1_gc; + TCC0.PER = 32000; //32MHz/32000=1ms + TCC0.INTCTRLA = TC0_OVFINTLVL_HI_gc; //interrupt on overflow + + PORTB.OUTCLR = (1 << 0); + + can_system_init: + + //Init SPI and CAN interface: + if(RST.STATUS & RST_WDRF_bm){ //if we come from a watchdog reset, we don't need to setup CAN + caninit = can_init(MCP_OPMOD_NORMAL, 1); //on second thought, we do + } else { + caninit = can_init(MCP_OPMOD_NORMAL, 1); + } + + if(caninit){ + //PORTB.OUTSET |= (1 << 0); //green LED, uncommented to save power + } else { + //PORTB.OUTSET |= (1 << 1); //red LED, uncommented to save power + _delay_ms(10); + goto can_system_init; + } + + //Set and enable interrupts with round-robin + XMEGACLK_CCP_Write((void * ) &PMIC.CTRL, PMIC_RREN_bm | PMIC_LOLVLEN_bm | PMIC_HILVLEN_bm);//PMIC.CTRL = PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm| PMIC_HILVLEN_bm; + + USB_Init(USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRILOW); + #ifdef USB_SERIAL + CDC_Device_CreateStream(&VirtualSerial_CDC_Interface, &USBSerialStream); + #endif + + wdt_enable(WDTO_15MS); + + sei(); +} + +int main(void){ + #ifdef USB_SERIAL + char * str = ""; + #endif + + hw_init(); + + while(1){ + //Setup complete, wait for can messages to trigger interrupts + #ifdef USB_SERIAL + //when USB is essentially unused, we output general status info + if(!output_can_to_serial){ + if(sec_interrupt){ + sec_interrupt = 0; + + /*//current shifter state + str = "Shift: 00\n"; + int_to_hex((char *) (str + 7), shifter_state); + print(str, 10);*/ + } + } + #endif + } +} +#ifdef USB_SERIAL +/* services commands received over the virtual serial port */ +void ProcessCDCCommand(void) +{ + uint16_t ReportStringLength = 0; + char * ReportString = ""; + int16_t cmd = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); + + if(cmd > -1){ + switch(cmd){ + case 48: //0 + break; + + case 0: //reset + case 90: //'Z' + _delay_ms(1000); + CCP = CCP_IOREG_gc; //allow changing CLK.CTRL + RST.CTRL = RST_SWRST_bm; + break; + + case 255: //send identity + ReportString = "DALA CAN bridge - v2.5 Leaf\n"; ReportStringLength = 28; + break; + + default: //when all else fails + ReportString = "Unrecognized Command: \n"; ReportStringLength = 25; + ReportString[22] = cmd; + break; + } + + if(ReportStringLength){ + print(ReportString, ReportStringLength); + } + + } +} +#endif +// Event handler for the LUFA library USB Disconnection event. +void EVENT_USB_Device_Disconnect(void){} + +void EVENT_USB_Device_Connect(void){} +#ifdef USB_SERIAL +// Event handler for the LUFA library USB Configuration Changed event. +void EVENT_USB_Device_ConfigurationChanged(void){ configSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); } + +// Event handler for the LUFA library USB Control Request reception event. +void EVENT_USB_Device_ControlRequest(void){ CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } + +//appends string to ring buffer and initiates transmission +void print(char * str, uint8_t len){ + if((print_char_limit + len) <= 120){ + fwrite(str, len, 1, &USBSerialStream); + print_char_limit += len; + } else { + fwrite("X\n",2,1,&USBSerialStream); + } +} +#endif + +//fires every 1ms +ISR(TCC0_OVF_vect){ + wdt_reset(); //Reset the watchdog + sec_timer--; //Increment the 1000ms timer + + #ifdef USB_SERIAL + if(!can_busy) ProcessCDCCommand(); + CDC_Device_USBTask(&VirtualSerial_CDC_Interface); + USB_USBTask(); + //handle second print buffer + if(print_char_limit <= 64) { print_char_limit = 0; } + else { print_char_limit -= 64; } + #endif + + //fires every 100ms + if(ms_timer_100 == 100) //Task that need to be performed each 100ms go here + { + ms_timer_100 = 0; //reset the timer + } + + //fires every second (1000ms tasks go here) + if(sec_timer == 0){ + PORTB.OUTCLR = (1 << 1); + + } +} + +//fires approx. every 100us +ISR(TCC1_OVF_vect){ + check_can1(); + check_can2(); + check_can3(); +} + +//can1 interrupt +ISR(PORTD_INT0_vect){ + can_busy = 1; + can_handler(1); +} + +//can2 interrupt +ISR(PORTD_INT1_vect){ + can_busy = 1; + can_handler(2); +} + +//can3 receive interrupt +ISR(PORTC_INT0_vect){ + can_busy = 1; + can_handler(3); +} + +//VCM side of the CAN bus (in Muxsan) +void can_handler(uint8_t can_bus){ + can_frame_t frame; + uint8_t flag = can_read(MCP_REG_CANINTF, can_bus); + + if (flag & (MCP_RX0IF | MCP_RX1IF)){ + + if(flag & MCP_RX1IF){ //prioritize the rollover buffer + can_read_rx_buf(MCP_RX_1, &frame, can_bus); + can_bit_modify(MCP_REG_CANINTF, MCP_RX1IF, 0x00, can_bus); + } else { + can_read_rx_buf(MCP_RX_0, &frame, can_bus); + can_bit_modify(MCP_REG_CANINTF, MCP_RX0IF, 0x00, can_bus); + } + + switch(frame.can_id){ + case 0xABC: //Example + //Code + break; + default: + break; + } + + + //block unwanted messages + uint8_t block = 0; + switch(frame.can_id){ + case 0xABC: + //block = 1; + break; + default: + block = 0; + break; + } + if(!block){ + if(can_bus == 1){send_can2(frame);} else {send_can1(frame); + } + } + } + + + if(flag & 0xA0){ + uint8_t flag2 = can_read(MCP_REG_EFLG, can_bus); + if(flag2 & 0xC0){ + can_write(MCP_REG_EFLG, 0, can_bus); //reset all errors + //ReportString = "CANX RX OVF\n"; + //ReportString[3] = 48 + can_bus; + //print(ReportString,12); + } + if(flag2 > 0){ PORTB.OUTSET = (1 << 1); } + if(flag & 0xE0){ can_bit_modify(MCP_REG_CANINTF, (flag & 0xE0), 0x00, can_bus); } + } + can_busy = 0; +} + + +void send_can(uint8_t can_bus, can_frame_t frame){ + if(can_bus == 1) send_can1(frame); + if(can_bus == 2) send_can2(frame); + if(can_bus == 3) send_can3(frame); +} + +void send_can1(can_frame_t frame){ + //put in the buffer + memcpy(&tx0_buffer[tx0_buffer_end++], &frame, sizeof(frame)); + + if(tx0_buffer_end >= TXBUFFER_SIZE){ //silently handle buffer overflows + tx0_buffer_end = TXBUFFER_SIZE - 1; + } + + check_can1(); +} + + + +void check_can1(void){ + uint8_t reg; + + if(tx0_buffer_end != tx0_buffer_pos){ + //check if TXB0 is free use + reg = can1_read(MCP_REG_TXB0CTRL); + + if(!(reg & MCP_TXREQ_bm)){ //we're free to send + can1_load_txbuff(0, (can_frame_t *) &tx0_buffer[tx0_buffer_pos++]); + can1_rts(0); + if(tx0_buffer_pos == tx0_buffer_end){ //end of buffer, reset + tx0_buffer_end = 0; + tx0_buffer_pos = 0; + } + } + } +} + +void send_can2(can_frame_t frame){ + //put in the buffer + memcpy(&tx2_buffer[tx2_buffer_end++], &frame, sizeof(frame)); + + if(tx2_buffer_end >= TXBUFFER_SIZE){ //silently handle buffer overflows + tx2_buffer_end = TXBUFFER_SIZE - 1; + } + + check_can2(); +} + +void check_can2(void){ + uint8_t reg; + + if(tx2_buffer_end != tx2_buffer_pos){ + //check if TXB0 is free use + reg = can2_read(MCP_REG_TXB0CTRL); + + if(!(reg & MCP_TXREQ_bm)){ //we're free to send + can2_load_txbuff(0, (can_frame_t *) &tx2_buffer[tx2_buffer_pos++]); + can2_rts(0); + if(tx2_buffer_pos == tx2_buffer_end){ //end of buffer, reset + tx2_buffer_end = 0; + tx2_buffer_pos = 0; + } + } + } +} + +void send_can3(can_frame_t frame){ + //put in the buffer + memcpy(&tx3_buffer[tx3_buffer_end++], &frame, sizeof(frame)); + + if(tx3_buffer_end >= TXBUFFER_SIZE){ //silently handle buffer overflows + tx3_buffer_end = TXBUFFER_SIZE - 1; + } + + check_can3(); +} + +void check_can3(void){ + uint8_t reg; + + if(tx3_buffer_end != tx3_buffer_pos){ + //check if TXB0 is free use + reg = can3_read(MCP_REG_TXB0CTRL); + + if(!(reg & MCP_TXREQ_bm)){ //we're free to send + can3_load_txbuff(0, (can_frame_t *) &tx3_buffer[tx3_buffer_pos++]); + can3_rts(0); + if(tx3_buffer_pos == tx3_buffer_end){ //end of buffer, reset + tx3_buffer_end = 0; + tx3_buffer_pos = 0; + } + } + } +} + + diff --git a/leaf-can-bridge-3-port-CCS/can-bridge-ccs.componentinfo.xml b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.componentinfo.xml new file mode 100644 index 0000000..e275755 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.componentinfo.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/leaf-can-bridge-3-port-CCS/can-bridge-ccs.cproj b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.cproj new file mode 100644 index 0000000..16ca937 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.cproj @@ -0,0 +1,364 @@ + + + + 2.0 + 7.0 + com.Atmel.AVRGCC8.C + {42d3b1f0-734c-43ee-8086-170013b1ec8c} + ATxmega32C4 + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + batmon_fw + can-bridge-ccs + batmon_fw + Native + true + false + true + true + 0x20000000 + + true + exception_table + 2 + 0 + + + + + + + + + + + + + com.atmel.avrdbg.tool.ispmk2 + PDI + + + + + PDI + + com.atmel.avrdbg.tool.ispmk2 + 000200135511 + AVRISP mkII + + + + + + PDI + + com.atmel.avrdbg.tool.simulator + + + Simulator + + 0 + + 000200135511 + 0x1E9544 + + + + + -mmcu=atxmega32c4 -B "%24(PackRepoDir)\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" + True + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\atmel\XMEGAC_DFP\1.1.50\include + + + Optimize most (-O3) + True + True + True + True + + + libm + + + -lprintf_flt + + + %24(PackRepoDir)\atmel\XMEGAC_DFP\1.1.50\include + + + + + + + + + -mmcu=atxmega32c4 -B "%24(PackRepoDir)\atmel\XMEGAC_DFP\1.1.50\gcc\dev\atxmega32c4" + True + True + True + True + True + False + True + True + + + DEBUG + ARCH=ARCH_XMEGA + USE_RAM_DESCRIPTORS + FIXED_CONTROL_ENDPOINT_SIZE=8 + FIXED_NUM_CONFIGURATIONS=1 + MAX_ENDPOINT_INDEX=4 + F_CPU=32000000 + F_USB=48000000 + + + + + %24(PackRepoDir)\atmel\XMEGAC_DFP\1.1.50\include + + + Optimize (-O1) + True + True + Default (-g2) + True + -std=gnu99 -fms-extensions + True + + + libm + + + + + %24(PackRepoDir)\atmel\XMEGAC_DFP\1.1.50\include + + + Default (-Wa,-g) + + + "$(ToolchainDir)\avr-objcopy.exe" -O binary $(MSBuildProjectName).elf FLASH.BIN + + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/leaf-can-bridge-3-port-CCS/can-bridge-ccs.h b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.h new file mode 100644 index 0000000..3df853c --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/can-bridge-ccs.h @@ -0,0 +1,76 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Descriptors.h" +#include "LUFA/Platform/Platform.h" +#include "LUFA/Drivers/USB/USB.h" +#include "sp_driver.h" +#include "mcp25xx.h" +#include "helper_functions.h" + +//function prototypes +void hw_init(void); +void print(char * str, uint8_t len); +void uint32_to_str(char * str, uint32_t num); +void SID_to_str(char * str, uint32_t num); +//void blink(void); +void canframe_to_str(char * str, can_frame_t frame); +void send_can(uint8_t can_bus, can_frame_t frame); +void send_can1(can_frame_t frame); +void send_can2(can_frame_t frame); +void send_can3(can_frame_t frame); +void can_handler(uint8_t can_bus); +void ProcessCDCCommand(void); +void check_can1(void); +void check_can2(void); +void check_can3(void); + + +//defines +#define TC0_CLKSEL_DIV1_gc 0b0001 +#define TC0_CLKSEL_DIV256_gc 0b0110 +#define TC0_CLKSEL_DIV1024_gc 0b0111 +#define TC0_OVFINTLVL_HI_gc 0b11 +#define TC0_OVFINTLVL_LO_gc 0b01 +#define TC0_CCAINTLVL_HI_gc 0x03 +#define TC0_CCBINTLVL_HI_gc 0x0C +#define TC0_CCCINTLVL_HI_gc 0x30 +#define TC0_WGMODE_SINGLESLOPE_bm 0x03 + +#define OUTBUF_SIZE 2048 +#define CURVOL_AVERAGES 100 + +#define SHIFT_P 0x00 +#define SHIFT_D 0x40 //Modified, no longer following mux standard +#define SHIFT_N 0x30 +#define SHIFT_R 0x20 + +#define TXBUFFER_SIZE 16 + +USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { + .Config = { + .ControlInterfaceNumber = 0, + .DataINEndpoint = { + .Address = CDC_TX_EPADDR, + .Size = CDC_TXRX_EPSIZE, + .Banks = 1, + }, + .DataOUTEndpoint = { + .Address = CDC_RX_EPADDR, + .Size = CDC_TXRX_EPSIZE, + .Banks = 1, + }, + .NotificationEndpoint = { + .Address = CDC_NOTIFICATION_EPADDR, + .Size = CDC_NOTIFICATION_EPSIZE, + .Banks = 1, + }, + }, +}; diff --git a/leaf-can-bridge-3-port-CCS/canframe.h b/leaf-can-bridge-3-port-CCS/canframe.h new file mode 100644 index 0000000..1df7bde --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/canframe.h @@ -0,0 +1,33 @@ +/* + * canframe.h + * + * Created: 1/13/2018 1:32:28 PM + * Author: Dick + */ +#ifndef CANFRAME_H_ +#define CANFRAME_H_ + +typedef struct can_frame can_frame_t; + +/** + * struct can_frame - basic CAN frame structure + * @can_id: CAN ID of the frame and CAN_*_FLAG flags, see canid_t definition + * @can_dlc: frame payload length in byte (0 .. 8) aka data length code + * N.B. the DLC field from ISO 11898-1 Chapter 8.4.2.3 has a 1:1 + * mapping of the 'data length code' to the real payload length + * @__pad: padding + * @__res0: reserved / padding + * @__res1: reserved / padding + * @data: CAN frame payload (up to 8 byte) + */ +#define CAN_MAX_DLEN 8 + +struct can_frame{ + uint32_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ + uint8_t can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ + uint8_t data[CAN_MAX_DLEN]; +}; + + + +#endif /* CANFRAME_H_ */ \ No newline at end of file diff --git a/leaf-can-bridge-3-port-CCS/config.h b/leaf-can-bridge-3-port-CCS/config.h new file mode 100644 index 0000000..9907eee --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/config.h @@ -0,0 +1,20 @@ +/* + * config.h + * + * Created: 5-4-2013 10:36:17 + * Author: Emile + */ + + +#ifndef INCFILE1_H_ +#define INCFILE1_H_ + +#define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH) +#define USE_FLASH_DESCRIPTORS +#define FIXED_CONTROL_ENDPOINT_SIZE 8 +#define FIXED_NUM_CONFIGURATIONS 1 +#define MAX_ENDPOINT_INDEX 4 + + + +#endif /* INCFILE1_H_ */ \ No newline at end of file diff --git a/leaf-can-bridge-3-port-CCS/helper_functions.c b/leaf-can-bridge-3-port-CCS/helper_functions.c new file mode 100644 index 0000000..6077308 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/helper_functions.c @@ -0,0 +1,153 @@ +#include +#include +#include "mcp25xx.h" +#include "helper_functions.h" + +uint8_t crctable[256] = {0,133,143,10,155,30,20,145,179,54,60,185,40,173,167,34,227,102,108,233,120,253,247,114,80,213,223,90,203,78,68,193,67,198,204,73,216,93,87,210,240,117,127,250,107,238,228,97,160,37,47,170,59,190,180,49,19,150,156,25,136,13,7,130,134,3,9,140,29,152,146,23,53,176,186,63,174,43,33,164,101,224,234,111,254,123,113,244,214,83,89,220,77,200,194,71,197,64,74,207,94,219,209,84,118,243,249,124,237,104,98,231,38,163,169,44,189,56,50,183,149,16,26,159,14,139,129,4,137,12,6,131,18,151,157,24,58,191,181,48,161,36,46,171,106,239,229,96,241,116,126,251,217,92,86,211,66,199,205,72,202,79,69,192,81,212,222,91,121,252,246,115,226,103,109,232,41,172,166,35,178,55,61,184,154,31,21,144,1,132,142,11,15,138,128,5,148,17,27,158,188,57,51,182,39,162,168,45,236,105,99,230,119,242,248,125,95,218,208,85,196,65,75,206,76,201,195,70,215,82,88,221,255,122,112,245,100,225,235,110,175,42,32,165,52,177,187,62,28,153,147,22,135,2,8,141}; + +//print standard ID (11-bit) to string +void SID_to_str(char * str, uint32_t num){ + uint8_t tmp; + str += 2; + tmp = num & 0xF; + if(tmp > 9){ *str-- = 55 + tmp; } else { *str-- = 48 + tmp; } + tmp = (num & 0xF0) >> 4; + if(tmp > 9){ *str-- = 55 + tmp; } else { *str-- = 48 + tmp; } + num >>= 8; + tmp = num & 0xF; + if(tmp > 9){ *str = 55 + tmp; } else { *str = 48 + tmp; } +} + +//print uint32 to hex value in a string +void uint32_to_str(char * str, uint32_t num){ + num = num & 0x1FFFFFFF; + uint8_t tmp; + str += 7; + for(uint8_t i = 0; i < 4; i++){ + tmp = num & 0xF; + if(tmp > 9){ *str-- = 55 + tmp; } else { *str-- = 48 + tmp; } + tmp = (num & 0xF0) >> 4; + if(tmp > 9){ *str-- = 55 + tmp; } else { *str-- = 48 + tmp; } + num >>= 8; + } +} + +void canframe_to_str(char * str, can_frame_t frame){ + uint8_t tmp; + for(uint8_t i = 0; i < frame.can_dlc; i++){ + tmp = (frame.data[i] & 0xF0) >> 4; + if(tmp > 9){ *str++ = 55 + tmp; } else { *str++ = 48 + tmp; } + tmp = frame.data[i] & 0xF; + if(tmp > 9){ *str++ = 55 + tmp; } else { *str++ = 48 + tmp; } + } +} + +void int_to_hex(char * str, int num){ + uint8_t tmp; + tmp = (num & 0xF0) >> 4; + if(tmp > 9){ *str++ = 55 + tmp; } else { *str++ = 48 + tmp; } + tmp = num & 0xF; + if(tmp > 9){ *str++ = 55 + tmp; } else { *str++ = 48 + tmp; } +} + +//recalculates the CRC-8 with 0x85 poly +void calc_crc8(can_frame_t *frame){ + uint8_t crc = 0; + for(uint8_t i = 0; i < 7; i++){ + crc = crctable[(crc ^ ((int) (*frame).data[i])) % 256]; + } + (*frame).data[7] = crc; +} + +void calc_sum4(can_frame_t *frame){ + uint8_t sum = 0; + for(uint8_t i = 0; i < 7; i++){ + sum += (*frame).data[i] >> 4; + sum += (*frame).data[i] & 0xF; + } + sum = (sum + 2) & 0xF; + (*frame).data[7] = ((*frame).data[7] & 0xF0) + sum; +} + + + +void int_to_3digit(int num, char * buffer){ + if(num < 0) num = -num; + uint16_t res = 100; + for(uint8_t i = 0; i < 3; i++){ + *buffer++ = 48 + (num / res); + num = num % res; + res /= 10; + } +} + +void int_to_4digit(int num, char * buffer){ + if(num < 0) num = -num; + uint16_t res = 1000; + for(uint8_t i = 0; i < 4; i++){ + if(i == 3) *buffer++ = 46; + *buffer++ = 48 + (num / res); + num = num % res; + res /= 10; + } +} + +void int_to_4digit_nodec(int num, char * buffer){ + if(num < 0) num = -num; + uint16_t res = 1000; + for(uint8_t i = 0; i < 4; i++){ + *buffer++ = 48 + (num / res); + num = num % res; + res /= 10; + } +} + +void int_to_5digit(int num, char * buffer){ + uint16_t res = 10000; + for(uint8_t i = 0; i < 5; i++){ + *buffer++ = 48 + (num / res); + num = num % res; + res /= 10; + } +} + +//reads signature bytes +void NVM_GetGUID(uint8_t * b) { + enum { + LOTNUM0=8, // Lot Number Byte 0, ASCII + LOTNUM1, // Lot Number Byte 1, ASCII + LOTNUM2, // Lot Number Byte 2, ASCII + LOTNUM3, // Lot Number Byte 3, ASCII + LOTNUM4, // Lot Number Byte 4, ASCII + LOTNUM5, // Lot Number Byte 5, ASCII + WAFNUM =16, // Wafer Number + COORDX0=18, // Wafer Coordinate X Byte 0 + COORDX1, // Wafer Coordinate X Byte 1 + COORDY0, // Wafer Coordinate Y Byte 0 + COORDY1, // Wafer Coordinate Y Byte 1 + }; + b[ 0]=ReadCalibrationByte(LOTNUM0); + b[ 1]=ReadCalibrationByte(LOTNUM1); + b[ 2]=ReadCalibrationByte(LOTNUM2); + b[ 3]=ReadCalibrationByte(LOTNUM3); + b[ 4]=ReadCalibrationByte(LOTNUM4); + b[ 5]=ReadCalibrationByte(LOTNUM5); + b[ 6]=ReadCalibrationByte(WAFNUM ); + b[ 7]=ReadCalibrationByte(COORDX0); + b[ 8]=ReadCalibrationByte(COORDX1); + b[ 9]=ReadCalibrationByte(COORDY0); + b[10]=ReadCalibrationByte(COORDY1); +} + +uint8_t ReadCalibrationByte( uint8_t index ){ + uint8_t result; + + /* Load the NVM Command register to read the calibration row. */ + NVM_CMD = NVM_CMD_READ_CALIB_ROW_gc; + result = pgm_read_byte(index); + + /* Clean up NVM Command register. */ + NVM_CMD = NVM_CMD_NO_OPERATION_gc; + + return result; +} diff --git a/leaf-can-bridge-3-port-CCS/helper_functions.h b/leaf-can-bridge-3-port-CCS/helper_functions.h new file mode 100644 index 0000000..2fe22f9 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/helper_functions.h @@ -0,0 +1,9 @@ +void uint32_to_str(char * str, uint32_t num); +uint8_t ReadCalibrationByte( uint8_t index ); +void int_to_5digit(int num, char * buffer); +void int_to_4digit(int num, char * buffer); +void int_to_3digit(int num, char * buffer); +void int_to_4digit_nodec(int num, char * buffer); +void int_to_hex(char * str, int num); +void calc_crc8(can_frame_t *frame); +void calc_sum4(can_frame_t *frame); diff --git a/leaf-can-bridge-3-port-CCS/mcp25xx.c b/leaf-can-bridge-3-port-CCS/mcp25xx.c new file mode 100644 index 0000000..37cd86d --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/mcp25xx.c @@ -0,0 +1,286 @@ +/* + +Extra special quad CAN driver for SPIC and SPID on XMEGA with up to 4 CAN devices + +The crystal is on SPIC with the regular enable line. Initialization starts by +configuring the crystal output on this CAN device + +Then initialization cycles through the rest of the devices + +CAN messages can be received and sent by CAN bus (0 or 1) and device (0 or 1). + +Timing logic: + +EV-CAN is about 5m, let's calculate with 10m worst case. Propagation delay is 2*(235ns + 10mx5ns)=570ns +With BRP=0 and so Tq=125ns, we need 5Tq PRSEG and 16PRSEG total. So PHSEG1/2=5 Tq + +NBT should be 1/500kHz=2us +each time quantum is 2*(BRP+1)/Fosc with Fosc=16M so Tclk=62.5ns +so: +BRP Tq Tq in 2us PRSEG(min) PHSEG1(max) +0 125 16 5 8 +2 250 8 3 2 + +So a logical option would be BRP=2, PRSEG=3, PHSEG1=2, PHSEG2=2, SJW=2Tq +or otherwise BRP=0, PRSEG=5, PHSEG1=5, PHSEG2=5, SJW=4Tq +and SAM=1 + +Then again, if we want to stick to 87.5% sample point, then: + BRP=0, PRSEG=8, PHSEG1=5, PHSEG2=2, SJW=1 + +Driver optimization: + +We're really just doing the same thing over and over again, so I coalesced all functionality in minimal functions +that specifically serve the muxsan leaf CAN bridge + +A CAN frame with 8 data bytes is 108 bits, @500kbaud, that makes ~216us +we can service a CAN interrupt within 30us, so we should never see RX1 hits +yet... we do! so something else in the code is limiting us + +Upgrade to 3-port: +Let's fix the inconsistent naming and actually make the silkscreen names match the function names! +CAN3 sits on SPI pins with the -3 suffix +CAN2 sits on the un-numbered suffix +CAN1 sits on the -2 suffix +*/ + +//uncomment this to run at 250 instead of 500kHz +//#define BAUDRATE_250kHz + +#include "mcp25xx.h" +//#define F_CPU 48000000UL +#include + +#define SPI0 SPIC +#define SPI0_PORT PORTC +#define SPI0_SCK PIN7_bm +#define SPI0_MISO PIN6_bm +#define SPI0_MOSI PIN5_bm + +#define CAN1_PORT PORTD +#define CAN1_STBY PIN1_bm +#define CAN1_CS_PORT PORTC +#define CAN1_CS PIN4_bm + +#define CAN2_PORT PORTE +#define CAN2_STBY PIN1_bm +#define CAN2_CS_PORT PORTD +#define CAN2_CS PIN4_bm + +#define CAN3_PORT PORTC +#define CAN3_STBY PIN3_bm +#define CAN3_CS_PORT PORTB +#define CAN3_CS PIN3_bm + +#define can1_standby() CAN1_PORT.OUTSET = CAN1_STBY +#define can2_standby() CAN2_PORT.OUTSET = CAN2_STBY +#define can3_standby() CAN3_PORT.OUTSET = CAN3_STBY +#define can1_unstandby() CAN1_PORT.OUTCLR = CAN1_STBY +#define can2_unstandby() CAN2_PORT.OUTCLR = CAN2_STBY +#define can3_unstandby() CAN3_PORT.OUTCLR = CAN3_STBY + +#define can1_select() CAN1_CS_PORT.OUTCLR = CAN1_CS +#define can2_select() CAN2_CS_PORT.OUTCLR = CAN2_CS +#define can3_select() CAN3_CS_PORT.OUTCLR = CAN3_CS +#define can1_deselect() CAN1_CS_PORT.OUTSET = CAN1_CS +#define can2_deselect() CAN2_CS_PORT.OUTSET = CAN2_CS +#define can3_deselect() CAN3_CS_PORT.OUTSET = CAN3_CS + +uint8_t can_init(uint8_t opmod, uint8_t reset){ + uint8_t mode1, mode2, mode3; + + SPI0_PORT.DIRSET = SPI0_SCK | SPI0_MOSI; + SPI0_PORT.DIRCLR = SPI0_MISO; + CAN1_PORT.DIRSET = CAN1_STBY; + CAN2_PORT.DIRSET = CAN2_STBY; + CAN3_PORT.DIRSET = CAN3_STBY; + CAN1_CS_PORT.DIRSET = CAN1_CS; + CAN2_CS_PORT.DIRSET = CAN2_CS; + CAN3_CS_PORT.DIRSET = CAN3_CS; + SPI0.CTRL = SPI_ENABLE_bm | SPI_MASTER_bm | SPI_CLK2X_bm | //enable SPI SPI_CLK2X_bm | + SPI_PRESCALER_DIV4_gc; //run faster than usual (clkperx2/4=24MHz) + + if(!reset) return 1; + + can1_deselect(); + can2_deselect(); + can3_deselect(); + + _delay_ms(0.1); + + can1_reset(); + can2_reset(); + can3_reset(); + + _delay_ms(1); //wait for MCP25625 to be ready + + mode1 = can1_read(MCP_REG_CANCTRL); //read opmode + mode1 = (mode1 & MCP_MASK_OPMOD)>>5; //mask with opmode bits + + mode2 = can2_read(MCP_REG_CANCTRL); //read opmode + mode2 = (mode2 & MCP_MASK_OPMOD)>>5; //mask with opmode bits + + mode3 = can3_read(MCP_REG_CANCTRL); //read opmode + mode3 = (mode3 & MCP_MASK_OPMOD)>>5; //mask with opmode bits + + if(mode1 != MCP_OPMOD_CONFIG) return 0; //return error if not opmode CONFIG + if(mode2 != MCP_OPMOD_CONFIG) return 0; //return error if not opmode CONFIG + if(mode3 != MCP_OPMOD_CONFIG) return 0; //return error if not opmode CONFIG + + _delay_ms(0.1); //wait a bit for other CAN devices to start up + #ifdef BAUDRATE_250kHz + can1_write(MCP_REG_CNF1,0xC1); //set BRP to 0 so we get Tq = 1/8M, then we need 16xTq to get 500kHz + can2_write(MCP_REG_CNF1,0xC1); + can1_write(MCP_REG_CNF2,0xF0); //PHSEG1 is 7xTq, PRSEG = 1xTq, SAM=1 + can2_write(MCP_REG_CNF2,0xF0); + can1_write(MCP_REG_CNF3,0x06); //PHSEG2 is 7xTq, so total is (7+7+1+1)=16Tq + can2_write(MCP_REG_CNF3,0x06); + #else + can1_write(MCP_REG_CNF1,0b00000000); //set BRP to 0 so we get Tq = 1/8M, then we need 16xTq to get 500kHz, SJW=1 + can2_write(MCP_REG_CNF1,0b00000000); + can3_write(MCP_REG_CNF1,0b00000000); + can1_write(MCP_REG_CNF2,0b11100111); //PHSEG1 is 5xTq, PRSEG = 8xTq, SAM=1 + can2_write(MCP_REG_CNF2,0b11100111); + can3_write(MCP_REG_CNF2,0b11100111); + can1_write(MCP_REG_CNF3,0b00000001); //PHSEG2 is 2xTq, so total is (5+5+5+1)=16Tq + can2_write(MCP_REG_CNF3,0b00000001); + can3_write(MCP_REG_CNF3,0b00000001); + #endif + + + //we leave RXM to 0 and set acceptance filters to 0 to avoid bogus data from error frames + //ending up in the data stream + + can1_bit_modify(MCP_REG_RXB0CTRL, MCP_RXB_BUKT_MASK, MCP_RXB_BUKT_MASK);//configure message rollover + can2_bit_modify(MCP_REG_RXB0CTRL, MCP_RXB_BUKT_MASK, MCP_RXB_BUKT_MASK); + can3_bit_modify(MCP_REG_RXB0CTRL, MCP_RXB_BUKT_MASK, MCP_RXB_BUKT_MASK); + can1_write(MCP_REG_CANINTE, 0xA3); //enable both RX interrupts and the error interrupt + can2_write(MCP_REG_CANINTE, 0xA3); + can3_write(MCP_REG_CANINTE, 0xA3); + can1_bit_modify(MCP_REG_CANCTRL, MCP_MASK_OPMOD, opmod); //Set device mode per argument + can2_bit_modify(MCP_REG_CANCTRL, MCP_MASK_OPMOD, opmod); + can3_bit_modify(MCP_REG_CANCTRL, MCP_MASK_OPMOD, opmod); + can1_unstandby(); //set to active + can2_unstandby(); + can3_unstandby(); + return 1; +} + +//reset +void all_reset(){ can1_reset();can2_reset();can3_reset();} +void can1_reset(){ can1_select();spi0_write(MCP_RESET);can1_deselect(); } +void can2_reset(){ can2_select();spi0_write(MCP_RESET);can2_deselect(); } +void can3_reset(){ can3_select();spi0_write(MCP_RESET);can3_deselect(); } + +//bit modify +void can_bit_modify(uint8_t reg, uint8_t mask, uint8_t val, uint8_t bus){if(bus == 1){can1_select();can123_bit_modify(reg,mask,val);can1_deselect();} + if(bus == 2){can2_select();can123_bit_modify(reg,mask,val);can2_deselect();} + if(bus == 3){can3_select();can123_bit_modify(reg,mask,val);can3_deselect();}} +void can1_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can1_select();can123_bit_modify(reg,mask,val);can1_deselect(); } +void can2_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can2_select();can123_bit_modify(reg,mask,val);can2_deselect(); } +void can3_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ can3_select();can123_bit_modify(reg,mask,val);can3_deselect(); } +void can123_bit_modify(uint8_t reg, uint8_t mask, uint8_t val){ spi0_write(MCP_BITMOD); spi0_write(reg); spi0_write(mask); spi0_write(val);} + +//RTS from SPI +void can1_rts(uint8_t channel){ can1_select(); can123_rts(channel); can1_deselect(); } +void can2_rts(uint8_t channel){ can2_select(); can123_rts(channel); can2_deselect(); } +void can3_rts(uint8_t channel){ can3_select(); can123_rts(channel); can3_deselect(); } + +void can123_rts(uint8_t channel){ + switch (channel){ + case MCP_TX_0: spi0_write(MCP_RTS_TXB0); break; + case MCP_TX_1: spi0_write(MCP_RTS_TXB1); break; + case MCP_TX_2: spi0_write(MCP_RTS_TXB2); break; + default: return; +} } + +void can1_load_txbuff(uint8_t channel, can_frame_t* frame){ can1_select(); can123_load_txbuff(channel, frame); can1_deselect(); } +void can2_load_txbuff(uint8_t channel, can_frame_t* frame){ can2_select(); can123_load_txbuff(channel, frame); can2_deselect(); } +void can3_load_txbuff(uint8_t channel, can_frame_t* frame){ can3_select(); can123_load_txbuff(channel, frame); can3_deselect(); } + +void can123_load_txbuff(uint8_t channel, can_frame_t* frame){ + uint8_t tmp = 0; + + spi0_write(MCP_LOAD_BUF_TXB0SIDH + (channel * 2)); //set buffer + + #ifdef EXTENDED_ID_SUPPORT + if(frame->can_id > 0x7FF){ + frame->can_id |= 0x20000000; + } + + if (frame->can_id & 0x20000000){ + spi0_write((uint8_t)(frame->can_id>>21)); // send XXXnSIDH + tmp = ((uint8_t)(frame->can_id >> 13) ) & 0xe0; + tmp |= ((uint8_t)(frame->can_id >> 16) ) & 0x03; + tmp |= 0x08; + spi0_write(tmp); // send XXXnSIDL + spi0_write((uint8_t)(frame->can_id >> 8)); // send XXXnEID8 + spi0_write((uint8_t)(frame->can_id)); // send XXXnEID0 + } else { + #endif + + spi0_write((uint8_t)(frame->can_id>>3)); // send XXXnSIDH + tmp = ((uint8_t)(frame->can_id << 5) ) & 0xe0; + tmp |= ((uint8_t)(frame->can_id << 2) ) & 0x03; + spi0_write(tmp); // send XXXnSIDL + spi0_write(0); // send XXXnEID8 + spi0_write(0); // send XXXnEID0 + + #ifdef TC_CHARGER + } + #endif + + spi0_write(frame->can_dlc & 0x0f); + + for(uint8_t i= 0; ican_dlc; i++){ spi0_write(frame->data[i]); } +} + +//Read rxbuffer to a frame +uint8_t can_read_rx_buf(uint8_t channel, can_frame_t* frame, uint8_t bus){uint8_t res = 0; if(bus == 1){res = can1_read_rx_buf(channel, frame);} if(bus == 2){res = can2_read_rx_buf(channel, frame);} if(bus == 3){res = can3_read_rx_buf(channel, frame);} return res;} +uint8_t can1_read_rx_buf(uint8_t channel, can_frame_t* frame){uint8_t res = 0; can1_select(); res = can123_read_rx_buf(channel, frame); can1_deselect(); return res;} +uint8_t can2_read_rx_buf(uint8_t channel, can_frame_t* frame){uint8_t res = 0; can2_select(); res = can123_read_rx_buf(channel, frame); can2_deselect(); return res;} +uint8_t can3_read_rx_buf(uint8_t channel, can_frame_t* frame){uint8_t res = 0; can3_select(); res = can123_read_rx_buf(channel, frame); can3_deselect(); return res;} + +uint8_t can123_read_rx_buf(uint8_t channel, can_frame_t* frame){ + uint16_t id = 0; + uint8_t data; + + spi0_write(channel); + + data = spi0_write(0); // read XXXnSIDH + id = (((uint16_t)data) << 3); + + data = spi0_write(0); // read XXXnSIDL + id |= (((uint16_t)(data & 0xe0)) >> 5); + + spi0_write(0); // read XXXnEID8 + spi0_write(0); // read XXXnEID0 + + frame->can_id = id; + frame->can_dlc = spi0_write(0); // read length of the frame + frame->can_dlc &= 0x0f; + + for (uint8_t i=0; ican_dlc; i++){ frame->data[i] = spi0_write(0); } + + return 1; +} + +//read a register +uint8_t can_read(uint8_t reg, uint8_t bus){if(bus == 1){return can1_read(reg);} else if(bus == 2) {return can2_read(reg);} else {return can3_read(reg);}} +uint8_t can1_read(uint8_t reg){uint8_t res=0; can1_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can1_deselect(); return res;} +uint8_t can2_read(uint8_t reg){uint8_t res=0; can2_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can2_deselect(); return res;} +uint8_t can3_read(uint8_t reg){uint8_t res=0; can3_select(); spi0_write(MCP_READ); spi0_write(reg); res=spi0_write(0); can3_deselect(); return res;} + +//write a register. +void can_write(uint8_t reg, uint8_t value, uint8_t bus){if(bus == 1){can1_write(reg, value);} else if(bus == 2){can2_write(reg, value);} else {can3_write(reg, value);}} +void can1_write(uint8_t reg, uint8_t value){can1_select(); spi0_write(MCP_WRITE);spi0_write(reg);spi0_write(value); can1_deselect();} +void can2_write(uint8_t reg, uint8_t value){can2_select(); spi0_write(MCP_WRITE);spi0_write(reg);spi0_write(value); can2_deselect();} +void can3_write(uint8_t reg, uint8_t value){can3_select(); spi0_write(MCP_WRITE);spi0_write(reg);spi0_write(value); can3_deselect();} + +uint8_t spi0_write(uint8_t data){ + SPI0.STATUS = SPI0.STATUS; + SPI0.DATA = data; + //Send the data out, wait for data to be shifted out. + while (!(SPI0.STATUS & SPI_IF_bm)); + return SPI0.DATA; +} diff --git a/leaf-can-bridge-3-port-CCS/mcp25xx.h b/leaf-can-bridge-3-port-CCS/mcp25xx.h new file mode 100644 index 0000000..273e86e --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/mcp25xx.h @@ -0,0 +1,168 @@ +#ifndef MCP25XX_H_ +#define MCP25XX_H_ + +#include + +typedef struct can_frame can_frame_t; + +#define CAN_MAX_DLEN 8 +//#define EXTENDED_ID_SUPPORT + +#ifdef EXTENDED_ID_SUPPORT +struct can_frame{ + uint32_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ + uint8_t can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ + uint8_t data[CAN_MAX_DLEN]; +}; +#else +struct can_frame{ + uint16_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ + uint8_t can_dlc; /* frame payload length in byte (0 .. CAN_MAX_DLEN) */ + uint8_t data[CAN_MAX_DLEN]; +}; +#endif + +//Instructions +#define MCP_RESET 0xC0 + +#define MCP_READ 0x03 +#define MCP_READ_BUF_RXB0SIDH 0x90 //read data from begin address of Standard ID (MSB) of RX buffer 0 +#define MCP_READ_BUF_RXB0D0 0x92 //read data from begin address of data byte 0 of RX buffer 0 +#define MCP_READ_BUF_RXB1SIDH 0x94 //...RX buffer 1 +#define MCP_READ_BUF_RXB1D0 0x96 //...RX buffer 1 + +#define MCP_WRITE 0x02 +#define MCP_LOAD_BUF_TXB0SIDH 0x40 //load data from begin address of Standard ID (MSB) of TX buffer 0 +#define MCP_LOAD_BUF_TXB0D0 0X41 //load data from begin address of data byte 0 of TX buffer 0 +#define MCP_LOAD_BUF_TXB1SIDH 0x42 //...TX buffer 1 +#define MCP_LOAD_BUF_TXB1D0 0X43 //...TX buffer 1 +#define MCP_LOAD_BUF_TXB2SIDH 0x44 //...TX buffer 2 +#define MCP_LOAD_BUF_TXB2D0 0X45 //...TX buffer 2 +#define MCP_RTS_TXB0 0x81 //activate the RTS of TX buffer 0. +#define MCP_RTS_TXB1 0x82 //...TX buffer 1. +#define MCP_RTS_TXB2 0x84 //...TX buffer 2. +#define MCP_RTS_ALL 0x87 //...TX buffer 0, 1 and 2. +#define MCP_READ_RXTX_STATUS 0xA0 +#define MCP_RX_STATUS 0xB0 + +#define MCP_BITMOD 0x05 + +#define MCP_LOAD_TX0 0x40 +#define MCP_LOAD_TX1 0x42 +#define MCP_LOAD_TX2 0x44 + +#define MCP_RTS_TX0 0x81 +#define MCP_RTS_TX1 0x82 +#define MCP_RTS_TX2 0x84 +#define MCP_RTS_ALL 0x87 + +//Registers +#define MCP_MASK_CANSTAT 0x0E +#define MCP_MASK_CANCTRL 0x0F + +#define MCP_REG_BFPCTRL 0x0C //RXnBF pin control/status +#define MCP_REG_TXRTSCTRL 0x0D //TXnRTS pin control/status +#define MCP_REG_CANSTAT 0x0E //CAN status. any addr of MSB will give the same info??? +#define MCP_REG_CANCTRL 0x0F //CAN control status. any addr of MSB will give the same info??? +#define MCP_REG_TEC 0x1C //Transmit Error Counter +#define MCP_REG_REC 0x1D //Receive Error Counter +#define MCP_REG_CNF3 0x28 //Phase segment 2 +#define MCP_REG_CNF2 0x29 //Propagation segment & Phase segment 1 & n sample setting +#define MCP_REG_CNF1 0x2A //Baud rate prescaler & Sync Jump Width +#define MCP_REG_CANINTE 0x2B //CAN interrupt enable +#define MCP_REG_CANINTF 0x2C //Interrupt flag +#define MCP_REG_EFLG 0x2D //Error flag +#define MCP_REG_TXB0CTRL 0x30 //TX buffer 0 control +#define MCP_REG_TXB1CTRL 0x40 //TX buffer 1 control +#define MCP_REG_TXB2CTRL 0x50 //TX buffer 2 control +#define MCP_REG_RXB0CTRL 0x60 //RX buffer 0 control +#define MCP_REG_RXB1CTRL 0x70 //RX buffer 1 control + +#define MCP_MASK_OPMOD 0xE0 +#define MCP_OPMOD_NORMAL 0x00 +#define MCP_OPMOD_SLEEP 0x01 +#define MCP_OPMOD_LOOPBACK 0x02 +#define MCP_OPMOD_LISTEN 0x03 +#define MCP_OPMOD_CONFIG 0x04 + +#define MCP_MASK_CLKEN 0x04 +#define MCP_CLKEN 0x04 + +#define MCP_OPMOD_INVALID 0x07 + +#define MCP_RX_OPMOD_FILTER_ANY 0 +#define MCP_RX_OPMOD_FILTER_STANDARD 1 +#define MCP_RX_OPMOD_FILTER_EXTENDED 2 +#define MCP_RX_OPMOD_ANY 3 + + +#define MCP_TX_0 0 +#define MCP_TX_1 1 +#define MCP_TX_2 2 + +#define MCP_RX_0 0x90 +#define MCP_RX_1 0x94 + +#define MCP_SIDH 0 +#define MCP_SIDL 1 +#define MCP_EID8 2 +#define MCP_EID0 3 + +#define MCP_TXB_EXIDE_M 0x08 // In TXBnSIDL + +//MCP_REG_RXB0CTRL +#define MCP_RXB_RX_ANY 0x60 +#define MCP_RXB_RX_EX 0x40 +#define MCP_RXB_RX_ST 0x20 +#define MCP_RXB_RX_STDEXT 0x00 +#define MCP_RXB_RX_MASK 0x60 +#define MCP_RXB_BUKT_MASK 0x04 + +//MCP_REG_CANINTF Register Bits +#define MCP_RX0IF 0x01 +#define MCP_RX1IF 0x02 +#define MCP_TX0IF 0x04 +#define MCP_TX1IF 0x08 +#define MCP_TX2IF 0x10 +#define MCP_ERRIF 0x20 +#define MCP_WAKIF 0x40 +#define MCP_MERRF 0x80 + +#define MCP_TXREQ_bm 0x08 + +uint8_t can_init(uint8_t opmod, uint8_t reset); +void all_reset(void); +void can1_reset(void); +void can2_reset(void); +void can3_reset(void); + +//bit modify +void can_bit_modify(uint8_t reg, uint8_t mask, uint8_t val, uint8_t bus); +void can1_bit_modify(uint8_t reg, uint8_t mask, uint8_t val); +void can2_bit_modify(uint8_t reg, uint8_t mask, uint8_t val); +void can3_bit_modify(uint8_t reg, uint8_t mask, uint8_t val); +void can123_bit_modify(uint8_t reg, uint8_t mask, uint8_t val); +void can1_rts(uint8_t channel); +void can2_rts(uint8_t channel); +void can3_rts(uint8_t channel); +void can123_rts(uint8_t channel); +void can1_load_txbuff(uint8_t channel, can_frame_t* frame); +void can2_load_txbuff(uint8_t channel, can_frame_t* frame); +void can3_load_txbuff(uint8_t channel, can_frame_t* frame); +void can123_load_txbuff(uint8_t channel, can_frame_t* frame); +uint8_t spi0_write(uint8_t data); +uint8_t can_read_rx_buf(uint8_t channel, can_frame_t* frame, uint8_t bus); +uint8_t can1_read_rx_buf(uint8_t channel, can_frame_t* frame); +uint8_t can2_read_rx_buf(uint8_t channel, can_frame_t* frame); +uint8_t can3_read_rx_buf(uint8_t channel, can_frame_t* frame); +uint8_t can123_read_rx_buf(uint8_t channel, can_frame_t* frame); +uint8_t can_read(uint8_t reg, uint8_t bus); +uint8_t can1_read(uint8_t reg); +uint8_t can2_read(uint8_t reg); +uint8_t can3_read(uint8_t reg); +void can_write(uint8_t reg, uint8_t value, uint8_t bus); +void can1_write(uint8_t reg, uint8_t value); +void can2_write(uint8_t reg, uint8_t value); +void can3_write(uint8_t reg, uint8_t value); + +#endif \ No newline at end of file diff --git a/leaf-can-bridge-3-port-CCS/sp_driver.S b/leaf-can-bridge-3-port-CCS/sp_driver.S new file mode 100644 index 0000000..e6fff99 --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/sp_driver.S @@ -0,0 +1,794 @@ +;****************************************************************************** +;* +;* XMEGA Self-programming driver assembly source file. +;* +;* This file contains the low-level implementations for the +;* XMEGA Self-programming driver. It is written for the GCC Assembler. +;* +;* If any SPM instructions are used, the linker file must define +;* a segment named bootloader which must be located in the device Boot section. +;* This can be done by passing "-Wl,--section-start=.BOOT=0x020000" to the +;* linker with the correct address for the boot section. +;* +;* None of these routines clean up the NVM Command Register after use. +;* It is therefore important to write NVM_CMD_NO_OPERATION_gc (0x00) to this +;* register when you are finished using any of the functions in this driver. +;* +;* For all routines, it is important that any interrupt handlers do not +;* perform any NVM operations. The user must implement a scheme for mutually +;* exclusive access to the NVM. However, the 4-cycle timeout will work fine, +;* since writing to the Configuration Change Protection register (CCP) +;* automatically disables interrupts for 4 instruction cycles. +;* +;* Note on IAR calling convention: +;* Scratch registers: R18-R27, R30-R31 +;* Preserved registers: R2-R17, R28-R29 +;* Parameter registers: R8-R25 (2-,4-, or 8- byte alignment) +;* Return registers: R18-R25 (up to 64-bit) +;* +;* Application note: +;* AVR1316: XMEGA Self-programming +;* +;* Documentation +;* For comprehensive code documentation, supported compilers, compiler +;* settings and supported devices see readme.html +;* +;* Atmel Corporation: http:;www.atmel.com \n +;* Support email: avr@atmel.com +;* +;* $Revision: 1153 $ +;* $Date: 2007-12-18 09:48:23 +0100 (ti, 18 des 2007) $ +;* +;* Copyright (c) 2007, Atmel Corporation 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. The name of ATMEL may not be used to endorse or promote products derived +;* from this software without specific prior written permission. +;* +;* THIS SOFTWARE IS PROVIDED BY ATMEL "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 EXPRESSLY AND +;* SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. +;****************************************************************************** + +#include +;#include "Flash_Defines.h" + +/* Define the size of the flash page if not defined in the header files. */ +#ifndef APP_SECTION_PAGE_SIZE + #error APP_SECTION_PAGE_SIZE must be defined if not defined in header files. + //#define APP_SECTION_PAGE_SIZE 512 +#endif /*APP_SECTION_PAGE_SIZE*/ + +/* Defines not yet included in header file. */ +#define NVM_CMD_NO_OPERATION_gc (0x00<<0) // Noop/Ordinary LPM +#define NVM_CMD_READ_USER_SIG_ROW_gc (0x01<<0) // Read user signature row +#define NVM_CMD_READ_CALIB_ROW_gc (0x02<<0) // Read calibration row +#define NVM_CMD_READ_EEPROM_gc (0x06<<0) // Read EEPROM +#define NVM_CMD_READ_FUSES_gc (0x07<<0) // Read fuse byte +#define NVM_CMD_WRITE_LOCK_BITS_gc (0x08<<0) // Write lock bits +#define NVM_CMD_ERASE_USER_SIG_ROW_gc (0x18<<0) // Erase user signature row +#define NVM_CMD_WRITE_USER_SIG_ROW_gc (0x1A<<0) // Write user signature row +#define NVM_CMD_ERASE_APP_gc (0x20<<0) // Erase Application Section +#define NVM_CMD_ERASE_APP_PAGE_gc (0x22<<0) // Erase Application Section page +#define NVM_CMD_LOAD_FLASH_BUFFER_gc (0x23<<0) // Load Flash page buffer +#define NVM_CMD_WRITE_APP_PAGE_gc (0x24<<0) // Write Application Section page +#define NVM_CMD_ERASE_WRITE_APP_PAGE_gc (0x25<<0) // Erase-and-write Application Section page +#define NVM_CMD_ERASE_FLASH_BUFFER_gc (0x26<<0) // Erase/flush Flash page buffer +#define NVM_CMD_ERASE_BOOT_PAGE_gc (0x2A<<0) // Erase Boot Section page +#define NVM_CMD_WRITE_BOOT_PAGE_gc (0x2C<<0) // Write Boot Section page +#define NVM_CMD_ERASE_WRITE_BOOT_PAGE_gc (0x2D<<0) // Erase-and-write Boot Section page +#define NVM_CMD_ERASE_EEPROM_gc (0x30<<0) // Erase EEPROM +#define NVM_CMD_ERASE_EEPROM_PAGE_gc (0x32<<0) // Erase EEPROM page +#define NVM_CMD_LOAD_EEPROM_BUFFER_gc (0x33<<0) // Load EEPROM page buffer +#define NVM_CMD_WRITE_EEPROM_PAGE_gc (0x34<<0) // Write EEPROM page +#define NVM_CMD_ERASE_WRITE_EEPROM_PAGE_gc (0x35<<0) // Erase-and-write EEPROM page +#define NVM_CMD_ERASE_EEPROM_BUFFER_gc (0x36<<0) // Erase/flush EEPROM page buffer +#define NVM_CMD_APP_CRC_gc (0x38<<0) // Generate Application section CRC +#define NVM_CMD_BOOT_CRC_gc (0x39<<0) // Generate Boot Section CRC +#define NVM_CMD_FLASH_RANGE_CRC_gc (0x3A<<0) // Generate Flash Range CRC +#define CCP_SPM_gc (0x9D<<0) // SPM Instruction Protection +#define CCP_IOREG_gc (0xD8<<0) // IO Register Protection + + + +; --- +; This routine reads a byte from flash given by the address in +; R25:R24:R23:R22. +; +; Input: +; R25:R24:R23:R22. +; +; Returns: +; R24 - Read byte. +; --- + +.section .text +.global SP_ReadByte + +SP_ReadByte: + in r19, RAMPZ ; Save RAMPZ. + out RAMPZ, r24 ; Load RAMPZ with the MSB of the address. + movw ZL, r22 ; Move the low bytes to the Z pointer + elpm r24, Z ; Extended load byte from address pointed to by Z. + out RAMPZ, r19 ; Restore RAMPZ register. + ret + + + +; --- +; This routine reads a word from flash given by the address in +; R25:R24:R23:R22. +; +; Input: +; R25:R24:R23:R22. +; +; Returns: +; R25:R24 - Read word. +; --- + +.section .text +.global SP_ReadWord + +SP_ReadWord: + in r19, RAMPZ ; Save RAMPZ. + out RAMPZ, r24 ; Load RAMPZ with the MSB of the address. + movw ZL, r22 ; Move the low bytes to the Z pointer + elpm r24, Z+ ; Extended load byte from address pointed to by Z. + elpm r25, Z ; Extended load byte from address pointed to by Z. + out RAMPZ, r19 ; Restore RAMPZ register. + ret + + + +; --- +; This routine reads the calibration byte given by the index in R24. +; +; Input: +; R24 - Byte index. +; +; Returns: +; R24 - Calibration byte. +; --- + +.section .text +.global SP_ReadCalibrationByte + +SP_ReadCalibrationByte: + ldi r20, NVM_CMD_READ_CALIB_ROW_gc ; Prepare NVM command in R20. + rjmp SP_CommonLPM ; Jump to common LPM code. + + + +; --- +; This routine reads the user signature byte given by the index in R25:R24. +; +; Input: +; R25:R24 - Byte index. +; +; Returns: +; R24 - Signature byte. +; --- + +.section .text +.global SP_ReadUserSignatureByte + +SP_ReadUserSignatureByte: + ldi r20, NVM_CMD_READ_USER_SIG_ROW_gc ; Prepare NVM command in R20. + rjmp SP_CommonLPM ; Jump to common LPM code. + + + +; --- +; This routine reads the fuse byte given by the index in R24. +; +; Input: +; R24 - Byte index. +; +; Returns: +; R24 - Fuse byte. +; --- + +.section .text +.global SP_ReadFuseByte + +SP_ReadFuseByte: + sts NVM_ADDR0, r24 ; Load fuse byte index into NVM Address Register 0. + clr r24 ; Prepare a zero. + sts NVM_ADDR1, r24 ; Load zero into NVM Address Register 1. + sts NVM_ADDR2, r24 ; Load zero into NVM Address Register 2. + ldi r20, NVM_CMD_READ_FUSES_gc ; Prepare NVM command in R20. + rcall SP_CommonCMD ; Jump to common NVM Action code. + movw r24, r22 ; Move low byte to 1 byte return address. + ret + + + +; --- +; This routine sets the lock bits from R24. Note that unlocking is only +; possible by doing a full chip erase, not available from software. +; +; Input: +; R24 - Lock bits. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_WriteLockBits + +SP_WriteLockBits: + sts NVM_DATA0, r24 ; Load lock bits into NVM Data Register 0. + ldi r20, NVM_CMD_WRITE_LOCK_BITS_gc ; Prepare NVM command in R20. + rjmp SP_CommonCMD ; Jump to common NVM Action code. + + + +; --- +; This routine reads the lock bits. +; +; Input: +; Nothing. +; +; Returns: +; R24 - Lock bits. +; --- + +.section .text +.global SP_ReadLockBits + +SP_ReadLockBits: + lds r24, NVM_LOCKBITS ; Read IO-mapped lock bits. + ret + + + +; --- +; This routine erases the user signature row. +; +; Input: +; Nothing. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_EraseUserSignatureRow + +SP_EraseUserSignatureRow: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + ldi r20, NVM_CMD_ERASE_USER_SIG_ROW_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine writes the flash buffer to the user signature row. +; +; Input: +; Nothing. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_WriteUserSignatureRow + +SP_WriteUserSignatureRow: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + ldi r20, NVM_CMD_WRITE_USER_SIG_ROW_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine erases the entire application section. +; +; Input: +; Nothing. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_EraseApplicationSection + +SP_EraseApplicationSection: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + clr r24 ; Prepare a zero. + clr r25 + out RAMPZ, r24 ; Point into Application area. + ldi r20, NVM_CMD_ERASE_APP_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine erases the page at address R25:R24:R23:R22 in the application +; section. The address can point anywhere inside the page. +; +; Input: +; R25:R24:R23:R22 - Byte address into Flash page. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_EraseApplicationPage + +SP_EraseApplicationPage: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + out RAMPZ, r24 ; Load RAMPZ with the MSB of the address. + movw r24, r22 ; Move low bytes for ZH:ZL to R25:R24 + ldi r20, NVM_CMD_ERASE_APP_PAGE_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine writes the word from R23:R22 into the Flash page buffer at +; address R25:R24. +; +; Input: +; R25:R24 - Byte address into Flash page. +; R23:R22 - Word to write. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_LoadFlashWord + +SP_LoadFlashWord: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + movw r0, r22 ; Prepare flash word in R1:R0. + ldi r20, NVM_CMD_LOAD_FLASH_BUFFER_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine writes an entire page from the SRAM buffer at +; address R25:R24 into the Flash page buffer. +; +; Note that you must define "-Wl,--section-start=.BOOT=0x020000" for the +; linker to place this function in the boot section with the correct address. +; +; Input: +; R25:R24 - 16-bit pointer to SRAM buffer. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_LoadFlashPage + +SP_LoadFlashPage: + clr ZL ; Clear low byte of Z, to indicate start of page. + clr ZH ; Clear high byte of Z, to indicate start of page. + + out RAMPX, r1 ; Clear RAMPX pointer. + movw XL, r24 ; Load X with data buffer address. + + ldi r20, NVM_CMD_LOAD_FLASH_BUFFER_gc ; Prepare NVM command code in R20. + sts NVM_CMD, r20 ; Load it into NVM command register. + +#if APP_SECTION_PAGE_SIZE > 512 + ldi r22, ((APP_SECTION_PAGE_SIZE/2) >> 8) +#endif + + ldi r21, ((APP_SECTION_PAGE_SIZE/2)&0xFF) ; Load R21 with page word count. + ldi r18, CCP_SPM_gc ; Prepare Protect SPM signature in R16. + +SP_LoadFlashPage_1: + ld r0, X+ ; Load low byte from buffer into R0. + ld r1, X+ ; Load high byte from buffer into R1. + sts CCP, r18 ; Enable SPM operation (this disables interrupts for 4 cycles). + spm ; Self-program. + adiw ZL, 2 ; Move Z to next Flash word. + +#if APP_SECTION_PAGE_SIZE > 512 + subi r21, 1 ; Decrement word count. + sbci r22, 0 +#else + dec r21 ; Decrement word count. +#endif + + brne SP_LoadFlashPage_1 ; Repeat until word cont is zero. + + clr r1 ; Clear R1 for GCC _zero_reg_ to function properly. + ret + + + +; --- +; This routine reads an entire Flash page from address R23:R22:R21:R20 into the +; SRAM buffer at address R25:R24. +; +; +; Input: +; R23:R22:R21:R20 - Flash byte address. +; R25:R24 - 16-bit pointer to SRAM buffer. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_ReadFlashPage + +SP_ReadFlashPage: + + in r19, RAMPZ ; Save RAMPZ during assembly. + out RAMPZ, r22 ; Load RAMPZ with MSB of address + movw ZL, r20 ; Load Z with Flash address. + + out RAMPX, r1 ; Load RAMPX with data pointer + movw XL, r24 ; Load X with data buffer address. + + ldi r20, NVM_CMD_NO_OPERATION_gc ; Prepare NVM command code in R20. + sts NVM_CMD, r20 ; Set NVM command to No Operation so that LPM reads Flash. + +#if APP_SECTION_PAGE_SIZE > 512 + ldi r22, ((APP_SECTION_PAGE_SIZE/2) >> 8) ; Load R22 with byte cont high if flash page is large. +#endif + + ldi r21, ((APP_SECTION_PAGE_SIZE)&0xFF) ; Load R21 with byte count. + +SP_ReadFlashPage_1: + elpm r24, Z+ ; Load Flash bytes into R18:r19 + elpm r25, Z+ + st X+, r24 ; Write bytes to buffer. + st X+, r25 + +#if APP_SECTION_PAGE_SIZE > 512 + subi r21, 1 ; Decrement word count. + sbci r22, 0 +#else + dec r21 ; Decrement word count. +#endif + + brne SP_ReadFlashPage_1 ; Repeat until byte count is zero. + + out RAMPZ, r19 + ret + + + +; --- +; This routine writes the page buffer to the Flash page at address R25:R24:R23:R22 +; in the application section. The address can point anywhere inside the page. +; +; Input: +; R25:R24:R23:R22 - Byte address into Flash page. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_WriteApplicationPage + +SP_WriteApplicationPage: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + out RAMPZ, r24 ; Load RAMPZ with the MSB of the address. + movw r24, r22 ; Move low bytes of address to ZH:ZL from R23:R22 + ldi r20, NVM_CMD_WRITE_APP_PAGE_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine erases first and then writes the page buffer to the +; Flash page at address R25:R24:R23:R22 in the application section. The address +; can point anywhere inside the page. +; +; Input: +; R25:R24:R23:R22 - Byte address into Flash page. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_EraseWriteApplicationPage + +SP_EraseWriteApplicationPage: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + out RAMPZ, r24 ; Load RAMPZ with the MSB of the address. + movw r24, r22 ; Move low bytes of address to ZH:ZL from R23:R22 + ldi r20, NVM_CMD_ERASE_WRITE_APP_PAGE_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine flushes the Flash page buffer. +; +; Input: +; Nothing. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_EraseFlashBuffer + +SP_EraseFlashBuffer: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + ldi r20, NVM_CMD_ERASE_FLASH_BUFFER_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine erases the page at address R25:R24:R23:R22 in the Boot section. The +; address can point anywhere inside the page. +; +; Input: +; R25:R24:R23:R22 - Byte address into Flash page. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_EraseBootPage + +SP_EraseBootPage: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + out RAMPZ, r24 ; Load RAMPZ with the MSB of the address. + movw r24, r22 ; Move low bytes of address to ZH:ZL from R23:R22 + ldi r20, NVM_CMD_ERASE_BOOT_PAGE_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine writes the page buffer to the Flash page at address R25:R24:R23:R22 +; in the BOOT section. The address can point anywhere inside the page. +; +; Input: +; R25:R24:R23:R22 - Byte address into Flash page. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_WriteBootPage + +SP_WriteBootPage: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + out RAMPZ, r24 ; Load RAMPZ with the MSB of the address. + movw r24, r22 ; Move low bytes of address to ZH:ZL from R23:R22 + ldi r20, NVM_CMD_WRITE_BOOT_PAGE_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine erases first and then writes the page buffer to the +; Flash page at address R25:R24:R23:R22 in the Boot section. The address +; can point anywhere inside the page. +; +; Input: +; R25:R24:R23:R22 - Byte address into Flash page. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_EraseWriteBootPage + +SP_EraseWriteBootPage: + in r19, RAMPZ ; Save RAMPZ, which is restored in SP_CommonSPM. + out RAMPZ, r24 ; Load RAMPZ with the MSB of the address. + movw r24, r22 ; Move low bytes of address to ZH:ZL from R23:R22 + ldi r20, NVM_CMD_ERASE_WRITE_BOOT_PAGE_gc ; Prepare NVM command in R20. + jmp SP_CommonSPM ; Jump to common SPM code. + + + +; --- +; This routine calculates a CRC for the application section. +; +; Input: +; Nothing. +; +; Returns: +; R25:R24:R23:R22 - 32-bit CRC result (actually only 24-bit used). +; --- + +.section .text +.global SP_ApplicationCRC + +SP_ApplicationCRC: + ldi r20, NVM_CMD_APP_CRC_gc ; Prepare NVM command in R20. + rjmp SP_CommonCMD ; Jump to common NVM Action code. + + + +; --- +; This routine calculates a CRC for the Boot section. +; +; Input: +; Nothing. +; +; Returns: +; R25:R24:R23:R22 - 32-bit CRC result (actually only 24-bit used). +; --- + +.section .text +.global SP_BootCRC + +SP_BootCRC: + ldi r20, NVM_CMD_BOOT_CRC_gc ; Prepare NVM command in R20. + rjmp SP_CommonCMD ; Jump to common NVM Action code. + + + +; --- +; This routine locks all further access to SPM operations until next reset. +; +; Input: +; Nothing. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_LockSPM + +SP_LockSPM: + ldi r18, CCP_IOREG_gc ; Prepare Protect IO-register signature in R18. + sts CCP, r18 ; Enable IO-register operation (this disables interrupts for 4 cycles). + ldi r18, NVM_SPMLOCK_bm ; Prepare bitmask for locking SPM into R18. + sts NVM_CTRLB, r18 ; Load bitmask into NVM Control Register B, which locks SPM. + ret + + + +; --- +; This routine wait for the SPM to finish and clears the command register. +; +; Note that this routine is blocking, and will halt any execution until the SPM +; is finished. +; +; Input: +; Nothing. +; +; Returns: +; Nothing. +; --- + +.section .text +.global SP_WaitForSPM + +SP_WaitForSPM: + lds r18, NVM_STATUS ; Load the NVM Status register. + sbrc r18, NVM_NVMBUSY_bp ; Check if bit is cleared. + rjmp SP_WaitForSPM ; Repeat check if bit is not cleared. + clr r18 + sts NVM_CMD, r18 ; Clear up command register to NO_OPERATION. + ret + + + +; --- +; This routine is called by several other routines, and contains common code +; for executing an NVM command, including the return statement itself. +; +; If the operation (NVM command) requires the NVM Address registers to be +; prepared, this must be done before jumping to this routine. +; +; Note that R25:R24:R23:R22 is used for returning results, even if the +; C-domain calling function only expects a single byte or even void. +; +; Input: +; R20 - NVM Command code. +; +; Returns: +; R25:R24:R23:R22 - 32-bit result from NVM operation. +; --- + +.section .text + +SP_CommonCMD: + sts NVM_CMD, r20 ; Load command into NVM Command register. + ldi r18, CCP_IOREG_gc ; Prepare Protect IO-register signature in R18. + ldi r19, NVM_CMDEX_bm ; Prepare bitmask for setting NVM Command Execute bit into R19. + sts CCP, r18 ; Enable IO-register operation (this disables interrupts for 4 cycles). + sts NVM_CTRLA, r19 ; Load bitmask into NVM Control Register A, which executes the command. + lds r22, NVM_DATA0 ; Load NVM Data Register 0 into R22. + lds r23, NVM_DATA1 ; Load NVM Data Register 1 into R23. + lds r24, NVM_DATA2 ; Load NVM Data Register 2 into R24. + clr r25 ; Clear R25 in order to return a clean 32-bit value. + ret + + + +; --- +; This routine is called by several other routines, and contains common code +; for executing an LPM command, including the return statement itself. +; +; Note that R24 is used for returning results, even if the +; C-domain calling function expects a void. +; +; Input: +; R25:R24 - Low bytes of Z pointer. +; R20 - NVM Command code. +; +; Returns: +; R24 - Result from LPM operation. +; --- + +.section .text + +SP_CommonLPM: + movw ZL, r24 ; Load index into Z. + sts NVM_CMD, r20 ; Load prepared command into NVM Command register. + lpm r24,Z + ret + + + +; --- +; This routine is called by several other routines, and contains common code +; for executing an SPM command, including the return statement itself. +; +; If the operation (SPM command) requires the R1:R0 registers to be +; prepared, this must be done before jumping to this routine. +; +; Note that you must define "-Wl,--section-start=.BOOT=0x020000" for the +; linker to place this function in the boot section with the correct address. +; +; Input: +; R1:R0 - Optional input to SPM command. +; R25:R24 - Low bytes of Z pointer. +; R20 - NVM Command code. +; +; Returns: +; Nothing. +; --- + +.section .text + +SP_CommonSPM: + movw ZL, r24 ; Load R25:R24 into Z. + sts NVM_CMD, r20 ; Load prepared command into NVM Command register. + ldi r18, CCP_SPM_gc ; Prepare Protect SPM signature in R18 + sts CCP, r18 ; Enable SPM operation (this disables interrupts for 4 cycles). + spm ; Self-program. + clr r1 ; Clear R1 for GCC _zero_reg_ to function properly. + out RAMPZ, r19 ; Restore RAMPZ register. + ret + + +; END OF FILE + diff --git a/leaf-can-bridge-3-port-CCS/sp_driver.h b/leaf-can-bridge-3-port-CCS/sp_driver.h new file mode 100644 index 0000000..e98caba --- /dev/null +++ b/leaf-can-bridge-3-port-CCS/sp_driver.h @@ -0,0 +1,293 @@ +/* This file has been prepared for Doxygen automatic documentation generation.*/ +/*! \file ********************************************************************* + * + * \brief XMEGA Self-programming driver header file. + * + * This file contains the function prototypes for the + * XMEGA Self-programming driver. + * If any SPM instructions are used, the linker file must define + * a segment named BOOT which must be located in the device boot section. + * + * + * None of these functions clean up the NVM Command Register after use. + * It is therefore important to write NVMCMD_NO_OPERATION (0x00) to this + * register when you are finished using any of the functions in this driver. + * + * For all functions, it is important that no interrupt handlers + * perform any NVM operations. The user must implement a scheme for mutually + * exclusive access to the NVM. However, the 4-cycle timeout will work fine, + * since writing to the Configuration Change Protection register (CCP) + * automatically disables interrupts for 4 instruction cycles. + * + * \par Application note: + * AVR1316: XMEGA Self-programming + * + * \par Documentation + * For comprehensive code documentation, supported compilers, compiler + * settings and supported devices see readme.html + * + * \author + * Atmel Corporation: http://www.atmel.com \n + * Support email: avr@atmel.com + * + * $Revision: 1691 $ + * $Date: 2008-07-29 13:25:40 +0200 (ti, 29 jul 2008) $ \n + * + * Copyright (c) 2008, Atmel Corporation 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. The name of ATMEL may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY ATMEL "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 EXPRESSLY AND + * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. + *****************************************************************************/ +#ifndef SP_DRIVER_H +#define SP_DRIVER_H + +//#include "avr_compiler.h" +//#include "Flash_Defines.h" + + + +/* Define the size of the flash page if not defined in the header files. */ +#ifndef APP_SECTION_PAGE_SIZE + #error APP_SECTION_PAGE_SIZE must be defined if not defined in header files. + //#define APP_SECTION_PAGE_SIZE 512 +#endif /*FLASH_PAGE_SIZE*/ + +/* Define the Start of the application table if not defined in the header files. */ +#ifndef APPTABLE_SECTION_START + #error APPTABLE_SECTION_START must be defined if not defined in header files. + //#define APPTABLE_SECTION_START 0x01E000 //APPTABLE address for ATxmega128A1 +#endif /*APPTABLE_SECTION_START*/ + +/*! \brief Read a byte from flash. + * + * This function reads one byte from the flash. + * + * \note Both IAR and GCC have functions to do this, but + * we include the fucntions for easier use. + * + * \param address Address to the location of the byte to read. + * + * \retval Byte read from flash. + */ +uint8_t SP_ReadByte(uint32_t address); + +/*! \brief Read a word from flash. + * + * This function reads one word from the flash. + * + * \note Both IAR and GCC have functions to do this automatically, but + * we include the fucntions for easier use. + * + * \param address Address to the location of the word to read. + * + * \retval word read from flash. + */ +uint16_t SP_ReadWord(uint32_t address); + +/*! \brief Read calibration byte at given index. + * + * This function reads one calibration byte from the Calibration signature row. + * + * \param index Index of the byte in the calibration signature row. + * + * \retval Calibration byte + */ +uint8_t SP_ReadCalibrationByte(uint8_t index); + +/*! \brief Read fuse byte from given index. + * + * This function reads the fuse byte at the given index. + * + * \param index Index of the fuse byte. + * + * \retval Fuse byte + */ +uint8_t SP_ReadFuseByte(uint8_t index); + +/*! \brief Write lock bits. + * + * This function changes the lock bits. + * + * \note It is only possible to change the lock bits to a higher security level. + * + * \param data The new value of the lock bits. + */ +void SP_WriteLockBits(uint8_t data); + +/*! \brief Read lock bits. + * + * This function reads the lock bits. + * + * \retval Lock bits + */ +uint8_t SP_ReadLockBits(void); + +/*! \brief Read user signature at given index. + * + * This function reads one byte from the user signature row. + * + * \param index Index of the byte in the user signature row. + * + * \retval User signature byte + */ +uint8_t SP_ReadUserSignatureByte(uint16_t index); + +/*! \brief Erase user signature row. + * + * This function erase the entire user signature row. + */ +void SP_EraseUserSignatureRow(void); + +/*! \brief Write user signature row. + * + * This function write the flash buffer in the user signature row. + */ +void SP_WriteUserSignatureRow(void); + +/*! \brief Erase entire application section. + * + * This function erases the entire application and application table section + * + * \note If the lock bits is set to not allow spm in the application or + * application table section the erase is not done. + */ +void SP_EraseApplicationSection(void); + +/*! \brief Erase page at byte address in application or application table section. + * + * This function erase one page given by the byte address. + * + * \param address Byte address for flash page. + */ +void SP_EraseApplicationPage(uint32_t address); + +/*! \brief Erase and write page buffer to application or application table section at byte address. + * + * This function does a combined erase and write to a flash page in the application + * or application table section. + * + * \param address Byte address for flash page. + */ +void SP_EraseWriteApplicationPage(uint32_t address); + +/*! \brief Write page buffer to application or application table section at byte address. + * + * This function writes the Flash page buffer to a page in the application or + * application table section given by the byte address. + * + * \note The page that is written to must be erased before it is written to. + * + * \param address Byte address for flash page. + */ +void SP_WriteApplicationPage(uint32_t address); + +/*! \brief Load one word into Flash page buffer. + * + * This function Loads one word into the Flash page buffer. + * + * \param address Position in inside the flash page buffer. + * \param data Value to be put into the buffer. + */ +void SP_LoadFlashWord(uint16_t address, uint16_t data); + +/*! \brief Load entire page from SRAM buffer into Flash page buffer. + * + * This function load an entire page from SRAM. + * + * \param data Pointer to the data to put in buffer. + * + * \note The __near keyword limits the pointer to two bytes which means that + * only data up to 64K (internal SRAM) can be used. + */ +void SP_LoadFlashPage(const uint8_t * data); + +/*! \brief Read entire Flash page into SRAM buffer. + * + * This function reads an entire flash page and puts it to SRAM. + * + * \param data Pointer to where to store the data. + * \param address Address to page to read from flash. + */ +void SP_ReadFlashPage(const uint8_t * data, uint32_t address); + +/*! \brief Flush Flash page buffer. + * + * This function flush the Flash page buffer. + */ +void SP_EraseFlashBuffer(void); + +/*! \brief Erase page at byte address in boot section. + * + * This function erase one page given by the byte address. + * + * \param address Byte address for flash page. + */ +void SP_EraseBootPage(uint32_t address); + +/*! \brief Erase and write page buffer to boot section at byte address. + * + * This function does a combined erase and write to a flash page in the boot + * section. + * + * \param address Byte address for flash page. + */ +void SP_EraseWriteBootPage(uint32_t address); + +/*! \brief Write page buffer to boot section at byte address. + * + * This function writes the Flash page buffer to a page in the boot section + * given by the byte address. + * + * \note The page that is written to must be erased before it is written to. + * + * \param address Byte address for flash page. + */ +void SP_WriteBootPage(uint32_t address); + +/*! \brief Generate CRC from application section. + * + * \retval 24-bit CRC value + */ +uint32_t SP_ApplicationCRC(void); + +/*! \brief Generate CRC from boot section. + * + * \retval 24-bit CRC value + */ +uint32_t SP_BootCRC(void); + +/*! \brief Lock SPM instruction. + * + * This function locks the SPM instruction, and will disable the use of + * SPM until the next reset occurs. + */ +void SP_LockSPM(void); + +/*! \brief Wait for SPM to finish. + * + * This routine waits for the SPM to finish and clears the command register. + */ +void SP_WaitForSPM(void); + +#endif /* SP_DRIVER_H */