Contiki 2.6

rndis_task.h

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00002 /*! \file rndis_task.h *********************************************************
00003  *
00004  * \brief
00005  *      This file manages the RNDIS task
00006  *
00007  * \addtogroup usbstick
00008  *
00009  * \author
00010  *      Colin O'Flynn
00011  *
00012  ******************************************************************************/
00013 /* Copyright (c) 2008  ATMEL Corporation
00014    Copyright (c) 2008 Colin O'Flynn
00015    All rights reserved.
00016 
00017    Redistribution and use in source and binary forms, with or without
00018    modification, are permitted provided that the following conditions are met:
00019 
00020    * Redistributions of source code must retain the above copyright
00021      notice, this list of conditions and the following disclaimer.
00022    * Redistributions in binary form must reproduce the above copyright
00023      notice, this list of conditions and the following disclaimer in
00024      the documentation and/or other materials provided with the
00025      distribution.
00026    * Neither the name of the copyright holders nor the names of
00027      contributors may be used to endorse or promote products derived
00028      from this software without specific prior written permission.
00029 
00030   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00031   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00032   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00033   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00034   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00035   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00036   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00037   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00038   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00039   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00040   POSSIBILITY OF SUCH DAMAGE.
00041 */
00042 
00043 #ifndef _RNDIS_TASK_H_
00044 #define _RNDIS_TASK_H_
00045 
00046 /**
00047  \addtogroup RNDIS
00048  @{
00049  */
00050 
00051 //_____ I N C L U D E S ____________________________________________________
00052 
00053 
00054 #include "config.h"
00055 #include "../conf_usb.h"
00056 
00057 //_____ M A C R O S ________________________________________________________
00058 
00059 #define USB_ETH_MTU     UIP_BUFSIZE+4
00060 
00061 
00062 /*! Hook Documentation
00063 **      USB_ETH_HOOK_RX_START()
00064 **      USB_ETH_HOOK_RX_END()
00065 **      USB_ETH_HOOK_RX_ERROR(string_reason)
00066 **
00067 **      USB_ETH_HOOK_TX_START()
00068 **      USB_ETH_HOOK_TX_END()
00069 **      USB_ETH_HOOK_TX_ERROR(string_reason)
00070 **
00071 **      USB_ETH_HOOK_INITIALIZED()
00072 **      USB_ETH_HOOK_UNINITIALIZED()
00073 **
00074 **      USB_ETH_HOOK_INIT()
00075 **
00076 **      USB_ETH_HOOK_SET_PROMISCIOUS_MODE(bool)
00077 **
00078 **      USB_ETH_HOOK_HANDLE_INBOUND_PACKET(buffer,len)
00079 **      USB_ETH_HOOK_IS_READY_FOR_INBOUND_PACKET()
00080 */
00081 
00082 
00083 
00084 #ifndef USB_ETH_HOOK_RX_START
00085 void rx_start_led(void);
00086 #define USB_ETH_HOOK_RX_START() rx_start_led()
00087 #endif
00088 
00089 #ifndef USB_ETH_HOOK_TX_END
00090 void tx_end_led(void);
00091 #define USB_ETH_HOOK_TX_END()   tx_end_led()
00092 #endif
00093 
00094 
00095 
00096 #ifndef USB_ETH_HOOK_TX_ERROR
00097 #define USB_ETH_HOOK_TX_ERROR(string)   do { } while(0)
00098 #endif
00099 
00100 #ifndef USB_ETH_HOOK_RX_ERROR
00101 #define USB_ETH_HOOK_RX_ERROR(string)   do { } while(0)
00102 #endif
00103 
00104 //_____ D E C L A R A T I O N S ____________________________________________
00105 
00106 
00107 uint8_t usb_eth_send(uint8_t * senddata, uint16_t sendlen, uint8_t led);
00108 uint8_t usb_eth_set_active(uint8_t active);
00109 uint8_t usb_eth_ready_for_next_packet();
00110 
00111 void sof_action(void);
00112 
00113 extern uint8_t usb_eth_is_active;
00114 
00115 // TIP: Avoid using usb_ethernet_addr directly and use the get/set mac_address functions below.
00116 extern uint64_t usb_ethernet_addr;
00117 void usb_eth_get_mac_address(uint8_t dest[6]);
00118 void usb_eth_set_mac_address(const uint8_t src[6]);
00119 
00120 PROCESS_NAME(usb_eth_process);
00121 
00122 /** @} */
00123 
00124 #endif /* _RNDIS_TASK_H_ */
00125