Merge pull request #142 from jacobseptember/master
authorDean Camera <dean@fourwalledcubicle.com>
Tue, 8 Jan 2019 08:26:54 +0000 (19:26 +1100)
committerGitHub <noreply@github.com>
Tue, 8 Jan 2019 08:26:54 +0000 (19:26 +1100)
Add support for RC calibration in AVRISP-MKII.

28 files changed:
.drone.yml [new file with mode: 0644]
Bootloaders/Printer/BootloaderPrinter.c
Bootloaders/Printer/BootloaderPrinter.h
Bootloaders/makefile
BuildTests/StaticAnalysisTest/makefile
Demos/Device/ClassDriver/CCID/HostTestApp/test_generic_ccid_libusb.js [new file with mode: 0644]
Demos/Device/ClassDriver/makefile
Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c
Demos/Device/LowLevel/makefile
Demos/DualRole/ClassDriver/makefile
Demos/Host/ClassDriver/makefile
Demos/Host/LowLevel/makefile
LUFA/DoxygenPages/ChangeLog.txt
LUFA/Drivers/USB/Class/Common/HIDParser.c
LUFA/Drivers/USB/Class/Device/CCIDClassDevice.h
LUFA/Drivers/USB/Class/Device/CDCClassDevice.h
LUFA/Drivers/USB/Class/Host/CDCClassHost.h
LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c
LUFA/Drivers/USB/Core/Events.c
LUFA/Drivers/USB/Core/UC3/EndpointStream_UC3.c
LUFA/Drivers/USB/Core/XMEGA/EndpointStream_XMEGA.c
LUFA/Version.h
Maintenance/makefile
Projects/LEDNotifier/LEDNotifier.c
Projects/Webserver/Lib/DHCPServerApp.c
Projects/XPLAINBridge/makefile
Projects/makefile
makefile

diff --git a/.drone.yml b/.drone.yml
new file mode 100644 (file)
index 0000000..2d2abb1
--- /dev/null
@@ -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
index 629cc07..94521ef 100644 (file)
@@ -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
index 78f938c..c927ec5 100644 (file)
                /** 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
index 33e1396..1942df6 100644 (file)
@@ -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
index 9e65e8a..c56f1e6 100644 (file)
@@ -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 (file)
index 0000000..69cd1c2
--- /dev/null
@@ -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();
index 77ed706..e582bd7 100644 (file)
@@ -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
index 44849fb..6fcab3b 100644 (file)
@@ -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);
 
index 77ed706..e582bd7 100644 (file)
@@ -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
index b33ecf2..b8e5e2a 100644 (file)
@@ -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
index bbe5023..566baed 100644 (file)
@@ -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
index bbe5023..566baed 100644 (file)
@@ -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
index 228e236..4f2ae77 100644 (file)
   *   - 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:
   *   - 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>
   *     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>
index 87eaf7c..08f894e 100644 (file)
@@ -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;
 
index e29ccef..562ad3b 100644 (file)
                         *  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.
                         */
                         *  \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.
index 2e327ef..69dcff3 100644 (file)
                                                    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);
index 306bf23..da55773 100644 (file)
                                                  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);
index 0364c60..bf6fee4 100644 (file)
@@ -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++;
                }
        }
index df21f50..1aeb98e 100644 (file)
@@ -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();
 }
index 214edd7..5a6131f 100644 (file)
@@ -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++;
                }
        }
index a24f624..e8ee7e6 100644 (file)
@@ -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++;
                }
        }
index 3720350..37a7944 100644 (file)
@@ -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
 
index 3fbc9df..76d6b35 100644 (file)
@@ -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
index cfad0c2..f252b3d 100644 (file)
@@ -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);
index 22bd6ac..49bbde4 100644 (file)
@@ -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)
index 92344e5..0bcf777 100644 (file)
@@ -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
index 992dff8..3f5cd57 100644 (file)
@@ -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
index db8279d..1080f76 100644 (file)
--- a/makefile
+++ b/makefile
@@ -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.