From 0076bfe8a5c5d579f1b9645d1181630f01094864 Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Tue, 17 Mar 2009 15:56:32 +0000 Subject: [PATCH] Changed the name of the 'serial' module to 'serial-line' to signify that the module is about lines of data from the serial port, not individual bytes, and to make sdcc happy --- Makefile.include | 3 ++- apps/serial-shell/serial-shell.c | 6 +++--- core/dev/{serial.c => serial-line.c} | 30 ++++++++++++++-------------- core/dev/{serial.h => serial-line.h} | 16 +++++++-------- cpu/msp430/Makefile.msp430 | 4 ++-- platform/cooja/Makefile.cooja | 4 ++-- platform/cooja/dev/rs232.c | 8 ++++---- platform/cooja/testapps/testserial.c | 8 ++++---- platform/minimal-net/contiki-main.c | 10 +++++----- platform/native/Makefile.native | 2 +- platform/native/contiki-main.c | 8 ++++---- platform/netsim/Makefile.netsim | 10 +++++----- platform/netsim/contiki-main.c | 9 +++++---- platform/netsim/ether.c | 8 ++++---- platform/sky/contiki-sky-main.c | 8 ++++---- 15 files changed, 68 insertions(+), 66 deletions(-) rename core/dev/{serial.c => serial-line.c} (80%) rename core/dev/{serial.h => serial-line.h} (89%) diff --git a/Makefile.include b/Makefile.include index aa2b8da69..aa8179741 100644 --- a/Makefile.include +++ b/Makefile.include @@ -47,7 +47,8 @@ CFLAGS += -DCONTIKI_TARGET_$(TARGET_UPPERCASE) include $(CONTIKI)/core/net/rime/Makefile.rime include $(CONTIKI)/core/net/mac/Makefile.mac -SYSTEM = process.c procinit.c autostart.c elfloader.c profile.c timetable.c timetable-aggregate.c compower.c +SYSTEM = process.c procinit.c autostart.c elfloader.c profile.c \ + timetable.c timetable-aggregate.c compower.c serial-line.c THREADS = mt.c LIBS = memb.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 diff --git a/apps/serial-shell/serial-shell.c b/apps/serial-shell/serial-shell.c index ed1939b29..e814a223a 100644 --- a/apps/serial-shell/serial-shell.c +++ b/apps/serial-shell/serial-shell.c @@ -33,7 +33,7 @@ * * This file is part of the Contiki operating system. * - * $Id: serial-shell.c,v 1.4 2009/03/02 21:56:16 adamdunkels Exp $ + * $Id: serial-shell.c,v 1.5 2009/03/17 15:56:32 adamdunkels Exp $ */ /** @@ -46,7 +46,7 @@ #include "contiki.h" #include "shell.h" -#include "dev/serial.h" +#include "dev/serial-line.h" #include "net/rime.h" #include @@ -84,7 +84,7 @@ PROCESS_THREAD(serial_shell_process, ev, data) shell_init(); while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == serial_event_message && data != NULL); + PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message && data != NULL); shell_input(data, strlen(data)); } diff --git a/core/dev/serial.c b/core/dev/serial-line.c similarity index 80% rename from core/dev/serial.c rename to core/dev/serial-line.c index 95acfd217..77a41fe27 100644 --- a/core/dev/serial.c +++ b/core/dev/serial-line.c @@ -28,16 +28,16 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: serial.c,v 1.3 2008/01/08 07:49:51 adamdunkels Exp $ + * @(#)$Id: serial-line.c,v 1.1 2009/03/17 15:56:33 adamdunkels Exp $ */ -#include "serial.h" +#include "dev/serial-line.h" #include /* for memcpy() */ -#ifdef SERIAL_CONF_BUFSIZE -#define BUFSIZE SERIAL_CONF_BUFSIZE -#else /* SERIAL_CONF_BUFSIZE */ +#ifdef SERIAL_LINE_CONF_BUFSIZE +#define BUFSIZE SERIAL_LINE_CONF_BUFSIZE +#else /* SERIAL_LINE_CONF_BUFSIZE */ #define BUFSIZE 80 -#endif /* SERIAL_CONF_BUFSIZE */ +#endif /* SERIAL_LINE_CONF_BUFSIZE */ #define IGNORE_CHAR(c) (c == 0x0d) #define END 0x0a @@ -46,21 +46,21 @@ static char buffer[BUFSIZE], appbuffer[BUFSIZE]; static volatile unsigned char bufwptr; static volatile char buffer_full = 0; -PROCESS(serial_process, "Serial driver"); +PROCESS(serial_line_process, "Serial driver"); -process_event_t serial_event_message; +process_event_t serial_line_event_message; /*---------------------------------------------------------------------------*/ int -serial_input_byte(unsigned char c) +serial_line_input_byte(unsigned char c) { if(!buffer_full && !IGNORE_CHAR(c)) { if(c == END) { /* terminate the string */ buffer[bufwptr++] = '\0'; buffer_full++; - process_poll(&serial_process); + process_poll(&serial_line_process); return 1; } @@ -72,21 +72,21 @@ serial_input_byte(unsigned char c) return 0; } /*---------------------------------------------------------------------------*/ -PROCESS_THREAD(serial_process, ev, data) +PROCESS_THREAD(serial_line_process, ev, data) { PROCESS_BEGIN(); bufwptr = 0; buffer_full = 0; - serial_event_message = process_alloc_event(); + serial_line_event_message = process_alloc_event(); while(1) { PROCESS_YIELD(); if(buffer_full) { memcpy(appbuffer, buffer, bufwptr); - process_post(PROCESS_BROADCAST, serial_event_message, appbuffer); + process_post(PROCESS_BROADCAST, serial_line_event_message, appbuffer); bufwptr = 0; buffer_full = 0; } @@ -96,8 +96,8 @@ PROCESS_THREAD(serial_process, ev, data) } /*---------------------------------------------------------------------------*/ void -serial_init(void) +serial_line_init(void) { - process_start(&serial_process, NULL); + process_start(&serial_line_process, NULL); } /*---------------------------------------------------------------------------*/ diff --git a/core/dev/serial.h b/core/dev/serial-line.h similarity index 89% rename from core/dev/serial.h rename to core/dev/serial-line.h index 1398b0355..7cccdaa34 100644 --- a/core/dev/serial.h +++ b/core/dev/serial-line.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: serial.h,v 1.1 2006/06/17 22:41:17 adamdunkels Exp $ + * @(#)$Id: serial-line.h,v 1.1 2009/03/17 15:56:33 adamdunkels Exp $ */ /** * \file @@ -37,8 +37,8 @@ * Adam Dunkels * */ -#ifndef __SERIAL_H__ -#define __SERIAL_H__ +#ifndef __SERIAL_LINE_H__ +#define __SERIAL_LINE_H__ #include "contiki.h" @@ -49,7 +49,7 @@ * from the serial port. A data pointer to the incoming line of input * is sent together with the event. */ -extern process_event_t serial_event_message; +extern process_event_t serial_line_event_message; /** * Get one byte of input from the serial driver. @@ -68,10 +68,10 @@ extern process_event_t serial_event_message; * \return Non-zero if the CPU should be powered up, zero otherwise. */ -int serial_input_byte(unsigned char c); +int serial_line_input_byte(unsigned char c); -void serial_init(void); +void serial_line_init(void); -PROCESS_NAME(serial_process); +PROCESS_NAME(serial_line_process); -#endif /* __SERIAL_H__ */ +#endif /* __SERIAL_LINE_H__ */ diff --git a/cpu/msp430/Makefile.msp430 b/cpu/msp430/Makefile.msp430 index d83cc93c7..c54a249b5 100644 --- a/cpu/msp430/Makefile.msp430 +++ b/cpu/msp430/Makefile.msp430 @@ -1,4 +1,4 @@ -# $Id: Makefile.msp430,v 1.27 2009/02/20 23:16:08 nvt-se Exp $ +# $Id: Makefile.msp430,v 1.28 2009/03/17 15:56:32 adamdunkels Exp $ ifdef nodeid CFLAGS += -DNODEID=$(nodeid) @@ -17,7 +17,7 @@ MSP430 = msp430.c flash.c clock.c leds.c leds-arch.c \ watchdog.c lpm.c mtarch.c uart1.c slip_uart1.c rtimer-arch.c UIPDRIVERS = me.c me_tabs.c slip.c crc16.c ELFLOADER = elfloader.c elfloader-msp430.c symtab.c -TARGETLIBS = random.c serial.c +TARGETLIBS = random.c CONTIKI_TARGET_SOURCEFILES += $(MSP430) \ $(SYSAPPS) $(ELFLOADER) \ diff --git a/platform/cooja/Makefile.cooja b/platform/cooja/Makefile.cooja index 8abbe1435..8d3b46192 100644 --- a/platform/cooja/Makefile.cooja +++ b/platform/cooja/Makefile.cooja @@ -1,4 +1,4 @@ -# $Id: Makefile.cooja,v 1.29 2009/03/12 17:48:23 fros4943 Exp $ +# $Id: Makefile.cooja,v 1.30 2009/03/17 15:56:32 adamdunkels Exp $ ## The COOJA Simulator Contiki platform Makefile ## @@ -57,7 +57,7 @@ COOJA_INTFS = beep.c button-sensor.c ip.c leds-arch.c moteid.c \ pir-sensor.c rs232.c vib-sensor.c \ clock.c log.c radio-sensor.c cfs-cooja.c -COOJA_CORE = random.c sensors.c leds.c serial.c symbols.c +COOJA_CORE = random.c sensors.c leds.c symbols.c # (COOJA_SOURCEFILES contains additional sources set from simulator) CONTIKI_TARGET_SOURCEFILES = \ diff --git a/platform/cooja/dev/rs232.c b/platform/cooja/dev/rs232.c index 734b6591e..4c1d43a20 100644 --- a/platform/cooja/dev/rs232.c +++ b/platform/cooja/dev/rs232.c @@ -26,12 +26,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: rs232.c,v 1.1 2006/08/21 12:11:19 fros4943 Exp $ + * $Id: rs232.c,v 1.2 2009/03/17 15:56:32 adamdunkels Exp $ */ #include "lib/sensors.h" #include "dev/rs232.h" -#include "dev/serial.h" +#include "dev/serial-line.h" #include "lib/simEnvChange.h" #include #include @@ -89,9 +89,9 @@ doInterfaceActionsBeforeTick(void) // Tell serial process for (i=0; i < simSerialReceivingLength; i++) - serial_input_byte(simSerialReceivingData[i]); + serial_line_input_byte(simSerialReceivingData[i]); - serial_input_byte(0x0a); + serial_line_input_byte(0x0a); simSerialReceivingLength = 0; simSerialReceivingFlag = 0; diff --git a/platform/cooja/testapps/testserial.c b/platform/cooja/testapps/testserial.c index 3cb339a84..b8b519888 100644 --- a/platform/cooja/testapps/testserial.c +++ b/platform/cooja/testapps/testserial.c @@ -26,11 +26,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: testserial.c,v 1.2 2008/10/03 09:39:38 fros4943 Exp $ + * $Id: testserial.c,v 1.3 2009/03/17 15:56:32 adamdunkels Exp $ */ #include "contiki.h" -#include "dev/serial.h" +#include "dev/serial-port.h" #include "dev/rs232.h" #include @@ -47,7 +47,7 @@ PROCESS_THREAD(test_serial_process, ev, data) etimer_set(&et, CLOCK_SECOND); /* Start serial process */ - serial_init(); + serial_port_init(); printf("Starting serial test process\n"); @@ -60,7 +60,7 @@ PROCESS_THREAD(test_serial_process, ev, data) etimer_restart(&et); } - if(ev == serial_event_message) { + if(ev == serial_port_event_message) { printf("Message received: '%s'\n", data); } } diff --git a/platform/minimal-net/contiki-main.c b/platform/minimal-net/contiki-main.c index 8f7cf7863..83efb2215 100644 --- a/platform/minimal-net/contiki-main.c +++ b/platform/minimal-net/contiki-main.c @@ -29,7 +29,7 @@ * * This file is part of the Contiki OS * - * $Id: contiki-main.c,v 1.18 2009/03/06 00:13:56 adamdunkels Exp $ + * $Id: contiki-main.c,v 1.19 2009/03/17 15:56:32 adamdunkels Exp $ * */ @@ -41,7 +41,7 @@ #include "contiki.h" #include "contiki-net.h" -#include "dev/serial.h" +#include "dev/serial-line.h" #include "net/uip.h" #ifdef __CYGWIN__ @@ -51,9 +51,9 @@ #endif /* __CYGWIN__ */ #ifdef __CYGWIN__ -PROCINIT(&etimer_process, &tcpip_process, &wpcap_process, &serial_process); +PROCINIT(&etimer_process, &tcpip_process, &wpcap_process, &serial_line_process); #else /* __CYGWIN__ */ -PROCINIT(&etimer_process, &tapdev_process, &tcpip_process, &serial_process); +PROCINIT(&etimer_process, &tapdev_process, &tcpip_process, &serial_line_process); #endif /* __CYGWIN__ */ /*---------------------------------------------------------------------------*/ @@ -104,7 +104,7 @@ main(void) if(FD_ISSET(STDIN_FILENO, &fds)) { char c; if(read(STDIN_FILENO, &c, 1) > 0) { - serial_input_byte(c); + serial_line_input_byte(c); } } etimer_request_poll(); diff --git a/platform/native/Makefile.native b/platform/native/Makefile.native index 6e2752468..c23a4cfc2 100644 --- a/platform/native/Makefile.native +++ b/platform/native/Makefile.native @@ -7,7 +7,7 @@ CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o} CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c leds.c leds-arch.c \ button-sensor.c pir-sensor.c vib-sensor.c xmem.c \ - sensors.c irq.c random.c serial.c cfs-posix.c cfs-posix-dir.c + sensors.c irq.c cfs-posix.c cfs-posix-dir.c CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) diff --git a/platform/native/contiki-main.c b/platform/native/contiki-main.c index 838d1db15..3a4378f81 100644 --- a/platform/native/contiki-main.c +++ b/platform/native/contiki-main.c @@ -29,7 +29,7 @@ * * This file is part of the Contiki OS * - * $Id: contiki-main.c,v 1.9 2008/07/09 20:58:25 adamdunkels Exp $ + * $Id: contiki-main.c,v 1.10 2009/03/17 15:56:32 adamdunkels Exp $ * */ @@ -39,7 +39,7 @@ #include "contiki.h" -#include "dev/serial.h" +#include "dev/serial-line.h" #include "net/uip.h" @@ -47,7 +47,7 @@ #include "dev/pir-sensor.h" #include "dev/vib-sensor.h" -PROCINIT(&etimer_process, &tcpip_process, &serial_process); +PROCINIT(&etimer_process, &tcpip_process, &serial_line_process); SENSORS(&pir_sensor, &vib_sensor, &button_sensor); @@ -83,7 +83,7 @@ main(void) if(FD_ISSET(STDIN_FILENO, &fds)) { char c; if(read(STDIN_FILENO, &c, 1) > 0) { - serial_input_byte(c); + serial_line_input_byte(c); } } diff --git a/platform/netsim/Makefile.netsim b/platform/netsim/Makefile.netsim index 2bf48276b..d7c0625dd 100644 --- a/platform/netsim/Makefile.netsim +++ b/platform/netsim/Makefile.netsim @@ -7,9 +7,9 @@ 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 = cfs-ram.c ether.c ethernode.c ethernode-uip.c lpm.c rs232.c flash.c \ - node.c nodes.c sensor.c display.c random.c radio.c serial.c \ - dlloader.c main.c netsim-init.c contiki-main.c symtab.c symbols.c tr1001.c tr1001-drv.c +NETSIM = ether.c ethernode.c ethernode-uip.c lpm.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 cfs-posix.c cfs-posix-dir.c ifeq ($(OS),Windows_NT) CONTIKI_TARGET_SOURCEFILES = $(NETSIM) $(SENSORS) wpcap-drv.c wpcap.c @@ -26,8 +26,8 @@ CONTIKI_CPU=$(CONTIKI)/cpu/native include $(CONTIKI)/cpu/native/Makefile.native ### Compiler definitions -CFLAGS += `gtk-config --cflags` -TARGET_LIBFILES = `gtk-config --libs` +CFLAGS += $(shell gtk-config --cflags) -DNETSIM=1 +TARGET_LIBFILES = $(shell gtk-config --libs) ifeq ($(OS),Windows_NT) TARGET_LIBFILES += /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a diff --git a/platform/netsim/contiki-main.c b/platform/netsim/contiki-main.c index 42455ff32..b383b40f8 100644 --- a/platform/netsim/contiki-main.c +++ b/platform/netsim/contiki-main.c @@ -30,14 +30,14 @@ * * Author: Adam Dunkels * - * $Id: contiki-main.c,v 1.32 2008/11/09 12:30:32 adamdunkels Exp $ + * $Id: contiki-main.c,v 1.33 2009/03/17 15:56:32 adamdunkels Exp $ */ #include "contiki.h" #include "contiki-net.h" #include "contiki-lib.h" -#include "dev/serial.h" +#include "dev/serial-line.h" #include "net/rime.h" #ifdef __CYGWIN__ @@ -121,14 +121,15 @@ contiki_main(int flag) procinit_init(); - serial_init(); + serial_line_init(); uip_init(); ctimer_init(); rime_init(nullmac_init(ðernode_driver)); + /* rime_init(lpp_init(ðernode_driver));*/ - uip_over_mesh_init(0); + uip_over_mesh_init(2); uip_over_mesh_set_net(&meshif.ipaddr, &meshif.netmask); if(flag == 1) { diff --git a/platform/netsim/ether.c b/platform/netsim/ether.c index 3c506e96b..885845c5b 100644 --- a/platform/netsim/ether.c +++ b/platform/netsim/ether.c @@ -30,7 +30,7 @@ * * Author: Adam Dunkels * - * $Id: ether.c,v 1.14 2008/12/16 09:59:42 joxe Exp $ + * $Id: ether.c,v 1.15 2009/03/17 15:56:32 adamdunkels Exp $ */ /** * \file @@ -61,7 +61,7 @@ #include "dev/radio-sensor.h" -#include "dev/serial.h" +#include "dev/serial-line.h" #include "sensor.h" @@ -304,9 +304,9 @@ ether_client_read(u8_t *buf, int bufsize) } } else if(hdr->type == PTYPE_SERIAL) { char *ptr = hdr->text; - /* printf("serial input %s\n", ptr);*/ + printf("serial input %s\n", ptr); for(ptr = hdr->text; *ptr != 0; ++ptr) { - serial_input_byte(*ptr); + serial_line_input_byte(*ptr); } } } diff --git a/platform/sky/contiki-sky-main.c b/platform/sky/contiki-sky-main.c index 0e1c6641e..eab6c114a 100644 --- a/platform/sky/contiki-sky-main.c +++ b/platform/sky/contiki-sky-main.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)$Id: contiki-sky-main.c,v 1.48 2009/03/01 20:42:10 adamdunkels Exp $ + * @(#)$Id: contiki-sky-main.c,v 1.49 2009/03/17 15:56:33 adamdunkels Exp $ */ #include @@ -42,7 +42,7 @@ #include "dev/leds.h" #include "dev/light.h" #include "dev/battery-sensor.h" -#include "dev/serial.h" +#include "dev/serial-line.h" #include "dev/sht11.h" #include "dev/cc2420.h" #include "dev/slip.h" @@ -260,8 +260,8 @@ main(int argc, char **argv) #endif /* WITH_UIP6 */ #if !WITH_UIP && !WITH_UIP6 - uart1_set_input(serial_input_byte); - serial_init(); + uart1_set_input(serial_line_input_byte); + serial_line_init(); #endif #if PROFILE_CONF_ON