From 21dea1aba3e8308ab9b1a62a6735bed47f13d522 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 30 Jun 2015 00:47:42 +0200 Subject: ported usb-eth to new lufa --- usb-eth/usb-eth.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'usb-eth/usb-eth.c') 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(); } -- cgit v1.2.3