diff options
28 files changed, 409 insertions, 247 deletions
diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 000000000..2d2abb1a4 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,58 @@ +kind: pipeline +name: Documentation (Arch) + +platform: + os: linux + arch: amd64 + +steps: +- name: Build Documentation + image: abcminiuser/docker-ci-avr8-toolchain:latest-arch + pull: always + commands: + - make --quiet -C Maintenance upgrade-doxygen + - make --quiet doxygen + +--- + +kind: pipeline +name: Build (Arch) + +platform: + os: linux + arch: amd64 + +steps: +- name: Build Tests + image: abcminiuser/docker-ci-avr8-toolchain:latest-arch + pull: always + commands: + - ln -s /bin/true /sbin/avr32-gcc + - make --quiet -C BuildTests all + +- name: Projects + image: abcminiuser/docker-ci-avr8-toolchain:latest-arch + commands: + - make --quiet all + +--- + +kind: pipeline +name: Build (Ubuntu) + +platform: + os: linux + arch: amd64 + +steps: +- name: Build Tests + image: abcminiuser/docker-ci-avr8-toolchain:latest-arch + pull: always + commands: + - ln -s /bin/true /sbin/avr32-gcc + - make --quiet -C BuildTests all + +- name: Projects + image: abcminiuser/docker-ci-avr8-toolchain:latest-arch + commands: + - make --quiet all diff --git a/Bootloaders/Printer/BootloaderPrinter.c b/Bootloaders/Printer/BootloaderPrinter.c index 629cc07b4..94521ef16 100644 --- a/Bootloaders/Printer/BootloaderPrinter.c +++ b/Bootloaders/Printer/BootloaderPrinter.c @@ -67,7 +67,7 @@ USB_ClassInfo_PRNT_Device_t TextOnly_Printer_Interface = /** Intel HEX parser state machine state information, to track the contents of * a HEX file streamed in as a sequence of arbitrary bytes. */ -struct +static struct { /** Current HEX parser state machine state. */ uint8_t ParserState; @@ -87,11 +87,11 @@ struct /** Checksum of the current record received so far. */ uint8_t Checksum; /** Starting address of the last addressed FLASH page. */ - uint32_t PageStartAddress; + flashaddr_t PageStartAddress; /** Current 32-bit byte extended base address in FLASH being targeted. */ - uint32_t CurrBaseAddress; + flashaddr_t CurrBaseAddress; /** Current 32-bit byte address in FLASH being targeted. */ - uint32_t CurrAddress; + flashaddr_t CurrAddress; } HEXParser; /** Indicates if there is data waiting to be written to a physical page of diff --git a/Bootloaders/Printer/BootloaderPrinter.h b/Bootloaders/Printer/BootloaderPrinter.h index 78f938c68..c927ec5ef 100644 --- a/Bootloaders/Printer/BootloaderPrinter.h +++ b/Bootloaders/Printer/BootloaderPrinter.h @@ -74,6 +74,13 @@ /** Magic bootloader key to unlock forced application start mode. */ #define MAGIC_BOOT_KEY 0xDC42 + /* Type Defines: */ + #if (FLASHEND > 0xFFFF) + typedef uint32_t flashaddr_t; + #else + typedef uint16_t flashaddr_t; + #endif + /* Enums: */ /** Intel HEX parser state machine states. */ enum HEX_Parser_States_t diff --git a/Bootloaders/makefile b/Bootloaders/makefile index 33e1396fd..1942df61c 100644 --- a/Bootloaders/makefile +++ b/Bootloaders/makefile @@ -22,20 +22,9 @@ ifeq ($(MAKELEVEL), 10) $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) endif -# Need to special-case building without a per-project object directory -ifeq ($(OBJDIR),) - # If no target specified, force "clean all" and disallow parallel build - ifeq ($(MAKECMDGOALS),) - MAKECMDGOALS := clean all - .NOTPARALLEL: - endif - - # If one of the targets is to build, force "clean" beforehand and disallow parallel build - ifneq ($(findstring all, $(MAKECMDGOALS)),) - MAKECMDGOALS := clean $(MAKECMDGOALS) - .NOTPARALLEL: - endif -endif +# Build each directory sequentially, even if we are building using multiple +# cores within each project +.NOTPARALLEL: %: $(PROJECT_DIRECTORIES) @echo . > /dev/null diff --git a/BuildTests/StaticAnalysisTest/makefile b/BuildTests/StaticAnalysisTest/makefile index 9e65e8a3c..c56f1e684 100644 --- a/BuildTests/StaticAnalysisTest/makefile +++ b/BuildTests/StaticAnalysisTest/makefile @@ -13,14 +13,15 @@ LUFA_PATH := ../../LUFA/ CPPCHECK_EXCLUDES := FATFs/ \ PetiteFATFs/ \ - uip/ + uip/ \ + HID/HostLoaderApp/ CPPCHECK_INCLUDES := $(patsubst %/,%,$(LUFA_PATH))/CodeTemplates/ \ $(patsubst %/,%,$(LUFA_PATH))/../Projects/AVRISP-MKII/ CPPCHECK_FLAGS := -U TEMPLATE_FUNC_NAME -U __GNUC__ -U __DOXYGEN__ -CPPCHECK_SUPPRESS := variableScope missingInclude unusedFunction +CPPCHECK_SUPPRESS := variableScope missingInclude noValidConfiguration unusedFunction redundantAssignment SRC := $(patsubst %/,%,$(LUFA_PATH))/.. diff --git a/Demos/Device/ClassDriver/CCID/HostTestApp/test_generic_ccid_libusb.js b/Demos/Device/ClassDriver/CCID/HostTestApp/test_generic_ccid_libusb.js new file mode 100644 index 000000000..69cd1c28d --- /dev/null +++ b/Demos/Device/ClassDriver/CCID/HostTestApp/test_generic_ccid_libusb.js @@ -0,0 +1,202 @@ +#!/usr/bin/env node + +// LUFA Library +// Copyright (C) Dean Camera, 2018. +// +// dean [at] fourwalledcubicle [dot] com +// +// www.lufa-lib.org + +// Copyright 2018 Filipe Rodrigues (filipepazrodrigues [at] gmail [dot] com) +// +// LUFA Generic CCID device demo host test script. This script test multiple +// kinds of CCID messages and shows the result to the console +// +// You have to install the usb and async modules prior to executing this script: +// apt-get install libusb-1.0-0-dev +// npm install usb async sprintf + +var usb = require('usb'); +var async = require('async'); +var sprintf = require('sprintf'); + +var deviceVid = 0x03EB; +var devicePid = 0x206E; + +var CCID_PC_to_RDR_SetParameters = 0x61; +var CCID_PC_to_RDR_GetParameters = 0x6C; +var CCID_PC_to_RDR_IccPowerOn = 0x62; +var CCID_PC_to_RDR_IccPowerOff = 0x63; +var CCID_PC_to_RDR_GetSlotStatus = 0x65; +var CCID_PC_to_RDR_XfrBlock = 0x6f; + +function getAndInitCcidDeviceAndInterface() +{ + device = usb.findByIds(deviceVid, devicePid); + if (!device) { + console.log('No device found'); + process.exit(1); + } + device.open(); + + var ccidInterface = device.interface(0); + if (ccidInterface.isKernelDriverActive()) { + ccidInterface.detachKernelDriver(); + } + ccidInterface.claim(); + + return {ccidDevice:device, ccidInterface:ccidInterface}; +} + +function read(ccidInterface, responseSize, callback) +{ + inEndpoint = ccidInterface.endpoints[0]; + inEndpoint.transfer(responseSize, function(error, data) { + if (error) { + console.log(error) + } else { + console.log("Received data:", data); + } + callback(); + }); +} + +function write(ccidInterface, message, callback) +{ + outEndpoint = ccidInterface.endpoints[1] + outEndpoint.transfer( // Send a Set Report control request + message, // message to be sent + function(error) { // callback to be executed upon finishing the transfer + callback(); + } + ); +} + +//CCID functions + +function GetParametersMessage(slot, seq, protocolNum, t0Params) +{ + return [ + CCID_PC_to_RDR_GetParameters, //message type + 0, 0, 0, 0, //length + slot, + seq, + 0, 0, 0 //RFU + ]; +} + +function SetParametersMessage(slot, seq, protocolNum, t0Params) +{ + return [ + CCID_PC_to_RDR_SetParameters, //message type + t0Params.length, 0, 0, 0, //length + slot, + seq, + protocolNum, + 0, 0 //RFU + ].concat(t0Params); +} + + +function IccPowerOnMessage(slot, seq) +{ + return [ + CCID_PC_to_RDR_IccPowerOn, //message type + 0, 0, 0, 0, //length + slot, + seq, + 0, //power select: automatic + 0, 0 //RFU + ]; +} + +function IccPowerOffMessage(slot, seq) +{ + return [ + CCID_PC_to_RDR_IccPowerOff, //message type + 0, 0, 0, 0, //length + slot, + seq, + 0, 0, 0 //RFU + ]; +} + +function GetSlotStatusMessage(slot, seq) +{ + return [ + CCID_PC_to_RDR_GetSlotStatus, //message type + 0, 0, 0, 0, //length + slot, + seq, + 0, 0, 0 //RFU + ]; +} + +function XfrBlockMessage(slot, seq, apdu) +{ + return [ + CCID_PC_to_RDR_XfrBlock, //message type + apdu.length, 0, 0, 0, //length: only for < 0xFF + slot, + seq, + 0, //BWI + 0, 0 //level parameter + ].concat(apdu); + +} + +function testCcidMessages() +{ + return [ + function(callback) { + write(ccidInterface, new Buffer(IccPowerOnMessage(0, 1)), callback); + }, + function(callback) { + read(ccidInterface, 10 + 17, callback); + }, + function(callback) { + write(ccidInterface, new Buffer(IccPowerOffMessage(0, 2)), callback); + }, + function(callback) { + read(ccidInterface, 10, callback); + }, + function(callback) { + write(ccidInterface, new Buffer(GetSlotStatusMessage(0, 3)), callback); + }, + function(callback) { + read(ccidInterface, 10, callback); + }, + function(callback) { + write(ccidInterface, new Buffer(SetParametersMessage(0, 4, 0, [0x11, 0x00, 0x00, 0x0a, 0x00])), callback); + }, + function(callback) { + //must return 82 05 00 00 00 00 04 00 80 00 11 00 00 0a 00 + read(ccidInterface, 30, callback); + }, + function(callback) { + write(ccidInterface, new Buffer(GetParametersMessage(0, 5, 0)), callback); + }, + function(callback) { + //must return 82 05 00 00 00 00 04 00 80 00 11 00 00 0a 00 + read(ccidInterface, 30, callback); + }]; +} + +function startTest() +{ + async.series([] + .concat(testCcidMessages()) + ); +} + +var ccidDeviceAndInterface = getAndInitCcidDeviceAndInterface(); +var ccidDevice = ccidDeviceAndInterface.ccidDevice +var ccidInterface = ccidDeviceAndInterface.ccidInterface; + +console.log(sprintf("Connected to device 0x%04X/0x%04X - %s [%s]", + ccidDevice.deviceDescriptor.idVendor, + ccidDevice.deviceDescriptor.idProduct, + ccidDevice.deviceDescriptor.iProduct, + ccidDevice.deviceDescriptor.iManufacturer)); + +startTest(); diff --git a/Demos/Device/ClassDriver/makefile b/Demos/Device/ClassDriver/makefile index 77ed7069e..e582bd790 100644 --- a/Demos/Device/ClassDriver/makefile +++ b/Demos/Device/ClassDriver/makefile @@ -22,20 +22,9 @@ ifeq ($(MAKELEVEL), 10) $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) endif -# Need to special-case building without a per-project object directory -ifeq ($(OBJDIR),) - # If no target specified, force "clean all" and disallow parallel build - ifeq ($(MAKECMDGOALS),) - MAKECMDGOALS := clean all - .NOTPARALLEL: - endif - - # If one of the targets is to build, force "clean" beforehand and disallow parallel build - ifneq ($(findstring all, $(MAKECMDGOALS)),) - MAKECMDGOALS := clean $(MAKECMDGOALS) - .NOTPARALLEL: - endif -endif +# Build each directory sequentially, even if we are building using multiple +# cores within each project +.NOTPARALLEL: %: $(PROJECT_DIRECTORIES) @echo . > /dev/null diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c index 44849fbff..6fcab3b7d 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c +++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c @@ -54,8 +54,8 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, DHCP_Header_t* DHCPHeaderIN = (DHCP_Header_t*)DHCPHeaderInStart; DHCP_Header_t* DHCPHeaderOUT = (DHCP_Header_t*)DHCPHeaderOutStart; - uint8_t* DHCPOptionsINStart = (uint8_t*)(DHCPHeaderInStart + sizeof(DHCP_Header_t)); - uint8_t* DHCPOptionsOUTStart = (uint8_t*)(DHCPHeaderOutStart + sizeof(DHCP_Header_t)); + uint8_t* DHCPOptionsINStart = ((uint8_t*)DHCPHeaderInStart + sizeof(DHCP_Header_t)); + uint8_t* DHCPOptionsOUTStart = ((uint8_t*)DHCPHeaderOutStart + sizeof(DHCP_Header_t)); DecodeDHCPHeader(DHCPHeaderInStart); diff --git a/Demos/Device/LowLevel/makefile b/Demos/Device/LowLevel/makefile index 77ed7069e..e582bd790 100644 --- a/Demos/Device/LowLevel/makefile +++ b/Demos/Device/LowLevel/makefile @@ -22,20 +22,9 @@ ifeq ($(MAKELEVEL), 10) $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) endif -# Need to special-case building without a per-project object directory -ifeq ($(OBJDIR),) - # If no target specified, force "clean all" and disallow parallel build - ifeq ($(MAKECMDGOALS),) - MAKECMDGOALS := clean all - .NOTPARALLEL: - endif - - # If one of the targets is to build, force "clean" beforehand and disallow parallel build - ifneq ($(findstring all, $(MAKECMDGOALS)),) - MAKECMDGOALS := clean $(MAKECMDGOALS) - .NOTPARALLEL: - endif -endif +# Build each directory sequentially, even if we are building using multiple +# cores within each project +.NOTPARALLEL: %: $(PROJECT_DIRECTORIES) @echo . > /dev/null diff --git a/Demos/DualRole/ClassDriver/makefile b/Demos/DualRole/ClassDriver/makefile index b33ecf28b..b8e5e2a34 100644 --- a/Demos/DualRole/ClassDriver/makefile +++ b/Demos/DualRole/ClassDriver/makefile @@ -22,20 +22,9 @@ ifeq ($(MAKELEVEL), 10) $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) endif -# Need to special-case building without a per-project object directory -ifeq ($(OBJDIR),) - # If no target specified, force "clean all" and disallow parallel build - ifeq ($(MAKECMDGOALS),) - MAKECMDGOALS := clean all - .NOTPARALLEL: - endif - - # If one of the targets is to build, force "clean" beforehand and disallow parallel build - ifneq ($(findstring all, $(MAKECMDGOALS)),) - MAKECMDGOALS := clean $(MAKECMDGOALS) - .NOTPARALLEL: - endif -endif +# Build each directory sequentially, even if we are building using multiple +# cores within each project +.NOTPARALLEL: %: $(PROJECT_DIRECTORIES) @echo . > /dev/null diff --git a/Demos/Host/ClassDriver/makefile b/Demos/Host/ClassDriver/makefile index bbe50239f..566baed42 100644 --- a/Demos/Host/ClassDriver/makefile +++ b/Demos/Host/ClassDriver/makefile @@ -22,20 +22,9 @@ ifeq ($(MAKELEVEL), 10) $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) endif -# Need to special-case building without a per-project object directory -ifeq ($(OBJDIR),) - # If no target specified, force "clean all" and disallow parallel build - ifeq ($(MAKECMDGOALS),) - MAKECMDGOALS := clean all - .NOTPARALLEL: - endif - - # If one of the targets is to build, force "clean" beforehand and disallow parallel build - ifneq ($(findstring all, $(MAKECMDGOALS)),) - MAKECMDGOALS := clean $(MAKECMDGOALS) - .NOTPARALLEL: - endif -endif +# Build each directory sequentially, even if we are building using multiple +# cores within each project +.NOTPARALLEL: %: $(PROJECT_DIRECTORIES) @echo . > /dev/null diff --git a/Demos/Host/LowLevel/makefile b/Demos/Host/LowLevel/makefile index bbe50239f..566baed42 100644 --- a/Demos/Host/LowLevel/makefile +++ b/Demos/Host/LowLevel/makefile @@ -22,20 +22,9 @@ ifeq ($(MAKELEVEL), 10) $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) endif -# Need to special-case building without a per-project object directory -ifeq ($(OBJDIR),) - # If no target specified, force "clean all" and disallow parallel build - ifeq ($(MAKECMDGOALS),) - MAKECMDGOALS := clean all - .NOTPARALLEL: - endif - - # If one of the targets is to build, force "clean" beforehand and disallow parallel build - ifneq ($(findstring all, $(MAKECMDGOALS)),) - MAKECMDGOALS := clean $(MAKECMDGOALS) - .NOTPARALLEL: - endif -endif +# Build each directory sequentially, even if we are building using multiple +# cores within each project +.NOTPARALLEL: %: $(PROJECT_DIRECTORIES) @echo . > /dev/null diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index 228e236aa..4f2ae7732 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -15,8 +15,12 @@ * - Added Microsoft OS Compatibility descriptors to the RNDIS demos for driverless install on Windows 7 and newer * * <b>Changed:</b> + * - Core: * - Moved the functional descriptor types DTYPE_CSInterface and DTYPE_CSEndpoint to their respective CDC and Audio class * drivers, as they are class-defined rather than general descriptor types. + * - Reduced compiled size of the Endpoint_Discard_Stream() and Endpoint_Null_Stream() functions. + * - Library Applications: + * - Updated Printer class bootloader to not store 32-bit HEX parser flash offsets on small flash devices. * * <b>Fixed:</b> * - Core: @@ -27,10 +31,13 @@ * - Fixed CDC_Device_Send*_P() and CDC_Host_Send*_P() variant functions not compiled out for UC3 architecture * - Fixed USB_STRING_DESCRIPTOR_ARRAY() not accepting more than two byte long arrays * - Fixed HID report parser corruption when parsing PUSH and POP report item elements + * - Fixed HID report parser incorrectly decoding 32-bit USAGE elements * - Library Applications: * - Fixed bootloaders not disabling global interrupts during erase and write operations (thanks to Zoltan) * - Fixed bootloaders accepting flash writes to the bootloader region (thanks to NicoHood) * - Fixed bootloaders incorrectly checking the BOOTRST fuse on start (thanks to Braden Kell) + * - Fixed void pointer arithmetic in the low level RNDIS demo protocol decoders + * - Fixed invalid DHCP server socket creation in the Webserver project * * \section Sec_ChangeLog170418 Version 170418 * <b>New:</b> @@ -46,19 +53,22 @@ * in a user application (thanks to Matlo) * - Fixed missing \c va_end() calls in the HID bootloader CLI app which could cause portability issues * - Fixed void pointer arithmetic in the \c Serial_SendData() functions for AVR8 and XMEGA architectures - * - Fixed void pointer arithmetic in the low level and class driver RNDIS demo protocol decoders - * - Fixed low level RNDIS demo incorrectly setting the RNDIS state when a null packet filter was requested - * - Fixed missing entries in several project's Atmel Studio integration files, such as driver INF files * - Fixed invalid endpoint indexes causing memory corruption in device Clear/Set Feature standard requests (thanks to Peter Popovec) * - Fixed incorrect serialization in USB_SetHIDReportItemInfo() function (thanks to e-chip) + * - Library Applications: + * - Fixed low level RNDIS demo incorrectly setting the RNDIS state when a null packet filter was requested + * - Fixed void pointer arithmetic in the low level and class driver RNDIS demo protocol decoders + * - Fixed missing entries in several project's Atmel Studio integration files, such as driver INF files * * <b>Changed:</b> - * - Added signed alternative libUSB driver for the AVRISP-MKII clone project, to support Atmel Studio 7 (thanks to Atmel) - * - Removed no longer required LIBUSB_DRIVER_COMPAT and RESET_TOGGLES_LIBUSB_COMPAT configuration options from the AVRISP-MKII - * clone project, as the new libUSB driver works for AVRDUDE and Atmel Studio 7 under Windows + * - Core: * - Replaced the LUFA build system with its (compatible) successor, DMBS (Dean's Makefile Build System) * - Removed obsolete library TAR export and associated documentation * - Fixed incorrect HID_DESCRIPTOR_KEYBOARD() macro definition (thanks to Eric Tang) + * - Library Applications: + * - Added signed alternative libUSB driver for the AVRISP-MKII clone project, to support Atmel Studio 7 (thanks to Atmel) + * - Removed no longer required LIBUSB_DRIVER_COMPAT and RESET_TOGGLES_LIBUSB_COMPAT configuration options from the AVRISP-MKII + * clone project, as the new libUSB driver works for AVRDUDE and Atmel Studio 7 under Windows * * \section Sec_ChangeLog151115 Version 151115 * <b>New:</b> diff --git a/LUFA/Drivers/USB/Class/Common/HIDParser.c b/LUFA/Drivers/USB/Class/Common/HIDParser.c index 87eaf7c67..08f894e6b 100644 --- a/LUFA/Drivers/USB/Class/Common/HIDParser.c +++ b/LUFA/Drivers/USB/Class/Common/HIDParser.c @@ -105,9 +105,6 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, 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; @@ -178,6 +175,9 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, if (UsageListSize == HID_USAGE_STACK_DEPTH) return HID_PARSE_UsageListOverflow; + if ((HIDReportItem & HID_RI_DATA_SIZE_MASK) == HID_RI_DATA_BITS_32) + CurrStateTable->Attributes.Usage.Page = (ReportItemData >> 16); + UsageList[UsageListSize++] = ReportItemData; break; diff --git a/LUFA/Drivers/USB/Class/Device/CCIDClassDevice.h b/LUFA/Drivers/USB/Class/Device/CCIDClassDevice.h index e29ccef08..562ad3b5f 100644 --- a/LUFA/Drivers/USB/Class/Device/CCIDClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/CCIDClassDevice.h @@ -147,8 +147,8 @@ * Retrieves the current status of a given slot * * \param[in,out] CCIDInterfaceInfo Pointer to a structure containing a CCID Class configuration and state. - * \param[in] slot The slot ID from which we want to retrieve the status. - * \param[out] error The result of the operation, or error. + * \param[in] Slot The slot ID from which we want to retrieve the status. + * \param[out] Error The result of the operation, or error. * * \return The command result code. */ @@ -178,6 +178,7 @@ * \param[in,out] CCIDInterfaceInfo Pointer to a structure containing a CCID Class configuration, state and protocol data. * \param[in] Slot The slot ID from which we want to retrieve the status. * \param[out] Error The result of the operation, or error. + * \param[out] ProtocolNum The CCID protocol ID of the parameter being retrieved. * \param[out] T0 Pointer to a buffer where the parameters will be returned * * \return The command result code. diff --git a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h index 2e327ef22..69dcff3d6 100644 --- a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h @@ -216,43 +216,43 @@ 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 from PROGMEM space 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. - * - * \note This function does not exist on architectures that do not have a separate flash memory space. - * - * \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. - */ #if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + /** Sends a given null terminated string from PROGMEM space 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. + * + * \note This function does not exist on architectures that do not have a separate flash memory space. + * + * \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_P(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo, const char* const String) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); #endif - /** Sends a given data buffer from PROGMEM space 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. - * - * \note This function does not exist on architectures that do not have a separate flash memory space. - * - * \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. - */ #if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + /** Sends a given data buffer from PROGMEM space 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. + * + * \note This function does not exist on architectures that do not have a separate flash memory space. + * + * \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_P(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); diff --git a/LUFA/Drivers/USB/Class/Host/CDCClassHost.h b/LUFA/Drivers/USB/Class/Host/CDCClassHost.h index 306bf23d1..da557733f 100644 --- a/LUFA/Drivers/USB/Class/Host/CDCClassHost.h +++ b/LUFA/Drivers/USB/Class/Host/CDCClassHost.h @@ -217,43 +217,43 @@ const void* const Buffer, const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); - /** Sends a given null terminated string from PROGMEM space to the attached USB device, if connected. If a device is not connected - * when the function is called, the string is discarded. Bytes will be queued for transmission to the device until either - * the pipe bank becomes full, or the \ref CDC_Host_Flush() function is called to flush the pending data to - * the device. This allows for multiple bytes to be packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or - * the call will fail. - * - * \note This function does not exist on architectures that do not have a separate flash memory space. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. - * \param[in] String Pointer to the null terminated string to send to the host. - * - * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. - */ #if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + /** Sends a given null terminated string from PROGMEM space to the attached USB device, if connected. If a device is not connected + * when the function is called, the string is discarded. Bytes will be queued for transmission to the device until either + * the pipe bank becomes full, or the \ref CDC_Host_Flush() function is called to flush the pending data to + * the device. This allows for multiple bytes to be packed into a single pipe packet, increasing data throughput. + * + * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or + * the call will fail. + * + * \note This function does not exist on architectures that do not have a separate flash memory space. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host configuration and state. + * \param[in] String Pointer to the null terminated string to send to the host. + * + * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum. + */ uint8_t CDC_Host_SendString_P(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const char* const String) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2); #endif - /** Sends a given data buffer from PROGMEM space to the attached USB device, if connected. If a device is not connected when the - * function is called, the string is discarded. Bytes will be queued for transmission to the host until either the pipe - * bank becomes full, or the \ref CDC_Host_Flush() function is called to flush the pending data to the device. This allows - * for multiple bytes to be packed into a single pipe packet, increasing data throughput. - * - * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or - * the call will fail. - * - * \note This function does not exist on architectures that do not have a separate flash memory space. - * - * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host 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 Pipe_Stream_RW_ErrorCodes_t enum. - */ #if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) + /** Sends a given data buffer from PROGMEM space to the attached USB device, if connected. If a device is not connected when the + * function is called, the string is discarded. Bytes will be queued for transmission to the host until either the pipe + * bank becomes full, or the \ref CDC_Host_Flush() function is called to flush the pending data to the device. This allows + * for multiple bytes to be packed into a single pipe packet, increasing data throughput. + * + * \pre This function must only be called when the Host state machine is in the \ref HOST_STATE_Configured state or + * the call will fail. + * + * \note This function does not exist on architectures that do not have a separate flash memory space. + * + * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class host 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 Pipe_Stream_RW_ErrorCodes_t enum. + */ uint8_t CDC_Host_SendData_P(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo, const void* const Buffer, const uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); diff --git a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c index 0364c60f1..bf6fee42a 100644 --- a/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c +++ b/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c @@ -43,15 +43,12 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length, uint16_t* const BytesProcessed) { uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; + uint16_t BytesInTransfer = BytesProcessed ? *BytesProcessed : 0; if ((ErrorCode = Endpoint_WaitUntilReady())) return ErrorCode; - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) + while (BytesInTransfer < Length) { if (!(Endpoint_IsReadWriteAllowed())) { @@ -59,7 +56,7 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length, if (BytesProcessed != NULL) { - *BytesProcessed += BytesInTransfer; + *BytesProcessed = BytesInTransfer; return ENDPOINT_RWSTREAM_IncompleteTransfer; } @@ -69,8 +66,6 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length, else { Endpoint_Discard_8(); - - Length--; BytesInTransfer++; } } @@ -82,15 +77,12 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, uint16_t* const BytesProcessed) { uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; + uint16_t BytesInTransfer = BytesProcessed ? *BytesProcessed : 0; if ((ErrorCode = Endpoint_WaitUntilReady())) return ErrorCode; - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) + while (BytesInTransfer < Length) { if (!(Endpoint_IsReadWriteAllowed())) { @@ -98,7 +90,7 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, if (BytesProcessed != NULL) { - *BytesProcessed += BytesInTransfer; + *BytesProcessed = BytesInTransfer; return ENDPOINT_RWSTREAM_IncompleteTransfer; } @@ -108,8 +100,6 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, else { Endpoint_Write_8(0); - - Length--; BytesInTransfer++; } } diff --git a/LUFA/Drivers/USB/Core/Events.c b/LUFA/Drivers/USB/Core/Events.c index df21f5045..1aeb98eda 100644 --- a/LUFA/Drivers/USB/Core/Events.c +++ b/LUFA/Drivers/USB/Core/Events.c @@ -39,10 +39,13 @@ void USB_Event_Stub(void) void USB_Event_Stub_2(const uint8_t _1) { + (void)_1; USB_Event_Stub(); } void USB_Event_Stub_3(const uint8_t _1, const uint8_t _2) { + (void)_1; + (void)_2; USB_Event_Stub(); } diff --git a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c index 214edd733..5a6131f1f 100644 --- a/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c +++ b/LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c @@ -43,15 +43,12 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length, uint16_t* const BytesProcessed) { uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; + uint16_t BytesInTransfer = BytesProcessed ? *BytesProcessed : 0; if ((ErrorCode = Endpoint_WaitUntilReady())) return ErrorCode; - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) + while (BytesInTransfer < Length) { if (!(Endpoint_IsReadWriteAllowed())) { @@ -59,7 +56,7 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length, if (BytesProcessed != NULL) { - *BytesProcessed += BytesInTransfer; + *BytesProcessed = BytesInTransfer; return ENDPOINT_RWSTREAM_IncompleteTransfer; } @@ -69,8 +66,6 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length, else { Endpoint_Discard_8(); - - Length--; BytesInTransfer++; } } @@ -82,15 +77,12 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, uint16_t* const BytesProcessed) { uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; + uint16_t BytesInTransfer = BytesProcessed ? *BytesProcessed : 0; if ((ErrorCode = Endpoint_WaitUntilReady())) return ErrorCode; - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) + while (BytesInTransfer < Length) { if (!(Endpoint_IsReadWriteAllowed())) { @@ -98,7 +90,7 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, if (BytesProcessed != NULL) { - *BytesProcessed += BytesInTransfer; + *BytesProcessed = BytesInTransfer; return ENDPOINT_RWSTREAM_IncompleteTransfer; } @@ -108,8 +100,6 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, else { Endpoint_Write_8(0); - - Length--; BytesInTransfer++; } } diff --git a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c index a24f624ab..e8ee7e645 100644 --- a/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c +++ b/LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c @@ -43,15 +43,12 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length, uint16_t* const BytesProcessed) { uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; + uint16_t BytesInTransfer = BytesProcessed ? *BytesProcessed : 0; if ((ErrorCode = Endpoint_WaitUntilReady())) return ErrorCode; - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) + while (BytesInTransfer < Length) { if (!(Endpoint_IsReadWriteAllowed())) { @@ -59,7 +56,7 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length, if (BytesProcessed != NULL) { - *BytesProcessed += BytesInTransfer; + *BytesProcessed = BytesInTransfer; return ENDPOINT_RWSTREAM_IncompleteTransfer; } @@ -69,8 +66,6 @@ uint8_t Endpoint_Discard_Stream(uint16_t Length, else { Endpoint_Discard_8(); - - Length--; BytesInTransfer++; } } @@ -82,15 +77,12 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, uint16_t* const BytesProcessed) { uint8_t ErrorCode; - uint16_t BytesInTransfer = 0; + uint16_t BytesInTransfer = BytesProcessed ? *BytesProcessed : 0; if ((ErrorCode = Endpoint_WaitUntilReady())) return ErrorCode; - if (BytesProcessed != NULL) - Length -= *BytesProcessed; - - while (Length) + while (BytesInTransfer < Length) { if (!(Endpoint_IsReadWriteAllowed())) { @@ -98,7 +90,7 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, if (BytesProcessed != NULL) { - *BytesProcessed += BytesInTransfer; + *BytesProcessed = BytesInTransfer; return ENDPOINT_RWSTREAM_IncompleteTransfer; } @@ -108,8 +100,6 @@ uint8_t Endpoint_Null_Stream(uint16_t Length, else { Endpoint_Write_8(0); - - Length--; BytesInTransfer++; } } diff --git a/LUFA/Version.h b/LUFA/Version.h index 37203506c..37a79442d 100644 --- a/LUFA/Version.h +++ b/LUFA/Version.h @@ -61,7 +61,7 @@ #define LUFA_VERSION_STRING "170418" /** Indicates the release type of the library. */ - #define LUFA_VERSION_RELEASE_TYPE LUFA_VERSION_RELEASE_TYPE_FULL + #define LUFA_VERSION_RELEASE_TYPE LUFA_VERSION_RELEASE_TYPE_DEVELOPMENT #endif diff --git a/Maintenance/makefile b/Maintenance/makefile index 3fbc9df45..76d6b35a5 100644 --- a/Maintenance/makefile +++ b/Maintenance/makefile @@ -14,10 +14,6 @@ LUFA_ROOT := ../ all: -# Print a list of all filenames and line numbers that exceed an allowed threshold -line-lengths: - awk '{ if (length > 120) { print FILENAME, ":", FNR, "[", length, "]" } }' `find $(LUFA_ROOT) -name *.[ch]` - # Generate a header containing all library functions function-list: $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT))/LUFA doxygen DOXYGEN_OVERRIDE_PARAMS="GENERATE_HTML=no GENERATE_XML=yes" @@ -69,7 +65,7 @@ bootloaders: rm -f BuildMakefile # Check the working branch documentation, ensure no placeholder values -check-documentation-placeholders: +check-release: @echo Checking for release suitability... @if ( grep " LUFA_VERSION_RELEASE_TYPE " $(patsubst %/,%,$(LUFA_ROOT))/LUFA/Version.h | grep "LUFA_VERSION_RELEASE_TYPE_DEVELOPMENT" > /dev/null ;); then \ echo " ERROR: Version header has not been updated for release!"; \ @@ -79,16 +75,7 @@ check-documentation-placeholders: echo " ERROR: Doxygen documentation has not been updated for release!"; \ exit 1; \ fi; - @echo Done. - -# Validate the working branch - compile all documentation, demos/projects/examples and run build tests -validate-branch: - $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT)) doxygen - $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT)) all DEBUG_LEVEL=0 - $(MAKE) -C $(patsubst %/,%,$(LUFA_ROOT))/BuildTests all - -# Validate the working branch for general release, check for placeholder documentation then build and test everything -validate-release: check-documentation-placeholders validate-branch + @echo Done. -.PHONY: all upgrade-doxygen bootloaders check-documentation-placeholders validate-branch +.PHONY: all function-list upgrade-doxygen bootloaders check-release diff --git a/Projects/LEDNotifier/LEDNotifier.c b/Projects/LEDNotifier/LEDNotifier.c index cfad0c288..f252b3dbe 100644 --- a/Projects/LEDNotifier/LEDNotifier.c +++ b/Projects/LEDNotifier/LEDNotifier.c @@ -134,6 +134,7 @@ int main(void) if (Channel & (1 << 7)) SoftPWM_Channel3_Duty = Duty; + // cppcheck-suppress IOWithoutPositioning fputc(ColourUpdate, &USBSerialStream); CDC_Device_USBTask(&VirtualSerial_CDC_Interface); diff --git a/Projects/Webserver/Lib/DHCPServerApp.c b/Projects/Webserver/Lib/DHCPServerApp.c index 22bd6ac01..49bbde4d3 100644 --- a/Projects/Webserver/Lib/DHCPServerApp.c +++ b/Projects/Webserver/Lib/DHCPServerApp.c @@ -50,7 +50,7 @@ void DHCPServerApp_Init(void) uip_listen(HTONS(DHCP_SERVER_PORT)); /* Create a new UDP connection to the DHCP server port for the DHCP solicitation */ - struct uip_udp_conn* BroadcastConnection = uip_udp_new(&uip_broadcast_addr, HTONS(DHCP_CLIENT_PORT)); + BroadcastConnection = uip_udp_new(&uip_broadcast_addr, HTONS(DHCP_CLIENT_PORT)); /* If the connection was successfully created, bind it to the local DHCP client port */ if (BroadcastConnection != NULL) diff --git a/Projects/XPLAINBridge/makefile b/Projects/XPLAINBridge/makefile index 92344e585..0bcf77729 100644 --- a/Projects/XPLAINBridge/makefile +++ b/Projects/XPLAINBridge/makefile @@ -36,7 +36,7 @@ all: # identical OBJDIR directory, we need to enforce the use of this project's object file # directory as the one where the build object files are to be stored, by giving it a # path relative to the current folder. -OBJDIR := ./obj +OBJDIR := ./xpb-obj # Include LUFA-specific DMBS extension modules DMBS_LUFA_PATH ?= $(LUFA_PATH)/Build/LUFA diff --git a/Projects/makefile b/Projects/makefile index 992dff860..3f5cd5719 100644 --- a/Projects/makefile +++ b/Projects/makefile @@ -22,20 +22,9 @@ ifeq ($(MAKELEVEL), 10) $(error EMERGENCY ABORT: INFINITE RECURSION DETECTED) endif -# Need to special-case building without a per-project object directory -ifeq ($(OBJDIR),) - # If no target specified, force "clean all" and disallow parallel build - ifeq ($(MAKECMDGOALS),) - MAKECMDGOALS := clean all - .NOTPARALLEL: - endif - - # If one of the targets is to build, force "clean" beforehand and disallow parallel build - ifneq ($(findstring all, $(MAKECMDGOALS)),) - MAKECMDGOALS := clean $(MAKECMDGOALS) - .NOTPARALLEL: - endif -endif +# Build each directory sequentially, even if we are building using multiple +# cores within each project +.NOTPARALLEL: %: $(PROJECT_DIRECTORIES) @echo . > /dev/null @@ -9,7 +9,6 @@ # Makefile to build the LUFA library, projects and demos. # Call with "make all" to rebuild everything, "make clean" to clean everything, -# "make mostlyclean" to remove all intermediary files but preserve any binaries, # "make doxygen" to document everything with Doxygen (if installed). Call # "make help" for additional target build information within a specific project. |