Control of mbed using OSC. Based on code from the Make Controller. Right now you can turn the onboard LEDs on/off and toggle 8 digital out pins. More I/O will be done in the future.
lwip/lwIP/netif/loopif.c@0:439354122597, 2010-03-17 (annotated)
- Committer:
- pehrhovey
- Date:
- Wed Mar 17 03:17:38 2010 +0000
- Revision:
- 0:439354122597
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pehrhovey | 0:439354122597 | 1 | /** |
pehrhovey | 0:439354122597 | 2 | * @file |
pehrhovey | 0:439354122597 | 3 | * Loop Interface |
pehrhovey | 0:439354122597 | 4 | * |
pehrhovey | 0:439354122597 | 5 | */ |
pehrhovey | 0:439354122597 | 6 | |
pehrhovey | 0:439354122597 | 7 | /* |
pehrhovey | 0:439354122597 | 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
pehrhovey | 0:439354122597 | 9 | * All rights reserved. |
pehrhovey | 0:439354122597 | 10 | * |
pehrhovey | 0:439354122597 | 11 | * Redistribution and use in source and binary forms, with or without modification, |
pehrhovey | 0:439354122597 | 12 | * are permitted provided that the following conditions are met: |
pehrhovey | 0:439354122597 | 13 | * |
pehrhovey | 0:439354122597 | 14 | * 1. Redistributions of source code must retain the above copyright notice, |
pehrhovey | 0:439354122597 | 15 | * this list of conditions and the following disclaimer. |
pehrhovey | 0:439354122597 | 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
pehrhovey | 0:439354122597 | 17 | * this list of conditions and the following disclaimer in the documentation |
pehrhovey | 0:439354122597 | 18 | * and/or other materials provided with the distribution. |
pehrhovey | 0:439354122597 | 19 | * 3. The name of the author may not be used to endorse or promote products |
pehrhovey | 0:439354122597 | 20 | * derived from this software without specific prior written permission. |
pehrhovey | 0:439354122597 | 21 | * |
pehrhovey | 0:439354122597 | 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
pehrhovey | 0:439354122597 | 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
pehrhovey | 0:439354122597 | 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
pehrhovey | 0:439354122597 | 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
pehrhovey | 0:439354122597 | 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
pehrhovey | 0:439354122597 | 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
pehrhovey | 0:439354122597 | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
pehrhovey | 0:439354122597 | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
pehrhovey | 0:439354122597 | 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
pehrhovey | 0:439354122597 | 31 | * OF SUCH DAMAGE. |
pehrhovey | 0:439354122597 | 32 | * |
pehrhovey | 0:439354122597 | 33 | * This file is part of the lwIP TCP/IP stack. |
pehrhovey | 0:439354122597 | 34 | * |
pehrhovey | 0:439354122597 | 35 | * Author: Adam Dunkels <adam@sics.se> |
pehrhovey | 0:439354122597 | 36 | * |
pehrhovey | 0:439354122597 | 37 | */ |
pehrhovey | 0:439354122597 | 38 | #include "lwip/opt.h" |
pehrhovey | 0:439354122597 | 39 | |
pehrhovey | 0:439354122597 | 40 | #if LWIP_HAVE_LOOPIF |
pehrhovey | 0:439354122597 | 41 | |
pehrhovey | 0:439354122597 | 42 | #include "netif/loopif.h" |
pehrhovey | 0:439354122597 | 43 | #include "lwip/snmp.h" |
pehrhovey | 0:439354122597 | 44 | |
pehrhovey | 0:439354122597 | 45 | /** |
pehrhovey | 0:439354122597 | 46 | * Initialize a lwip network interface structure for a loopback interface |
pehrhovey | 0:439354122597 | 47 | * |
pehrhovey | 0:439354122597 | 48 | * @param netif the lwip network interface structure for this loopif |
pehrhovey | 0:439354122597 | 49 | * @return ERR_OK if the loopif is initialized |
pehrhovey | 0:439354122597 | 50 | * ERR_MEM if private data couldn't be allocated |
pehrhovey | 0:439354122597 | 51 | */ |
pehrhovey | 0:439354122597 | 52 | err_t |
pehrhovey | 0:439354122597 | 53 | loopif_init(struct netif *netif) |
pehrhovey | 0:439354122597 | 54 | { |
pehrhovey | 0:439354122597 | 55 | /* initialize the snmp variables and counters inside the struct netif |
pehrhovey | 0:439354122597 | 56 | * ifSpeed: no assumption can be made! |
pehrhovey | 0:439354122597 | 57 | */ |
pehrhovey | 0:439354122597 | 58 | NETIF_INIT_SNMP(netif, snmp_ifType_softwareLoopback, 0); |
pehrhovey | 0:439354122597 | 59 | |
pehrhovey | 0:439354122597 | 60 | netif->name[0] = 'l'; |
pehrhovey | 0:439354122597 | 61 | netif->name[1] = 'o'; |
pehrhovey | 0:439354122597 | 62 | netif->output = netif_loop_output; |
pehrhovey | 0:439354122597 | 63 | return ERR_OK; |
pehrhovey | 0:439354122597 | 64 | } |
pehrhovey | 0:439354122597 | 65 | |
pehrhovey | 0:439354122597 | 66 | #endif /* LWIP_HAVE_LOOPIF */ |