Commit 397c2f91 authored by Dean Camera's avatar Dean Camera

Merge over trunk changes to the 110528 BETA to form the 110528 release.

parent 2b09c428
...@@ -66,6 +66,9 @@ int main(void) ...@@ -66,6 +66,9 @@ int main(void)
/* Setup hardware required for the bootloader */ /* Setup hardware required for the bootloader */
SetupHardware(); SetupHardware();
/* Turn on first LED on the board to indicate that the bootloader has started */
LEDs_SetAllLEDs(LEDS_LED1);
/* Enable global interrupts so that the USB stack can function */ /* Enable global interrupts so that the USB stack can function */
sei(); sei();
...@@ -100,6 +103,17 @@ void SetupHardware(void) ...@@ -100,6 +103,17 @@ void SetupHardware(void)
/* Initialize USB Subsystem */ /* Initialize USB Subsystem */
USB_Init(); USB_Init();
LEDs_Init();
/* Bootloader active LED toggle timer initialization */
TIMSK1 = (1 << TOIE1);
TCCR1B = ((1 << CS11) | (1 << CS10));
}
/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */
ISR(TIMER1_OVF_vect, ISR_BLOCK)
{
LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
} }
/** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready /** Event handler for the USB_ConfigurationChanged event. This configures the device's endpoints ready
...@@ -134,6 +148,9 @@ void EVENT_USB_Device_ControlRequest(void) ...@@ -134,6 +148,9 @@ void EVENT_USB_Device_ControlRequest(void)
return; return;
} }
/* Activity - toggle indicator LEDs */
LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
/* Process CDC specific control requests */ /* Process CDC specific control requests */
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)
{ {
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "Descriptors.h" #include "Descriptors.h"
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
/* Macros: */ /* Macros: */
/** Version major of the CDC bootloader. */ /** Version major of the CDC bootloader. */
......
...@@ -119,6 +119,9 @@ int main(void) ...@@ -119,6 +119,9 @@ int main(void)
MCUCR &= ~(1 << JTD); MCUCR &= ~(1 << JTD);
#endif #endif
/* Turn on first LED on the board to indicate that the bootloader has started */
LEDs_SetAllLEDs(LEDS_LED1);
/* Enable global interrupts so that the USB stack can function */ /* Enable global interrupts so that the USB stack can function */
sei(); sei();
...@@ -149,6 +152,11 @@ void SetupHardware(void) ...@@ -149,6 +152,11 @@ void SetupHardware(void)
/* Initialize the USB subsystem */ /* Initialize the USB subsystem */
USB_Init(); USB_Init();
LEDs_Init();
/* Bootloader active LED toggle timer initialization */
TIMSK1 = (1 << TOIE1);
TCCR1B = ((1 << CS11) | (1 << CS10));
} }
/** Resets all configured hardware required for the bootloader back to their original states. */ /** Resets all configured hardware required for the bootloader back to their original states. */
...@@ -162,15 +170,18 @@ void ResetHardware(void) ...@@ -162,15 +170,18 @@ void ResetHardware(void)
MCUCR = 0; MCUCR = 0;
} }
/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */
ISR(TIMER1_OVF_vect, ISR_BLOCK)
{
LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
}
/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to /** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
* the device from the USB host before passing along unhandled control requests to the library for processing * the device from the USB host before passing along unhandled control requests to the library for processing
* internally. * internally.
*/ */
void EVENT_USB_Device_ControlRequest(void) void EVENT_USB_Device_ControlRequest(void)
{ {
/* Get the size of the command and data from the wLength value */
SentCommand.DataSize = USB_ControlRequest.wLength;
/* Ignore any requests that aren't directed to the DFU interface */ /* Ignore any requests that aren't directed to the DFU interface */
if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) != if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) !=
(REQTYPE_CLASS | REQREC_INTERFACE)) (REQTYPE_CLASS | REQREC_INTERFACE))
...@@ -178,6 +189,12 @@ void EVENT_USB_Device_ControlRequest(void) ...@@ -178,6 +189,12 @@ void EVENT_USB_Device_ControlRequest(void)
return; return;
} }
/* Activity - toggle indicator LEDs */
LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
/* Get the size of the command and data from the wLength value */
SentCommand.DataSize = USB_ControlRequest.wLength;
switch (USB_ControlRequest.bRequest) switch (USB_ControlRequest.bRequest)
{ {
case DFU_REQ_DNLOAD: case DFU_REQ_DNLOAD:
......
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
#include "Descriptors.h" #include "Descriptors.h"
#include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/USB/USB.h>
#include <LUFA/Drivers/Board/LEDs.h>
/* Macros: */ /* Macros: */
/** Configuration define. Define this token to true to case the bootloader to reject all memory commands /** Configuration define. Define this token to true to case the bootloader to reject all memory commands
......
...@@ -113,10 +113,18 @@ void EVENT_USB_Device_ControlRequest(void) ...@@ -113,10 +113,18 @@ void EVENT_USB_Device_ControlRequest(void)
while (!(Endpoint_IsOUTReceived())); while (!(Endpoint_IsOUTReceived()));
/* Read in the write destination address */ /* Read in the write destination address */
#if (FLASHEND > 0xFFFF)
uint32_t PageAddress = ((uint32_t)Endpoint_Read_16_LE() << 8);
#else
uint16_t PageAddress = Endpoint_Read_16_LE(); uint16_t PageAddress = Endpoint_Read_16_LE();
#endif
/* Check if the command is a program page command, or a start application command */ /* Check if the command is a program page command, or a start application command */
#if (FLASHEND > 0xFFFF)
if ((uint16_t)(PageAddress >> 8) == COMMAND_STARTAPPLICATION)
#else
if (PageAddress == COMMAND_STARTAPPLICATION) if (PageAddress == COMMAND_STARTAPPLICATION)
#endif
{ {
RunBootloader = false; RunBootloader = false;
} }
......
...@@ -59,7 +59,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, ...@@ -59,7 +59,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
DecodeDHCPHeader(DHCPHeaderInStart); DecodeDHCPHeader(DHCPHeaderInStart);
/* Zero out the response DHCP packet, as much of it legacy and left at 0 */ /* Zero out the response DHCP packet, as much of it is legacy and left at 0 */
memset(DHCPHeaderOUT, 0, sizeof(DHCP_Header_t)); memset(DHCPHeaderOUT, 0, sizeof(DHCP_Header_t));
/* Fill out the response DHCP packet */ /* Fill out the response DHCP packet */
......
...@@ -96,7 +96,6 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN, ...@@ -96,7 +96,6 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN,
/* Set the response length in the buffer and indicate that a response is ready to be sent */ /* 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); FrameOUT->FrameLength = (sizeof(Ethernet_Frame_Header_t) + RetSize);
FrameOUT->FrameInBuffer = true;
} }
} }
...@@ -104,7 +103,7 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN, ...@@ -104,7 +103,7 @@ void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN,
if (RetSize != NO_PROCESS) if (RetSize != NO_PROCESS)
{ {
/* Clear the frame buffer */ /* Clear the frame buffer */
FrameIN->FrameInBuffer = false; FrameIN->FrameLength = 0;
} }
} }
......
...@@ -55,7 +55,8 @@ TCP_ConnectionState_t ConnectionStateTable[MAX_TCP_CONNECTIONS]; ...@@ -55,7 +55,8 @@ TCP_ConnectionState_t ConnectionStateTable[MAX_TCP_CONNECTIONS];
* level. If an application produces a response, this task constructs the appropriate Ethernet frame and places it into the Ethernet OUT * level. If an application produces a response, this task constructs the appropriate Ethernet frame and places it into the Ethernet OUT
* buffer for later transmission. * buffer for later transmission.
*/ */
void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
Ethernet_Frame_Info_t* const FrameOUT)
{ {
/* Run each application in sequence, to process incoming and generate outgoing packets */ /* Run each application in sequence, to process incoming and generate outgoing packets */
for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++) for (uint8_t CSTableEntry = 0; CSTableEntry < MAX_TCP_CONNECTIONS; CSTableEntry++)
...@@ -73,11 +74,8 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ...@@ -73,11 +74,8 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
} }
} }
/* Get pointer to the output frame info struct for convenience */
Ethernet_Frame_Info_t* FrameOUT = &RNDISInterfaceInfo->State.FrameOUT;
/* Bail out early if there is already a frame waiting to be sent in the Ethernet OUT buffer */ /* Bail out early if there is already a frame waiting to be sent in the Ethernet OUT buffer */
if (FrameOUT->FrameInBuffer) if (FrameOUT->FrameLength)
return; return;
/* Send response packets from each application as the TCP packet buffers are filled by the applications */ /* Send response packets from each application as the TCP packet buffers are filled by the applications */
...@@ -147,7 +145,6 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ...@@ -147,7 +145,6 @@ void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo)
/* Set the response length in the buffer and indicate that a response is ready to be sent */ /* Set the response length in the buffer and indicate that a response is ready to be sent */
FrameOUT->FrameLength = PacketSize; FrameOUT->FrameLength = PacketSize;
FrameOUT->FrameInBuffer = true;
ConnectionStateTable[CSTableEntry].Info.Buffer.Ready = false; ConnectionStateTable[CSTableEntry].Info.Buffer.Ready = false;
......
...@@ -228,7 +228,8 @@ ...@@ -228,7 +228,8 @@
} TCP_Header_t; } TCP_Header_t;
/* Function Prototypes: */ /* Function Prototypes: */
void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo); void TCP_TCPTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo,
Ethernet_Frame_Info_t* const FrameOUT);
void TCP_Init(void); void TCP_Init(void);
bool TCP_SetPortState(const uint16_t Port, bool TCP_SetPortState(const uint16_t Port,
const uint8_t State, const uint8_t State,
......
...@@ -63,6 +63,11 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface = ...@@ -63,6 +63,11 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface =
}, },
}; };
/** Global to store the incoming frame from the host before it is processed by the device. */
static Ethernet_Frame_Info_t FrameIN;
/** Global to store the outgoing frame created in the device before it is sent to the host. */
static Ethernet_Frame_Info_t FrameOUT;
/** Main program entry point. This routine contains the overall program flow, including initial /** Main program entry point. This routine contains the overall program flow, including initial
* setup of all components and the main program loop. * setup of all components and the main program loop.
...@@ -79,14 +84,23 @@ int main(void) ...@@ -79,14 +84,23 @@ int main(void)
for (;;) for (;;)
{ {
if (Ethernet_RNDIS_Interface.State.FrameIN.FrameInBuffer) if (RNDIS_Device_IsPacketReceived(&Ethernet_RNDIS_Interface))
{ {
LEDs_SetAllLEDs(LEDMASK_USB_BUSY); LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
Ethernet_ProcessPacket(&Ethernet_RNDIS_Interface.State.FrameIN, &Ethernet_RNDIS_Interface.State.FrameOUT);
RNDIS_Device_ReadPacket(&Ethernet_RNDIS_Interface, &FrameIN.FrameData, &FrameIN.FrameLength);
Ethernet_ProcessPacket(&FrameIN, &FrameOUT);
if (FrameOUT.FrameLength)
{
RNDIS_Device_SendPacket(&Ethernet_RNDIS_Interface, &FrameOUT.FrameData, FrameOUT.FrameLength);
FrameOUT.FrameLength = 0;
}
LEDs_SetAllLEDs(LEDMASK_USB_READY); LEDs_SetAllLEDs(LEDMASK_USB_READY);
} }
TCP_TCPTask(&Ethernet_RNDIS_Interface); TCP_TCPTask(&Ethernet_RNDIS_Interface, &FrameOUT);
RNDIS_Device_USBTask(&Ethernet_RNDIS_Interface); RNDIS_Device_USBTask(&Ethernet_RNDIS_Interface);
USB_USBTask(); USB_USBTask();
......
...@@ -59,7 +59,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart, ...@@ -59,7 +59,7 @@ int16_t DHCP_ProcessDHCPPacket(void* IPHeaderInStart,
DecodeDHCPHeader(DHCPHeaderInStart); DecodeDHCPHeader(DHCPHeaderInStart);
/* Zero out the response DHCP packet, as much of it legacy and left at 0 */ /* Zero out the response DHCP packet, as much of it is legacy and left at 0 */
memset(DHCPHeaderOUT, 0, sizeof(DHCP_Header_t)); memset(DHCPHeaderOUT, 0, sizeof(DHCP_Header_t));
/* Fill out the response DHCP packet */ /* Fill out the response DHCP packet */
......
...@@ -100,7 +100,6 @@ void Ethernet_ProcessPacket(void) ...@@ -100,7 +100,6 @@ void Ethernet_ProcessPacket(void)
/* Set the response length in the buffer and indicate that a response is ready to be sent */ /* 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); FrameOUT.FrameLength = (sizeof(Ethernet_Frame_Header_t) + RetSize);
FrameOUT.FrameInBuffer = true;
} }
} }
...@@ -108,7 +107,7 @@ void Ethernet_ProcessPacket(void) ...@@ -108,7 +107,7 @@ void Ethernet_ProcessPacket(void)
if (RetSize != NO_PROCESS) if (RetSize != NO_PROCESS)
{ {
/* Clear the frame buffer */ /* Clear the frame buffer */
FrameIN.FrameInBuffer = false; FrameIN.FrameLength = 0;
} }
} }
......
...@@ -74,7 +74,7 @@ void TCP_Task(void) ...@@ -74,7 +74,7 @@ void TCP_Task(void)
} }
/* Bail out early if there is already a frame waiting to be sent in the Ethernet OUT buffer */ /* Bail out early if there is already a frame waiting to be sent in the Ethernet OUT buffer */
if (FrameOUT.FrameInBuffer) if (FrameOUT.FrameLength)
return; return;
/* Send response packets from each application as the TCP packet buffers are filled by the applications */ /* Send response packets from each application as the TCP packet buffers are filled by the applications */
...@@ -144,7 +144,6 @@ void TCP_Task(void) ...@@ -144,7 +144,6 @@ void TCP_Task(void)
/* Set the response length in the buffer and indicate that a response is ready to be sent */ /* Set the response length in the buffer and indicate that a response is ready to be sent */
FrameOUT.FrameLength = PacketSize; FrameOUT.FrameLength = PacketSize;
FrameOUT.FrameInBuffer = true;
ConnectionStateTable[CSTableEntry].Info.Buffer.Ready = false; ConnectionStateTable[CSTableEntry].Info.Buffer.Ready = false;
......
...@@ -204,7 +204,7 @@ void RNDIS_Task(void) ...@@ -204,7 +204,7 @@ void RNDIS_Task(void)
Endpoint_SelectEndpoint(CDC_RX_EPNUM); Endpoint_SelectEndpoint(CDC_RX_EPNUM);
/* Check if the data OUT endpoint contains data, and that the IN buffer is empty */ /* Check if the data OUT endpoint contains data, and that the IN buffer is empty */
if (Endpoint_IsOUTReceived() && !(FrameIN.FrameInBuffer)) if (Endpoint_IsOUTReceived() && !(FrameIN.FrameLength))
{ {
/* Read in the packet message header */ /* Read in the packet message header */
Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL); Endpoint_Read_Stream_LE(&RNDISPacketHeader, sizeof(RNDIS_Packet_Message_t), NULL);
...@@ -224,16 +224,13 @@ void RNDIS_Task(void) ...@@ -224,16 +224,13 @@ void RNDIS_Task(void)
/* Store the size of the Ethernet frame */ /* Store the size of the Ethernet frame */
FrameIN.FrameLength = RNDISPacketHeader.DataLength; FrameIN.FrameLength = RNDISPacketHeader.DataLength;
/* Indicate Ethernet IN buffer full */
FrameIN.FrameInBuffer = true;
} }
/* Select the data IN endpoint */ /* Select the data IN endpoint */
Endpoint_SelectEndpoint(CDC_TX_EPNUM); Endpoint_SelectEndpoint(CDC_TX_EPNUM);
/* Check if the data IN endpoint is ready for more data, and that the IN buffer is full */ /* Check if the data IN endpoint is ready for more data, and that the IN buffer is full */
if (Endpoint_IsINReady() && FrameOUT.FrameInBuffer) if (Endpoint_IsINReady() && FrameOUT.FrameLength)
{ {
/* Clear the packet header with all 0s so that the relevant fields can be filled */ /* Clear the packet header with all 0s so that the relevant fields can be filled */
memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t)); memset(&RNDISPacketHeader, 0, sizeof(RNDIS_Packet_Message_t));
...@@ -254,7 +251,7 @@ void RNDIS_Task(void) ...@@ -254,7 +251,7 @@ void RNDIS_Task(void)
Endpoint_ClearIN(); Endpoint_ClearIN();
/* Indicate Ethernet OUT buffer no longer full */ /* Indicate Ethernet OUT buffer no longer full */
FrameOUT.FrameInBuffer = false; FrameOUT.FrameLength = 0;
} }
} }
} }
...@@ -273,7 +270,7 @@ void Ethernet_Task(void) ...@@ -273,7 +270,7 @@ void Ethernet_Task(void)
return; return;
/* Check if a frame has been written to the IN frame buffer */ /* Check if a frame has been written to the IN frame buffer */
if (FrameIN.FrameInBuffer) if (FrameIN.FrameLength)
{ {
/* Indicate packet processing started */ /* Indicate packet processing started */
LEDs_SetAllLEDs(LEDMASK_USB_BUSY); LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
......
...@@ -236,9 +236,7 @@ ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-l ...@@ -236,9 +236,7 @@ ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-l
# -Map: create map file # -Map: create map file
# --cref: add cross reference to map file # --cref: add cross reference to map file
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
LDFLAGS += -Wl,--relax LDFLAGS += -Wl,--gc-sections --rodata-writable
LDFLAGS += -Wl,--gc-sections
LDFLAGS += -Wl,--rodata-writable
LDFLAGS += -Wl,--direct-data LDFLAGS += -Wl,--direct-data
#LDFLAGS += -T linker_script.x #LDFLAGS += -T linker_script.x
......
...@@ -73,7 +73,10 @@ ...@@ -73,7 +73,10 @@
/* Architecture specific utility includes: */ /* Architecture specific utility includes: */
#if defined(__DOXYGEN__) #if defined(__DOXYGEN__)
/** Type define for an unsigned integer the same width as the selected architecture's machine register. */ /** Type define for an unsigned integer the same width as the selected architecture's machine register.
* This is distinct from the non-specific standard int data type, whose width is machine dependant but
* which may not reflect the actual machine register width on some targets (e.g. AVR8).
*/
typedef MACHINE_REG_t uint_reg_t; typedef MACHINE_REG_t uint_reg_t;
#elif (ARCH == ARCH_AVR8) #elif (ARCH == ARCH_AVR8)
#include <avr/io.h> #include <avr/io.h>
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
* *
* \return Input value with the byte ordering reversed. * \return Input value with the byte ordering reversed.
*/ */
#define SWAPENDIAN_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8)) #define SWAPENDIAN_16(x) (uint16_t)((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
/** Swaps the byte ordering of a 32-bit value at compile-time. Do not use this macro for swapping byte orderings /** Swaps the byte ordering of a 32-bit value at compile-time. Do not use this macro for swapping byte orderings
* of dynamic values computed at runtime- use \ref SwapEndian_32() instead. The result of this macro can be used * of dynamic values computed at runtime- use \ref SwapEndian_32() instead. The result of this macro can be used
...@@ -91,8 +91,8 @@ ...@@ -91,8 +91,8 @@
* *
* \return Input value with the byte ordering reversed. * \return Input value with the byte ordering reversed.
*/ */
#define SWAPENDIAN_32(x) ((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \ #define SWAPENDIAN_32(x) (uint32_t)((((x) & 0xFF000000UL) >> 24UL) | (((x) & 0x00FF0000UL) >> 8UL) | \
(((x) & 0x0000FF00UL) << 8UL) | (((x) & 0x000000FFUL) << 24UL)) (((x) & 0x0000FF00UL) << 8UL) | (((x) & 0x000000FFUL) << 24UL))
#if defined(ARCH_BIG_ENDIAN) && !defined(le16_to_cpu) #if defined(ARCH_BIG_ENDIAN) && !defined(le16_to_cpu)
#define le16_to_cpu(x) SwapEndian_16(x) #define le16_to_cpu(x) SwapEndian_16(x)
......
...@@ -145,10 +145,10 @@ ...@@ -145,10 +145,10 @@
CDC_CSCP_ATCommandProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface CDC_CSCP_ATCommandProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface
* belongs to the AT Command protocol of the CDC class. * belongs to the AT Command protocol of the CDC class.
*/ */
CDC_CSCP_NoSpecificProtocol = 0x00, /**< Descriptor Class value indicating that the device or interface CDC_CSCP_NoSpecificProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface
* belongs to no specific protocol of the CDC class. * belongs to no specific protocol of the CDC class.
*/ */
CDC_CSCP_VendorSpecificProtocol = 0xFF, /**< Descriptor Class value indicating that the device or interface CDC_CSCP_VendorSpecificProtocol = 0xFF, /**< Descriptor Protocol value indicating that the device or interface
* belongs to a vendor-specific protocol of the CDC class. * belongs to a vendor-specific protocol of the CDC class.
*/ */
CDC_CSCP_CDCDataClass = 0x0A, /**< Descriptor Class value indicating that the device or interface CDC_CSCP_CDCDataClass = 0x0A, /**< Descriptor Class value indicating that the device or interface
......
...@@ -68,6 +68,9 @@ ...@@ -68,6 +68,9 @@
#endif #endif
/* Macros: */ /* Macros: */
/** Additional error code for RNDIS functions when a device returns a logical command failure. */
#define RNDIS_ERROR_LOGICAL_CMD_FAILED 0x80
/** Implemented RNDIS Version Major. */ /** Implemented RNDIS Version Major. */
#define REMOTE_NDIS_VERSION_MAJOR 0x01 #define REMOTE_NDIS_VERSION_MAJOR 0x01
...@@ -205,25 +208,25 @@ ...@@ -205,25 +208,25 @@
}; };
/* Type Defines: */ /* Type Defines: */
/** \brief MAC Address Structure. /** \brief Ethernet Frame Packet Information Structure.
* *
* Type define for a physical MAC address of a device on a network. * Type define for an Ethernet frame buffer data and information structure. This can be used to conveniently
* store both the size and data in an Ethernet frame.
*/ */
typedef struct typedef struct
{ {
uint8_t Octets[6]; /**< Individual bytes of a MAC address */ uint8_t FrameData[ETHERNET_FRAME_SIZE_MAX]; /**< Ethernet frame contents. */
} ATTR_PACKED MAC_Address_t; uint16_t FrameLength; /**< Length in bytes of the Ethernet frame stored in the buffer. */
} Ethernet_Frame_Info_t;
/** \brief RNDIS Ethernet Frame Packet Information Structure. /** \brief MAC Address Structure.
* *
* Type define for an Ethernet frame buffer data and information structure. * Type define for a physical MAC address of a device on a network.
*/ */
typedef struct typedef struct
{ {
uint8_t FrameData[ETHERNET_FRAME_SIZE_MAX]; /**< Ethernet frame contents. */ uint8_t Octets[6]; /**< Individual bytes of a MAC address */
uint16_t FrameLength; /**< Length in bytes of the Ethernet frame stored in the buffer. */ } ATTR_PACKED MAC_Address_t;
bool FrameInBuffer; /**< Indicates if a frame is currently stored in the buffer. */
} ATTR_PACKED Ethernet_Frame_Info_t;
/** \brief RNDIS Common Message Header Structure. /** \brief RNDIS Common Message Header Structure.
* *
......
...@@ -163,8 +163,6 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo ...@@ -163,8 +163,6 @@ void RNDIS_Device_USBTask(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo
if (USB_DeviceState != DEVICE_STATE_Configured) if (USB_DeviceState != DEVICE_STATE_Configured)
return; return;
RNDIS_Message_Header_t* MessageHeader = (RNDIS_Message_Header_t*)&RNDISInterfaceInfo->State.RNDISMessageBuffer;
Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.NotificationEndpointNumber); Endpoint_SelectEndpoint(RNDISInterfaceInfo->Config.NotificationEndpointNumber);