2004-10-03 Vangelis Rokas <vrokas AT otenet.gr>
+ * device/include/pic16/stdio.h,
+ * device/include/pic16/stdlib.h,
+ * device/include/pic16/math.h: NEW
+ * device/lib/pic16/libsdcc/gptr/*.c (gptrget*, gptrput*): functions
+ declared as _naked to reduce overhead
* device/lib/Makefile.in (target port-specific-objects-pic16):
changed * to *.* so to ignore the CVS directory,
* src/pic16/gen.c (pic16_freeAsmop): added code to store result of
#ifndef __PIC16_ASM_FEATURES_H
#define __PIC16_ASM_FEATURES_H 1
-#if 0
-#define _IL_REENTRANT reentrant
-#define _FS_REENTRANT reentrant
-#else
+#define _REENTRANT
+
#define _IL_REENTRANT
#define _FS_REENTRANT
-#endif
+#define _MATH_REENTRANT
+
-#endif
+#endif /* __PIC16_ASM_FEATURES_H */
--- /dev/null
+/* math.h: Floating point math function declarations
+
+ Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
+
+ Copyright (C) 2001 Jesus Calvino-Fraga, jesusc@ieee.org
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/* Version 1.0 - Initial release */
+
+#ifndef __PIC16_MATH_H
+#define __PIC16_MATH_H 1
+
+
+#define PI 3.1415926536
+#define TWO_PI 6.2831853071
+#define HALF_PI 1.5707963268
+#define QUART_PI 0.7853981634
+#define iPI 0.3183098862
+#define iTWO_PI 0.1591549431
+#define TWO_O_PI 0.6366197724
+
+// EPS=B**(-t/2), where B is the radix of the floating-point representation
+// and there are t base-B digits in the significand. Therefore, for floats
+// EPS=2**(-12). Also define EPS2=EPS*EPS.
+#define EPS 244.14062E-6
+#define EPS2 59.6046E-9
+#define XMAX 3.402823466E+38
+
+union float_long
+{
+ float f;
+ long l;
+};
+
+/**********************************************
+ * Prototypes for float ANSI C math functions *
+ **********************************************/
+
+/* Trigonometric functions */
+float sinf(const float x) _MATH_REENTRANT;
+float cosf(const float x) _MATH_REENTRANT;
+float tanf(const float x) _MATH_REENTRANT;
+float cotf(const float x) _MATH_REENTRANT;
+float asinf(const float x) _MATH_REENTRANT;
+float acosf(const float x) _MATH_REENTRANT;
+float atanf(const float x) _MATH_REENTRANT;
+float atan2f(const float x, const float y);
+
+/* Hyperbolic functions */
+float sinhf(const float x) _MATH_REENTRANT;
+float coshf(const float x) _MATH_REENTRANT;
+float tanhf(const float x) _MATH_REENTRANT;
+
+/* Exponential, logarithmic and power functions */
+float expf(const float x);
+float logf(const float x) _MATH_REENTRANT;
+float log10f(const float x) _MATH_REENTRANT;
+float powf(const float x, const float y);
+float sqrtf(const float a) _MATH_REENTRANT;
+
+/* Nearest integer, absolute value, and remainder functions */
+float fabsf(const float x) _MATH_REENTRANT;
+float frexpf(const float x, int *pw2);
+float ldexpf(const float x, const int pw2);
+float ceilf(float x) _MATH_REENTRANT;
+float floorf(float x) _MATH_REENTRANT;
+float modff(float x, float * y);
+
+#endif /* _PIC16_MATH_H */
--- /dev/null
+/*-------------------------------------------------------------------------
+ stdio.h - ANSI functions forward declarations
+
+ Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
+
+ Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998)
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ In other words, you are welcome to use, share and improve this program.
+ You are forbidden to forbid anyone else to use, share and improve
+ what you give them. Help stamp out software-hoarding!
+-------------------------------------------------------------------------*/
+
+#ifndef __PIC16_STDIO_H
+#define __PIC16_STDIO_H 1
+
+#include <stdarg.h>
+
+#include <sdcc-lib.h>
+
+#ifndef NULL
+ #define NULL (void *)0
+#endif
+
+#ifndef _SIZE_T_DEFINED
+#define _SIZE_T_DEFINED
+ typedef unsigned int size_t;
+#endif
+
+typedef void (*pfn_outputchar)(char c, void* p) _REENTRANT;
+
+extern int _print_format (pfn_outputchar pfn, void* pvoid, const char *format, va_list ap);
+
+/*-----------------------------------------------------------------------*/
+
+extern void printf_small (char *,...); _REENTRANT;
+extern int printf (const char *,...);
+extern int vprintf (const char *, va_list);
+extern int sprintf (char *, const char *, ...);
+extern int vsprintf (char *, const char *, va_list);
+extern int puts(const char *);
+extern char *gets(char *);
+extern char getchar(void);
+extern void putchar(char);
+
+
+#endif /* __PIC16_STDIO_H */
--- /dev/null
+/*-------------------------------------------------------------------------
+ stdlib.h - ANSI functions forward declarations
+
+ Ported to PIC16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
+
+ Written By - Sandeep Dutta . sandeep.dutta@usa.net (1998)
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ In other words, you are welcome to use, share and improve this program.
+ You are forbidden to forbid anyone else to use, share and improve
+ what you give them. Help stamp out software-hoarding!
+-------------------------------------------------------------------------*/
+
+#ifndef __PIC16_STDLIB_H
+#define __PIC16_STDLIB_H 1
+
+#ifndef NULL
+# define NULL (void *)0
+#endif
+
+//#include <malloc.h>
+
+extern float atof (char *);
+extern int atoi (char *);
+extern long atol (char *);
+
+extern void uitoa(unsigned int, char*, unsigned char);
+extern void itoa(unsigned int, char*, unsigned char);
+
+extern void ultoa(unsigned long, char*, unsigned char);
+extern void ltoa(unsigned long, char*, unsigned char);
+
+#endif /* __PIC16_STDLIB_H */
extern TABLAT;
extern PRODL;
-void _gptrget1(void)
+void _gptrget1(void) _naked
{
_asm
/* decode generic pointer MSB (in WREG) bits 6 and 7:
extern TABLAT;
extern PRODL;
-void _gptrget2(void)
+void _gptrget2(void) _naked
{
_asm
/* decode generic pointer MSB (in WREG) bits 6 and 7:
extern PRODL;
extern PRODH;
-void _gptrget3(void)
+void _gptrget3(void) _naked
{
_asm
/* decode generic pointer MSB (in WREG) bits 6 and 7:
extern PRODL;
extern PRODH;
-void _gptrget4(void)
+void _gptrget4(void) _naked
{
_asm
/* decode generic pointer MSB (in WREG) bits 6 and 7:
extern PRODL;
extern PRODH;
-void _gptrput1(void)
+void _gptrput1(void) _naked
{
_asm
/* decode generic pointer MSB (in WREG) bits 6 and 7:
/*-------------------------------------------------------------------------
- gptrput1.c :- put 1 byte value at generic pointer
+ gptrput1.c :- put 2 byte value at generic pointer
Adopted for pic16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
extern PRODL;
extern PRODH;
-void _gptrput2(void)
+void _gptrput2(void) _naked
{
_asm
/* decode generic pointer MSB (in WREG) bits 6 and 7:
/*-------------------------------------------------------------------------
- gptrput1.c :- put 1 byte value at generic pointer
+ gptrput3.c :- put 3 byte value at generic pointer
Adopted for pic16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
extern PRODL;
extern PRODH;
-void _gptrput3(void)
+void _gptrput3(void) _naked
{
_asm
/* decode generic pointer MSB (in WREG) bits 6 and 7:
/*-------------------------------------------------------------------------
- gptrput1.c :- put 1 byte value at generic pointer
+ gptrput4.c :- put 4 byte value at generic pointer
Adopted for pic16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
extern PRODL;
extern PRODH;
-void _gptrput4(void)
+void _gptrput4(void) _naked
{
_asm
/* decode generic pointer MSB (in WREG) bits 6 and 7: