Renamed all library events to properly seperate out Device and Host mode events....
[pub/USBasp.git] / Demos / Device / LowLevel / RNDISEthernet / RNDISEthernet.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2009.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2009 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, and distribute this software
13 and its documentation for any purpose and without fee is hereby
14 granted, provided that the above copyright notice appear in all
15 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/pgmspace.h>
43 #include <avr/power.h>
44 #include <string.h>
45 #include <stdio.h>
46
47 #include "Descriptors.h"
48
49 #include "Lib/RNDIS.h"
50 #include "Lib/Ethernet.h"
51 #include "Lib/TCP.h"
52 #include "Lib/ARP.h"
53 #include "Lib/Webserver.h"
54
55 #include <LUFA/Version.h>
56 #include <LUFA/Drivers/USB/USB.h>
57 #include <LUFA/Drivers/Board/LEDs.h>
58 #include <LUFA/Drivers/Peripheral/SerialStream.h>
59
60 /* Macros: */
61 /** Notification value to indicate that a frame is ready to be read by the host. */
62 #define NOTIF_RESPONSE_AVAILABLE 0x01
63
64 /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
65 #define LEDMASK_USB_NOTREADY LEDS_LED1
66
67 /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
68 #define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
69
70 /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
71 #define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
72
73 /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
74 #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
75
76 /** LED mask for the library LED driver, to indicate that the USB interface is busy. */
77 #define LEDMASK_USB_BUSY (LEDS_LED2)
78
79 /* Type Defines: */
80 /** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification
81 * Endpoint.
82 */
83 typedef struct
84 {
85 uint8_t bmRequestType; /**< Notification type, a mask of values from SrdRequestType.h */
86 uint8_t bNotification; /**< Notification index, indicating what the RNDIS notification relates to */
87 uint16_t wValue; /**< Two byte notification value parameter */
88 uint16_t wIndex; /**< Two byte notification index parameter */
89 uint16_t wLength; /**< Size of data payload following the notification header */
90 } USB_Notification_t;
91
92 /* Function Prototypes: */
93 void SetupHardware(void);
94 void RNDIS_Task(void);
95 void Ethernet_Task(void);
96
97 void EVENT_USB_Device_Connect(void);
98 void EVENT_USB_Device_Disconnect(void);
99 void EVENT_USB_Device_ConfigurationChanged(void);
100 void EVENT_USB_Device_UnhandledControlRequest(void);
101
102 #endif