1 /*-------------------------------------------------------------------------
2 stdio.h - ANSI functions forward declarations
4 Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
6 Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998)
8 This program is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 2, or (at your option) any
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 In other words, you are welcome to use, share and improve this program.
23 You are forbidden to forbid anyone else to use, share and improve
24 what you give them. Help stamp out software-hoarding!
26 As a special exception, if you link this library with other files,
27 some of which are compiled with SDCC, to produce an executable,
28 this library does not by itself cause the resulting executable
29 to be covered by the GNU General Public License.
30 This exception does not however invalidate any other reasons why
31 the executable file might be covered by the GNU General Public License.
32 -------------------------------------------------------------------------*/
37 /* link the C library */
45 #define NULL (void *)0
48 #ifndef _SIZE_T_DEFINED
49 #define _SIZE_T_DEFINED
50 typedef unsigned int size_t;
53 /* stream descriptor definition */
56 /* USART and MSSP module stream descriptors */
58 /* since FILE is declared as a generic pointer,
59 * the upper byte is used to dereference the pointer
60 * information. For the stream descriptors we
61 * use the 5th bit and the lower nubble bits.
62 * Descriptors are denoted by an 1 in bit 5,
63 * further dereference is made for:
69 * There is a special value for GPSIM specific (see below)
74 * if further stream descriptors need to be added then more
75 * bits of the upper byte can be used
78 #define USART_DEREF 0x0
79 #define MSSP_DEREF 0x1
80 #define USER_DEREF 0xf
82 #define STREAM_USART ((FILE *)(0x00200000UL))
83 #define STREAM_MSSP ((FILE *)(0x00210000UL))
84 #define STREAM_USER ((FILE *)(0x002f0000UL))
86 /* this is a custom dereference which points to a custom
87 * port of GPSIM simulator. This port redirects characters
88 * to /tmp/gpsim.debug.1 file (used for debugging purposes)
89 * NOTICE: This feature is not part of the official gpsim
90 * distribution. Contact vrokas AT users.sourceforge.net
92 #define GPSIM_DEREF 0xe
93 #define STREAM_GPSIM ((FILE *)(0x002e0000UL))
98 /* printf_small() supports float print */
99 void printf_small (const char *fmt, ...);
101 /* printf_tiny() does not support float print */
102 void printf_tiny (const char *fmt, ...); // __reentrant;
104 extern int printf (const char *fmt, ...);
105 extern int fprintf (FILE *stream, const char *fmt, ...);
106 extern int sprintf (char *str, const char *fmt, ...);
108 extern int vprintf (const char *fmt, va_list ap);
109 extern int vfprintf (FILE *stream, const char *fmt, va_list ap);
110 extern int vsprintf (char *str, const char *fmt, va_list ap);
112 extern void putchar (char c) __wparam;
114 extern void __stream_putchar (FILE *stream, char c);
116 extern void __stream_usart_putchar (char c) __wparam __naked;
117 extern void __stream_mssp_putchar (char c) __wparam __naked;
118 extern void __stream_gpsim_putchar (char c) __wparam __naked;
120 extern char *gets (char *str);
121 extern char getchar (void);
123 #endif /* __STDIO_H */