Common initialization code for the netstack

This commit is contained in:
adamdunkels 2010-02-18 23:15:26 +00:00
parent 927aa821c3
commit 5cf3b83733
3 changed files with 58 additions and 3 deletions

View File

@ -54,16 +54,18 @@ THREADS = mt.c
LIBS = memb.c mmem.c timer.c list.c etimer.c energest.c rtimer.c stimer.c \ LIBS = memb.c mmem.c timer.c list.c etimer.c energest.c rtimer.c stimer.c \
print-stats.c ifft.c crc16.c random.c checkpoint.c ringbuf.c print-stats.c ifft.c crc16.c random.c checkpoint.c ringbuf.c
NET = netstack.c
ifdef UIP_CONF_IPV6 ifdef UIP_CONF_IPV6
CFLAGS += -DUIP_CONF_IPV6 CFLAGS += -DUIP_CONF_IPV6
UIP = uip6.c tcpip.c psock.c uip-udp-packet.c uip-split.c \ UIP = uip6.c tcpip.c psock.c uip-udp-packet.c uip-split.c \
resolv.c tcpdump.c uiplib.c resolv.c tcpdump.c uiplib.c
NET = $(UIP) uip-icmp6.c uip-nd6.c uip-nd6-io.c uip-netif.c sicslowpan.c NET += $(UIP) uip-icmp6.c uip-nd6.c uip-nd6-io.c uip-netif.c sicslowpan.c
else # UIP_CONF_IPV6 else # UIP_CONF_IPV6
UIP = uip.c uiplib.c resolv.c tcpip.c psock.c hc.c uip-split.c uip-fw.c \ UIP = uip.c uiplib.c resolv.c tcpip.c psock.c hc.c uip-split.c uip-fw.c \
uip-fw-drv.c uip_arp.c tcpdump.c uip-neighbor.c uip-udp-packet.c \ uip-fw-drv.c uip_arp.c tcpdump.c uip-neighbor.c uip-udp-packet.c \
uip-over-mesh.c dhcpc.c #rawpacket-udp.c uip-over-mesh.c dhcpc.c #rawpacket-udp.c
NET = $(UIP) uaodv.c uaodv-rt.c NET += $(UIP) uaodv.c uaodv-rt.c
endif # UIP_CONF_IPV6 endif # UIP_CONF_IPV6
CTK = ctk.c CTK = ctk.c

51
core/net/netstack.c Normal file
View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2010, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* $Id: netstack.c,v 1.1 2010/02/18 23:15:26 adamdunkels Exp $
*/
/**
* \file
* Initialiation file for the Contiki low-layer network stack (NETSTACK)
* \author
* Adam Dunkels <adam@sics.se>
*/
#include "net/netstack.h"
/*---------------------------------------------------------------------------*/
void
netstack_init(void)
{
NETSTACK_RADIO.init();
NETSTACK_RDC.init();
NETSTACK_MAC.init();
NETSTACK_NETWORK.init();
}
/*---------------------------------------------------------------------------*/

View File

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: netstack.h,v 1.1 2010/02/18 21:50:33 adamdunkels Exp $ * $Id: netstack.h,v 1.2 2010/02/18 23:15:26 adamdunkels Exp $
*/ */
/** /**
@ -83,4 +83,6 @@ extern const struct mac_driver NETSTACK_RDC;
extern const struct mac_driver NETSTACK_MAC; extern const struct mac_driver NETSTACK_MAC;
extern const struct radio_driver NETSTACK_RADIO; extern const struct radio_driver NETSTACK_RADIO;
void netstack_init(void);
#endif /* NETSTACK_H */ #endif /* NETSTACK_H */