From: jesusc Date: Thu, 26 Oct 2006 05:49:01 +0000 (+0000) Subject: Initialize uart only if SM0 and SM1 are zero. Also, use flag 'putchar_crlf' to turn... X-Git-Url: https://git.gag.com/?a=commitdiff_plain;ds=sidebyside;h=1130d6b9cec9a5e9ed70166ac4d0ba5255172292;p=fw%2Fsdcc Initialize uart only if SM0 and SM1 are zero. Also, use flag 'putchar_crlf' to turn on/off CR to CRLF conversion. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4437 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 73d8c04e..0110c291 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-10-24 Jesus Calvino-Fraga + + * device/lib/_putchar.c, device/lib/_getchar.c, device/lib/inituart.c: + Initialize uart only if SM0 and SM1 are zero. Also, use flag to turn + on/off CR to CRLF conversion. + 2006-10-25 Frieder Ferlemann * doc/sdccman.lyx: updated IRQ section diff --git a/device/lib/_getchar.c b/device/lib/_getchar.c index 2cbf71da..1f5f7a34 100644 --- a/device/lib/_getchar.c +++ b/device/lib/_getchar.c @@ -20,14 +20,13 @@ #ifdef SDCC_mcs51 #include <8051.h> -extern bit uart_init_flag; void inituart(unsigned char t1_reload); char getchar (void) { char c; - if(!uart_init_flag) inituart(0xff); + if((!SM0)&&(!SM1)) inituart(0xff); while (!RI); RI=0; diff --git a/device/lib/_putchar.c b/device/lib/_putchar.c index dec4601c..91ab61ce 100644 --- a/device/lib/_putchar.c +++ b/device/lib/_putchar.c @@ -20,13 +20,13 @@ #ifdef SDCC_mcs51 #include <8051.h> -extern bit uart_init_flag; +bit putchar_crlf=0; void inituart(unsigned char t1_reload); void putchar (char c) { - if(!uart_init_flag) inituart(0xff); - if (c=='\n') + if((!SM0)&&(!SM1)) inituart(0xff); + if ((c=='\n') && putchar_crlf) { while (!TI); TI=0; diff --git a/device/lib/inituart.c b/device/lib/inituart.c index 9a41c3d3..d9d6448d 100644 --- a/device/lib/inituart.c +++ b/device/lib/inituart.c @@ -20,8 +20,6 @@ #ifdef SDCC_mcs51 #include <8051.h> -bit uart_init_flag=0; - void inituart (unsigned char t1_reload) { TR1=0; @@ -30,7 +28,6 @@ void inituart (unsigned char t1_reload) TH1=TL1=t1_reload; TR1=1; SCON=0x52; - uart_init_flag=1; } #endif