code that uses Watchdog to reset Mbed every 30seconds. After 30-60mins, the ethernet interface fails to setup() after WatchDog reset.

Dependencies:   mbed

Committer:
eqon
Date:
Thu Jun 07 05:44:29 2012 +0000
Revision:
0:0ce833f21e63

        

Who changed what in which revision?

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