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!
25 -------------------------------------------------------------------------*/
34 /* link the C library */
42 #define NULL (void *)0
45 #ifndef _SIZE_T_DEFINED
46 #define _SIZE_T_DEFINED
47 typedef unsigned int size_t;
51 /* stream descriptor definition */
55 /* USART and MSSP module stream descriptors */
57 /* since FILE is declared as a generic pointer,
58 * the upper byte is used to dereference the pointer
59 * information. For the stream descriptors we
60 * use the 5th bit and the lower nubble bits.
61 * Descriptors are denoted by an 1 in bit 5,
62 * further dereference is made for:
68 * There is a special value for GPSIM specific (see below)
73 * if further stream descriptors need to be added then more
74 * 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))
87 /* this is a custom dereference which points to a custom
88 * port of GPSIM simulator. This port redirects characters
89 * to /tmp/gpsim.debug.1 file (used for debugging purposes)
90 * NOTICE: This feature is not part of the official gpsim
91 * distribution. Contact vrokas AT users.sourceforge.net
93 #define GPSIM_DEREF 0xe
94 #define STREAM_GPSIM ((FILE *)(0x002e0000UL))
99 //typedef void (*pfn_outputchar)(char c, void* p) _REENTRANT;
100 //extern int _print_format (pfn_outputchar pfn, void* pvoid, const char *format, va_list ap);
102 /* printf_small() supports float print */
103 void printf_small(char *, ...);
105 /* printf_tiny() does not support float print */
106 void printf_tiny(char *, ...); // __reentrant;
108 extern unsigned int printf (char *,...);
109 extern unsigned int sprintf (char *, char *, ...);
110 extern unsigned int fprintf(FILE *, char *, ...);
112 extern unsigned int vsprintf (char *, char *, va_list);
113 extern unsigned int vprintf (char *, va_list);
114 extern unsigned int vfprintf(FILE *, char *, va_list);
116 extern int puts(char *);
118 extern void __stream_putchar(FILE *, unsigned char);
120 #define PUTCHAR(arg) void putchar(unsigned char arg) __wparam
123 extern void __stream_usart_putchar(unsigned char c) __wparam __naked;
124 extern void __stream_mssp_putchar(unsigned char c) __wparam __naked;
125 extern void __stream_gpsim_putchar(unsigned char c) __wparam __naked;
127 extern char *gets(char *);
128 extern char getchar(void);
130 #endif /* __STDIO_H */