]> git.gag.com Git - fw/sdcc/commitdiff
* device/include/pic16/stdio.h,
authorvrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 3 Oct 2004 12:05:16 +0000 (12:05 +0000)
committervrokas <vrokas@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 3 Oct 2004 12:05:16 +0000 (12:05 +0000)
* 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

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3521 4a8a32a2-be11-0410-ad9d-d568d2c75423

13 files changed:
ChangeLog
device/include/asm/pic16/features.h
device/include/pic16/math.h [new file with mode: 0644]
device/include/pic16/stdio.h [new file with mode: 0644]
device/include/pic16/stdlib.h [new file with mode: 0644]
device/lib/pic16/libsdcc/gptr/gptrget1.c
device/lib/pic16/libsdcc/gptr/gptrget2.c
device/lib/pic16/libsdcc/gptr/gptrget3.c
device/lib/pic16/libsdcc/gptr/gptrget4.c
device/lib/pic16/libsdcc/gptr/gptrput1.c
device/lib/pic16/libsdcc/gptr/gptrput2.c
device/lib/pic16/libsdcc/gptr/gptrput3.c
device/lib/pic16/libsdcc/gptr/gptrput4.c

index 7692025407d2b28edb3e9ff7d7255f0431cd41aa..20ab886246a2be9de41eebd94fdd1958504456ac 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 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
index 44535f2b9733389dc1c7e407718e2c7c7b1635c6..d0ef2bbd5210c2d63f7cbe659b5b6f4a56aa8fbe 100644 (file)
 #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 */
diff --git a/device/include/pic16/math.h b/device/include/pic16/math.h
new file mode 100644 (file)
index 0000000..16ecbbe
--- /dev/null
@@ -0,0 +1,82 @@
+/*  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 */
diff --git a/device/include/pic16/stdio.h b/device/include/pic16/stdio.h
new file mode 100644 (file)
index 0000000..5050b81
--- /dev/null
@@ -0,0 +1,60 @@
+/*-------------------------------------------------------------------------
+  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 */
diff --git a/device/include/pic16/stdlib.h b/device/include/pic16/stdlib.h
new file mode 100644 (file)
index 0000000..f13b4a0
--- /dev/null
@@ -0,0 +1,46 @@
+/*-------------------------------------------------------------------------
+  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 */
index 084ccae652cba30b1af9b31a8feb0f27c199c00f..919c89e90ea96db9a75b8113b3d5e4e8fbc34a5a 100644 (file)
@@ -43,7 +43,7 @@ extern TBLPTRU;
 extern TABLAT;
 extern PRODL;
 
-void _gptrget1(void)
+void _gptrget1(void) _naked
 {
   _asm
     /* decode generic pointer MSB (in WREG) bits 6 and 7:
index c16581f235671b4d1c84187e0ec443231ea0d9b0..6d4ca32130b380461b5682f174a9334811063f91 100644 (file)
@@ -44,7 +44,7 @@ extern TBLPTRU;
 extern TABLAT;
 extern PRODL;
 
-void _gptrget2(void)
+void _gptrget2(void) _naked
 {
   _asm
     /* decode generic pointer MSB (in WREG) bits 6 and 7:
index 0e5d5868f64c8eb2edeb734e5dd2b42b33450ea7..91387a321a09cf2eac32b8c249dd3a13d02bfa07 100644 (file)
@@ -45,7 +45,7 @@ extern TABLAT;
 extern PRODL;
 extern PRODH;
 
-void _gptrget3(void)
+void _gptrget3(void) _naked
 {
   _asm
     /* decode generic pointer MSB (in WREG) bits 6 and 7:
index 74f0a2ccbc18d690d7a0f59e8ea198d2b10497c4..f0721f8fabba7349d05e496af20a9352edc43b26 100644 (file)
@@ -45,7 +45,7 @@ extern TABLAT;
 extern PRODL;
 extern PRODH;
 
-void _gptrget4(void)
+void _gptrget4(void) _naked
 {
   _asm
     /* decode generic pointer MSB (in WREG) bits 6 and 7:
index edda1e99a08c819e2cf6399f3fbcc43e65d06f81..79df3509f42230a87e6a58b0a5d09f0d54b49a21 100644 (file)
@@ -44,7 +44,7 @@ extern TABLAT;
 extern PRODL;
 extern PRODH;
 
-void _gptrput1(void)
+void _gptrput1(void) _naked
 {
   _asm
     /* decode generic pointer MSB (in WREG) bits 6 and 7:
index 58e2daa57349e4cdfe7b3d092c4be5b25527cfde..80589c5efddaf2fa2ab0f78064b129042d4068e1 100644 (file)
@@ -1,6 +1,6 @@
 /*-------------------------------------------------------------------------
 
-   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)
 
@@ -44,7 +44,7 @@ extern TABLAT;
 extern PRODL;
 extern PRODH;
 
-void _gptrput2(void)
+void _gptrput2(void) _naked
 {
   _asm
     /* decode generic pointer MSB (in WREG) bits 6 and 7:
index 7ce8762efe36c261289086f32264637f469afa99..c699c8645b43919e21e26a4ded02ea8459efbace 100644 (file)
@@ -1,6 +1,6 @@
 /*-------------------------------------------------------------------------
 
-   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)
 
@@ -44,7 +44,7 @@ extern TABLAT;
 extern PRODL;
 extern PRODH;
 
-void _gptrput3(void)
+void _gptrput3(void) _naked
 {
   _asm
     /* decode generic pointer MSB (in WREG) bits 6 and 7:
index adf5a8f9126bf1ef1b3e2684340d2b8f9cfc4c55..6f0baaecb1da2f9aeb4632b6e6144dfe4aae9dc2 100644 (file)
@@ -1,6 +1,6 @@
 /*-------------------------------------------------------------------------
 
-   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)
 
@@ -44,7 +44,7 @@ extern TABLAT;
 extern PRODL;
 extern PRODH;
 
-void _gptrput4(void)
+void _gptrput4(void) _naked
 {
   _asm
     /* decode generic pointer MSB (in WREG) bits 6 and 7: