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