Library for Bert van Dam's book "ARM MICROCONTROLLERS" For all chapters with internet.

Dependencies:   mbed

Committer:
ICTFBI
Date:
Fri Oct 16 14:28:26 2015 +0000
Revision:
0:4edb816d21e1
Pre-update 16-10-15

Who changed what in which revision?

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