All USB class drivers are now automatically included when LUFA/Drivers/USB.h is included, and no longer need to be seperately included.
All LowLevel demos changed to use the constants and types defined in the USB class drivers.
This commit is contained in:
		
							parent
							
								
									8f3bee7d86
								
							
						
					
					
						commit
						b37d77eab3
					
				
					 208 changed files with 589 additions and 2910 deletions
				
			
		| 
						 | 
				
			
			@ -104,24 +104,24 @@ USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor =
 | 
			
		|||
 | 
			
		||||
	.CDC_Functional_Header =
 | 
			
		||||
		{
 | 
			
		||||
			.Header                 = {.Size = sizeof(USB_Descriptor_CDC_FunctionalHeader_t), .Type = DTYPE_CSInterface},
 | 
			
		||||
			.Subtype                = 0x00,
 | 
			
		||||
			.Header                 = {.Size = sizeof(USB_CDC_Descriptor_FunctionalHeader_t), .Type = DTYPE_CSInterface},
 | 
			
		||||
			.Subtype                = CDC_DSUBTYPE_CSInterface_Header,
 | 
			
		||||
 | 
			
		||||
			.CDCSpecification       = VERSION_BCD(01.10),
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
	.CDC_Functional_ACM =
 | 
			
		||||
		{
 | 
			
		||||
			.Header                 = {.Size = sizeof(USB_Descriptor_CDC_FunctionalACM_t), .Type = DTYPE_CSInterface},
 | 
			
		||||
			.Subtype                = 0x02,
 | 
			
		||||
			.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_Descriptor_CDC_FunctionalUnion_t), .Type = DTYPE_CSInterface},
 | 
			
		||||
			.Subtype                = 0x06,
 | 
			
		||||
			.Header                 = {.Size = sizeof(USB_CDC_Descriptor_FunctionalUnion_t), .Type = DTYPE_CSInterface},
 | 
			
		||||
			.Subtype                = CDC_DSUBTYPE_CSInterface_Union,
 | 
			
		||||
 | 
			
		||||
			.MasterInterfaceNumber  = 0,
 | 
			
		||||
			.SlaveInterfaceNumber   = 1,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,40 +58,6 @@
 | 
			
		|||
		#define CDC_NOTIFICATION_EPSIZE        8
 | 
			
		||||
 | 
			
		||||
	/* Type Defines: */
 | 
			
		||||
		/** Type define for a CDC class-specific functional header descriptor. This indicates to the host that the device
 | 
			
		||||
		 *  contains one or more CDC functional data descriptors, which give the CDC interface's capabilities and configuration.
 | 
			
		||||
		 *  See the CDC class specification for more details.
 | 
			
		||||
		 */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
 | 
			
		||||
			uint8_t                 Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
 | 
			
		||||
			uint16_t                CDCSpecification; /**< Version number of the CDC specification implemented by the device,
 | 
			
		||||
			                                           *   encoded in BCD format.
 | 
			
		||||
			                                           */
 | 
			
		||||
		} USB_Descriptor_CDC_FunctionalHeader_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a CDC class-specific functional ACM descriptor. This indicates to the host that the CDC interface
 | 
			
		||||
		 *  supports the CDC ACM subclass of the CDC specification. See the CDC class specification for more details.
 | 
			
		||||
		 */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
 | 
			
		||||
			uint8_t                 Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
 | 
			
		||||
			uint8_t                 Capabilities; /**< Capabilities of the ACM interface, given as a bit mask. */
 | 
			
		||||
		} USB_Descriptor_CDC_FunctionalACM_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a CDC class-specific functional Union descriptor. This indicates to the host that specific
 | 
			
		||||
		 *  CDC control and data interfaces are related. See the CDC class specification for more details.
 | 
			
		||||
		 */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length. */
 | 
			
		||||
			uint8_t                 Subtype; /**< Sub type value used to distinguish between CDC class-specific descriptors. */
 | 
			
		||||
			uint8_t                 MasterInterfaceNumber; /**< Interface number of the CDC Control interface. */
 | 
			
		||||
			uint8_t                 SlaveInterfaceNumber; /**< Interface number of the CDC Data interface. */
 | 
			
		||||
		} USB_Descriptor_CDC_FunctionalUnion_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for the device configuration descriptor structure. This must be defined in the
 | 
			
		||||
		 *  application code, as the configuration descriptor contains several sub-descriptors which
 | 
			
		||||
		 *  vary between devices, and which describe the device's usage to the host.
 | 
			
		||||
| 
						 | 
				
			
			@ -100,9 +66,9 @@
 | 
			
		|||
		{
 | 
			
		||||
			USB_Descriptor_Configuration_Header_t    Config;
 | 
			
		||||
			USB_Descriptor_Interface_t               CDC_CCI_Interface;
 | 
			
		||||
			USB_Descriptor_CDC_FunctionalHeader_t    CDC_Functional_Header;
 | 
			
		||||
			USB_Descriptor_CDC_FunctionalACM_t       CDC_Functional_ACM;
 | 
			
		||||
			USB_Descriptor_CDC_FunctionalUnion_t     CDC_Functional_Union;
 | 
			
		||||
			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;
 | 
			
		||||
			USB_Descriptor_Interface_t               CDC_DCI_Interface;
 | 
			
		||||
			USB_Descriptor_Endpoint_t                RNDIS_DataOutEndpoint;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,8 @@
 | 
			
		|||
		#include <avr/io.h>
 | 
			
		||||
		#include <string.h>
 | 
			
		||||
 | 
			
		||||
		#include <LUFA/Drivers/USB/USB.h>
 | 
			
		||||
 | 
			
		||||
		#include "EthernetProtocols.h"
 | 
			
		||||
		#include "Ethernet.h"
 | 
			
		||||
		#include "ProtocolDecoders.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,14 +81,6 @@
 | 
			
		|||
		#define NO_PROCESS                       -1
 | 
			
		||||
 | 
			
		||||
	/* Type Defines: */
 | 
			
		||||
		/** Type define for an Ethernet frame buffer. */
 | 
			
		||||
		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 */
 | 
			
		||||
			bool          FrameInBuffer; /**< Indicates if a frame is currently stored in the buffer */
 | 
			
		||||
		} Ethernet_Frame_Info_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for an Ethernet frame header. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,7 @@
 | 
			
		|||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint8_t       Octets[6]; /**< Individual bytes of a MAC address */
 | 
			
		||||
		} MAC_Address_t;
 | 
			
		||||
		} RNDIS_MAC_Address_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a protocol IP address of a device on a network. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -264,7 +264,7 @@ static bool ProcessNDISQuery(const uint32_t OId, void* QueryData, uint16_t Query
 | 
			
		|||
			*ResponseSize = sizeof(uint32_t);
 | 
			
		||||
 | 
			
		||||
			/* Always indicate hardware ready */
 | 
			
		||||
			*((uint32_t*)ResponseData) = NdisHardwareStatusReady;
 | 
			
		||||
			*((uint32_t*)ResponseData) = NDIS_HardwareStatus_Ready;
 | 
			
		||||
 | 
			
		||||
			return true;
 | 
			
		||||
		case OID_GEN_MEDIA_SUPPORTED:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -44,167 +44,6 @@
 | 
			
		|||
		#include "RNDISConstants.h"
 | 
			
		||||
		#include "Ethernet.h"
 | 
			
		||||
 | 
			
		||||
	/* Macros: */
 | 
			
		||||
		/** Implemented RNDIS Version Major. */
 | 
			
		||||
		#define REMOTE_NDIS_VERSION_MAJOR             0x01
 | 
			
		||||
 | 
			
		||||
		/** Implemented RNDIS Version Minor. */
 | 
			
		||||
		#define REMOTE_NDIS_VERSION_MINOR             0x00
 | 
			
		||||
 | 
			
		||||
		/** RNDIS request to issue a host-to-device NDIS command. */
 | 
			
		||||
		#define REQ_SendEncapsulatedCommand           0x00
 | 
			
		||||
 | 
			
		||||
		/** RNDIS request to issue a device-to-host NDIS response. */
 | 
			
		||||
		#define REQ_GetEncapsulatedResponse           0x01
 | 
			
		||||
 | 
			
		||||
	/* Enums: */
 | 
			
		||||
		/** Enum for the possible NDIS adapter states. */
 | 
			
		||||
		enum RNDIS_States_t
 | 
			
		||||
		{
 | 
			
		||||
			RNDIS_Uninitialized    = 0, /**< Adapter currently uninitialized */
 | 
			
		||||
			RNDIS_Initialized      = 1, /**< Adapter currently initialized but not ready for data transfers */
 | 
			
		||||
			RNDIS_Data_Initialized = 2, /**< Adapter currently initialized and ready for data transfers */
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		/** Enum for the NDIS hardware states. */
 | 
			
		||||
		enum NDIS_Hardware_Status_t
 | 
			
		||||
		{
 | 
			
		||||
			NdisHardwareStatusReady, /**< Hardware Ready to accept commands from the host */
 | 
			
		||||
			NdisHardwareStatusInitializing, /**< Hardware busy initializing */
 | 
			
		||||
			NdisHardwareStatusReset, /**< Hardware reset */
 | 
			
		||||
			NdisHardwareStatusClosing, /**< Hardware currently closing */
 | 
			
		||||
			NdisHardwareStatusNotReady /**< Hardware not ready to accept commands from the host */
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
	/* Type Defines: */
 | 
			
		||||
		/** Type define for a RNDIS message header, sent before RNDIS messages. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType; /**< RNDIS message type, a REMOTE_NDIS_*_MSG constant */
 | 
			
		||||
			uint32_t MessageLength; /**< Total length of the RNDIS message, in bytes */
 | 
			
		||||
		} RNDIS_Message_Header_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS packet message, used to encapsulate Ethernet packets sent to and from the adapter. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t DataOffset;
 | 
			
		||||
			uint32_t DataLength;
 | 
			
		||||
			uint32_t OOBDataOffset;
 | 
			
		||||
			uint32_t OOBDataLength;
 | 
			
		||||
			uint32_t NumOOBDataElements;
 | 
			
		||||
			uint32_t PerPacketInfoOffset;
 | 
			
		||||
			uint32_t PerPacketInfoLength;
 | 
			
		||||
			uint32_t VcHandle;
 | 
			
		||||
			uint32_t Reserved;
 | 
			
		||||
		} RNDIS_Packet_Message_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS Initialize command message. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t RequestId;
 | 
			
		||||
 | 
			
		||||
			uint32_t MajorVersion;
 | 
			
		||||
			uint32_t MinorVersion;
 | 
			
		||||
			uint32_t MaxTransferSize;
 | 
			
		||||
		} RNDIS_Initialize_Message_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS Initialize complete response message. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t RequestId;
 | 
			
		||||
			uint32_t Status;
 | 
			
		||||
 | 
			
		||||
			uint32_t MajorVersion;
 | 
			
		||||
			uint32_t MinorVersion;
 | 
			
		||||
			uint32_t DeviceFlags;
 | 
			
		||||
			uint32_t Medium;
 | 
			
		||||
			uint32_t MaxPacketsPerTransfer;
 | 
			
		||||
			uint32_t MaxTransferSize;
 | 
			
		||||
			uint32_t PacketAlignmentFactor;
 | 
			
		||||
			uint32_t AFListOffset;
 | 
			
		||||
			uint32_t AFListSize;
 | 
			
		||||
		} RNDIS_Initialize_Complete_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS Keep-alive command message. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t RequestId;
 | 
			
		||||
		} RNDIS_KeepAlive_Message_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS Keep-alive complete message. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t RequestId;
 | 
			
		||||
			uint32_t Status;
 | 
			
		||||
		} RNDIS_KeepAlive_Complete_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS Reset complete message. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t Status;
 | 
			
		||||
 | 
			
		||||
			uint32_t AddressingReset;
 | 
			
		||||
		} RNDIS_Reset_Complete_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS Set command message. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t RequestId;
 | 
			
		||||
 | 
			
		||||
			uint32_t Oid;
 | 
			
		||||
			uint32_t InformationBufferLength;
 | 
			
		||||
			uint32_t InformationBufferOffset;
 | 
			
		||||
			uint32_t DeviceVcHandle;
 | 
			
		||||
		} RNDIS_Set_Message_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS Set complete response message. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t RequestId;
 | 
			
		||||
			uint32_t Status;
 | 
			
		||||
		} RNDIS_Set_Complete_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS Query command message. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t RequestId;
 | 
			
		||||
 | 
			
		||||
			uint32_t Oid;
 | 
			
		||||
			uint32_t InformationBufferLength;
 | 
			
		||||
			uint32_t InformationBufferOffset;
 | 
			
		||||
			uint32_t DeviceVcHandle;
 | 
			
		||||
		} RNDIS_Query_Message_t;
 | 
			
		||||
 | 
			
		||||
		/** Type define for a RNDIS Query complete response message. */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint32_t MessageType;
 | 
			
		||||
			uint32_t MessageLength;
 | 
			
		||||
			uint32_t RequestId;
 | 
			
		||||
			uint32_t Status;
 | 
			
		||||
 | 
			
		||||
			uint32_t InformationBufferLength;
 | 
			
		||||
			uint32_t InformationBufferOffset;
 | 
			
		||||
		} RNDIS_Query_Complete_t;
 | 
			
		||||
 | 
			
		||||
	/* External Variables: */
 | 
			
		||||
		extern uint8_t                 RNDISMessageBuffer[];
 | 
			
		||||
		extern RNDIS_Message_Header_t* MessageHeader;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,113 +0,0 @@
 | 
			
		|||
/*
 | 
			
		||||
             LUFA Library
 | 
			
		||||
     Copyright (C) Dean Camera, 2010.
 | 
			
		||||
 | 
			
		||||
  dean [at] fourwalledcubicle [dot] com
 | 
			
		||||
      www.fourwalledcubicle.com
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
  Copyright 2010  Dean Camera (dean [at] fourwalledcubicle [dot] com)
 | 
			
		||||
 | 
			
		||||
  Permission to use, copy, modify, distribute, and sell this
 | 
			
		||||
  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 disclaim 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
 | 
			
		||||
 *
 | 
			
		||||
 *  RNDIS specification related constants. For more information on these
 | 
			
		||||
 *  constants, please refer to the Microsoft RNDIS specification.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _RNDIS_CONSTANTS_DEVICE_H_
 | 
			
		||||
#define _RNDIS_CONSTANTS_DEVICE_H_
 | 
			
		||||
 | 
			
		||||
	/* Macros: */
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_MSG                0x00000001UL
 | 
			
		||||
		#define REMOTE_NDIS_INITIALIZE_MSG            0x00000002UL
 | 
			
		||||
		#define REMOTE_NDIS_HALT_MSG                  0x00000003UL
 | 
			
		||||
		#define REMOTE_NDIS_QUERY_MSG                 0x00000004UL
 | 
			
		||||
		#define REMOTE_NDIS_SET_MSG                   0x00000005UL
 | 
			
		||||
		#define REMOTE_NDIS_RESET_MSG                 0x00000006UL
 | 
			
		||||
		#define REMOTE_NDIS_INDICATE_STATUS_MSG       0x00000007UL
 | 
			
		||||
		#define REMOTE_NDIS_KEEPALIVE_MSG             0x00000008UL
 | 
			
		||||
 | 
			
		||||
		#define REMOTE_NDIS_INITIALIZE_CMPLT          0x80000002UL
 | 
			
		||||
		#define REMOTE_NDIS_QUERY_CMPLT               0x80000004UL
 | 
			
		||||
		#define REMOTE_NDIS_SET_CMPLT                 0x80000005UL
 | 
			
		||||
		#define REMOTE_NDIS_RESET_CMPLT               0x80000006UL
 | 
			
		||||
		#define REMOTE_NDIS_KEEPALIVE_CMPLT           0x80000008UL
 | 
			
		||||
 | 
			
		||||
		#define REMOTE_NDIS_STATUS_SUCCESS            0x00000000UL
 | 
			
		||||
		#define REMOTE_NDIS_STATUS_FAILURE            0xC0000001UL
 | 
			
		||||
		#define REMOTE_NDIS_STATUS_INVALID_DATA       0xC0010015UL
 | 
			
		||||
		#define REMOTE_NDIS_STATUS_NOT_SUPPORTED      0xC00000BBUL
 | 
			
		||||
		#define REMOTE_NDIS_STATUS_MEDIA_CONNECT      0x4001000BUL
 | 
			
		||||
		#define REMOTE_NDIS_STATUS_MEDIA_DISCONNECT   0x4001000CUL
 | 
			
		||||
 | 
			
		||||
		#define REMOTE_NDIS_MEDIA_STATE_CONNECTED     0x00000000UL
 | 
			
		||||
		#define REMOTE_NDIS_MEDIA_STATE_DISCONNECTED  0x00000001UL
 | 
			
		||||
 | 
			
		||||
		#define REMOTE_NDIS_MEDIUM_802_3              0x00000000UL
 | 
			
		||||
 | 
			
		||||
		#define REMOTE_NDIS_DF_CONNECTIONLESS	      0x00000001UL
 | 
			
		||||
		#define REMOTE_NDIS_DF_CONNECTION_ORIENTED    0x00000002UL
 | 
			
		||||
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_DIRECTED           0x00000001UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_MULTICAST          0x00000002UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_ALL_MULTICAST      0x00000004UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_BROADCAST          0x00000008UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_SOURCE_ROUTING     0x00000010UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_PROMISCUOUS        0x00000020UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_SMT                0x00000040UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_ALL_LOCAL          0x00000080UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_GROUP              0x00001000UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_ALL_FUNCTIONAL     0x00002000UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_FUNCTIONAL         0x00004000UL
 | 
			
		||||
		#define REMOTE_NDIS_PACKET_MAC_FRAME          0x00008000UL
 | 
			
		||||
 | 
			
		||||
		#define OID_GEN_SUPPORTED_LIST                0x00010101UL
 | 
			
		||||
		#define OID_GEN_HARDWARE_STATUS               0x00010102UL
 | 
			
		||||
		#define OID_GEN_MEDIA_SUPPORTED               0x00010103UL
 | 
			
		||||
		#define OID_GEN_MEDIA_IN_USE                  0x00010104UL
 | 
			
		||||
		#define OID_GEN_MAXIMUM_FRAME_SIZE            0x00010106UL
 | 
			
		||||
		#define OID_GEN_MAXIMUM_TOTAL_SIZE            0x00010111UL
 | 
			
		||||
		#define OID_GEN_LINK_SPEED                    0x00010107UL
 | 
			
		||||
		#define OID_GEN_TRANSMIT_BLOCK_SIZE           0x0001010AUL
 | 
			
		||||
		#define OID_GEN_RECEIVE_BLOCK_SIZE            0x0001010BUL
 | 
			
		||||
		#define OID_GEN_VENDOR_ID                     0x0001010CUL
 | 
			
		||||
		#define OID_GEN_VENDOR_DESCRIPTION            0x0001010DUL
 | 
			
		||||
		#define OID_GEN_CURRENT_PACKET_FILTER         0x0001010EUL
 | 
			
		||||
		#define OID_GEN_MAXIMUM_TOTAL_SIZE            0x00010111UL
 | 
			
		||||
		#define OID_GEN_MEDIA_CONNECT_STATUS          0x00010114UL
 | 
			
		||||
		#define OID_GEN_PHYSICAL_MEDIUM               0x00010202UL
 | 
			
		||||
		#define OID_GEN_XMIT_OK                       0x00020101UL
 | 
			
		||||
		#define OID_GEN_RCV_OK                        0x00020102UL
 | 
			
		||||
		#define OID_GEN_XMIT_ERROR                    0x00020103UL
 | 
			
		||||
		#define OID_GEN_RCV_ERROR                     0x00020104UL
 | 
			
		||||
		#define OID_GEN_RCV_NO_BUFFER                 0x00020105UL
 | 
			
		||||
		#define OID_802_3_PERMANENT_ADDRESS           0x01010101UL
 | 
			
		||||
		#define OID_802_3_CURRENT_ADDRESS             0x01010102UL
 | 
			
		||||
		#define OID_802_3_MULTICAST_LIST              0x01010103UL
 | 
			
		||||
		#define OID_802_3_MAXIMUM_LIST_SIZE           0x01010104UL
 | 
			
		||||
		#define OID_802_3_RCV_ERROR_ALIGNMENT         0x01020101UL
 | 
			
		||||
		#define OID_802_3_XMIT_ONE_COLLISION          0x01020102UL
 | 
			
		||||
		#define OID_802_3_XMIT_MORE_COLLISIONS        0x01020103UL
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -121,7 +121,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
 | 
			
		|||
	/* Process RNDIS class commands */
 | 
			
		||||
	switch (USB_ControlRequest.bRequest)
 | 
			
		||||
	{
 | 
			
		||||
		case REQ_SendEncapsulatedCommand:
 | 
			
		||||
		case RNDIS_REQ_SendEncapsulatedCommand:
 | 
			
		||||
			if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{
 | 
			
		||||
				Endpoint_ClearSETUP();
 | 
			
		||||
| 
						 | 
				
			
			@ -135,7 +135,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
 | 
			
		|||
			}
 | 
			
		||||
 | 
			
		||||
			break;
 | 
			
		||||
		case REQ_GetEncapsulatedResponse:
 | 
			
		||||
		case RNDIS_REQ_GetEncapsulatedResponse:
 | 
			
		||||
			if (USB_ControlRequest.bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE))
 | 
			
		||||
			{
 | 
			
		||||
				/* Check if a response to the last message is ready */
 | 
			
		||||
| 
						 | 
				
			
			@ -172,10 +172,10 @@ void RNDIS_Task(void)
 | 
			
		|||
	/* Check if a message response is ready for the host */
 | 
			
		||||
	if (Endpoint_IsINReady() && ResponseReady)
 | 
			
		||||
	{
 | 
			
		||||
		USB_Notification_t Notification = (USB_Notification_t)
 | 
			
		||||
		USB_Request_Header_t Notification = (USB_Request_Header_t)
 | 
			
		||||
			{
 | 
			
		||||
				.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
 | 
			
		||||
				.bNotification = NOTIF_RESPONSE_AVAILABLE,
 | 
			
		||||
				.bRequest      = RNDIS_NOTIF_ResponseAvailable,
 | 
			
		||||
				.wValue        = 0,
 | 
			
		||||
				.wIndex        = 0,
 | 
			
		||||
				.wLength       = 0,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -75,19 +75,6 @@
 | 
			
		|||
		/** LED mask for the library LED driver, to indicate that the USB interface is busy. */
 | 
			
		||||
		#define LEDMASK_USB_BUSY          LEDS_LED2
 | 
			
		||||
 | 
			
		||||
	/* Type Defines: */
 | 
			
		||||
		/** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification
 | 
			
		||||
		 *  Endpoint.
 | 
			
		||||
		 */
 | 
			
		||||
		typedef struct
 | 
			
		||||
		{
 | 
			
		||||
			uint8_t  bmRequestType; /**< Notification type, a mask of values from SrdRequestType.h */
 | 
			
		||||
			uint8_t  bNotification; /**< Notification index, indicating what the RNDIS notification relates to */
 | 
			
		||||
			uint16_t wValue; /**< Two byte notification value parameter */
 | 
			
		||||
			uint16_t wIndex; /**< Two byte notification index parameter */
 | 
			
		||||
			uint16_t wLength; /**< Size of data payload following the notification header */
 | 
			
		||||
		} USB_Notification_t;
 | 
			
		||||
 | 
			
		||||
	/* Function Prototypes: */
 | 
			
		||||
		void SetupHardware(void);
 | 
			
		||||
		void RNDIS_Task(void);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue