refactored putchar to make it replacable

This commit is contained in:
nifi 2006-10-09 09:19:02 +00:00
parent b04edbebb3
commit 39098934a6
3 changed files with 47 additions and 11 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile.esb,v 1.2 2006/10/06 07:58:19 adamdunkels Exp $ # $Id: Makefile.esb,v 1.3 2006/10/09 09:19:02 nifi Exp $
SENSORS = sensors.c irq.c button-sensor.c pir-sensor.c vib-sensor.c \ SENSORS = sensors.c irq.c button-sensor.c pir-sensor.c vib-sensor.c \
sound-sensor.c radio-sensor.c ctsrts-sensor.c battery-sensor.c \ sound-sensor.c radio-sensor.c ctsrts-sensor.c battery-sensor.c \
@ -12,7 +12,7 @@ endif
CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(ESB) \ CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(ESB) \
contiki-esb-default-init-lowlevel.c \ contiki-esb-default-init-lowlevel.c \
contiki-esb-default-init-apps.c contiki-esb-default-init-net.c \ contiki-esb-default-init-apps.c contiki-esb-default-init-net.c \
rs232.c fader.c $(CONTIKI_TARGET_MAIN) rs232.c rs232-putchar.c fader.c $(CONTIKI_TARGET_MAIN)
include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps

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: contiki-esb-main.c,v 1.2 2006/10/06 07:49:31 adamdunkels Exp $ * @(#)$Id: contiki-esb-main.c,v 1.3 2006/10/09 09:19:02 nifi Exp $
*/ */
#include <io.h> #include <io.h>
@ -154,15 +154,10 @@ void arg_init(void) {}
void arg_free(char *arg) {} void arg_free(char *arg) {}
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
int
putchar(int c)
{
rs232_send(c);
return c;
}
void void
uip_log(char *m) uip_log(char *m)
{ {
printf("uIP log: '%s'\n", m); printf("uIP log: '%s'", m);
/* Needed to force link with putchar */
putchar('\n');
} }

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2006, 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: rs232-putchar.c,v 1.1 2006/10/09 09:19:02 nifi Exp $
*/
#include "dev/rs232.h"
int
putchar(int c)
{
rs232_send(c);
return c;
}