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

This commit is contained in:
adamdunkels 2009-03-17 15:56:32 +00:00
parent 7f3def31b7
commit 0076bfe8a5
15 changed files with 68 additions and 66 deletions

View file

@ -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

View file

@ -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 <stdio.h>
@ -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));
}

View file

@ -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 <string.h> /* 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);
}
/*---------------------------------------------------------------------------*/

View file

@ -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__ */

View file

@ -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) \

View file

@ -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 = \

View file

@ -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 <string.h>
#include <stdio.h>
@ -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;

View file

@ -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 <stdio.h>
@ -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);
}
}

View file

@ -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();

View file

@ -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)

View file

@ -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);
}
}

View file

@ -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

View file

@ -30,14 +30,14 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $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(&ethernode_driver));
/* rime_init(lpp_init(&ethernode_driver));*/
uip_over_mesh_init(0);
uip_over_mesh_init(2);
uip_over_mesh_set_net(&meshif.ipaddr, &meshif.netmask);
if(flag == 1) {

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $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);
}
}
}

View file

@ -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 <signal.h>
@ -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