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 * @file
sam_grove 5:3f93dd1d4cb3 3 * Common functions used throughout the stack.
sam_grove 5:3f93dd1d4cb3 4 *
sam_grove 5:3f93dd1d4cb3 5 */
sam_grove 5:3f93dd1d4cb3 6
sam_grove 5:3f93dd1d4cb3 7 /*
sam_grove 5:3f93dd1d4cb3 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
sam_grove 5:3f93dd1d4cb3 9 * All rights reserved.
sam_grove 5:3f93dd1d4cb3 10 *
sam_grove 5:3f93dd1d4cb3 11 * Redistribution and use in source and binary forms, with or without modification,
sam_grove 5:3f93dd1d4cb3 12 * are permitted provided that the following conditions are met:
sam_grove 5:3f93dd1d4cb3 13 *
sam_grove 5:3f93dd1d4cb3 14 * 1. Redistributions of source code must retain the above copyright notice,
sam_grove 5:3f93dd1d4cb3 15 * this list of conditions and the following disclaimer.
sam_grove 5:3f93dd1d4cb3 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
sam_grove 5:3f93dd1d4cb3 17 * this list of conditions and the following disclaimer in the documentation
sam_grove 5:3f93dd1d4cb3 18 * and/or other materials provided with the distribution.
sam_grove 5:3f93dd1d4cb3 19 * 3. The name of the author may not be used to endorse or promote products
sam_grove 5:3f93dd1d4cb3 20 * derived from this software without specific prior written permission.
sam_grove 5:3f93dd1d4cb3 21 *
sam_grove 5:3f93dd1d4cb3 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
sam_grove 5:3f93dd1d4cb3 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
sam_grove 5:3f93dd1d4cb3 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
sam_grove 5:3f93dd1d4cb3 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
sam_grove 5:3f93dd1d4cb3 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
sam_grove 5:3f93dd1d4cb3 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
sam_grove 5:3f93dd1d4cb3 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
sam_grove 5:3f93dd1d4cb3 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
sam_grove 5:3f93dd1d4cb3 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
sam_grove 5:3f93dd1d4cb3 31 * OF SUCH DAMAGE.
sam_grove 5:3f93dd1d4cb3 32 *
sam_grove 5:3f93dd1d4cb3 33 * This file is part of the lwIP TCP/IP stack.
sam_grove 5:3f93dd1d4cb3 34 *
sam_grove 5:3f93dd1d4cb3 35 * Author: Simon Goldschmidt
sam_grove 5:3f93dd1d4cb3 36 *
sam_grove 5:3f93dd1d4cb3 37 */
sam_grove 5:3f93dd1d4cb3 38
sam_grove 5:3f93dd1d4cb3 39 #include "lwip/opt.h"
sam_grove 5:3f93dd1d4cb3 40 #include "lwip/def.h"
sam_grove 5:3f93dd1d4cb3 41
sam_grove 5:3f93dd1d4cb3 42 /**
sam_grove 5:3f93dd1d4cb3 43 * These are reference implementations of the byte swapping functions.
sam_grove 5:3f93dd1d4cb3 44 * Again with the aim of being simple, correct and fully portable.
sam_grove 5:3f93dd1d4cb3 45 * Byte swapping is the second thing you would want to optimize. You will
sam_grove 5:3f93dd1d4cb3 46 * need to port it to your architecture and in your cc.h:
sam_grove 5:3f93dd1d4cb3 47 *
sam_grove 5:3f93dd1d4cb3 48 * #define LWIP_PLATFORM_BYTESWAP 1
sam_grove 5:3f93dd1d4cb3 49 * #define LWIP_PLATFORM_HTONS(x) <your_htons>
sam_grove 5:3f93dd1d4cb3 50 * #define LWIP_PLATFORM_HTONL(x) <your_htonl>
sam_grove 5:3f93dd1d4cb3 51 *
sam_grove 5:3f93dd1d4cb3 52 * Note ntohs() and ntohl() are merely references to the htonx counterparts.
sam_grove 5:3f93dd1d4cb3 53 */
sam_grove 5:3f93dd1d4cb3 54
sam_grove 5:3f93dd1d4cb3 55 #if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN)
sam_grove 5:3f93dd1d4cb3 56
sam_grove 5:3f93dd1d4cb3 57 /**
sam_grove 5:3f93dd1d4cb3 58 * Convert an u16_t from host- to network byte order.
sam_grove 5:3f93dd1d4cb3 59 *
sam_grove 5:3f93dd1d4cb3 60 * @param n u16_t in host byte order
sam_grove 5:3f93dd1d4cb3 61 * @return n in network byte order
sam_grove 5:3f93dd1d4cb3 62 */
sam_grove 5:3f93dd1d4cb3 63 u16_t
sam_grove 5:3f93dd1d4cb3 64 lwip_htons(u16_t n)
sam_grove 5:3f93dd1d4cb3 65 {
sam_grove 5:3f93dd1d4cb3 66 return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
sam_grove 5:3f93dd1d4cb3 67 }
sam_grove 5:3f93dd1d4cb3 68
sam_grove 5:3f93dd1d4cb3 69 /**
sam_grove 5:3f93dd1d4cb3 70 * Convert an u16_t from network- to host byte order.
sam_grove 5:3f93dd1d4cb3 71 *
sam_grove 5:3f93dd1d4cb3 72 * @param n u16_t in network byte order
sam_grove 5:3f93dd1d4cb3 73 * @return n in host byte order
sam_grove 5:3f93dd1d4cb3 74 */
sam_grove 5:3f93dd1d4cb3 75 u16_t
sam_grove 5:3f93dd1d4cb3 76 lwip_ntohs(u16_t n)
sam_grove 5:3f93dd1d4cb3 77 {
sam_grove 5:3f93dd1d4cb3 78 return lwip_htons(n);
sam_grove 5:3f93dd1d4cb3 79 }
sam_grove 5:3f93dd1d4cb3 80
sam_grove 5:3f93dd1d4cb3 81 /**
sam_grove 5:3f93dd1d4cb3 82 * Convert an u32_t from host- to network byte order.
sam_grove 5:3f93dd1d4cb3 83 *
sam_grove 5:3f93dd1d4cb3 84 * @param n u32_t in host byte order
sam_grove 5:3f93dd1d4cb3 85 * @return n in network byte order
sam_grove 5:3f93dd1d4cb3 86 */
sam_grove 5:3f93dd1d4cb3 87 u32_t
sam_grove 5:3f93dd1d4cb3 88 lwip_htonl(u32_t n)
sam_grove 5:3f93dd1d4cb3 89 {
sam_grove 5:3f93dd1d4cb3 90 return ((n & 0xff) << 24) |
sam_grove 5:3f93dd1d4cb3 91 ((n & 0xff00) << 8) |
sam_grove 5:3f93dd1d4cb3 92 ((n & 0xff0000UL) >> 8) |
sam_grove 5:3f93dd1d4cb3 93 ((n & 0xff000000UL) >> 24);
sam_grove 5:3f93dd1d4cb3 94 }
sam_grove 5:3f93dd1d4cb3 95
sam_grove 5:3f93dd1d4cb3 96 /**
sam_grove 5:3f93dd1d4cb3 97 * Convert an u32_t from network- to host byte order.
sam_grove 5:3f93dd1d4cb3 98 *
sam_grove 5:3f93dd1d4cb3 99 * @param n u32_t in network byte order
sam_grove 5:3f93dd1d4cb3 100 * @return n in host byte order
sam_grove 5:3f93dd1d4cb3 101 */
sam_grove 5:3f93dd1d4cb3 102 u32_t
sam_grove 5:3f93dd1d4cb3 103 lwip_ntohl(u32_t n)
sam_grove 5:3f93dd1d4cb3 104 {
sam_grove 5:3f93dd1d4cb3 105 return lwip_htonl(n);
sam_grove 5:3f93dd1d4cb3 106 }
sam_grove 5:3f93dd1d4cb3 107
sam_grove 5:3f93dd1d4cb3 108 #endif /* (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) */