summaryrefslogtreecommitdiff
path: root/usb-eth
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-06-30 00:47:42 +0200
committerChristian Pointner <equinox@spreadspace.org>2015-06-30 00:47:42 +0200
commit21dea1aba3e8308ab9b1a62a6735bed47f13d522 (patch)
tree78ce5f3da71fc89d1da0f03c808bf511030f99de /usb-eth
parentupdate usb-pwm example to new lufa (diff)
ported usb-eth to new lufa
Diffstat (limited to 'usb-eth')
-rw-r--r--usb-eth/Makefile7
-rw-r--r--usb-eth/usb-eth.c43
2 files changed, 29 insertions, 21 deletions
diff --git a/usb-eth/Makefile b/usb-eth/Makefile
index 23c51f7..f7f6eb5 100644
--- a/usb-eth/Makefile
+++ b/usb-eth/Makefile
@@ -27,16 +27,15 @@ LIBS := util led lufa-descriptor-rndis
EXTERNAL_LIBS := lufa
SPREADAVR_PATH := ..
-LUFA_PATH := $(SPREADAVR_PATH)/contrib/LUFA-120219
-
+LUFA_PATH := $(SPREADAVR_PATH)/contrib/lufa-LUFA-140928
LUFA_OPTS = -D USB_DEVICE_ONLY
LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
-LUFA_OPTS += -D USB_MANUFACTURER="L\"equinox\"" -D USB_MANUFACTURER_LEN=7
-LUFA_OPTS += -D USB_PRODUCT="L\"spreadspace usb-eth example\"" -D USB_PRODUCT_LEN=27
+LUFA_OPTS += -D USB_MANUFACTURER="L\"equinox\""
+LUFA_OPTS += -D USB_PRODUCT="L\"spreadspace usb-eth example\""
LUFA_COMPONENTS := USB USBCLASS
diff --git a/usb-eth/usb-eth.c b/usb-eth/usb-eth.c
index 71e4a3b..67fb861 100644
--- a/usb-eth/usb-eth.c
+++ b/usb-eth/usb-eth.c
@@ -31,7 +31,7 @@
/*
LUFA Library
- Copyright (C) Dean Camera, 2012.
+ Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
@@ -43,6 +43,8 @@
#define ADAPTER_MAC_ADDR {0x02, 0x00, 0x02, 0x00, 0x02, 0x00}
#define MY_MAC_ADDR {0x01, 0x02, 0x03, 0x04, 0x05, 0x06}
+static uint8_t RNDIS_Message_Buffer[192];
+
/** LUFA RNDIS Class driver interface configuration and state information. This structure is
* passed to all RNDIS Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
@@ -51,22 +53,29 @@ USB_ClassInfo_RNDIS_Device_t Ethernet_RNDIS_Interface =
{
.Config =
{
- .ControlInterfaceNumber = 0,
-
- .DataINEndpointNumber = CDC_TX_EPNUM,
- .DataINEndpointSize = CDC_TXRX_EPSIZE,
- .DataINEndpointDoubleBank = false,
-
- .DataOUTEndpointNumber = CDC_RX_EPNUM,
- .DataOUTEndpointSize = CDC_TXRX_EPSIZE,
- .DataOUTEndpointDoubleBank = false,
-
- .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM,
- .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE,
- .NotificationEndpointDoubleBank = false,
-
- .AdapterVendorDescription = "LUFA RNDIS Adapter",
+ .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI,
+ .DataINEndpoint =
+ {
+ .Address = CDC_TX_EPADDR,
+ .Size = CDC_TXRX_EPSIZE,
+ .Banks = 1,
+ },
+ .DataOUTEndpoint =
+ {
+ .Address = CDC_RX_EPADDR,
+ .Size = CDC_TXRX_EPSIZE,
+ .Banks = 1,
+ },
+ .NotificationEndpoint =
+ {
+ .Address = CDC_NOTIFICATION_EPADDR,
+ .Size = CDC_NOTIFICATION_EPSIZE,
+ .Banks = 1,
+ },
+ .AdapterVendorDescription = "LUFA RNDIS Demo Adapter",
.AdapterMACAddress = {ADAPTER_MAC_ADDR},
+ .MessageBuffer = RNDIS_Message_Buffer,
+ .MessageBufferLength = sizeof(RNDIS_Message_Buffer),
},
};
@@ -126,7 +135,7 @@ int main(void)
RNDIS_Device_SendPacket(&Ethernet_RNDIS_Interface, eth_recv_buf.data, eth_recv_buf.len);
led_off();
}
-
+
RNDIS_Device_USBTask(&Ethernet_RNDIS_Interface);
USB_USBTask();
}