Make XPLAINBridge serial bridge much more reliable for the reception of characters...
[pub/USBasp.git] / Demos / Device / LowLevel / RNDISEthernet / RNDISEthernet.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2010.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \file
32 *
33 * Header file for RNDISEthernet.c.
34 */
35
36 #ifndef _RNDISETHERNET_H_
37 #define _RNDISETHERNET_H_
38
39 /* Includes: */
40 #include <avr/io.h>
41 #include <avr/wdt.h>
42 #include <avr/power.h>
43 #include <avr/interrupt.h>
44 #include <string.h>
45
46 #include "Descriptors.h"
47
48 #include "Lib/RNDIS.h"
49 #include "Lib/Ethernet.h"
50 #include "Lib/TCP.h"
51 #include "Lib/ARP.h"
52 #include "Lib/Webserver.h"
53
54 #include <LUFA/Version.h>
55 #include <LUFA/Drivers/USB/USB.h>
56 #include <LUFA/Drivers/Board/LEDs.h>
57 #include <LUFA/Drivers/Peripheral/SerialStream.h>
58
59 /* Macros: */
60 /** Notification value to indicate that a frame is ready to be read by the host. */
61 #define NOTIF_RESPONSE_AVAILABLE 0x01
62
63 /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
64 #define LEDMASK_USB_NOTREADY LEDS_LED1
65
66 /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
67 #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
68
69 /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
70 #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
71
72 /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
73 #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
74
75 /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
76 #define LEDMASK_USB_BUSY LEDS_LED2
77
78 /* Type Defines: */
79 /** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification
80 * Endpoint.
81 */
82 typedef struct
83 {
84 uint8_t bmRequestType; /**< Notification type, a mask of values from SrdRequestType.h */
85 uint8_t bNotification; /**< Notification index, indicating what the RNDIS notification relates to */
86 uint16_t wValue; /**< Two byte notification value parameter */
87 uint16_t wIndex; /**< Two byte notification index parameter */
88 uint16_t wLength; /**< Size of data payload following the notification header */
89 } USB_Notification_t;
90
91 /* Function Prototypes: */
92 void SetupHardware(void);
93 void RNDIS_Task(void);
94 void Ethernet_Task(void);
95
96 void EVENT_USB_Device_Connect(void);
97 void EVENT_USB_Device_Disconnect(void);
98 void EVENT_USB_Device_ConfigurationChanged(void);
99 void EVENT_USB_Device_UnhandledControlRequest(void);
100
101 #endif