SNMP agent attached to SPI slave

Dependencies:   mbed

Committer:
lorcansmith
Date:
Mon Aug 13 15:07:40 2012 +0000
Revision:
0:2a53a4c3238c
v1.1 release includes ioAlarm traps

Who changed what in which revision?

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