mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-08-28 07:28:58 +00:00
Moved putchar into separate file to make it easier to override its implementation
This commit is contained in:
parent
36eae6fcdf
commit
790f2f632a
@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile.msp430,v 1.29 2009/09/03 17:41:58 adamdunkels Exp $
|
# $Id: Makefile.msp430,v 1.30 2009/10/30 15:06:26 adamdunkels Exp $
|
||||||
|
|
||||||
ifdef nodeid
|
ifdef nodeid
|
||||||
CFLAGS += -DNODEID=$(nodeid)
|
CFLAGS += -DNODEID=$(nodeid)
|
||||||
@ -14,7 +14,7 @@ CONTIKI_CPU=$(CONTIKI)/cpu/msp430
|
|||||||
CONTIKI_CPU_DIRS = . dev
|
CONTIKI_CPU_DIRS = . dev
|
||||||
|
|
||||||
MSP430 = msp430.c flash.c clock.c leds.c leds-arch.c \
|
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
|
watchdog.c lpm.c mtarch.c uart1.c slip_uart1.c uart1-putchar.c rtimer-arch.c
|
||||||
UIPDRIVERS = me.c me_tabs.c slip.c crc16.c
|
UIPDRIVERS = me.c me_tabs.c slip.c crc16.c
|
||||||
ELFLOADER = elfloader.c elfloader-msp430.c symtab.c
|
ELFLOADER = elfloader.c elfloader-msp430.c symtab.c
|
||||||
TARGETLIBS = random.c
|
TARGETLIBS = random.c
|
||||||
|
9
cpu/msp430/dev/uart1-putchar.c
Normal file
9
cpu/msp430/dev/uart1-putchar.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "dev/uart1.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
putchar(int c)
|
||||||
|
{
|
||||||
|
uart1_writeb((char)c);
|
||||||
|
return c;
|
||||||
|
}
|
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)$Id: uart1.c,v 1.13 2009/10/27 16:25:28 fros4943 Exp $
|
* @(#)$Id: uart1.c,v 1.14 2009/10/30 15:06:27 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -37,6 +37,7 @@
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#include "dev/leds.h"
|
||||||
#include "sys/energest.h"
|
#include "sys/energest.h"
|
||||||
#include "dev/uart1.h"
|
#include "dev/uart1.h"
|
||||||
#include "dev/watchdog.h"
|
#include "dev/watchdog.h"
|
||||||
@ -99,12 +100,6 @@ uart1_writeb(unsigned char c)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */
|
#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */
|
||||||
int
|
|
||||||
putchar(int c)
|
|
||||||
{
|
|
||||||
uart1_writeb((char)c);
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
#endif /* ! WITH_UIP */
|
#endif /* ! WITH_UIP */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
@ -169,6 +164,7 @@ uart1_init(unsigned long ubr)
|
|||||||
interrupt(UART1RX_VECTOR)
|
interrupt(UART1RX_VECTOR)
|
||||||
uart1_rx_interrupt(void)
|
uart1_rx_interrupt(void)
|
||||||
{
|
{
|
||||||
|
uint8_t c;
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
|
|
||||||
if(!(URXIFG1 & IFG2)) {
|
if(!(URXIFG1 & IFG2)) {
|
||||||
@ -178,14 +174,16 @@ uart1_rx_interrupt(void)
|
|||||||
rx_in_progress = 1;
|
rx_in_progress = 1;
|
||||||
LPM4_EXIT;
|
LPM4_EXIT;
|
||||||
} else {
|
} else {
|
||||||
|
c = RXBUF1;
|
||||||
rx_in_progress = 0;
|
rx_in_progress = 0;
|
||||||
/* Check status register for receive errors. */
|
/* Check status register for receive errors. */
|
||||||
if(URCTL1 & RXERR) {
|
if(URCTL1 & RXERR) {
|
||||||
volatile unsigned dummy;
|
volatile unsigned dummy;
|
||||||
dummy = RXBUF1; /* Clear error flags by forcing a dummy read. */
|
leds_invert(LEDS_ALL);
|
||||||
|
// dummy = RXBUF1; /* Clear error flags by forcing a dummy read. */
|
||||||
} else {
|
} else {
|
||||||
if(uart1_input_handler != NULL) {
|
if(uart1_input_handler != NULL) {
|
||||||
if(uart1_input_handler(RXBUF1)) {
|
if(uart1_input_handler(c)) {
|
||||||
LPM4_EXIT;
|
LPM4_EXIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user