Trial code integration web page update with analogue data and ntp support

Dependencies:   NTPClient_NetServices mbed

Committer:
pmr1
Date:
Fri Aug 06 17:57:45 2010 +0000
Revision:
0:8cc2035bebfc

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pmr1 0:8cc2035bebfc 1 /*
pmr1 0:8cc2035bebfc 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
pmr1 0:8cc2035bebfc 3 * All rights reserved.
pmr1 0:8cc2035bebfc 4 *
pmr1 0:8cc2035bebfc 5 * Redistribution and use in source and binary forms, with or without modification,
pmr1 0:8cc2035bebfc 6 * are permitted provided that the following conditions are met:
pmr1 0:8cc2035bebfc 7 *
pmr1 0:8cc2035bebfc 8 * 1. Redistributions of source code must retain the above copyright notice,
pmr1 0:8cc2035bebfc 9 * this list of conditions and the following disclaimer.
pmr1 0:8cc2035bebfc 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
pmr1 0:8cc2035bebfc 11 * this list of conditions and the following disclaimer in the documentation
pmr1 0:8cc2035bebfc 12 * and/or other materials provided with the distribution.
pmr1 0:8cc2035bebfc 13 * 3. The name of the author may not be used to endorse or promote products
pmr1 0:8cc2035bebfc 14 * derived from this software without specific prior written permission.
pmr1 0:8cc2035bebfc 15 *
pmr1 0:8cc2035bebfc 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
pmr1 0:8cc2035bebfc 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
pmr1 0:8cc2035bebfc 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
pmr1 0:8cc2035bebfc 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
pmr1 0:8cc2035bebfc 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
pmr1 0:8cc2035bebfc 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
pmr1 0:8cc2035bebfc 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
pmr1 0:8cc2035bebfc 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
pmr1 0:8cc2035bebfc 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
pmr1 0:8cc2035bebfc 25 * OF SUCH DAMAGE.
pmr1 0:8cc2035bebfc 26 *
pmr1 0:8cc2035bebfc 27 * This file is part of the lwIP TCP/IP stack.
pmr1 0:8cc2035bebfc 28 */
pmr1 0:8cc2035bebfc 29
pmr1 0:8cc2035bebfc 30 /*
pmr1 0:8cc2035bebfc 31 * This is the interface to the platform specific serial IO module
pmr1 0:8cc2035bebfc 32 * It needs to be implemented by those platforms which need SLIP or PPP
pmr1 0:8cc2035bebfc 33 */
pmr1 0:8cc2035bebfc 34
pmr1 0:8cc2035bebfc 35 #ifndef __SIO_H__
pmr1 0:8cc2035bebfc 36 #define __SIO_H__
pmr1 0:8cc2035bebfc 37
pmr1 0:8cc2035bebfc 38 #include "lwip/arch.h"
pmr1 0:8cc2035bebfc 39
pmr1 0:8cc2035bebfc 40 #ifdef __cplusplus
pmr1 0:8cc2035bebfc 41 extern "C" {
pmr1 0:8cc2035bebfc 42 #endif
pmr1 0:8cc2035bebfc 43
pmr1 0:8cc2035bebfc 44 /* If you want to define sio_fd_t elsewhere or differently,
pmr1 0:8cc2035bebfc 45 define this in your cc.h file. */
pmr1 0:8cc2035bebfc 46 #ifndef __sio_fd_t_defined
pmr1 0:8cc2035bebfc 47 typedef void * sio_fd_t;
pmr1 0:8cc2035bebfc 48 #endif
pmr1 0:8cc2035bebfc 49
pmr1 0:8cc2035bebfc 50 /* The following functions can be defined to something else in your cc.h file
pmr1 0:8cc2035bebfc 51 or be implemented in your custom sio.c file. */
pmr1 0:8cc2035bebfc 52
pmr1 0:8cc2035bebfc 53 #ifndef sio_open
pmr1 0:8cc2035bebfc 54 /**
pmr1 0:8cc2035bebfc 55 * Opens a serial device for communication.
pmr1 0:8cc2035bebfc 56 *
pmr1 0:8cc2035bebfc 57 * @param devnum device number
pmr1 0:8cc2035bebfc 58 * @return handle to serial device if successful, NULL otherwise
pmr1 0:8cc2035bebfc 59 */
pmr1 0:8cc2035bebfc 60 sio_fd_t sio_open(u8_t devnum);
pmr1 0:8cc2035bebfc 61 #endif
pmr1 0:8cc2035bebfc 62
pmr1 0:8cc2035bebfc 63 #ifndef sio_send
pmr1 0:8cc2035bebfc 64 /**
pmr1 0:8cc2035bebfc 65 * Sends a single character to the serial device.
pmr1 0:8cc2035bebfc 66 *
pmr1 0:8cc2035bebfc 67 * @param c character to send
pmr1 0:8cc2035bebfc 68 * @param fd serial device handle
pmr1 0:8cc2035bebfc 69 *
pmr1 0:8cc2035bebfc 70 * @note This function will block until the character can be sent.
pmr1 0:8cc2035bebfc 71 */
pmr1 0:8cc2035bebfc 72 void sio_send(u8_t c, sio_fd_t fd);
pmr1 0:8cc2035bebfc 73 #endif
pmr1 0:8cc2035bebfc 74
pmr1 0:8cc2035bebfc 75 #ifndef sio_recv
pmr1 0:8cc2035bebfc 76 /**
pmr1 0:8cc2035bebfc 77 * Receives a single character from the serial device.
pmr1 0:8cc2035bebfc 78 *
pmr1 0:8cc2035bebfc 79 * @param fd serial device handle
pmr1 0:8cc2035bebfc 80 *
pmr1 0:8cc2035bebfc 81 * @note This function will block until a character is received.
pmr1 0:8cc2035bebfc 82 */
pmr1 0:8cc2035bebfc 83 u8_t sio_recv(sio_fd_t fd);
pmr1 0:8cc2035bebfc 84 #endif
pmr1 0:8cc2035bebfc 85
pmr1 0:8cc2035bebfc 86 #ifndef sio_read
pmr1 0:8cc2035bebfc 87 /**
pmr1 0:8cc2035bebfc 88 * Reads from the serial device.
pmr1 0:8cc2035bebfc 89 *
pmr1 0:8cc2035bebfc 90 * @param fd serial device handle
pmr1 0:8cc2035bebfc 91 * @param data pointer to data buffer for receiving
pmr1 0:8cc2035bebfc 92 * @param len maximum length (in bytes) of data to receive
pmr1 0:8cc2035bebfc 93 * @return number of bytes actually received - may be 0 if aborted by sio_read_abort
pmr1 0:8cc2035bebfc 94 *
pmr1 0:8cc2035bebfc 95 * @note This function will block until data can be received. The blocking
pmr1 0:8cc2035bebfc 96 * can be cancelled by calling sio_read_abort().
pmr1 0:8cc2035bebfc 97 */
pmr1 0:8cc2035bebfc 98 u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len);
pmr1 0:8cc2035bebfc 99 #endif
pmr1 0:8cc2035bebfc 100
pmr1 0:8cc2035bebfc 101 #ifndef sio_tryread
pmr1 0:8cc2035bebfc 102 /**
pmr1 0:8cc2035bebfc 103 * Tries to read from the serial device. Same as sio_read but returns
pmr1 0:8cc2035bebfc 104 * immediately if no data is available and never blocks.
pmr1 0:8cc2035bebfc 105 *
pmr1 0:8cc2035bebfc 106 * @param fd serial device handle
pmr1 0:8cc2035bebfc 107 * @param data pointer to data buffer for receiving
pmr1 0:8cc2035bebfc 108 * @param len maximum length (in bytes) of data to receive
pmr1 0:8cc2035bebfc 109 * @return number of bytes actually received
pmr1 0:8cc2035bebfc 110 */
pmr1 0:8cc2035bebfc 111 u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len);
pmr1 0:8cc2035bebfc 112 #endif
pmr1 0:8cc2035bebfc 113
pmr1 0:8cc2035bebfc 114 #ifndef sio_write
pmr1 0:8cc2035bebfc 115 /**
pmr1 0:8cc2035bebfc 116 * Writes to the serial device.
pmr1 0:8cc2035bebfc 117 *
pmr1 0:8cc2035bebfc 118 * @param fd serial device handle
pmr1 0:8cc2035bebfc 119 * @param data pointer to data to send
pmr1 0:8cc2035bebfc 120 * @param len length (in bytes) of data to send
pmr1 0:8cc2035bebfc 121 * @return number of bytes actually sent
pmr1 0:8cc2035bebfc 122 *
pmr1 0:8cc2035bebfc 123 * @note This function will block until all data can be sent.
pmr1 0:8cc2035bebfc 124 */
pmr1 0:8cc2035bebfc 125 u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len);
pmr1 0:8cc2035bebfc 126 #endif
pmr1 0:8cc2035bebfc 127
pmr1 0:8cc2035bebfc 128 #ifndef sio_read_abort
pmr1 0:8cc2035bebfc 129 /**
pmr1 0:8cc2035bebfc 130 * Aborts a blocking sio_read() call.
pmr1 0:8cc2035bebfc 131 *
pmr1 0:8cc2035bebfc 132 * @param fd serial device handle
pmr1 0:8cc2035bebfc 133 */
pmr1 0:8cc2035bebfc 134 void sio_read_abort(sio_fd_t fd);
pmr1 0:8cc2035bebfc 135 #endif
pmr1 0:8cc2035bebfc 136
pmr1 0:8cc2035bebfc 137 #ifdef __cplusplus
pmr1 0:8cc2035bebfc 138 }
pmr1 0:8cc2035bebfc 139 #endif
pmr1 0:8cc2035bebfc 140
pmr1 0:8cc2035bebfc 141 #endif /* __SIO_H__ */