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