mbeduino + Weatherduino Weather Stations post test

Dependencies:   mbed

Committer:
okini3939
Date:
Tue Oct 26 17:19:28 2010 +0000
Revision:
0:10bcaa7c2253

        

Who changed what in which revision?

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