Contiki 2.5
rndis_task.h
Go to the documentation of this file.
1 /* This file has been prepared for Doxygen automatic documentation generation.*/
2 /*! \file rndis_task.h *********************************************************
3  *
4  * \brief
5  * This file manages the RNDIS task
6  *
7  * \addtogroup usbstick
8  *
9  * \author
10  * Colin O'Flynn
11  *
12  ******************************************************************************/
13 /* Copyright (c) 2008 ATMEL Corporation
14  Copyright (c) 2008 Colin O'Flynn
15  All rights reserved.
16 
17  Redistribution and use in source and binary forms, with or without
18  modification, are permitted provided that the following conditions are met:
19 
20  * Redistributions of source code must retain the above copyright
21  notice, this list of conditions and the following disclaimer.
22  * Redistributions in binary form must reproduce the above copyright
23  notice, this list of conditions and the following disclaimer in
24  the documentation and/or other materials provided with the
25  distribution.
26  * Neither the name of the copyright holders nor the names of
27  contributors may be used to endorse or promote products derived
28  from this software without specific prior written permission.
29 
30  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
34  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40  POSSIBILITY OF SUCH DAMAGE.
41 */
42 
43 #ifndef _RNDIS_TASK_H_
44 #define _RNDIS_TASK_H_
45 
46 /**
47  \addtogroup RNDIS
48  @{
49  */
50 
51 //_____ I N C L U D E S ____________________________________________________
52 
53 
54 #include "config.h"
55 #include "../conf_usb.h"
56 
57 //_____ M A C R O S ________________________________________________________
58 
59 #define USB_ETH_MTU UIP_BUFSIZE+4
60 
61 
62 /*! Hook Documentation
63 ** USB_ETH_HOOK_RX_START()
64 ** USB_ETH_HOOK_RX_END()
65 ** USB_ETH_HOOK_RX_ERROR(string_reason)
66 **
67 ** USB_ETH_HOOK_TX_START()
68 ** USB_ETH_HOOK_TX_END()
69 ** USB_ETH_HOOK_TX_ERROR(string_reason)
70 **
71 ** USB_ETH_HOOK_INITIALIZED()
72 ** USB_ETH_HOOK_UNINITIALIZED()
73 **
74 ** USB_ETH_HOOK_INIT()
75 **
76 ** USB_ETH_HOOK_SET_PROMISCIOUS_MODE(bool)
77 **
78 ** USB_ETH_HOOK_HANDLE_INBOUND_PACKET(buffer,len)
79 ** USB_ETH_HOOK_IS_READY_FOR_INBOUND_PACKET()
80 */
81 
82 
83 
84 #ifndef USB_ETH_HOOK_RX_START
85 void rx_start_led(void);
86 #define USB_ETH_HOOK_RX_START() rx_start_led()
87 #endif
88 
89 #ifndef USB_ETH_HOOK_TX_END
90 void tx_end_led(void);
91 #define USB_ETH_HOOK_TX_END() tx_end_led()
92 #endif
93 
94 
95 
96 #ifndef USB_ETH_HOOK_TX_ERROR
97 #define USB_ETH_HOOK_TX_ERROR(string) do { } while(0)
98 #endif
99 
100 #ifndef USB_ETH_HOOK_RX_ERROR
101 #define USB_ETH_HOOK_RX_ERROR(string) do { } while(0)
102 #endif
103 
104 //_____ D E C L A R A T I O N S ____________________________________________
105 
106 
107 uint8_t usb_eth_send(uint8_t * senddata, uint16_t sendlen, uint8_t led);
108 uint8_t usb_eth_set_active(uint8_t active);
109 uint8_t usb_eth_ready_for_next_packet();
110 
111 void sof_action(void);
112 
113 extern uint8_t usb_eth_is_active;
114 
115 // TIP: Avoid using usb_ethernet_addr directly and use the get/set mac_address functions below.
116 extern uint64_t usb_ethernet_addr;
117 void usb_eth_get_mac_address(uint8_t dest[6]);
118 void usb_eth_set_mac_address(const uint8_t src[6]);
119 
120 PROCESS_NAME(usb_eth_process);
121 
122 /** @} */
123 
124 #endif /* _RNDIS_TASK_H_ */
125