Removed ethernode uIP driver from the main code

This commit is contained in:
adamdunkels 2007-03-14 00:32:30 +00:00
parent 548e4ce556
commit 9d030483ff
6 changed files with 59 additions and 53 deletions

View file

@ -9,7 +9,7 @@ CONTIKI_TARGET_DIRS = . dev apps net
SENSORS = sensors.c beep.c button-sensor.c pir-sensor.c vib-sensor.c \
radio-sensor.c irq.c eeprom.c \
dummy-sensors.c leds.c leds-arch.c esb-sensors.c
NETSIM = ether.c ethernode.c ethernode-drv.c lpm.c \
NETSIM = ether.c ethernode.c ethernode-uip.c lpm.c \
tapdev-drv.c tapdev-service.c tapdev.c rs232.c flash.c \
node.c nodes.c sensor.c display.c random.c radio.c \
dlloader.c main.c netsim-init.c contiki-main.c symtab.c symbols.c tr1001.c tr1001-drv.c \

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: contiki-main.c,v 1.5 2007/03/13 13:07:47 adamdunkels Exp $
* $Id: contiki-main.c,v 1.6 2007/03/14 00:32:30 adamdunkels Exp $
*/
#include "contiki.h"
@ -40,7 +40,7 @@
#include "net/tapdev.h"
#include "net/tapdev-drv.h"
#include "net/tapdev-service.h"
#include "net/ethernode-drv.h"
#include "net/ethernode-uip.h"
#include "net/ethernode-rime.h"
#include "net/ethernode.h"
#include "ether.h"
@ -57,8 +57,8 @@
static struct uip_fw_netif tapif =
{UIP_FW_NETIF(0,0,0,0, 0,0,0,0, tapdev_send)};
static struct uip_fw_netif ethernodeif =
{UIP_FW_NETIF(172,16,0,0, 255,255,0,0, ethernode_drv_send)};
/*static struct uip_fw_netif ethernodeif =
{UIP_FW_NETIF(172,16,0,0, 255,255,0,0, ethernode_drv_send)};*/
static const struct uip_eth_addr ethaddr = {{0x00,0x06,0x98,0x01,0x02,0x12}};
@ -68,7 +68,8 @@ static const struct uip_eth_addr ethaddr = {{0x00,0x06,0x98,0x01,0x02,0x12}};
SENSORS(&button_sensor, &pir_sensor, &vib_sensor, &radio_sensor);
PROCINIT(&sensors_process, &etimer_process, &tcpip_process,
&ethernode_drv_process, &ethernode_rime_process,
/* &ethernode_uip_process,*/
&ethernode_rime_process,
&uip_fw_process);
#if 0
@ -149,20 +150,23 @@ void
contiki_main(int flag)
{
random_init(getpid());
srand(getpid());
leds_init();
process_init();
procinit_init();
rime_init();
if(flag == 1) {
process_start(&tapdev_drv_process, NULL);
uip_fw_register(&ethernodeif);
/* uip_fw_register(&ethernodeif);*/
uip_fw_default(&tapif);
printf("uip_hostaddr %02x%02x\n", uip_hostaddr.u16[0], uip_hostaddr.u16[1]);
} else {
uip_fw_default(&ethernodeif);
/* uip_fw_default(&ethernodeif);*/
}
leds_green(LEDS_ON);

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: ethernode-rime.c,v 1.1 2007/03/13 13:07:48 adamdunkels Exp $
* $Id: ethernode-rime.c,v 1.2 2007/03/14 00:32:30 adamdunkels Exp $
*/
#include "contiki.h"
@ -46,7 +46,7 @@ PROCESS_THREAD(ethernode_rime_process, ev, data)
{
PROCESS_BEGIN();
printf("ethernode_rime_process\n");
/* printf("ethernode_rime_process\n");*/
while(1) {
process_poll(&ethernode_rime_process);
@ -64,8 +64,8 @@ PROCESS_THREAD(ethernode_rime_process, ev, data)
rimebuf_set_datalen(len);
printf("ethernode_rime_process: received len %d\n",
len);
/* printf("ethernode_rime_process: received len %d\n",
len);*/
abc_input_packet();
}
}
@ -75,8 +75,9 @@ PROCESS_THREAD(ethernode_rime_process, ev, data)
}
/*---------------------------------------------------------------------------*/
void
abc_arch_send(u8_t *buf, int len)
abc_driver_send(void)
{
ethernode_send_buf(buf, len);
/* printf("ethernode_rime: sending %d bytes\n", rimebuf_totlen());*/
ethernode_send_buf(rimebuf_hdrptr(), rimebuf_totlen());
}
/*---------------------------------------------------------------------------*/

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: ethernode-drv.c,v 1.5 2007/03/13 13:07:48 adamdunkels Exp $
* $Id: ethernode-uip.c,v 1.1 2007/03/14 00:32:30 adamdunkels Exp $
*/
#include "contiki.h"
@ -43,26 +43,26 @@
#include "node-id.h"
PROCESS(ethernode_drv_process, "Ethernode driver");
PROCESS(ethernode_uip_process, "Ethernode driver");
enum { NULLEVENT };
/*---------------------------------------------------------------------------*/
u8_t
ethernode_drv_send(void)
ethernode_uip_send(void)
{
/* printf("%d: ethernode_drv_send\n", node_id);*/
/* printf("%d: ethernode_uip_send\n", node_id);*/
uip_len = hc_compress(&uip_buf[UIP_LLH_LEN], uip_len);
return ethernode_send();
}
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(ethernode_drv_process, ev, data)
PROCESS_THREAD(ethernode_uip_process, ev, data)
{
static int drop = 3;
PROCESS_BEGIN();
while(1) {
process_poll(&ethernode_drv_process);
process_poll(&ethernode_uip_process);
PROCESS_WAIT_EVENT();
/* Poll Ethernet device to see if there is a frame avaliable. */

View file

@ -1,45 +1,45 @@
/* Copyright (c) 2004, Swedish Institute of Computer Science.
* All rights reserved.
* 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.
* 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 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.
*
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: ethernode-drv.h,v 1.1 2006/06/17 22:41:36 adamdunkels Exp $
* $Id: ethernode-uip.h,v 1.1 2007/03/14 00:32:30 adamdunkels Exp $
*/
#ifndef __ETHERNODE_DRV_H__
#define __ETHERNODE_DRV_H__
#ifndef __ETHERNODE_UIP_H__
#define __ETHERNODE_UIP_H__
#include "contiki.h"
PROCESS_NAME(ethernode_drv_process);
PROCESS_NAME(ethernode_uip_process);
u8_t ethernode_drv_send(void);
u8_t ethernode_uip_send(void);
u8_t ethernode_drv_send(void);
u8_t ethernode_uip_send(void);
#endif /* __ETHERNODE_DRV_H__ */
#endif /* __ETHERNODE_UIP_H__ */

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: ethernode.c,v 1.4 2007/03/13 13:07:48 adamdunkels Exp $
* $Id: ethernode.c,v 1.5 2007/03/14 00:32:30 adamdunkels Exp $
*/
/**
* \file
@ -90,6 +90,7 @@ do_send(u8_t type, u8_t dest, struct hdr *hdr, int len)
++state.seqno;
/* printf("ether_send len %d\n", len);*/
return ether_send((char *)hdr, len);
}