Integrating the ublox LISA C200 modem

Fork of SprintUSBModemHTTPClientTest by Donatien Garnier

Committer:
sam_grove
Date:
Thu Sep 26 00:44:20 2013 -0500
Revision:
5:3f93dd1d4cb3
Exported program and replaced contents of the repo with the source
to build and debug using keil mdk. Libs NOT upto date are lwip, lwip-sys
and socket. these have newer versions under mbed_official but were starting
from a know working point

Who changed what in which revision?

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