aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Device
diff options
context:
space:
mode:
Diffstat (limited to 'Demos/Device')
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c2
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h10
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c11
-rw-r--r--Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h2
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h7
-rw-r--r--Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c5
6 files changed, 24 insertions, 13 deletions
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c
index dacbdbf89..e65ad7755 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/Ethernet.c
@@ -59,7 +59,7 @@ const IP_Address_t ClientIPAddress = {CLIENT_IP_ADDRESS};
void Ethernet_ProcessPacket(Ethernet_Frame_Info_t* const FrameIN,
Ethernet_Frame_Info_t* const FrameOUT)
{
- DecodeEthernetFrameHeader(FrameIN);
+ DecodeEthernetFrameHeader(FrameIN->FrameData);
/* Cast the incoming Ethernet frame to the Ethernet header type */
Ethernet_Frame_Header_t* FrameINHeader = (Ethernet_Frame_Header_t*)&FrameIN->FrameData;
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h
index cb8e16c04..a67aca900 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/EthernetProtocols.h
@@ -37,6 +37,9 @@
#ifndef _ETHERNET_PROTOCOLS_H_
#define _ETHERNET_PROTOCOLS_H_
+ /* Includes: */
+ #include <LUFA/Drivers/USB/Class/RNDIS.h>
+
/* Macros: */
#define ETHERTYPE_IPV4 0x0800
#define ETHERTYPE_ARP 0x0806
@@ -72,6 +75,13 @@
#define PROTOCOL_SCTP 132
/* 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 a protocol IP address of a device on a network. */
typedef struct
{
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c
index de614956a..2c8c398f9 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.c
@@ -51,12 +51,12 @@
/** Decodes an Ethernet frame header and prints its contents to through the USART in a human readable format.
*
- * \param[in] FrameINData Pointer to the start of an Ethernet frame information structure
+ * \param[in] FrameINData Pointer to the start of an Ethernet frame data
*/
-void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* const FrameINData)
+void DecodeEthernetFrameHeader(void* InDataStart)
{
#if !defined(NO_DECODE_ETHERNET)
- Ethernet_Frame_Header_t* FrameHeader = (Ethernet_Frame_Header_t*)FrameINData->FrameData;
+ Ethernet_Frame_Header_t* FrameHeader = (Ethernet_Frame_Header_t*)InDataStart;
printf_P(PSTR("\r\n"));
@@ -84,10 +84,7 @@ void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* const FrameINData)
FrameHeader->Destination.Octets[4],
FrameHeader->Destination.Octets[5]);
- if (SwapEndian_16(FrameINData->FrameLength) > ETHERNET_VER2_MINSIZE)
- printf_P(PSTR(" + Protocol: 0x%04x\r\n"), SwapEndian_16(FrameHeader->EtherType));
- else
- printf_P(PSTR(" + Protocol: UNKNOWN E1\r\n"));
+ printf_P(PSTR(" + Protocol: 0x%04x\r\n"), SwapEndian_16(FrameHeader->EtherType));
#endif
}
diff --git a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h
index d798c2251..aeece3762 100644
--- a/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h
+++ b/Demos/Device/ClassDriver/RNDISEthernet/Lib/ProtocolDecoders.h
@@ -47,7 +47,7 @@
#include "Ethernet.h"
/* Function Prototypes: */
- void DecodeEthernetFrameHeader(Ethernet_Frame_Info_t* const FrameINData);
+ void DecodeEthernetFrameHeader(void* InDataStart);
void DecodeARPHeader(void* InDataStart);
void DecodeIPHeader(void* InDataStart);
void DecodeICMPHeader(void* InDataStart);
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
index 7749e7990..3ce62128c 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/Ethernet.h
@@ -81,6 +81,13 @@
#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
{
diff --git a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c
index cadd33563..827dc1ac3 100644
--- a/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c
+++ b/Demos/Device/LowLevel/RNDISEthernet/Lib/ProtocolDecoders.c
@@ -84,10 +84,7 @@ void DecodeEthernetFrameHeader(void* InDataStart)
FrameHeader->Destination.Octets[4],
FrameHeader->Destination.Octets[5]);
- if (SwapEndian_16(FrameIN.FrameLength) > ETHERNET_VER2_MINSIZE)
- printf_P(PSTR(" + Protocol: 0x%04x\r\n"), SwapEndian_16(FrameHeader->EtherType));
- else
- printf_P(PSTR(" + Protocol: UNKNOWN E1\r\n"));
+ printf_P(PSTR(" + Protocol: 0x%04x\r\n"), SwapEndian_16(FrameHeader->EtherType));
#endif
}