Net stack with AutoIP enabled

Dependencies:   mbed

Committer:
darran
Date:
Fri Jul 02 17:21:58 2010 +0000
Revision:
0:ac21159e27f4

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
darran 0:ac21159e27f4 1 /**
darran 0:ac21159e27f4 2 * @file
darran 0:ac21159e27f4 3 * lwIP Operating System abstraction
darran 0:ac21159e27f4 4 *
darran 0:ac21159e27f4 5 */
darran 0:ac21159e27f4 6
darran 0:ac21159e27f4 7 /*
darran 0:ac21159e27f4 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
darran 0:ac21159e27f4 9 * All rights reserved.
darran 0:ac21159e27f4 10 *
darran 0:ac21159e27f4 11 * Redistribution and use in source and binary forms, with or without modification,
darran 0:ac21159e27f4 12 * are permitted provided that the following conditions are met:
darran 0:ac21159e27f4 13 *
darran 0:ac21159e27f4 14 * 1. Redistributions of source code must retain the above copyright notice,
darran 0:ac21159e27f4 15 * this list of conditions and the following disclaimer.
darran 0:ac21159e27f4 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
darran 0:ac21159e27f4 17 * this list of conditions and the following disclaimer in the documentation
darran 0:ac21159e27f4 18 * and/or other materials provided with the distribution.
darran 0:ac21159e27f4 19 * 3. The name of the author may not be used to endorse or promote products
darran 0:ac21159e27f4 20 * derived from this software without specific prior written permission.
darran 0:ac21159e27f4 21 *
darran 0:ac21159e27f4 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
darran 0:ac21159e27f4 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
darran 0:ac21159e27f4 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
darran 0:ac21159e27f4 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
darran 0:ac21159e27f4 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
darran 0:ac21159e27f4 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
darran 0:ac21159e27f4 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
darran 0:ac21159e27f4 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
darran 0:ac21159e27f4 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
darran 0:ac21159e27f4 31 * OF SUCH DAMAGE.
darran 0:ac21159e27f4 32 *
darran 0:ac21159e27f4 33 * This file is part of the lwIP TCP/IP stack.
darran 0:ac21159e27f4 34 *
darran 0:ac21159e27f4 35 * Author: Adam Dunkels <adam@sics.se>
darran 0:ac21159e27f4 36 *
darran 0:ac21159e27f4 37 */
darran 0:ac21159e27f4 38
darran 0:ac21159e27f4 39 #include "lwip/opt.h"
darran 0:ac21159e27f4 40
darran 0:ac21159e27f4 41 #include "lwip/sys.h"
darran 0:ac21159e27f4 42
darran 0:ac21159e27f4 43 /* Most of the functions defined in sys.h must be implemented in the
darran 0:ac21159e27f4 44 * architecture-dependent file sys_arch.c */
darran 0:ac21159e27f4 45
darran 0:ac21159e27f4 46 #if !NO_SYS
darran 0:ac21159e27f4 47
darran 0:ac21159e27f4 48 /**
darran 0:ac21159e27f4 49 * Sleep for some ms. Timeouts are NOT processed while sleeping.
darran 0:ac21159e27f4 50 *
darran 0:ac21159e27f4 51 * @param ms number of milliseconds to sleep
darran 0:ac21159e27f4 52 */
darran 0:ac21159e27f4 53 void
darran 0:ac21159e27f4 54 sys_msleep(u32_t ms)
darran 0:ac21159e27f4 55 {
darran 0:ac21159e27f4 56 if (ms > 0) {
darran 0:ac21159e27f4 57 sys_sem_t delaysem;
darran 0:ac21159e27f4 58 err_t err = sys_sem_new(&delaysem, 0);
darran 0:ac21159e27f4 59 if (err == ERR_OK) {
darran 0:ac21159e27f4 60 sys_arch_sem_wait(&delaysem, ms);
darran 0:ac21159e27f4 61 sys_sem_free(&delaysem);
darran 0:ac21159e27f4 62 }
darran 0:ac21159e27f4 63 }
darran 0:ac21159e27f4 64 }
darran 0:ac21159e27f4 65
darran 0:ac21159e27f4 66 #endif /* !NO_SYS */