From cf4575b94a3c65e6535a159fc71fc885aebc2620 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 2 Aug 2019 14:02:40 -0700 Subject: Fix the LUFA lib to use a submodule instead of just files (#6245) * Remove LUFA files * Update descriptions for newer version of LUFA * Create PR6245.md * Fix CDC(Serial) type errors * Fix missed merge conflict for AUDIO_DTYPE_CSInterface --- .../LowLevel/RNDISEthernet/Config/AppConfig.h | 60 - .../LowLevel/RNDISEthernet/Config/LUFAConfig.h | 126 - .../Device/LowLevel/RNDISEthernet/Descriptors.c | 244 -- .../Device/LowLevel/RNDISEthernet/Descriptors.h | 112 - .../Device/LowLevel/RNDISEthernet/LUFA RNDIS.inf | 59 - .../Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c | 87 - .../Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h | 78 - .../Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c | 129 -- .../Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h | 131 -- .../Device/LowLevel/RNDISEthernet/Lib/Ethernet.c | 136 -- .../Device/LowLevel/RNDISEthernet/Lib/Ethernet.h | 111 - .../LowLevel/RNDISEthernet/Lib/EthernetProtocols.h | 88 - .../Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c | 81 - .../Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h | 82 - .../Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c | 113 - .../Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h | 92 - .../LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c | 276 --- .../LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h | 60 - .../Device/LowLevel/RNDISEthernet/Lib/RNDIS.c | 394 ---- .../Device/LowLevel/RNDISEthernet/Lib/RNDIS.h | 67 - .../Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c | 631 ------ .../Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h | 260 --- .../Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c | 84 - .../Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h | 73 - .../Device/LowLevel/RNDISEthernet/Lib/Webserver.c | 203 -- .../Device/LowLevel/RNDISEthernet/Lib/Webserver.h | 57 - .../Device/LowLevel/RNDISEthernet/RNDISEthernet.c | 294 --- .../Device/LowLevel/RNDISEthernet/RNDISEthernet.h | 87 - .../LowLevel/RNDISEthernet/RNDISEthernet.txt | 146 -- .../Demos/Device/LowLevel/RNDISEthernet/asf.xml | 86 - .../Demos/Device/LowLevel/RNDISEthernet/doxyfile | 2395 -------------------- .../Demos/Device/LowLevel/RNDISEthernet/makefile | 44 - 32 files changed, 6886 deletions(-) delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/LUFA RNDIS.inf delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/IP.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/RNDIS.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/TCP.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/UDP.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Webserver.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.txt delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/asf.xml delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/doxyfile delete mode 100644 lib/lufa/Demos/Device/LowLevel/RNDISEthernet/makefile (limited to 'lib/lufa/Demos/Device/LowLevel/RNDISEthernet') diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h deleted file mode 100644 index 0e4d1780a9..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/AppConfig.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 Application Configuration Header File - * - * This is a header file which is be used to configure some of - * the application's compile time options, as an alternative to - * specifying the compile time constants supplied through a - * makefile or build system. - * - * For information on what each token does, refer to the - * \ref Sec_Options section of the application documentation. - */ - -#ifndef _APP_CONFIG_H_ -#define _APP_CONFIG_H_ - - #define CLIENT_IP_ADDRESS { 10, 0, 0, 1} - #define SERVER_IP_ADDRESS { 10, 0, 0, 2} - - #define ADAPTER_MAC_ADDRESS {0x02, 0x00, 0x02, 0x00, 0x02, 0x00} - #define SERVER_MAC_ADDRESS {0x00, 0x01, 0x00, 0x01, 0x00, 0x01} - - #define NO_DECODE_ETHERNET - #define NO_DECODE_ARP - #define NO_DECODE_IP - #define NO_DECODE_ICMP - #define NO_DECODE_TCP - #define NO_DECODE_UDP - #define NO_DECODE_DHCP - -#endif diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h deleted file mode 100644 index cc828a108d..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Config/LUFAConfig.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 LUFA Library Configuration Header File - * - * This header file is used to configure LUFA's compile time options, - * as an alternative to the compile time constants supplied through - * a makefile. - * - * For information on what each token does, refer to the LUFA - * manual section "Summary of Compile Tokens". - */ - -#ifndef _LUFA_CONFIG_H_ -#define _LUFA_CONFIG_H_ - - #if (ARCH == ARCH_AVR8) - - /* Non-USB Related Configuration Tokens: */ -// #define DISABLE_TERMINAL_CODES - - /* USB Class Driver Related Tokens: */ -// #define HID_HOST_BOOT_PROTOCOL_ONLY -// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} -// #define HID_USAGE_STACK_DEPTH {Insert Value Here} -// #define HID_MAX_COLLECTIONS {Insert Value Here} -// #define HID_MAX_REPORTITEMS {Insert Value Here} -// #define HID_MAX_REPORT_IDS {Insert Value Here} -// #define NO_CLASS_DRIVER_AUTOFLUSH - - /* General USB Driver Related Tokens: */ -// #define ORDERED_EP_CONFIG - #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL) - #define USB_DEVICE_ONLY -// #define USB_HOST_ONLY -// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} -// #define NO_LIMITED_CONTROLLER_CONNECT -// #define NO_SOF_EVENTS - - /* USB Device Mode Driver Related Tokens: */ -// #define USE_RAM_DESCRIPTORS - #define USE_FLASH_DESCRIPTORS -// #define USE_EEPROM_DESCRIPTORS -// #define NO_INTERNAL_SERIAL - #define FIXED_CONTROL_ENDPOINT_SIZE 8 -// #define DEVICE_STATE_AS_GPIOR {Insert Value Here} - #define FIXED_NUM_CONFIGURATIONS 1 -// #define CONTROL_ONLY_DEVICE -// #define INTERRUPT_CONTROL_ENDPOINT -// #define NO_DEVICE_REMOTE_WAKEUP -// #define NO_DEVICE_SELF_POWER - - /* USB Host Mode Driver Related Tokens: */ -// #define HOST_STATE_AS_GPIOR {Insert Value Here} -// #define USB_HOST_TIMEOUT_MS {Insert Value Here} -// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here} -// #define NO_AUTO_VBUS_MANAGEMENT -// #define INVERTED_VBUS_ENABLE_LINE - - #elif (ARCH == ARCH_XMEGA) - - /* Non-USB Related Configuration Tokens: */ -// #define DISABLE_TERMINAL_CODES - - /* USB Class Driver Related Tokens: */ -// #define HID_HOST_BOOT_PROTOCOL_ONLY -// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here} -// #define HID_USAGE_STACK_DEPTH {Insert Value Here} -// #define HID_MAX_COLLECTIONS {Insert Value Here} -// #define HID_MAX_REPORTITEMS {Insert Value Here} -// #define HID_MAX_REPORT_IDS {Insert Value Here} -// #define NO_CLASS_DRIVER_AUTOFLUSH - - /* General USB Driver Related Tokens: */ - #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_RC32MCLKSRC | USB_OPT_BUSEVENT_PRIHIGH) -// #define USB_STREAM_TIMEOUT_MS {Insert Value Here} -// #define NO_LIMITED_CONTROLLER_CONNECT -// #define NO_SOF_EVENTS - - /* USB Device Mode Driver Related Tokens: */ -// #define USE_RAM_DESCRIPTORS - #define USE_FLASH_DESCRIPTORS -// #define USE_EEPROM_DESCRIPTORS -// #define NO_INTERNAL_SERIAL - #define FIXED_CONTROL_ENDPOINT_SIZE 8 -// #define DEVICE_STATE_AS_GPIOR {Insert Value Here} - #define FIXED_NUM_CONFIGURATIONS 1 -// #define CONTROL_ONLY_DEVICE - #define MAX_ENDPOINT_INDEX 3 -// #define NO_DEVICE_REMOTE_WAKEUP -// #define NO_DEVICE_SELF_POWER - - #else - - #error Unsupported architecture for this LUFA configuration file. - - #endif -#endif diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c deleted file mode 100644 index e42b318602..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * USB Device Descriptors, for library use when in USB device mode. Descriptors are special - * computer-readable structures which the host requests upon device enumeration, to determine - * the device's capabilities and functions. - */ - -#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 PROGMEM 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 = 0x204C, - .ReleaseNumber = VERSION_BCD(0,0,1), - - .ManufacturerStrIndex = STRING_ID_Manufacturer, - .ProductStrIndex = STRING_ID_Product, - .SerialNumStrIndex = NO_DESCRIPTOR, - - .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 PROGMEM 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(100) - }, - - .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_VendorSpecificProtocol, - - .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 = 0x00, - }, - - .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 - }, - - .RNDIS_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 - }, - - .RNDIS_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 PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARRAY(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 PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera"); - -/** 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 PROGMEM ProductString = USB_STRING_DESCRIPTOR(L"LUFA RNDIS CDC Demo"); - -/** 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 uint16_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 STRING_ID_Language: - Address = &LanguageString; - Size = pgm_read_byte(&LanguageString.Header.Size); - break; - case STRING_ID_Manufacturer: - Address = &ManufacturerString; - Size = pgm_read_byte(&ManufacturerString.Header.Size); - break; - case STRING_ID_Product: - Address = &ProductString; - Size = pgm_read_byte(&ProductString.Header.Size); - break; - } - - break; - } - - *DescriptorAddress = Address; - return Size; -} - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h deleted file mode 100644 index 84c336f169..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Descriptors.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * Header file for Descriptors.c. - */ - -#ifndef _DESCRIPTORS_H_ -#define _DESCRIPTORS_H_ - - /* Includes: */ - #include - - #include - - #include "Config/AppConfig.h" - - /* Macros: */ - /** Endpoint address of the CDC device-to-host data IN endpoint. */ - #define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 1) - - /** Endpoint address of the CDC host-to-device data OUT endpoint. */ - #define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 2) - - /** Endpoint address of the CDC device-to-host notification IN endpoint. */ - #define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 3) - - /** Size in bytes of the CDC data IN and OUT endpoints. */ - #define CDC_TXRX_EPSIZE 64 - - /** Size in bytes of the CDC device-to-host notification IN endpoint. */ - #define CDC_NOTIFICATION_EPSIZE 8 - - /* Type Defines: */ - /** Type define for the device configuration descriptor structure. This must be defined in the - * application code, as the configuration descriptor contains several sub-descriptors which - * vary between devices, and which describe the device's usage to the host. - */ - typedef struct - { - USB_Descriptor_Configuration_Header_t Config; - - // RNDIS 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; - - // RNDIS CDC Data Interface - USB_Descriptor_Interface_t CDC_DCI_Interface; - USB_Descriptor_Endpoint_t RNDIS_DataOutEndpoint; - USB_Descriptor_Endpoint_t RNDIS_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 uint16_t wIndex, - const void** const DescriptorAddress) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); - -#endif - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/LUFA RNDIS.inf b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/LUFA RNDIS.inf deleted file mode 100644 index f34e55f995..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/LUFA RNDIS.inf +++ /dev/null @@ -1,59 +0,0 @@ -; Windows LUFA RNDIS Setup File -; Copyright (c) 2000 Microsoft Corporation - -[DefaultInstall] -CopyINF="LUFA RNDIS.inf" - -[Version] -Signature="$Windows NT$" -Class=Net -ClassGuid={4d36e972-e325-11ce-bfc1-08002be10318} -Provider=%MFGNAME% -DriverVer=7/1/2012,10.0.0.0 - -[Manufacturer] -%MFGNAME%=DeviceList, NTx86, NTamd64, NTia64 - -[ControlFlags] -ExcludeFromSelect=* - -[DriverInstall] -Characteristics=0x84 ; NCF_PHYSICAL + NCF_HAS_UI -BusType=15 -include=netrndis.inf -needs=Usb_Rndis.ndi -AddReg=Rndis_AddReg_Vista - -[DriverInstall.Services] -include=netrndis.inf -needs=Usb_Rndis.ndi.Services - -;------------------------------------------------------------------------------ -; Vendor and Product ID Definitions -;------------------------------------------------------------------------------ -; When developing your USB device, the VID and PID used in the PC side -; application program and the firmware on the microcontroller must match. -; Modify the below line to use your VID and PID. Use the format as shown below. -; Note: One INF file can be used for multiple devices with different VID and PIDs. -; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line. -;------------------------------------------------------------------------------ -[DeviceList] -%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204C - -[DeviceList.NTx86] -%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204C - -[DeviceList.NTamd64] -%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204C - -[DeviceList.NTia64] -%DESCRIPTION%=DriverInstall, USB\VID_03EB&PID_204C - -;------------------------------------------------------------------------------ -; String Definitions -;------------------------------------------------------------------------------ -;Modify these strings to customize your device -;------------------------------------------------------------------------------ -[Strings] -MFGNAME="http://www.lufa-lib.org" -DESCRIPTION="LUFA USB RNDIS Demo" diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c deleted file mode 100644 index 24008705c1..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * Address Resolution Protocol (ARP) packet handling routines. This protocol handles the - * conversion of physical MAC addresses to protocol IP addresses between the host and the - * device. - */ - -#include "ARP.h" - -/** Processes an ARP packet inside an Ethernet frame, and writes the appropriate response - * to the output Ethernet frame if the host is requesting the IP or MAC address of the - * virtual server device on the network. - * - * \param[in] InDataStart Pointer to the start of the incoming packet's ARP header - * \param[out] OutDataStart Pointer to the start of the outgoing packet's ARP header - * - * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise - */ -int16_t ARP_ProcessARPPacket(void* InDataStart, - void* OutDataStart) -{ - DecodeARPHeader(InDataStart); - - ARP_Header_t* ARPHeaderIN = (ARP_Header_t*)InDataStart; - ARP_Header_t* ARPHeaderOUT = (ARP_Header_t*)OutDataStart; - - /* Ensure that the ARP request is a IPv4 request packet */ - if ((SwapEndian_16(ARPHeaderIN->ProtocolType) == ETHERTYPE_IPV4) && - (SwapEndian_16(ARPHeaderIN->Operation) == ARP_OPERATION_REQUEST)) - { - /* If the ARP packet is requesting the MAC or IP of the virtual webserver, return the response */ - if (IP_COMPARE(&ARPHeaderIN->TPA, &ServerIPAddress) || - MAC_COMPARE(&ARPHeaderIN->THA, &ServerMACAddress)) - { - /* Fill out the ARP response header */ - ARPHeaderOUT->HardwareType = ARPHeaderIN->HardwareType; - ARPHeaderOUT->ProtocolType = ARPHeaderIN->ProtocolType; - ARPHeaderOUT->HLEN = ARPHeaderIN->HLEN; - ARPHeaderOUT->PLEN = ARPHeaderIN->PLEN; - ARPHeaderOUT->Operation = SwapEndian_16(ARP_OPERATION_REPLY); - - /* Copy over the sender MAC/IP to the target fields for the response */ - ARPHeaderOUT->THA = ARPHeaderIN->SHA; - ARPHeaderOUT->TPA = ARPHeaderIN->SPA; - - /* Copy over the new sender MAC/IP - MAC and IP addresses of the virtual webserver */ - ARPHeaderOUT->SHA = ServerMACAddress; - ARPHeaderOUT->SPA = ServerIPAddress; - - /* Return the size of the response so far */ - return sizeof(ARP_Header_t); - } - } - - return NO_RESPONSE; -} - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h deleted file mode 100644 index c809cbf44a..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ARP.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * Header file for ARP.c. - */ - -#ifndef _ARP_H_ -#define _ARP_H_ - - /* Includes: */ - #include - #include - - #include - - #include "EthernetProtocols.h" - #include "Ethernet.h" - #include "ProtocolDecoders.h" - - /* Macros: */ - /** ARP header operation constant, indicating a request from a host for an address translation. */ - #define ARP_OPERATION_REQUEST 1 - - /** ARP header operation constant, indicating a reply from a host giving an address translation. */ - #define ARP_OPERATION_REPLY 2 - - /* Type Defines: */ - /** Type define for an ARP packet inside an Ethernet frame. */ - typedef struct - { - uint16_t HardwareType; /**< Hardware type constant, indicating the hardware used */ - uint16_t ProtocolType; /**< Protocol being resolved, usually ETHERTYPE_IPV4 */ - - uint8_t HLEN; /**< Length in bytes of the source/destination hardware addresses */ - uint8_t PLEN; /**< Length in bytes of the source/destination protocol addresses */ - uint16_t Operation; /**< Type of operation, either ARP_OPERATION_REQUEST or ARP_OPERATION_REPLY */ - - MAC_Address_t SHA; /**< Sender's hardware address */ - IP_Address_t SPA; /**< Sender's protocol address */ - MAC_Address_t THA; /**< Target's hardware address */ - IP_Address_t TPA; /**< Target's protocol address */ - } ARP_Header_t; - - /* Function Prototypes: */ - int16_t ARP_ProcessARPPacket(void* InDataStart, - void* OutDataStart); - -#endif - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c deleted file mode 100644 index 6f7b40af69..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * Dynamic Host Configuration Protocol (DHCP) packet handling routines. This protocol - * handles the automatic IP negotiation to the host, so that the host will use the provided - * IP address given to it by the device. - */ - -#include "DHCP.h" - -/** Processes a DHCP packet inside an Ethernet frame, and writes the appropriate response - * to the output Ethernet frame if the host is requesting or accepting an IP address. - * - * \param[in] IPHeaderInStart Pointer to the start of the incoming packet's IP header - * \param[in] DHCPHeaderInStart Pointer to the start of the incoming packet's DHCP header - * \param[out] DHCPHeaderOutStart Pointer to the start of the outgoing packet's DHCP header - * - * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise - */ -int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, - void* DHCPHeaderInStart, - void* DHCPHeaderOutStart) -{ - IP_Header_t* IPHeaderIN = (IP_Header_t*)IPHeaderInStart; - DHCP_Header_t* DHCPHeaderIN = (DHCP_Header_t*)DHCPHeaderInStart; - DHCP_Header_t* DHCPHeaderOUT = (DHCP_Header_t*)DHCPHeaderOutStart; - - uint8_t* DHCPOptionsINStart = (uint8_t*)(DHCPHeaderInStart + sizeof(DHCP_Header_t)); - uint8_t* DHCPOptionsOUTStart = (uint8_t*)(DHCPHeaderOutStart + sizeof(DHCP_Header_t)); - - DecodeDHCPHeader(DHCPHeaderInStart); - - /* Zero out the response DHCP packet, as much of it is legacy and left at 0 */ - memset(DHCPHeaderOUT, 0, sizeof(DHCP_Header_t)); - - /* Fill out the response DHCP packet */ - DHCPHeaderOUT->HardwareType = DHCPHeaderIN->HardwareType; - DHCPHeaderOUT->Operation = DHCP_OP_BOOTREPLY; - DHCPHeaderOUT->HardwareAddressLength = DHCPHeaderIN->HardwareAddressLength; - DHCPHeaderOUT->Hops = 0; - DHCPHeaderOUT->TransactionID = DHCPHeaderIN->TransactionID; - DHCPHeaderOUT->ElapsedSeconds = 0; - DHCPHeaderOUT->Flags = DHCPHeaderIN->Flags; - DHCPHeaderOUT->YourIP = ClientIPAddress; - memmove(&DHCPHeaderOUT->ClientHardwareAddress, &DHCPHeaderIN->ClientHardwareAddress, sizeof(MAC_Address_t)); - DHCPHeaderOUT->Cookie = SwapEndian_32(DHCP_MAGIC_COOKIE); - - /* Alter the incoming IP packet header so that the corrected IP source and destinations are used - this means that - when the response IP header is generated, it will use the corrected addresses and not the null/broatcast addresses */ - IPHeaderIN->SourceAddress = ClientIPAddress; - IPHeaderIN->DestinationAddress = ServerIPAddress; - - /* Process the incoming DHCP packet options */ - while (DHCPOptionsINStart[0] != DHCP_OPTION_END) - { - /* Find the Message Type DHCP option, to determine the type of DHCP packet */ - if (DHCPOptionsINStart[0] == DHCP_OPTION_MESSAGETYPE) - { - if ((DHCPOptionsINStart[2] == DHCP_MESSAGETYPE_DISCOVER) || (DHCPOptionsINStart[2] == DHCP_MESSAGETYPE_REQUEST)) - { - /* Fill out the response DHCP packet options for a DHCP OFFER or ACK response */ - - *(DHCPOptionsOUTStart++) = DHCP_OPTION_MESSAGETYPE; - *(DHCPOptionsOUTStart++) = 1; - *(DHCPOptionsOUTStart++) = (DHCPOptionsINStart[2] == DHCP_MESSAGETYPE_DISCOVER) ? DHCP_MESSAGETYPE_OFFER - : DHCP_MESSAGETYPE_ACK; - - *(DHCPOptionsOUTStart++) = DHCP_OPTION_SUBNETMASK; - *(DHCPOptionsOUTStart++) = sizeof(IP_Address_t); - *(DHCPOptionsOUTStart++) = 0xFF; - *(DHCPOptionsOUTStart++) = 0xFF; - *(DHCPOptionsOUTStart++) = 0xFF; - *(DHCPOptionsOUTStart++) = 0x00; - - *(DHCPOptionsOUTStart++) = DHCP_OPTION_LEASETIME; - *(DHCPOptionsOUTStart++) = sizeof(uint32_t); - /* Lease Time 86400s (ONE_DAY) */ - *(DHCPOptionsOUTStart++) = 0x00; - *(DHCPOptionsOUTStart++) = 0x01; - *(DHCPOptionsOUTStart++) = 0x51; - *(DHCPOptionsOUTStart++) = 0x80; - - *(DHCPOptionsOUTStart++) = DHCP_OPTION_DHCPSERVER; - *(DHCPOptionsOUTStart++) = sizeof(IP_Address_t); - memcpy(DHCPOptionsOUTStart, &ServerIPAddress, sizeof(IP_Address_t)); - DHCPOptionsOUTStart += sizeof(IP_Address_t); - - *(DHCPOptionsOUTStart++) = DHCP_OPTION_END; - - return (sizeof(DHCP_Header_t) + 18 + sizeof(IP_Address_t)); - } - } - - /* Go to the next DHCP option - skip one byte if option is a padding byte, else skip the complete option's size */ - DHCPOptionsINStart += ((DHCPOptionsINStart[0] == DHCP_OPTION_PAD) ? 1 : (DHCPOptionsINStart[1] + 2)); - } - - return NO_RESPONSE; -} - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h deleted file mode 100644 index 5ef78469ec..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/DHCP.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * Header file for DHCP.c. - */ - -#ifndef _DHCP_H_ -#define _DHCP_H_ - - /* Includes: */ - #include - #include - - #include "EthernetProtocols.h" - #include "Ethernet.h" - #include "ProtocolDecoders.h" - - /* Macros: */ - /** DHCP operation constant, indicating a request from a host to a DHCP server. */ - #define DHCP_OP_BOOTREQUEST 0x01 - - /** DHCP operation constant, indicating a reply from a DHCP server to a host. */ - #define DHCP_OP_BOOTREPLY 0x02 - - /** Hardware type constant, indicating Ethernet as a carrier. */ - #define DHCP_HTYPE_ETHERNET 0x01 - - /** Magic boot protocol "cookie", inserted into all BOOTP packets (BOOTP is the carrier of DHCP). */ - #define DHCP_MAGIC_COOKIE 0x63825363 - - /** DHCP option list entry header, indicating that a subnet mask will follow. */ - #define DHCP_OPTION_SUBNETMASK 1 - - /** DHCP option list entry header, indicating that the Lease Time will follow. */ - #define DHCP_OPTION_LEASETIME 51 - - /** DHCP option list entry header, indicating that the DHCP message type constant will follow. */ - #define DHCP_OPTION_MESSAGETYPE 53 - - /** DHCP option list entry header, indicating that the IP address of the DHCP server will follow. */ - #define DHCP_OPTION_DHCPSERVER 54 - - /** DHCP option list entry header, used to pad out option data. */ - #define DHCP_OPTION_PAD 0 - - /** DHCP option list entry header, indicating the end of option data. */ - #define DHCP_OPTION_END 255 - - /** Message type constant, used in the DHCP option data field, requesting that a DHCP server offer an IP address. */ - #define DHCP_MESSAGETYPE_DISCOVER 1 - - /** Message type constant, used in the DHCP option data field, indicating that a DHCP server is offering an IP address. */ - #define DHCP_MESSAGETYPE_OFFER 2 - - /** Message type constant, used in the DHCP option data field, requesting that a DHCP server lease a given IP address. */ - #define DHCP_MESSAGETYPE_REQUEST 3 - - /** Message type constant, used in the DHCP option data field, declining an offered DHCP server IP address lease. */ - #define DHCP_MESSAGETYPE_DECLINE 4 - - /** Message type constant, used in the DHCP option data field, ACKing a host IP lease request. */ - #define DHCP_MESSAGETYPE_ACK 5 - - /** Message type constant, used in the DHCP option data field, NACKing a host IP lease request. */ - #define DHCP_MESSAGETYPE_NACK 6 - - /** Message type constant, used in the DHCP option data field, indicating that a host is releasing a leased IP address. */ - #define DHCP_MESSAGETYPE_RELEASE 7 - - /* Type Defines: */ - /** Type define for a DHCP packet inside an Ethernet frame. */ - typedef struct - { - uint8_t Operation; /**< DHCP operation, either DHCP_OP_BOOTREQUEST or DHCP_OP_BOOTREPLY */ - uint8_t HardwareType; /**< Hardware carrier type constant */ - uint8_t HardwareAddressLength; /**< Length in bytes of a hardware (MAC) address on the network */ - uint8_t Hops; /**< Number of hops required to reach the server, unused */ - - uint32_t TransactionID; /**< Unique ID of the DHCP packet, for positive matching between sent and received packets */ - - uint16_t ElapsedSeconds; /**< Elapsed seconds since the request was made */ - uint16_t Flags; /**< BOOTP packet flags */ - - IP_Address_t ClientIP; /**< Client IP address, if already leased an IP */ - IP_Address_t YourIP; /**< Client IP address */ - IP_Address_t NextServerIP; /**< Legacy BOOTP protocol field, unused for DHCP */ - IP_Address_t RelayAgentIP; /**< Legacy BOOTP protocol field, unused for DHCP */ - - uint8_t ClientHardwareAddress[16]; /**< Hardware (MAC) address of the client making a request to the DHCP server */ - uint8_t ServerHostnameString[64]; /**< Legacy BOOTP protocol field, unused for DHCP */ - uint8_t BootFileName[128]; /**< Legacy BOOTP protocol field, unused for DHCP */ - - uint32_t Cookie; /**< Magic BOOTP protocol cookie to indicate a valid packet */ - } DHCP_Header_t; - - /* Function Prototypes: */ - int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, - void* DHCPHeaderInStart, - void* DHCPHeaderOutStart); - -#endif - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c deleted file mode 100644 index a48de2c717..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * Ethernet frame packet handling routines. This protocol handles the processing of raw Ethernet - * frames sent and received, deferring the processing of sub-packet protocols to the appropriate - * protocol handlers, such as DHCP or ARP. - */ - -#include "Ethernet.h" - -/** Ethernet Frame buffer structure, to hold the incoming Ethernet frame from the host. */ -Ethernet_Frame_Info_t FrameIN; - -/** Ethernet Frame buffer structure, to hold the outgoing Ethernet frame to the host. */ -Ethernet_Frame_Info_t FrameOUT; - -/** Constant for convenience when checking against or setting a MAC address to the virtual server MAC address. */ -const MAC_Address_t ServerMACAddress = {SERVER_MAC_ADDRESS}; - -/** Constant for convenience when checking against or setting an IP address to the virtual server IP address. */ -const IP_Address_t ServerIPAddress = {SERVER_IP_ADDRESS}; - -/** Constant for convenience when checking against or setting a MAC address to the broadcast MAC address. */ -const MAC_Address_t BroadcastMACAddress = {BROADCAST_MAC_ADDRESS}; - -/** Constant for convenience when checking against or setting a IP address to the broadcast IP address. */ -const IP_Address_t BroadcastIPAddress = {BROADCAST_IP_ADDRESS}; - -/** Constant for convenience when checking against or setting an IP address to the client (host) IP address. */ -const IP_Address_t ClientIPAddress = {CLIENT_IP_ADDRESS}; - - -/** Processes an incoming Ethernet frame, and writes the appropriate response to the output Ethernet - * frame buffer if the sub protocol handlers create a valid response. - */ -void Ethernet_ProcessPacket(void) -{ - DecodeEthernetFrameHeader(FrameIN.FrameData); - - /* Cast the incoming Ethernet frame to the Ethernet header type */ - Ethernet_Frame_Header_t* FrameINHeader = (Ethernet_Frame_Header_t*)&FrameIN.FrameData; - Ethernet_Frame_Header_t* FrameOUTHeader = (Ethernet_Frame_Header_t*)&FrameOUT.FrameData; - - int16_t RetSize = NO_RESPONSE; - - /* Ensure frame is addressed to either all (broadcast) or the virtual webserver, and is a type II frame */ - if ((MAC_COMPARE(&FrameINHeader->Destination, &ServerMACAddress) || - MAC_COMPARE(&FrameINHeader->Destination, &BroadcastMACAddress)) && - (SwapEndian_16(FrameIN.FrameLength) > ETHERNET_VER2_MINSIZE)) - { - /* Process the packet depending on its protocol */ - switch (SwapEndian_16(FrameINHeader->EtherType)) - { - case ETHERTYPE_ARP: - RetSize = ARP_ProcessARPPacket(&FrameIN.FrameData[sizeof(Ethernet_Frame_Header_t)], - &FrameOUT.FrameData[sizeof(Ethernet_Frame_Header_t)]); - break; - case ETHERTYPE_IPV4: - RetSize = IP_ProcessIPPacket(&FrameIN.FrameData[sizeof(Ethernet_Frame_Header_t)], - &FrameOUT.FrameData[sizeof(Ethernet_Frame_Header_t)]); - break; - } - - /* Protocol processing routine has filled a response, complete the ethernet frame header */ - if (RetSize > 0) - { - /* Fill out the response Ethernet frame header */ - FrameOUTHeader->Source = ServerMACAddress; - FrameOUTHeader->Destination = FrameINHeader->Source; - FrameOUTHeader->EtherType = FrameINHeader->EtherType; - - /* Set the response length in the buffer and indicate that a response is ready to be sent */ - FrameOUT.FrameLength = (sizeof(Ethernet_Frame_Header_t) + RetSize); - } - } - - /* Check if the packet was processed */ - if (RetSize != NO_PROCESS) - { - /* Clear the frame buffer */ - FrameIN.FrameLength = 0; - } -} - -/** Calculates the appropriate ethernet checksum, consisting of the addition of the one's - * compliment of each word, complimented. - * - * \param[in] Data Pointer to the packet buffer data whose checksum must be calculated - * \param[in] Bytes Number of bytes in the data buffer to process - * - * \return A 16-bit Ethernet checksum value - */ -uint16_t Ethernet_Checksum16(void* Data, - uint16_t Bytes) -{ - uint16_t* Words = (uint16_t*)Data; - uint32_t Checksum = 0; - - for (uint16_t CurrWord = 0; CurrWord < (Bytes >> 1); CurrWord++) - Checksum += Words[CurrWord]; - - while (Checksum & 0xFFFF0000) - Checksum = ((Checksum & 0xFFFF) + (Checksum >> 16)); - - return ~Checksum; -} - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h deleted file mode 100644 index 8eaf64080b..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * Header file for Ethernet.c. - */ - -#ifndef _ETHERNET_H_ -#define _ETHERNET_H_ - - /* Includes: */ - #include - #include - - #include "Config/AppConfig.h" - - #include "EthernetProtocols.h" - #include "ProtocolDecoders.h" - #include "ICMP.h" - #include "TCP.h" - #include "UDP.h" - #include "DHCP.h" - #include "ARP.h" - #include "IP.h" - - /* Macros: */ - /** Physical MAC address of the network broadcast address. */ - #define BROADCAST_MAC_ADDRESS {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} - - /** Performs a comparison between two MAC addresses, indicating if they are identical. - * - * \param[in] MAC1 First MAC address - * \param[in] MAC2 Second MAC address - * - * \return True if the addresses match, \c false otherwise - */ - #define MAC_COMPARE(MAC1, MAC2) (memcmp(MAC1, MAC2, sizeof(MAC_Address_t)) == 0) - - /** Maximum size of an incoming or outgoing Ethernet frame in bytes. */ - #define ETHERNET_FRAME_SIZE_MAX 1500 - - /** Minimum size of an Ethernet packet in bytes, to conform to the Ethernet V2 packet standard. */ - #define ETHERNET_VER2_MINSIZE 0x0600 - - /** Return value for all sub protocol handling routines, indicating that no response packet has been generated. */ - #define NO_RESPONSE 0 - - /** Return value for all sub protocol handling routines, indicating that the packet has not yet been handled. */ - #define NO_PROCESS -1 - - /* Type Defines: */ - /** Type define for an Ethernet frame buffer data and information structure. */ - typedef struct - { - uint8_t FrameData[ETHERNET_FRAME_SIZE_MAX]; /**< Ethernet frame contents. */ - uint16_t FrameLength; /**< Length in bytes of the Ethernet frame stored in the buffer. */ - } Ethernet_Frame_Info_t; - - /** Type define for an Ethernet frame header. */ - typedef struct - { - MAC_Address_t Destination; /**< Physical MAC address of the packet recipient */ - MAC_Address_t Source; /**< Physics MAC address of the packet source */ - uint16_t EtherType; /**< Ethernet packet sub-protocol type, for Ethernet V2 packets */ - } Ethernet_Frame_Header_t; - - /* External Variables: */ - extern Ethernet_Frame_Info_t FrameIN; - extern Ethernet_Frame_Info_t FrameOUT; - - extern const MAC_Address_t ServerMACAddress; - extern const IP_Address_t ServerIPAddress; - extern const MAC_Address_t BroadcastMACAddress; - extern const IP_Address_t BroadcastIPAddress; - extern const IP_Address_t ClientIPAddress; - - /* Function Prototypes: */ - void Ethernet_ProcessPacket(void); - uint16_t Ethernet_Checksum16(void* Data, - uint16_t Bytes); - -#endif - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h deleted file mode 100644 index ca738cd0db..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/EthernetProtocols.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * General Ethernet protocol constants and type defines, for use by - * all network protocol portions of the TCP/IP stack. - */ - -#ifndef _ETHERNET_PROTOCOLS_H_ -#define _ETHERNET_PROTOCOLS_H_ - - /* Macros: */ - #define ETHERTYPE_IPV4 0x0800 - #define ETHERTYPE_ARP 0x0806 - #define ETHERTYPE_RARP 0x8035 - #define ETHERTYPE_APPLETALK 0x809b - #define ETHERTYPE_APPLETALKARP 0x80f3 - #define ETHERTYPE_IEEE8021Q 0x8100 - #define ETHERTYPE_NOVELLIPX 0x8137 - #define ETHERTYPE_NOVELL 0x8138 - #define ETHERTYPE_IPV6 0x86DD - #define ETHERTYPE_COBRANET 0x8819 - #define ETHERTYPE_PROVIDERBRIDGING 0x88a8 - #define ETHERTYPE_MPLSUNICAST 0x8847 - #define ETHERTYPE_MPLSMULTICAST 0x8848 - #define ETHERTYPE_PPPoEDISCOVERY 0x8863 - #define ETHERTYPE_PPPoESESSION 0x8864 - #define ETHERTYPE_EAPOVERLAN 0x888E - #define ETHERTYPE_HYPERSCSI 0x889A - #define ETHERTYPE_ATAOVERETHERNET 0x88A2 - #define ETHERTYPE_ETHERCAT 0x88A4 - #define ETHERTYPE_SERCOSIII 0x88CD - #define ETHERTYPE_CESoE 0x88D8 - #define ETHERTYPE_MACSECURITY 0x88E5 - #define ETHERTYPE_FIBRECHANNEL 0x8906 - #define ETHERTYPE_QINQ 0x9100 - #define ETHERTYPE_VLLT 0xCAFE - - #define PROTOCOL_ICMP 1 - #define PROTOCOL_IGMP 2 - #define PROTOCOL_TCP 6 - #define PROTOCOL_UDP 17 - #define PROTOCOL_OSPF 89 - #define PROTOCOL_SCTP 132 - - /* Type Defines: */ - /** 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 */ - } RNDIS_MAC_Address_t; - - /** Type define for a protocol IP address of a device on a network. */ - typedef struct - { - uint8_t Octets[4]; /**< Individual bytes of an IP address */ - } IP_Address_t; - -#endif - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c deleted file mode 100644 index b144c4c517..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. - - dean [at] fourwalledcubicle [dot] com - www.lufa-lib.org -*/ - -/* - Copyright 2017 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 - * - * Internet Control Message Protocol (ICMP) packet handling routines. This protocol handles - * Echo requests from the host, to indicate a successful network connection between the host - * and the virtual server. - */ - -#include "ICMP.h" - -/** Processes an ICMP packet inside an Ethernet frame, and writes the appropriate response - * to the output Ethernet frame if the host is issuing a ICMP ECHO request. - * - * \param[in] InDataStart Pointer to the start of the incoming packet's ICMP header - * \param[out] OutDataStart Pointer to the start of the outgoing packet's ICMP header - * - * \return The number of bytes written to the out Ethernet frame if any, NO_RESPONSE otherwise - */ -int16_t ICMP_ProcessICMPPacket(void* InDataStart, - void* OutDataStart) -{ - ICMP_Header_t* ICMPHeaderIN = (ICMP_Header_t*)InDataStart; - ICMP_Header_t* ICMPHeaderOUT = (ICMP_Header_t*)OutDataStart; - - DecodeICMPHeader(InDataStart); - - /* Determine if the ICMP packet is an echo request (ping) */ - if (ICMPHeaderIN->Type == ICMP_TYPE_ECHOREQUEST) - { - /* Fill out the ICMP response packet */ - ICMPHeaderOUT->Type = ICMP_TYPE_ECHOREPLY; - ICMPHeaderOUT->Code = 0; - ICMPHeaderOUT->Checksum = 0; - ICMPHeaderOUT->Id = ICMPHeaderIN->Id; - ICMPHeaderOUT->Sequence = ICMPHeaderIN->Sequence; - - intptr_t DataSize = FrameIN.FrameLength - ((((intptr_t)InDataStart + sizeof(ICMP_Header_t)) - (intptr_t)FrameIN.FrameData)); - - /* Copy the remaining payload to the response - echo requests should echo back any sent data */ - memmove(&((uint8_t*)OutDataStart)[sizeof(ICMP_Header_t)], - &((uint8_t*)InDataStart)[sizeof(ICMP_Header_t)], - DataSize); - - ICMPHeaderOUT->Checksum = Ethernet_Checksum16(ICMPHeaderOUT, (DataSize + sizeof(ICMP_Header_t))); - - /* Return the size of the response so far */ - return (DataSize + sizeof(ICMP_Header_t)); - } - - return NO_RESPONSE; -} - diff --git a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h b/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h deleted file mode 100644 index e8039da3e0..0000000000 --- a/lib/lufa/Demos/Device/LowLevel/RNDISEthernet/Lib/ICMP.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - LUFA Library - Copyright (C) Dean Camera, 2017. -