1 /*-------------------------------------------------------------------------
2 stdio.h - ANSI functions forward declarations
4 Copyright (C) 1998, Sandeep Dutta . sandeep.dutta@usa.net
5 Ported to PIC16 port by Vangelis Rokas, 2004 <vrokas AT otenet.gr>
7 This library is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this library; see the file COPYING. If not, write to the
19 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22 As a special exception, if you link this library with other files,
23 some of which are compiled with SDCC, to produce an executable,
24 this library does not by itself cause the resulting executable to
25 be covered by the GNU General Public License. This exception does
26 not however invalidate any other reasons why the executable file
27 might be covered by the GNU General Public License.
28 -------------------------------------------------------------------------*/
33 /* link the C library */
41 #define NULL (void *)0
44 #ifndef _SIZE_T_DEFINED
45 #define _SIZE_T_DEFINED
46 typedef unsigned int size_t;
49 /* stream descriptor definition */
52 /* USART and MSSP module stream descriptors */
54 /* since FILE is declared as a generic pointer,
55 * the upper byte is used to dereference the pointer
56 * information. For the stream descriptors we
57 * use the 5th bit and the lower nubble bits.
58 * Descriptors are denoted by an 1 in bit 5,
59 * further dereference is made for:
65 * There is a special value for GPSIM specific (see below)
70 * if further stream descriptors need to be added then more
71 * bits of the upper byte can be used
74 #define USART_DEREF 0x0
75 #define MSSP_DEREF 0x1
76 #define USER_DEREF 0xf
78 #define STREAM_USART ((FILE *)(0x00200000UL))
79 #define STREAM_MSSP ((FILE *)(0x00210000UL))
80 #define STREAM_USER ((FILE *)(0x002f0000UL))
82 /* this is a custom dereference which points to a custom
83 * port of GPSIM simulator. This port redirects characters
84 * to /tmp/gpsim.debug.1 file (used for debugging purposes)
85 * NOTICE: This feature is not part of the official gpsim
86 * distribution. Contact vrokas AT users.sourceforge.net
88 #define GPSIM_DEREF 0xe
89 #define STREAM_GPSIM ((FILE *)(0x002e0000UL))
94 /* printf_small() supports float print */
95 void printf_small (const char *fmt
, ...);
97 /* printf_tiny() does not support float print */
98 void printf_tiny (const char *fmt
, ...); // __reentrant;
100 extern int printf (const char *fmt
, ...);
101 extern int fprintf (FILE *stream
, const char *fmt
, ...);
102 extern int sprintf (char *str
, const char *fmt
, ...);
104 extern int vprintf (const char *fmt
, va_list ap
);
105 extern int vfprintf (FILE *stream
, const char *fmt
, va_list ap
);
106 extern int vsprintf (char *str
, const char *fmt
, va_list ap
);
108 #define PUTCHAR(C) void putchar (char C) __wparam
111 extern void __stream_putchar (FILE *stream
, char c
);
113 extern void __stream_usart_putchar (char c
) __wparam __naked
;
114 extern void __stream_mssp_putchar (char c
) __wparam __naked
;
115 extern void __stream_gpsim_putchar (char c
) __wparam __naked
;
117 extern char *gets (char *str
);
118 extern char getchar (void);
120 #endif /* __STDIO_H */