Move new Class Driver powered demos to a new ClassDriver subdirectory, re-add old...
[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> // Library Version Information
56 #include <LUFA/Drivers/USB/USB.h> // USB Functionality
57 #include <LUFA/Drivers/Board/LEDs.h> // LEDs driver
58 #include <LUFA/Scheduler/Scheduler.h> // Simple scheduler for task management
59 #include <LUFA/Drivers/Peripheral/SerialStream.h> // Serial stream driver
60
61 /* Macros: */
62 /** Notification value to indicate that a frame is ready to be read by the host. */
63 #define NOTIF_RESPONSE_AVAILABLE 0x01
64
65 /* Type Defines: */
66 /** Type define for a RNDIS notification message, for transmission to the RNDIS host via the notification
67 * Endpoint.
68 */
69 typedef struct
70 {
71 uint8_t bmRequestType; /**< Notification type, a mask of values from SrdRequestType.h */
72 uint8_t bNotification; /**< Notification index, indicating what the RNDIS notification relates to */
73 uint16_t wValue; /**< Two byte notification value parameter */
74 uint16_t wIndex; /**< Two byte notification index parameter */
75 uint16_t wLength; /**< Size of data payload following the notification header */
76 } USB_Notification_t;
77
78 /* Enums: */
79 /** Enum for the possible status codes for passing to the UpdateStatus() function. */
80 enum RNDISEthernet_StatusCodes_t
81 {
82 Status_USBNotReady = 0, /**< USB is not ready (disconnected from a USB host) */
83 Status_USBEnumerating = 1, /**< USB interface is enumerating */
84 Status_USBReady = 2, /**< USB interface is connected and ready */
85 Status_ProcessingEthernetFrame = 3, /**< Currently processing an ethernet frame from the host */
86 };
87
88 /* Tasks: */
89 TASK(RNDIS_Task);
90 TASK(Ethernet_Task);
91
92 /* Function Prototypes: */
93 void EVENT_USB_Connect(void);
94 void EVENT_USB_Disconnect(void);
95 void EVENT_USB_ConfigurationChanged(void);
96 void EVENT_USB_UnhandledControlPacket(void);
97
98 void UpdateStatus(uint8_t CurrentStatus);
99
100 #endif