ID the MBED processor on the network if you have more than one. View MBED name on DHCP of your Router - Example \"MBED PE\" Change your ID in Core / host.h

Committer:
JeffM
Date:
Sat Nov 06 14:11:02 2010 +0000
Revision:
0:fd3b85615428
MBED ID 1A

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JeffM 0:fd3b85615428 1 /*
JeffM 0:fd3b85615428 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
JeffM 0:fd3b85615428 3 * All rights reserved.
JeffM 0:fd3b85615428 4 *
JeffM 0:fd3b85615428 5 * Redistribution and use in source and binary forms, with or without modification,
JeffM 0:fd3b85615428 6 * are permitted provided that the following conditions are met:
JeffM 0:fd3b85615428 7 *
JeffM 0:fd3b85615428 8 * 1. Redistributions of source code must retain the above copyright notice,
JeffM 0:fd3b85615428 9 * this list of conditions and the following disclaimer.
JeffM 0:fd3b85615428 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
JeffM 0:fd3b85615428 11 * this list of conditions and the following disclaimer in the documentation
JeffM 0:fd3b85615428 12 * and/or other materials provided with the distribution.
JeffM 0:fd3b85615428 13 * 3. The name of the author may not be used to endorse or promote products
JeffM 0:fd3b85615428 14 * derived from this software without specific prior written permission.
JeffM 0:fd3b85615428 15 *
JeffM 0:fd3b85615428 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
JeffM 0:fd3b85615428 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
JeffM 0:fd3b85615428 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
JeffM 0:fd3b85615428 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
JeffM 0:fd3b85615428 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
JeffM 0:fd3b85615428 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
JeffM 0:fd3b85615428 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
JeffM 0:fd3b85615428 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
JeffM 0:fd3b85615428 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
JeffM 0:fd3b85615428 25 * OF SUCH DAMAGE.
JeffM 0:fd3b85615428 26 *
JeffM 0:fd3b85615428 27 * This file is part of the lwIP TCP/IP stack.
JeffM 0:fd3b85615428 28 *
JeffM 0:fd3b85615428 29 * Author: Adam Dunkels <adam@sics.se>
JeffM 0:fd3b85615428 30 *
JeffM 0:fd3b85615428 31 */
JeffM 0:fd3b85615428 32 #ifndef __LWIP_TCPIP_H__
JeffM 0:fd3b85615428 33 #define __LWIP_TCPIP_H__
JeffM 0:fd3b85615428 34
JeffM 0:fd3b85615428 35 #include "lwip/opt.h"
JeffM 0:fd3b85615428 36
JeffM 0:fd3b85615428 37 #if !NO_SYS /* don't build if not configured for use in lwipopts.h */
JeffM 0:fd3b85615428 38
JeffM 0:fd3b85615428 39 #include "lwip/api_msg.h"
JeffM 0:fd3b85615428 40 #include "lwip/netifapi.h"
JeffM 0:fd3b85615428 41 #include "lwip/pbuf.h"
JeffM 0:fd3b85615428 42 #include "lwip/api.h"
JeffM 0:fd3b85615428 43 #include "lwip/sys.h"
JeffM 0:fd3b85615428 44 #include "lwip/timers.h"
JeffM 0:fd3b85615428 45 #include "lwip/netif.h"
JeffM 0:fd3b85615428 46
JeffM 0:fd3b85615428 47 #ifdef __cplusplus
JeffM 0:fd3b85615428 48 extern "C" {
JeffM 0:fd3b85615428 49 #endif
JeffM 0:fd3b85615428 50
JeffM 0:fd3b85615428 51 /** Define this to something that triggers a watchdog. This is called from
JeffM 0:fd3b85615428 52 * tcpip_thread after processing a message. */
JeffM 0:fd3b85615428 53 #ifndef LWIP_TCPIP_THREAD_ALIVE
JeffM 0:fd3b85615428 54 #define LWIP_TCPIP_THREAD_ALIVE()
JeffM 0:fd3b85615428 55 #endif
JeffM 0:fd3b85615428 56
JeffM 0:fd3b85615428 57 #if LWIP_TCPIP_CORE_LOCKING
JeffM 0:fd3b85615428 58 /** The global semaphore to lock the stack. */
JeffM 0:fd3b85615428 59 extern sys_mutex_t lock_tcpip_core;
JeffM 0:fd3b85615428 60 #define LOCK_TCPIP_CORE() sys_mutex_lock(&lock_tcpip_core)
JeffM 0:fd3b85615428 61 #define UNLOCK_TCPIP_CORE() sys_mutex_unlock(&lock_tcpip_core)
JeffM 0:fd3b85615428 62 #define TCPIP_APIMSG(m) tcpip_apimsg_lock(m)
JeffM 0:fd3b85615428 63 #define TCPIP_APIMSG_ACK(m)
JeffM 0:fd3b85615428 64 #define TCPIP_NETIFAPI(m) tcpip_netifapi_lock(m)
JeffM 0:fd3b85615428 65 #define TCPIP_NETIFAPI_ACK(m)
JeffM 0:fd3b85615428 66 #else /* LWIP_TCPIP_CORE_LOCKING */
JeffM 0:fd3b85615428 67 #define LOCK_TCPIP_CORE()
JeffM 0:fd3b85615428 68 #define UNLOCK_TCPIP_CORE()
JeffM 0:fd3b85615428 69 #define TCPIP_APIMSG(m) tcpip_apimsg(m)
JeffM 0:fd3b85615428 70 #define TCPIP_APIMSG_ACK(m) sys_sem_signal(&m->conn->op_completed)
JeffM 0:fd3b85615428 71 #define TCPIP_NETIFAPI(m) tcpip_netifapi(m)
JeffM 0:fd3b85615428 72 #define TCPIP_NETIFAPI_ACK(m) sys_sem_signal(&m->sem)
JeffM 0:fd3b85615428 73 #endif /* LWIP_TCPIP_CORE_LOCKING */
JeffM 0:fd3b85615428 74
JeffM 0:fd3b85615428 75 /** Function prototype for the init_done function passed to tcpip_init */
JeffM 0:fd3b85615428 76 typedef void (*tcpip_init_done_fn)(void *arg);
JeffM 0:fd3b85615428 77 /** Function prototype for functions passed to tcpip_callback() */
JeffM 0:fd3b85615428 78 typedef void (*tcpip_callback_fn)(void *ctx);
JeffM 0:fd3b85615428 79
JeffM 0:fd3b85615428 80 void tcpip_init(tcpip_init_done_fn tcpip_init_done, void *arg);
JeffM 0:fd3b85615428 81
JeffM 0:fd3b85615428 82 #if LWIP_NETCONN
JeffM 0:fd3b85615428 83 err_t tcpip_apimsg(struct api_msg *apimsg);
JeffM 0:fd3b85615428 84 #if LWIP_TCPIP_CORE_LOCKING
JeffM 0:fd3b85615428 85 err_t tcpip_apimsg_lock(struct api_msg *apimsg);
JeffM 0:fd3b85615428 86 #endif /* LWIP_TCPIP_CORE_LOCKING */
JeffM 0:fd3b85615428 87 #endif /* LWIP_NETCONN */
JeffM 0:fd3b85615428 88
JeffM 0:fd3b85615428 89 err_t tcpip_input(struct pbuf *p, struct netif *inp);
JeffM 0:fd3b85615428 90
JeffM 0:fd3b85615428 91 #if LWIP_NETIF_API
JeffM 0:fd3b85615428 92 err_t tcpip_netifapi(struct netifapi_msg *netifapimsg);
JeffM 0:fd3b85615428 93 #if LWIP_TCPIP_CORE_LOCKING
JeffM 0:fd3b85615428 94 err_t tcpip_netifapi_lock(struct netifapi_msg *netifapimsg);
JeffM 0:fd3b85615428 95 #endif /* LWIP_TCPIP_CORE_LOCKING */
JeffM 0:fd3b85615428 96 #endif /* LWIP_NETIF_API */
JeffM 0:fd3b85615428 97
JeffM 0:fd3b85615428 98 err_t tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block);
JeffM 0:fd3b85615428 99 #define tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1)
JeffM 0:fd3b85615428 100
JeffM 0:fd3b85615428 101 /* free pbufs or heap memory from another context without blocking */
JeffM 0:fd3b85615428 102 err_t pbuf_free_callback(struct pbuf *p);
JeffM 0:fd3b85615428 103 err_t mem_free_callback(void *m);
JeffM 0:fd3b85615428 104
JeffM 0:fd3b85615428 105 #if LWIP_TCPIP_TIMEOUT
JeffM 0:fd3b85615428 106 err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg);
JeffM 0:fd3b85615428 107 err_t tcpip_untimeout(sys_timeout_handler h, void *arg);
JeffM 0:fd3b85615428 108 #endif /* LWIP_TCPIP_TIMEOUT */
JeffM 0:fd3b85615428 109
JeffM 0:fd3b85615428 110 enum tcpip_msg_type {
JeffM 0:fd3b85615428 111 #if LWIP_NETCONN
JeffM 0:fd3b85615428 112 TCPIP_MSG_API,
JeffM 0:fd3b85615428 113 #endif /* LWIP_NETCONN */
JeffM 0:fd3b85615428 114 TCPIP_MSG_INPKT,
JeffM 0:fd3b85615428 115 #if LWIP_NETIF_API
JeffM 0:fd3b85615428 116 TCPIP_MSG_NETIFAPI,
JeffM 0:fd3b85615428 117 #endif /* LWIP_NETIF_API */
JeffM 0:fd3b85615428 118 #if LWIP_TCPIP_TIMEOUT
JeffM 0:fd3b85615428 119 TCPIP_MSG_TIMEOUT,
JeffM 0:fd3b85615428 120 TCPIP_MSG_UNTIMEOUT,
JeffM 0:fd3b85615428 121 #endif /* LWIP_TCPIP_TIMEOUT */
JeffM 0:fd3b85615428 122 TCPIP_MSG_CALLBACK
JeffM 0:fd3b85615428 123 };
JeffM 0:fd3b85615428 124
JeffM 0:fd3b85615428 125 struct tcpip_msg {
JeffM 0:fd3b85615428 126 enum tcpip_msg_type type;
JeffM 0:fd3b85615428 127 sys_sem_t *sem;
JeffM 0:fd3b85615428 128 union {
JeffM 0:fd3b85615428 129 #if LWIP_NETCONN
JeffM 0:fd3b85615428 130 struct api_msg *apimsg;
JeffM 0:fd3b85615428 131 #endif /* LWIP_NETCONN */
JeffM 0:fd3b85615428 132 #if LWIP_NETIF_API
JeffM 0:fd3b85615428 133 struct netifapi_msg *netifapimsg;
JeffM 0:fd3b85615428 134 #endif /* LWIP_NETIF_API */
JeffM 0:fd3b85615428 135 struct {
JeffM 0:fd3b85615428 136 struct pbuf *p;
JeffM 0:fd3b85615428 137 struct netif *netif;
JeffM 0:fd3b85615428 138 } inp;
JeffM 0:fd3b85615428 139 struct {
JeffM 0:fd3b85615428 140 tcpip_callback_fn function;
JeffM 0:fd3b85615428 141 void *ctx;
JeffM 0:fd3b85615428 142 } cb;
JeffM 0:fd3b85615428 143 #if LWIP_TCPIP_TIMEOUT
JeffM 0:fd3b85615428 144 struct {
JeffM 0:fd3b85615428 145 u32_t msecs;
JeffM 0:fd3b85615428 146 sys_timeout_handler h;
JeffM 0:fd3b85615428 147 void *arg;
JeffM 0:fd3b85615428 148 } tmo;
JeffM 0:fd3b85615428 149 #endif /* LWIP_TCPIP_TIMEOUT */
JeffM 0:fd3b85615428 150 } msg;
JeffM 0:fd3b85615428 151 };
JeffM 0:fd3b85615428 152
JeffM 0:fd3b85615428 153 #ifdef __cplusplus
JeffM 0:fd3b85615428 154 }
JeffM 0:fd3b85615428 155 #endif
JeffM 0:fd3b85615428 156
JeffM 0:fd3b85615428 157 #endif /* !NO_SYS */
JeffM 0:fd3b85615428 158
JeffM 0:fd3b85615428 159 #endif /* __LWIP_TCPIP_H__ */