device/lib/_putchar.c,_getchar.c, inituart.c replacements for serial_io.c
authorjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 25 Oct 2006 02:37:36 +0000 (02:37 +0000)
committerjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 25 Oct 2006 02:37:36 +0000 (02:37 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4435 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
device/lib/Makefile.in
device/lib/_getchar.c [new file with mode: 0644]
device/lib/_putchar.c [new file with mode: 0644]
device/lib/inituart.c [new file with mode: 0644]
device/lib/libsdcc.lib
device/lib/serial_io.c [deleted file]

index db580e71ce29b7ab59f0e4a544c64894445e4aeb..58c525e8b26cf4de98011b5db1e79cd42a20ae3f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-10-24 Jesus Calvino-Fraga <jesusc at ece.ubc.ca>
+
+       * device/lib/serial_io.c: removed
+       * device/lib/_putchar.c, device/lib/_getchar.c, device/lib/inituart.c
+       replacements for serial_io.c
+
 2006-10-24 Maarten Brock <sourceforge.brock AT dse.nl>
 
        * src/z80/main.c (_process_pragma, _parseOptions): fixed bug 1583318
index 6a0ab9c18364c4f01f5a2bc52290045a42679af8..74a9e490fb01f2e3d933ce05afc7ddc4d4c579dc 100644 (file)
@@ -69,7 +69,7 @@ OPT_DISABLE_Z80   = @OPT_DISABLE_Z80@
 SOURCES =      _autobaud.c _bp.c _decdptr.c \
                _gptrget.c _gptrgetc.c _gptrput.c \
                _ser.c _setjmp.c \
-               serial.c serial_io.c ser_ir.c \
+               serial.c inituart.c _putchar.c _getchar.c ser_ir.c \
                _atof.c _atoi.c _atol.c _itoa.c _ltoa.c \
                _schar2fs.c _sint2fs.c _slong2fs.c \
                _uchar2fs.c _uint2fs.c _ulong2fs.c \
diff --git a/device/lib/_getchar.c b/device/lib/_getchar.c
new file mode 100644 (file)
index 0000000..2cbf71d
--- /dev/null
@@ -0,0 +1,37 @@
+/* Default getchar() using the serial port\r
+\r
+   Written By -  Jesus Calvino-Fraga (October/2006)\r
+\r
+   This library is free software; you can redistribute it and/or\r
+   modify it under the terms of the GNU Lesser General Public\r
+   License as published by the Free Software Foundation; either\r
+   version 2.1 of the License, or (at your option) any later version.\r
+\r
+   This library is distributed in the hope that it will be useful,\r
+   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+   Lesser General Public License for more details.\r
+\r
+   You should have received a copy of the GNU Lesser General Public\r
+   License along with this library; if not, write to the Free Software\r
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
+*/\r
+\r
+#ifdef SDCC_mcs51\r
+#include <8051.h>\r
+\r
+extern bit uart_init_flag;\r
+void inituart(unsigned char t1_reload);\r
+\r
+char getchar (void)\r
+{\r
+       char c;\r
+       \r
+       if(!uart_init_flag) inituart(0xff);\r
+\r
+       while (!RI);\r
+       RI=0;\r
+       c=SBUF;\r
+       return c;\r
+}\r
+#endif\r
diff --git a/device/lib/_putchar.c b/device/lib/_putchar.c
new file mode 100644 (file)
index 0000000..dec4601
--- /dev/null
@@ -0,0 +1,40 @@
+/* Default polling putchar() using to the serial port\r
+\r
+   Written By -  Jesus Calvino-Fraga (October/2006)\r
+\r
+   This library is free software; you can redistribute it and/or\r
+   modify it under the terms of the GNU Lesser General Public\r
+   License as published by the Free Software Foundation; either\r
+   version 2.1 of the License, or (at your option) any later version.\r
+\r
+   This library is distributed in the hope that it will be useful,\r
+   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+   Lesser General Public License for more details.\r
+\r
+   You should have received a copy of the GNU Lesser General Public\r
+   License along with this library; if not, write to the Free Software\r
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
+*/\r
+\r
+#ifdef SDCC_mcs51\r
+#include <8051.h>\r
+\r
+extern bit uart_init_flag;\r
+void inituart(unsigned char t1_reload);\r
+\r
+void putchar (char c)\r
+{\r
+       if(!uart_init_flag) inituart(0xff);\r
+       if (c=='\n')\r
+       {\r
+               while (!TI);\r
+               TI=0;\r
+               SBUF='\r';\r
+       }\r
+       while (!TI);\r
+       TI=0;\r
+       SBUF=c;\r
+}\r
+\r
+#endif\r
diff --git a/device/lib/inituart.c b/device/lib/inituart.c
new file mode 100644 (file)
index 0000000..9a41c3d
--- /dev/null
@@ -0,0 +1,36 @@
+/* Uart initialization for putchar() and getchar()\r
+\r
+   Written By -  Jesus Calvino-Fraga (October/2006)\r
+\r
+   This library is free software; you can redistribute it and/or\r
+   modify it under the terms of the GNU Lesser General Public\r
+   License as published by the Free Software Foundation; either\r
+   version 2.1 of the License, or (at your option) any later version.\r
+\r
+   This library is distributed in the hope that it will be useful,\r
+   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
+   Lesser General Public License for more details.\r
+\r
+   You should have received a copy of the GNU Lesser General Public\r
+   License along with this library; if not, write to the Free Software\r
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
+*/\r
+\r
+#ifdef SDCC_mcs51\r
+#include <8051.h>\r
+\r
+bit uart_init_flag=0;\r
+\r
+void inituart (unsigned char t1_reload)\r
+{\r
+       TR1=0;\r
+       TMOD=(TMOD&0x0f)|0x20;\r
+       PCON|=0x80;\r
+       TH1=TL1=t1_reload;\r
+       TR1=1;\r
+       SCON=0x52;\r
+       uart_init_flag=1;\r
+}\r
+\r
+#endif\r
index fc6cf87978587a8f9494fc63edfec0c00d5803ad..68e52a105b7345ae9135a24b800ca9ea40a615a2 100644 (file)
@@ -44,7 +44,9 @@ malloc
 realloc
 free
 serial
-serial_io
+inituart
+_putchar
+_getchar
 _autobaud
 _startup
 _ser
diff --git a/device/lib/serial_io.c b/device/lib/serial_io.c
deleted file mode 100644 (file)
index 29ad746..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Default putchar and getchar to the serial port\r
-\r
-   Written By -  Jesus Calvino-Fraga (October/2006)\r
-\r
-   This library is free software; you can redistribute it and/or\r
-   modify it under the terms of the GNU Lesser General Public\r
-   License as published by the Free Software Foundation; either\r
-   version 2.1 of the License, or (at your option) any later version.\r
-\r
-   This library is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-   Lesser General Public License for more details.\r
-\r
-   You should have received a copy of the GNU Lesser General Public\r
-   License along with this library; if not, write to the Free Software\r
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA\r
-*/\r
-\r
-#ifdef SDCC_mcs51\r
-#include <8051.h>\r
-\r
-bit serial_init_flag=0;\r
-\r
-void init_serial (void)\r
-{\r
-       TR1=0;\r
-       TMOD=(TMOD&0x0f)|0x20;\r
-       PCON|=0x80;\r
-       TH1=TL1=0xff; //115200 baud with a 22MHz crystal \r
-       TR1=1;\r
-       SCON=0x52;\r
-       serial_init_flag=1;\r
-}\r
-\r
-void putchar (char c)\r
-{\r
-       if(!serial_init_flag) init_serial();\r
-       if (c=='\n')\r
-       {\r
-               while (!TI);\r
-               TI=0;\r
-               SBUF='\r';\r
-       }\r
-       while (!TI);\r
-       TI=0;\r
-       SBUF=c;\r
-}\r
-\r
-char getchar (void)\r
-{\r
-       char c;\r
-       \r
-       if(!serial_init_flag) init_serial();\r
-\r
-       while (!RI);\r
-       RI=0;\r
-       c=SBUF;\r
-       return c;\r
-}\r
-#endif\r