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-2003 Swedish Institute of Computer Science.
sam_grove 5:3f93dd1d4cb3 3 * Copyright (c) 2003-2004 Leon Woestenberg <leon.woestenberg@axon.tv>
sam_grove 5:3f93dd1d4cb3 4 * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands.
sam_grove 5:3f93dd1d4cb3 5 * All rights reserved.
sam_grove 5:3f93dd1d4cb3 6 *
sam_grove 5:3f93dd1d4cb3 7 * Redistribution and use in source and binary forms, with or without modification,
sam_grove 5:3f93dd1d4cb3 8 * are permitted provided that the following conditions are met:
sam_grove 5:3f93dd1d4cb3 9 *
sam_grove 5:3f93dd1d4cb3 10 * 1. Redistributions of source code must retain the above copyright notice,
sam_grove 5:3f93dd1d4cb3 11 * this list of conditions and the following disclaimer.
sam_grove 5:3f93dd1d4cb3 12 * 2. Redistributions in binary form must reproduce the above copyright notice,
sam_grove 5:3f93dd1d4cb3 13 * this list of conditions and the following disclaimer in the documentation
sam_grove 5:3f93dd1d4cb3 14 * and/or other materials provided with the distribution.
sam_grove 5:3f93dd1d4cb3 15 * 3. The name of the author may not be used to endorse or promote products
sam_grove 5:3f93dd1d4cb3 16 * derived from this software without specific prior written permission.
sam_grove 5:3f93dd1d4cb3 17 *
sam_grove 5:3f93dd1d4cb3 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
sam_grove 5:3f93dd1d4cb3 19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
sam_grove 5:3f93dd1d4cb3 20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
sam_grove 5:3f93dd1d4cb3 21 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
sam_grove 5:3f93dd1d4cb3 22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
sam_grove 5:3f93dd1d4cb3 23 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
sam_grove 5:3f93dd1d4cb3 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
sam_grove 5:3f93dd1d4cb3 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
sam_grove 5:3f93dd1d4cb3 26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
sam_grove 5:3f93dd1d4cb3 27 * OF SUCH DAMAGE.
sam_grove 5:3f93dd1d4cb3 28 *
sam_grove 5:3f93dd1d4cb3 29 * This file is part of the lwIP TCP/IP stack.
sam_grove 5:3f93dd1d4cb3 30 *
sam_grove 5:3f93dd1d4cb3 31 * Author: Adam Dunkels <adam@sics.se>
sam_grove 5:3f93dd1d4cb3 32 *
sam_grove 5:3f93dd1d4cb3 33 */
sam_grove 5:3f93dd1d4cb3 34
sam_grove 5:3f93dd1d4cb3 35 #ifndef __NETIF_ETHARP_H__
sam_grove 5:3f93dd1d4cb3 36 #define __NETIF_ETHARP_H__
sam_grove 5:3f93dd1d4cb3 37
sam_grove 5:3f93dd1d4cb3 38 #include "lwip/opt.h"
sam_grove 5:3f93dd1d4cb3 39
sam_grove 5:3f93dd1d4cb3 40 #if LWIP_ARP || LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */
sam_grove 5:3f93dd1d4cb3 41
sam_grove 5:3f93dd1d4cb3 42 #include "lwip/pbuf.h"
sam_grove 5:3f93dd1d4cb3 43 #include "lwip/ip_addr.h"
sam_grove 5:3f93dd1d4cb3 44 #include "lwip/netif.h"
sam_grove 5:3f93dd1d4cb3 45 #include "lwip/ip.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 #ifndef ETHARP_HWADDR_LEN
sam_grove 5:3f93dd1d4cb3 52 #define ETHARP_HWADDR_LEN 6
sam_grove 5:3f93dd1d4cb3 53 #endif
sam_grove 5:3f93dd1d4cb3 54
sam_grove 5:3f93dd1d4cb3 55 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 56 # include "arch/bpstruct.h"
sam_grove 5:3f93dd1d4cb3 57 #endif
sam_grove 5:3f93dd1d4cb3 58 PACK_STRUCT_BEGIN
sam_grove 5:3f93dd1d4cb3 59 struct eth_addr {
sam_grove 5:3f93dd1d4cb3 60 PACK_STRUCT_FIELD(u8_t addr[ETHARP_HWADDR_LEN]);
sam_grove 5:3f93dd1d4cb3 61 } PACK_STRUCT_STRUCT;
sam_grove 5:3f93dd1d4cb3 62 PACK_STRUCT_END
sam_grove 5:3f93dd1d4cb3 63 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 64 # include "arch/epstruct.h"
sam_grove 5:3f93dd1d4cb3 65 #endif
sam_grove 5:3f93dd1d4cb3 66
sam_grove 5:3f93dd1d4cb3 67 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 68 # include "arch/bpstruct.h"
sam_grove 5:3f93dd1d4cb3 69 #endif
sam_grove 5:3f93dd1d4cb3 70 PACK_STRUCT_BEGIN
sam_grove 5:3f93dd1d4cb3 71 /** Ethernet header */
sam_grove 5:3f93dd1d4cb3 72 struct eth_hdr {
sam_grove 5:3f93dd1d4cb3 73 #if ETH_PAD_SIZE
sam_grove 5:3f93dd1d4cb3 74 PACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]);
sam_grove 5:3f93dd1d4cb3 75 #endif
sam_grove 5:3f93dd1d4cb3 76 PACK_STRUCT_FIELD(struct eth_addr dest);
sam_grove 5:3f93dd1d4cb3 77 PACK_STRUCT_FIELD(struct eth_addr src);
sam_grove 5:3f93dd1d4cb3 78 PACK_STRUCT_FIELD(u16_t type);
sam_grove 5:3f93dd1d4cb3 79 } PACK_STRUCT_STRUCT;
sam_grove 5:3f93dd1d4cb3 80 PACK_STRUCT_END
sam_grove 5:3f93dd1d4cb3 81 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 82 # include "arch/epstruct.h"
sam_grove 5:3f93dd1d4cb3 83 #endif
sam_grove 5:3f93dd1d4cb3 84
sam_grove 5:3f93dd1d4cb3 85 #define SIZEOF_ETH_HDR (14 + ETH_PAD_SIZE)
sam_grove 5:3f93dd1d4cb3 86
sam_grove 5:3f93dd1d4cb3 87 #if ETHARP_SUPPORT_VLAN
sam_grove 5:3f93dd1d4cb3 88
sam_grove 5:3f93dd1d4cb3 89 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 90 # include "arch/bpstruct.h"
sam_grove 5:3f93dd1d4cb3 91 #endif
sam_grove 5:3f93dd1d4cb3 92 PACK_STRUCT_BEGIN
sam_grove 5:3f93dd1d4cb3 93 /** VLAN header inserted between ethernet header and payload
sam_grove 5:3f93dd1d4cb3 94 * if 'type' in ethernet header is ETHTYPE_VLAN.
sam_grove 5:3f93dd1d4cb3 95 * See IEEE802.Q */
sam_grove 5:3f93dd1d4cb3 96 struct eth_vlan_hdr {
sam_grove 5:3f93dd1d4cb3 97 PACK_STRUCT_FIELD(u16_t prio_vid);
sam_grove 5:3f93dd1d4cb3 98 PACK_STRUCT_FIELD(u16_t tpid);
sam_grove 5:3f93dd1d4cb3 99 } PACK_STRUCT_STRUCT;
sam_grove 5:3f93dd1d4cb3 100 PACK_STRUCT_END
sam_grove 5:3f93dd1d4cb3 101 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 102 # include "arch/epstruct.h"
sam_grove 5:3f93dd1d4cb3 103 #endif
sam_grove 5:3f93dd1d4cb3 104
sam_grove 5:3f93dd1d4cb3 105 #define SIZEOF_VLAN_HDR 4
sam_grove 5:3f93dd1d4cb3 106 #define VLAN_ID(vlan_hdr) (htons((vlan_hdr)->prio_vid) & 0xFFF)
sam_grove 5:3f93dd1d4cb3 107
sam_grove 5:3f93dd1d4cb3 108 #endif /* ETHARP_SUPPORT_VLAN */
sam_grove 5:3f93dd1d4cb3 109
sam_grove 5:3f93dd1d4cb3 110 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 111 # include "arch/bpstruct.h"
sam_grove 5:3f93dd1d4cb3 112 #endif
sam_grove 5:3f93dd1d4cb3 113 PACK_STRUCT_BEGIN
sam_grove 5:3f93dd1d4cb3 114 /** the ARP message, see RFC 826 ("Packet format") */
sam_grove 5:3f93dd1d4cb3 115 struct etharp_hdr {
sam_grove 5:3f93dd1d4cb3 116 PACK_STRUCT_FIELD(u16_t hwtype);
sam_grove 5:3f93dd1d4cb3 117 PACK_STRUCT_FIELD(u16_t proto);
sam_grove 5:3f93dd1d4cb3 118 PACK_STRUCT_FIELD(u8_t hwlen);
sam_grove 5:3f93dd1d4cb3 119 PACK_STRUCT_FIELD(u8_t protolen);
sam_grove 5:3f93dd1d4cb3 120 PACK_STRUCT_FIELD(u16_t opcode);
sam_grove 5:3f93dd1d4cb3 121 PACK_STRUCT_FIELD(struct eth_addr shwaddr);
sam_grove 5:3f93dd1d4cb3 122 PACK_STRUCT_FIELD(struct ip_addr2 sipaddr);
sam_grove 5:3f93dd1d4cb3 123 PACK_STRUCT_FIELD(struct eth_addr dhwaddr);
sam_grove 5:3f93dd1d4cb3 124 PACK_STRUCT_FIELD(struct ip_addr2 dipaddr);
sam_grove 5:3f93dd1d4cb3 125 } PACK_STRUCT_STRUCT;
sam_grove 5:3f93dd1d4cb3 126 PACK_STRUCT_END
sam_grove 5:3f93dd1d4cb3 127 #ifdef PACK_STRUCT_USE_INCLUDES
sam_grove 5:3f93dd1d4cb3 128 # include "arch/epstruct.h"
sam_grove 5:3f93dd1d4cb3 129 #endif
sam_grove 5:3f93dd1d4cb3 130
sam_grove 5:3f93dd1d4cb3 131 #define SIZEOF_ETHARP_HDR 28
sam_grove 5:3f93dd1d4cb3 132 #define SIZEOF_ETHARP_PACKET (SIZEOF_ETH_HDR + SIZEOF_ETHARP_HDR)
sam_grove 5:3f93dd1d4cb3 133
sam_grove 5:3f93dd1d4cb3 134 /** 5 seconds period */
sam_grove 5:3f93dd1d4cb3 135 #define ARP_TMR_INTERVAL 5000
sam_grove 5:3f93dd1d4cb3 136
sam_grove 5:3f93dd1d4cb3 137 #define ETHTYPE_ARP 0x0806U
sam_grove 5:3f93dd1d4cb3 138 #define ETHTYPE_IP 0x0800U
sam_grove 5:3f93dd1d4cb3 139 #define ETHTYPE_VLAN 0x8100U
sam_grove 5:3f93dd1d4cb3 140 #define ETHTYPE_PPPOEDISC 0x8863U /* PPP Over Ethernet Discovery Stage */
sam_grove 5:3f93dd1d4cb3 141 #define ETHTYPE_PPPOE 0x8864U /* PPP Over Ethernet Session Stage */
sam_grove 5:3f93dd1d4cb3 142
sam_grove 5:3f93dd1d4cb3 143 /** MEMCPY-like macro to copy to/from struct eth_addr's that are local variables
sam_grove 5:3f93dd1d4cb3 144 * or known to be 32-bit aligned within the protocol header. */
sam_grove 5:3f93dd1d4cb3 145 #ifndef ETHADDR32_COPY
sam_grove 5:3f93dd1d4cb3 146 #define ETHADDR32_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN)
sam_grove 5:3f93dd1d4cb3 147 #endif
sam_grove 5:3f93dd1d4cb3 148
sam_grove 5:3f93dd1d4cb3 149 /** MEMCPY-like macro to copy to/from struct eth_addr's that are no local
sam_grove 5:3f93dd1d4cb3 150 * variables and known to be 16-bit aligned within the protocol header. */
sam_grove 5:3f93dd1d4cb3 151 #ifndef ETHADDR16_COPY
sam_grove 5:3f93dd1d4cb3 152 #define ETHADDR16_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN)
sam_grove 5:3f93dd1d4cb3 153 #endif
sam_grove 5:3f93dd1d4cb3 154
sam_grove 5:3f93dd1d4cb3 155 #if LWIP_ARP /* don't build if not configured for use in lwipopts.h */
sam_grove 5:3f93dd1d4cb3 156
sam_grove 5:3f93dd1d4cb3 157 /** ARP message types (opcodes) */
sam_grove 5:3f93dd1d4cb3 158 #define ARP_REQUEST 1
sam_grove 5:3f93dd1d4cb3 159 #define ARP_REPLY 2
sam_grove 5:3f93dd1d4cb3 160
sam_grove 5:3f93dd1d4cb3 161 /** Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type)
sam_grove 5:3f93dd1d4cb3 162 * to a filter function that returns the correct netif when using multiple
sam_grove 5:3f93dd1d4cb3 163 * netifs on one hardware interface where the netif's low-level receive
sam_grove 5:3f93dd1d4cb3 164 * routine cannot decide for the correct netif (e.g. when mapping multiple
sam_grove 5:3f93dd1d4cb3 165 * IP addresses to one hardware interface).
sam_grove 5:3f93dd1d4cb3 166 */
sam_grove 5:3f93dd1d4cb3 167 #ifndef LWIP_ARP_FILTER_NETIF
sam_grove 5:3f93dd1d4cb3 168 #define LWIP_ARP_FILTER_NETIF 0
sam_grove 5:3f93dd1d4cb3 169 #endif
sam_grove 5:3f93dd1d4cb3 170
sam_grove 5:3f93dd1d4cb3 171 #if ARP_QUEUEING
sam_grove 5:3f93dd1d4cb3 172 /** struct for queueing outgoing packets for unknown address
sam_grove 5:3f93dd1d4cb3 173 * defined here to be accessed by memp.h
sam_grove 5:3f93dd1d4cb3 174 */
sam_grove 5:3f93dd1d4cb3 175 struct etharp_q_entry {
sam_grove 5:3f93dd1d4cb3 176 struct etharp_q_entry *next;
sam_grove 5:3f93dd1d4cb3 177 struct pbuf *p;
sam_grove 5:3f93dd1d4cb3 178 };
sam_grove 5:3f93dd1d4cb3 179 #endif /* ARP_QUEUEING */
sam_grove 5:3f93dd1d4cb3 180
sam_grove 5:3f93dd1d4cb3 181 #define etharp_init() /* Compatibility define, not init needed. */
sam_grove 5:3f93dd1d4cb3 182 void etharp_tmr(void);
sam_grove 5:3f93dd1d4cb3 183 s8_t etharp_find_addr(struct netif *netif, ip_addr_t *ipaddr,
sam_grove 5:3f93dd1d4cb3 184 struct eth_addr **eth_ret, ip_addr_t **ip_ret);
sam_grove 5:3f93dd1d4cb3 185 err_t etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr);
sam_grove 5:3f93dd1d4cb3 186 err_t etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q);
sam_grove 5:3f93dd1d4cb3 187 err_t etharp_request(struct netif *netif, ip_addr_t *ipaddr);
sam_grove 5:3f93dd1d4cb3 188 /** For Ethernet network interfaces, we might want to send "gratuitous ARP";
sam_grove 5:3f93dd1d4cb3 189 * this is an ARP packet sent by a node in order to spontaneously cause other
sam_grove 5:3f93dd1d4cb3 190 * nodes to update an entry in their ARP cache.
sam_grove 5:3f93dd1d4cb3 191 * From RFC 3220 "IP Mobility Support for IPv4" section 4.6. */
sam_grove 5:3f93dd1d4cb3 192 #define etharp_gratuitous(netif) etharp_request((netif), &(netif)->ip_addr)
sam_grove 5:3f93dd1d4cb3 193
sam_grove 5:3f93dd1d4cb3 194 #if ETHARP_SUPPORT_STATIC_ENTRIES
sam_grove 5:3f93dd1d4cb3 195 err_t etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr);
sam_grove 5:3f93dd1d4cb3 196 err_t etharp_remove_static_entry(ip_addr_t *ipaddr);
sam_grove 5:3f93dd1d4cb3 197 #endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
sam_grove 5:3f93dd1d4cb3 198
sam_grove 5:3f93dd1d4cb3 199 #if LWIP_AUTOIP
sam_grove 5:3f93dd1d4cb3 200 err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
sam_grove 5:3f93dd1d4cb3 201 const struct eth_addr *ethdst_addr,
sam_grove 5:3f93dd1d4cb3 202 const struct eth_addr *hwsrc_addr, const ip_addr_t *ipsrc_addr,
sam_grove 5:3f93dd1d4cb3 203 const struct eth_addr *hwdst_addr, const ip_addr_t *ipdst_addr,
sam_grove 5:3f93dd1d4cb3 204 const u16_t opcode);
sam_grove 5:3f93dd1d4cb3 205 #endif /* LWIP_AUTOIP */
sam_grove 5:3f93dd1d4cb3 206
sam_grove 5:3f93dd1d4cb3 207 #endif /* LWIP_ARP */
sam_grove 5:3f93dd1d4cb3 208
sam_grove 5:3f93dd1d4cb3 209 err_t ethernet_input(struct pbuf *p, struct netif *netif);
sam_grove 5:3f93dd1d4cb3 210
sam_grove 5:3f93dd1d4cb3 211 #define eth_addr_cmp(addr1, addr2) (memcmp((addr1)->addr, (addr2)->addr, ETHARP_HWADDR_LEN) == 0)
sam_grove 5:3f93dd1d4cb3 212
sam_grove 5:3f93dd1d4cb3 213 extern const struct eth_addr ethbroadcast, ethzero;
sam_grove 5:3f93dd1d4cb3 214
sam_grove 5:3f93dd1d4cb3 215 #ifdef __cplusplus
sam_grove 5:3f93dd1d4cb3 216 }
sam_grove 5:3f93dd1d4cb3 217 #endif
sam_grove 5:3f93dd1d4cb3 218
sam_grove 5:3f93dd1d4cb3 219 #endif /* LWIP_ARP || LWIP_ETHERNET */
sam_grove 5:3f93dd1d4cb3 220
sam_grove 5:3f93dd1d4cb3 221 #endif /* __NETIF_ARP_H__ */