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 * randm.h - Random number generator header file.
pmr1 0:8cc2035bebfc 3 *
pmr1 0:8cc2035bebfc 4 * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
pmr1 0:8cc2035bebfc 5 * Copyright (c) 1998 Global Election Systems Inc.
pmr1 0:8cc2035bebfc 6 *
pmr1 0:8cc2035bebfc 7 * The authors hereby grant permission to use, copy, modify, distribute,
pmr1 0:8cc2035bebfc 8 * and license this software and its documentation for any purpose, provided
pmr1 0:8cc2035bebfc 9 * that existing copyright notices are retained in all copies and that this
pmr1 0:8cc2035bebfc 10 * notice and the following disclaimer are included verbatim in any
pmr1 0:8cc2035bebfc 11 * distributions. No written agreement, license, or royalty fee is required
pmr1 0:8cc2035bebfc 12 * for any of the authorized uses.
pmr1 0:8cc2035bebfc 13 *
pmr1 0:8cc2035bebfc 14 * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR
pmr1 0:8cc2035bebfc 15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
pmr1 0:8cc2035bebfc 16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
pmr1 0:8cc2035bebfc 17 * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
pmr1 0:8cc2035bebfc 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
pmr1 0:8cc2035bebfc 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
pmr1 0:8cc2035bebfc 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
pmr1 0:8cc2035bebfc 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
pmr1 0:8cc2035bebfc 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
pmr1 0:8cc2035bebfc 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
pmr1 0:8cc2035bebfc 24 *
pmr1 0:8cc2035bebfc 25 ******************************************************************************
pmr1 0:8cc2035bebfc 26 * REVISION HISTORY
pmr1 0:8cc2035bebfc 27 *
pmr1 0:8cc2035bebfc 28 * 03-01-01 Marc Boucher <marc@mbsi.ca>
pmr1 0:8cc2035bebfc 29 * Ported to lwIP.
pmr1 0:8cc2035bebfc 30 * 98-05-29 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
pmr1 0:8cc2035bebfc 31 * Extracted from avos.
pmr1 0:8cc2035bebfc 32 *****************************************************************************/
pmr1 0:8cc2035bebfc 33
pmr1 0:8cc2035bebfc 34 #ifndef RANDM_H
pmr1 0:8cc2035bebfc 35 #define RANDM_H
pmr1 0:8cc2035bebfc 36
pmr1 0:8cc2035bebfc 37 /***********************
pmr1 0:8cc2035bebfc 38 *** PUBLIC FUNCTIONS ***
pmr1 0:8cc2035bebfc 39 ***********************/
pmr1 0:8cc2035bebfc 40 /*
pmr1 0:8cc2035bebfc 41 * Initialize the random number generator.
pmr1 0:8cc2035bebfc 42 */
pmr1 0:8cc2035bebfc 43 void avRandomInit(void);
pmr1 0:8cc2035bebfc 44
pmr1 0:8cc2035bebfc 45 /*
pmr1 0:8cc2035bebfc 46 * Churn the randomness pool on a random event. Call this early and often
pmr1 0:8cc2035bebfc 47 * on random and semi-random system events to build randomness in time for
pmr1 0:8cc2035bebfc 48 * usage. For randomly timed events, pass a null pointer and a zero length
pmr1 0:8cc2035bebfc 49 * and this will use the system timer and other sources to add randomness.
pmr1 0:8cc2035bebfc 50 * If new random data is available, pass a pointer to that and it will be
pmr1 0:8cc2035bebfc 51 * included.
pmr1 0:8cc2035bebfc 52 */
pmr1 0:8cc2035bebfc 53 void avChurnRand(char *randData, u32_t randLen);
pmr1 0:8cc2035bebfc 54
pmr1 0:8cc2035bebfc 55 /*
pmr1 0:8cc2035bebfc 56 * Randomize our random seed value. To be called for truely random events
pmr1 0:8cc2035bebfc 57 * such as user operations and network traffic.
pmr1 0:8cc2035bebfc 58 */
pmr1 0:8cc2035bebfc 59 #if MD5_SUPPORT
pmr1 0:8cc2035bebfc 60 #define avRandomize() avChurnRand(NULL, 0)
pmr1 0:8cc2035bebfc 61 #else /* MD5_SUPPORT */
pmr1 0:8cc2035bebfc 62 void avRandomize(void);
pmr1 0:8cc2035bebfc 63 #endif /* MD5_SUPPORT */
pmr1 0:8cc2035bebfc 64
pmr1 0:8cc2035bebfc 65 /*
pmr1 0:8cc2035bebfc 66 * Use the random pool to generate random data. This degrades to pseudo
pmr1 0:8cc2035bebfc 67 * random when used faster than randomness is supplied using churnRand().
pmr1 0:8cc2035bebfc 68 * Thus it's important to make sure that the results of this are not
pmr1 0:8cc2035bebfc 69 * published directly because one could predict the next result to at
pmr1 0:8cc2035bebfc 70 * least some degree. Also, it's important to get a good seed before
pmr1 0:8cc2035bebfc 71 * the first use.
pmr1 0:8cc2035bebfc 72 */
pmr1 0:8cc2035bebfc 73 void avGenRand(char *buf, u32_t bufLen);
pmr1 0:8cc2035bebfc 74
pmr1 0:8cc2035bebfc 75 /*
pmr1 0:8cc2035bebfc 76 * Return a new random number.
pmr1 0:8cc2035bebfc 77 */
pmr1 0:8cc2035bebfc 78 u32_t avRandom(void);
pmr1 0:8cc2035bebfc 79
pmr1 0:8cc2035bebfc 80
pmr1 0:8cc2035bebfc 81 #endif /* RANDM_H */