Initial Commit

This commit is contained in:
Leon Wilzer 2022-11-21 21:38:08 +01:00
parent e78b55aa62
commit 3f1b39099b
134 changed files with 9280 additions and 0 deletions

View File

@ -0,0 +1,99 @@
/* Provide support for both ANSI and non-ANSI environments. */
/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be
relied upon to have it's intended meaning. Therefore we must use our own
concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib
sources!
To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will
"comment out" the non-ANSI parts of the ANSI header files (non-ANSI header
files aren't affected). */
#ifndef _ANSIDECL_H_
#define _ANSIDECL_H_
#include <newlib.h>
#include <sys/config.h>
/* First try to figure out whether we really are in an ANSI C environment. */
/* FIXME: This probably needs some work. Perhaps sys/config.h can be
prevailed upon to give us a clue. */
#ifdef __STDC__
#define _HAVE_STDC
#endif
#ifdef _HAVE_STDC
#define _PTR void *
#define _AND ,
#define _NOARGS void
#define _CONST const
#define _VOLATILE volatile
#define _SIGNED signed
#define _DOTS , ...
#define _VOID void
#ifdef __CYGWIN__
#define _EXFUN(name, proto) __cdecl name proto
#define _EXPARM(name, proto) (* __cdecl name) proto
#else
#define _EXFUN(name, proto) name proto
#define _EXPARM(name, proto) (* name) proto
#endif
#define _DEFUN(name, arglist, args) name(args)
#define _DEFUN_VOID(name) name(_NOARGS)
#define _CAST_VOID (void)
#ifndef _LONG_DOUBLE
#define _LONG_DOUBLE long double
#endif
#ifndef _LONG_LONG_TYPE
#define _LONG_LONG_TYPE long long
#endif
#ifndef _PARAMS
#define _PARAMS(paramlist) paramlist
#endif
#else
#define _PTR char *
#define _AND ;
#define _NOARGS
#define _CONST
#define _VOLATILE
#define _SIGNED
#define _DOTS
#define _VOID void
#define _EXFUN(name, proto) name()
#define _DEFUN(name, arglist, args) name arglist args;
#define _DEFUN_VOID(name) name()
#define _CAST_VOID
#define _LONG_DOUBLE double
#define _LONG_LONG_TYPE long
#ifndef _PARAMS
#define _PARAMS(paramlist) ()
#endif
#endif
/* Support gcc's __attribute__ facility. */
#ifdef __GNUC__
#define _ATTRIBUTE(attrs) __attribute__ (attrs)
#else
#define _ATTRIBUTE(attrs)
#endif
/* ISO C++. */
#ifdef __cplusplus
#if !(defined(_BEGIN_STD_C) && defined(_END_STD_C))
#ifdef _HAVE_STD_CXX
#define _BEGIN_STD_C namespace std { extern "C" {
#define _END_STD_C } }
#else
#define _BEGIN_STD_C extern "C" {
#define _END_STD_C }
#endif
#endif
#else
#define _BEGIN_STD_C
#define _END_STD_C
#endif
#endif /* _ANSIDECL_H_ */

View File

@ -0,0 +1,121 @@
/*
* $Id: _default_types.h,v 1.2 2008/06/11 22:14:54 jjohnstn Exp $
*/
#ifndef _MACHINE__DEFAULT_TYPES_H
#define _MACHINE__DEFAULT_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Guess on types by examining *_MIN / *_MAX defines.
*/
#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ >= 3 ) \
&& defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 2 ))
/* GCC >= 3.3.0 has __<val>__ implicitly defined. */
#define __EXP(x) __##x##__
#else
/* Fall back to POSIX versions from <limits.h> */
#define __EXP(x) x
#include <limits.h>
#endif
#if __EXP(SCHAR_MAX) == 0x7f
typedef signed char __int8_t ;
typedef unsigned char __uint8_t ;
#define ___int8_t_defined 1
#endif
#if __EXP(INT_MAX) == 0x7fff
typedef signed int __int16_t;
typedef unsigned int __uint16_t;
#define ___int16_t_defined 1
#elif __EXP(SHRT_MAX) == 0x7fff
typedef signed short __int16_t;
typedef unsigned short __uint16_t;
#define ___int16_t_defined 1
#elif __EXP(SCHAR_MAX) == 0x7fff
typedef signed char __int16_t;
typedef unsigned char __uint16_t;
#define ___int16_t_defined 1
#endif
#if ___int16_t_defined
typedef __int16_t __int_least16_t;
typedef __uint16_t __uint_least16_t;
#define ___int_least16_t_defined 1
#if !___int8_t_defined
typedef __int16_t __int_least8_t;
typedef __uint16_t __uint_least8_t;
#define ___int_least8_t_defined 1
#endif
#endif
#if __EXP(INT_MAX) == 0x7fffffffL
typedef signed int __int32_t;
typedef unsigned int __uint32_t;
#define ___int32_t_defined 1
#elif __EXP(LONG_MAX) == 0x7fffffffL
typedef signed long __int32_t;
typedef unsigned long __uint32_t;
#define ___int32_t_defined 1
#elif __EXP(SHRT_MAX) == 0x7fffffffL
typedef signed short __int32_t;
typedef unsigned short __uint32_t;
#define ___int32_t_defined 1
#elif __EXP(SCHAR_MAX) == 0x7fffffffL
typedef signed char __int32_t;
typedef unsigned char __uint32_t;
#define ___int32_t_defined 1
#endif
#if ___int32_t_defined
typedef __int32_t __int_least32_t;
typedef __uint32_t __uint_least32_t;
#define ___int_least32_t_defined 1
#if !___int8_t_defined
typedef __int32_t __int_least8_t;
typedef __uint32_t __uint_least8_t;
#define ___int_least8_t_defined 1
#endif
#if !___int16_t_defined
typedef __int32_t __int_least16_t;
typedef __uint32_t __uint_least16_t;
#define ___int_least16_t_defined 1
#endif
#endif
#if __EXP(LONG_MAX) > 0x7fffffff
typedef signed long __int64_t;
typedef unsigned long __uint64_t;
#define ___int64_t_defined 1
/* GCC has __LONG_LONG_MAX__ */
#elif defined(__LONG_LONG_MAX__) && (__LONG_LONG_MAX__ > 0x7fffffff)
typedef signed long long __int64_t;
typedef unsigned long long __uint64_t;
#define ___int64_t_defined 1
/* POSIX mandates LLONG_MAX in <limits.h> */
#elif defined(LLONG_MAX) && (LLONG_MAX > 0x7fffffff)
typedef signed long long __int64_t;
typedef unsigned long long __uint64_t;
#define ___int64_t_defined 1
#elif __EXP(INT_MAX) > 0x7fffffff
typedef signed int __int64_t;
typedef unsigned int __uint64_t;
#define ___int64_t_defined 1
#endif
#undef __EXP
#ifdef __cplusplus
}
#endif
#endif /* _MACHINE__DEFAULT_TYPES_H */

View File

@ -0,0 +1,8 @@
/*
* $Id: _types.h,v 1.3 2007/09/07 21:16:25 jjohnstn Exp $
*/
#ifndef _MACHINE__TYPES_H
#define _MACHINE__TYPES_H
#include <machine/_default_types.h>
#endif

View File

@ -0,0 +1,333 @@
#ifndef __IEEE_BIG_ENDIAN
#ifndef __IEEE_LITTLE_ENDIAN
/* This file can define macros to choose variations of the IEEE float
format:
_FLT_LARGEST_EXPONENT_IS_NORMAL
Defined if the float format uses the largest exponent for finite
numbers rather than NaN and infinity representations. Such a
format cannot represent NaNs or infinities at all, but it's FLT_MAX
is twice the IEEE value.
_FLT_NO_DENORMALS
Defined if the float format does not support IEEE denormals. Every
float with a zero exponent is taken to be a zero representation.
??? At the moment, there are no equivalent macros above for doubles and
the macros are not fully supported by --enable-newlib-hw-fp.
__IEEE_BIG_ENDIAN
Defined if the float format is big endian. This is mutually exclusive
with __IEEE_LITTLE_ENDIAN.
__IEEE_LITTLE_ENDIAN
Defined if the float format is little endian. This is mutually exclusive
with __IEEE_BIG_ENDIAN.
Note that one of __IEEE_BIG_ENDIAN or __IEEE_LITTLE_ENDIAN must be specified for a
platform or error will occur.
__IEEE_BYTES_LITTLE_ENDIAN
This flag is used in conjunction with __IEEE_BIG_ENDIAN to describe a situation
whereby multiple words of an IEEE floating point are in big endian order, but the
words themselves are little endian with respect to the bytes.
_DOUBLE_IS_32BITS
This is used on platforms that support double by using the 32-bit IEEE
float type.
_FLOAT_ARG
This represents what type a float arg is passed as. It is used when the type is
not promoted to double.
*/
#if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__)
/* ARM traditionally used big-endian words; and within those words the
byte ordering was big or little endian depending upon the target.
Modern floating-point formats are naturally ordered; in this case
__VFP_FP__ will be defined, even if soft-float. */
#ifdef __VFP_FP__
# ifdef __ARMEL__
# define __IEEE_LITTLE_ENDIAN
# else
# define __IEEE_BIG_ENDIAN
# endif
#else
# define __IEEE_BIG_ENDIAN
# ifdef __ARMEL__
# define __IEEE_BYTES_LITTLE_ENDIAN
# endif
#endif
#endif
#ifdef __hppa__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __SPU__
#define __IEEE_BIG_ENDIAN
#define isfinite(y) \
(__extension__ ({__typeof__(y) __y = (y); \
(sizeof (__y) == sizeof (float)) ? (1) : \
fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;}))
#define isinf(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof (__x) == sizeof (float)) ? (0) : __isinfd(__x);}))
#define isnan(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof (__x) == sizeof (float)) ? (0) : __isnand(__x);}))
/*
* Macros for use in ieeefp.h. We can't just define the real ones here
* (like those above) as we have name space issues when this is *not*
* included via generic the ieeefp.h.
*/
#define __ieeefp_isnanf(x) 0
#define __ieeefp_isinff(x) 0
#define __ieeefp_finitef(x) 1
#endif
#ifdef __sparc__
#ifdef __LITTLE_ENDIAN_DATA__
#define __IEEE_LITTLE_ENDIAN
#else
#define __IEEE_BIG_ENDIAN
#endif
#endif
#if defined(__m68k__) || defined(__mc68000__)
#define __IEEE_BIG_ENDIAN
#endif
#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
#define __IEEE_BIG_ENDIAN
#ifdef __HAVE_SHORT_DOUBLE__
# define _DOUBLE_IS_32BITS
#endif
#endif
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) || defined (__H8500__) || defined (__H8300SX__)
#define __IEEE_BIG_ENDIAN
#define _FLOAT_ARG float
#define _DOUBLE_IS_32BITS
#endif
#ifdef __sh__
#ifdef __LITTLE_ENDIAN__
#define __IEEE_LITTLE_ENDIAN
#else
#define __IEEE_BIG_ENDIAN
#endif
#if defined(__SH2E__) || defined(__SH3E__) || defined(__SH4_SINGLE_ONLY__) || defined(__SH2A_SINGLE_ONLY__)
#define _DOUBLE_IS_32BITS
#endif
#endif
#ifdef _AM29K
#define __IEEE_BIG_ENDIAN
#endif
#ifdef _WIN32
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __i386__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __i960__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __lm32__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __M32R__
#define __IEEE_BIG_ENDIAN
#endif
#if defined(_C4x) || defined(_C3x)
#define __IEEE_BIG_ENDIAN
#define _DOUBLE_IS_32BITS
#endif
#ifdef __TIC80__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __MIPSEL__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __MIPSEB__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __MMIX__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __D30V__
#define __IEEE_BIG_ENDIAN
#endif
/* necv70 was __IEEE_LITTLE_ENDIAN. */
#ifdef __W65__
#define __IEEE_LITTLE_ENDIAN
#define _DOUBLE_IS_32BITS
#endif
#if defined(__Z8001__) || defined(__Z8002__)
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __m88k__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __mn10300__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __mn10200__
#define __IEEE_LITTLE_ENDIAN
#define _DOUBLE_IS_32BITS
#endif
#ifdef __v800
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __v850
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __D10V__
#define __IEEE_BIG_ENDIAN
#if __DOUBLE__ == 32
#define _DOUBLE_IS_32BITS
#endif
#endif
#ifdef __PPC__
#if (defined(_BIG_ENDIAN) && _BIG_ENDIAN) || (defined(_AIX) && _AIX)
#define __IEEE_BIG_ENDIAN
#else
#if (defined(_LITTLE_ENDIAN) && _LITTLE_ENDIAN) || (defined(__sun__) && __sun__) || (defined(_WIN32) && _WIN32)
#define __IEEE_LITTLE_ENDIAN
#endif
#endif
#endif
#ifdef __xstormy16__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __arc__
#ifdef __big_endian__
#define __IEEE_BIG_ENDIAN
#else
#define __IEEE_LITTLE_ENDIAN
#endif
#endif
#ifdef __CRX__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __fr30__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __mcore__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __mt__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __frv__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __ia64__
#ifdef __BIG_ENDIAN__
#define __IEEE_BIG_ENDIAN
#else
#define __IEEE_LITTLE_ENDIAN
#endif
#endif
#ifdef __AVR__
#define __IEEE_LITTLE_ENDIAN
#define _DOUBLE_IS_32BITS
#endif
#if defined(__or32__) || defined(__or1k__) || defined(__or16__)
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __IP2K__
#define __IEEE_BIG_ENDIAN
#define __SMALL_BITFIELDS
#define _DOUBLE_IS_32BITS
#endif
#ifdef __iq2000__
#define __IEEE_BIG_ENDIAN
#endif
#ifdef __MAVERICK__
#ifdef __ARMEL__
# define __IEEE_LITTLE_ENDIAN
#else /* must be __ARMEB__ */
# define __IEEE_BIG_ENDIAN
#endif /* __ARMEL__ */
#endif /* __MAVERICK__ */
#ifdef __m32c__
#define __IEEE_LITTLE_ENDIAN
#define __SMALL_BITFIELDS
#endif
#ifdef __CRIS__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __BFIN__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __x86_64__
#define __IEEE_LITTLE_ENDIAN
#endif
#ifdef __mep__
#ifdef __LITTLE_ENDIAN__
#define __IEEE_LITTLE_ENDIAN
#else
#define __IEEE_BIG_ENDIAN
#endif
#endif
#ifndef __IEEE_BIG_ENDIAN
#ifndef __IEEE_LITTLE_ENDIAN
#error Endianess not declared!!
#endif /* not __IEEE_LITTLE_ENDIAN */
#endif /* not __IEEE_BIG_ENDIAN */
#endif /* not __IEEE_LITTLE_ENDIAN */
#endif /* not __IEEE_BIG_ENDIAN */

View File

@ -0,0 +1,483 @@
#ifndef _MATH_H_
#define _MATH_H_
#include <sys/reent.h>
#include <machine/ieeefp.h>
#include "_ansi.h"
_BEGIN_STD_C
union __dmath
{
__ULong i[2];
double d;
};
union __fmath
{
__ULong i[1];
float f;
};
union __ldmath
{
__ULong i[4];
_LONG_DOUBLE ld;
};
/* Natural log of 2 */
#define _M_LOG2_E 0.693147180559945309417
#if defined(__GNUC__) && \
( (__GNUC__ >= 4) || \
( (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 3) ) )
/* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
# ifndef HUGE_VAL
# define HUGE_VAL (__builtin_huge_val())
# endif
# ifndef HUGE_VALF
# define HUGE_VALF (__builtin_huge_valf())
# endif
# ifndef HUGE_VALL
# define HUGE_VALL (__builtin_huge_vall())
# endif
# ifndef INFINITY
# define INFINITY (__builtin_inff())
# endif
# ifndef NAN
# define NAN (__builtin_nanf(""))
# endif
#else /* !gcc >= 3.3 */
/* No builtins. Use floating-point unions instead. Declare as an array
without bounds so no matter what small data support a port and/or
library has, the reference will be via the general method for accessing
globals. */
#ifndef HUGE_VAL
extern __IMPORT const union __dmath __infinity[];
#define HUGE_VAL (__infinity[0].d)
#endif
#ifndef HUGE_VALF
extern __IMPORT const union __fmath __infinityf[];
#define HUGE_VALF (__infinityf[0].f)
#endif
#ifndef HUGE_VALL
extern __IMPORT const union __ldmath __infinityld[];
#define HUGE_VALL (__infinityld[0].ld)
#endif
#endif /* !gcc >= 3.3 */
/* Reentrant ANSI C functions. */
#ifndef __math_68881
extern double atan _PARAMS((double));
extern double cos _PARAMS((double));
extern double sin _PARAMS((double));
extern double tan _PARAMS((double));
extern double tanh _PARAMS((double));
extern double frexp _PARAMS((double, int *));
extern double modf _PARAMS((double, double *));
extern double ceil _PARAMS((double));
extern double fabs _PARAMS((double));
extern double floor _PARAMS((double));
#endif /* ! defined (__math_68881) */
/* Non reentrant ANSI C functions. */
#ifndef _REENT_ONLY
#ifndef __math_6881
extern double acos _PARAMS((double));
extern double asin _PARAMS((double));
extern double atan2 _PARAMS((double, double));
extern double cosh _PARAMS((double));
extern double sinh _PARAMS((double));
extern double exp _PARAMS((double));
extern double ldexp _PARAMS((double, int));
extern double log _PARAMS((double));
extern double log10 _PARAMS((double));
extern double pow _PARAMS((double, double));
extern double sqrt _PARAMS((double));
extern double fmod _PARAMS((double, double));
#endif /* ! defined (__math_68881) */
#endif /* ! defined (_REENT_ONLY) */
#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
/* ISO C99 types and macros. */
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD 0
typedef float float_t;
typedef double double_t;
#endif /* FLT_EVAL_METHOD */
#define FP_NAN 0
#define FP_INFINITE 1
#define FP_ZERO 2
#define FP_SUBNORMAL 3
#define FP_NORMAL 4
#ifndef FP_ILOGB0
# define FP_ILOGB0 (-INT_MAX)
#endif
#ifndef FP_ILOGBNAN
# define FP_ILOGBNAN INT_MAX
#endif
#ifndef MATH_ERRNO
# define MATH_ERRNO 1
#endif
#ifndef MATH_ERREXCEPT
# define MATH_ERREXCEPT 2
#endif
#ifndef math_errhandling
# define math_errhandling MATH_ERRNO
#endif
extern int __isinff (float x);
extern int __isinfd (double x);
extern int __isnanf (float x);
extern int __isnand (double x);
extern int __fpclassifyf (float x);
extern int __fpclassifyd (double x);
extern int __signbitf (float x);
extern int __signbitd (double x);
#define fpclassify(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof (__x) == sizeof (float)) ? __fpclassifyf(__x) : __fpclassifyd(__x);}))
#ifndef isfinite
#define isfinite(y) \
(__extension__ ({__typeof__(y) __y = (y); \
fpclassify(__y) != FP_INFINITE && fpclassify(__y) != FP_NAN;}))
#endif
/* Note: isinf and isnan were once functions in newlib that took double
* arguments. C99 specifies that these names are reserved for macros
* supporting multiple floating point types. Thus, they are
* now defined as macros. Implementations of the old functions
* taking double arguments still exist for compatibility purposes. */
#ifndef isinf
#define isinf(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof (__x) == sizeof (float)) ? __isinff(__x) : __isinfd(__x);}))
#endif
#ifndef isnan
#define isnan(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof (__x) == sizeof (float)) ? __isnanf(__x) : __isnand(__x);}))
#endif
#define isnormal(y) (fpclassify(y) == FP_NORMAL)
#define signbit(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof(__x) == sizeof(float)) ? __signbitf(__x) : __signbitd(__x);}))
#define isgreater(x,y) \
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x,__y) && (__x > __y);}))
#define isgreaterequal(x,y) \
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x,__y) && (__x >= __y);}))
#define isless(x,y) \
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x,__y) && (__x < __y);}))
#define islessequal(x,y) \
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x,__y) && (__x <= __y);}))
#define islessgreater(x,y) \
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
!isunordered(__x,__y) && (__x < __y || __x > __y);}))
#define isunordered(a,b) \
(__extension__ ({__typeof__(a) __a = (a); __typeof__(b) __b = (b); \
fpclassify(__a) == FP_NAN || fpclassify(__b) == FP_NAN;}))
/* Non ANSI double precision functions. */
extern double infinity _PARAMS((void));
extern double nan _PARAMS((const char *));
extern int finite _PARAMS((double));
extern double copysign _PARAMS((double, double));
extern int ilogb _PARAMS((double));
extern double asinh _PARAMS((double));
extern double cbrt _PARAMS((double));
extern double nextafter _PARAMS((double, double));
extern double rint _PARAMS((double));
extern double scalbn _PARAMS((double, int));
extern double exp2 _PARAMS((double));
extern double scalbln _PARAMS((double, long int));
extern double tgamma _PARAMS((double));
extern double nearbyint _PARAMS((double));
extern long int lrint _PARAMS((double));
extern _LONG_LONG_TYPE int llrint _PARAMS((double));
extern double round _PARAMS((double));
extern long int lround _PARAMS((double));
extern double trunc _PARAMS((double));
extern double remquo _PARAMS((double, double, int *));
extern double copysign _PARAMS((double, double));
extern double fdim _PARAMS((double, double));
extern double fmax _PARAMS((double, double));
extern double fmin _PARAMS((double, double));
extern double fma _PARAMS((double, double, double));
#ifndef __math_68881
extern double log1p _PARAMS((double));
extern double expm1 _PARAMS((double));
#endif /* ! defined (__math_68881) */
#ifndef _REENT_ONLY
extern double acosh _PARAMS((double));
extern double atanh _PARAMS((double));
extern double remainder _PARAMS((double, double));
extern double gamma _PARAMS((double));
extern double lgamma _PARAMS((double));
extern double erf _PARAMS((double));
extern double erfc _PARAMS((double));
#define log2(x) (log (x) / _M_LOG2_E)
#ifndef __math_68881
extern double hypot _PARAMS((double, double));
#endif
#endif /* ! defined (_REENT_ONLY) */
/* Single precision versions of ANSI functions. */
extern float atanf _PARAMS((float));
extern float cosf _PARAMS((float));
extern float sinf _PARAMS((float));
extern float tanf _PARAMS((float));
extern float tanhf _PARAMS((float));
extern float frexpf _PARAMS((float, int *));
extern float modff _PARAMS((float, float *));
extern float ceilf _PARAMS((float));
extern float fabsf _PARAMS((float));
extern float floorf _PARAMS((float));
#ifndef _REENT_ONLY
extern float acosf _PARAMS((float));
extern float asinf _PARAMS((float));
extern float atan2f _PARAMS((float, float));
extern float coshf _PARAMS((float));
extern float sinhf _PARAMS((float));
extern float expf _PARAMS((float));
extern float ldexpf _PARAMS((float, int));
extern float logf _PARAMS((float));
extern float log10f _PARAMS((float));
extern float powf _PARAMS((float, float));
extern float sqrtf _PARAMS((float));
extern float fmodf _PARAMS((float, float));
#endif /* ! defined (_REENT_ONLY) */
/* Other single precision functions. */
extern float exp2f _PARAMS((float));
extern float scalblnf _PARAMS((float, long int));
extern float tgammaf _PARAMS((float));
extern float nearbyintf _PARAMS((float));
extern long int lrintf _PARAMS((float));
extern _LONG_LONG_TYPE llrintf _PARAMS((float));
extern float roundf _PARAMS((float));
extern long int lroundf _PARAMS((float));
extern float truncf _PARAMS((float));
extern float remquof _PARAMS((float, float, int *));
extern float copysignf _PARAMS((float, float));
extern float fdimf _PARAMS((float, float));
extern float fmaxf _PARAMS((float, float));
extern float fminf _PARAMS((float, float));
extern float fmaf _PARAMS((float, float, float));
extern float infinityf _PARAMS((void));
extern float nanf _PARAMS((const char *));
extern int isnanf _PARAMS((float));
extern int isinff _PARAMS((float));
extern int finitef _PARAMS((float));
extern float copysignf _PARAMS((float, float));
extern int ilogbf _PARAMS((float));
extern float asinhf _PARAMS((float));
extern float cbrtf _PARAMS((float));
extern float nextafterf _PARAMS((float, float));
extern float rintf _PARAMS((float));
extern float scalbnf _PARAMS((float, int));
extern float log1pf _PARAMS((float));
extern float expm1f _PARAMS((float));
#ifndef _REENT_ONLY
extern float acoshf _PARAMS((float));
extern float atanhf _PARAMS((float));
extern float remainderf _PARAMS((float, float));
extern float gammaf _PARAMS((float));
extern float lgammaf _PARAMS((float));
extern float erff _PARAMS((float));
extern float erfcf _PARAMS((float));
#define log2f(x) (logf (x) / (float) _M_LOG2_E)
extern float hypotf _PARAMS((float, float));
#endif /* ! defined (_REENT_ONLY) */
/* Other long double precision functions. */
extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
extern long int lrintl _PARAMS((_LONG_DOUBLE));
extern _LONG_LONG_TYPE llrintl _PARAMS((_LONG_DOUBLE));
#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L */
#if !defined (__STRICT_ANSI__) || defined(__cplusplus)
extern double cabs();
extern double drem _PARAMS((double, double));
extern void sincos _PARAMS((double, double *, double *));
extern double gamma_r _PARAMS((double, int *));
extern double lgamma_r _PARAMS((double, int *));
extern double y0 _PARAMS((double));
extern double y1 _PARAMS((double));
extern double yn _PARAMS((int, double));
extern double j0 _PARAMS((double));
extern double j1 _PARAMS((double));
extern double jn _PARAMS((int, double));
extern float cabsf();
extern float dremf _PARAMS((float, float));
extern void sincosf _PARAMS((float, float *, float *));
extern float gammaf_r _PARAMS((float, int *));
extern float lgammaf_r _PARAMS((float, int *));
extern float y0f _PARAMS((float));
extern float y1f _PARAMS((float));
extern float ynf _PARAMS((int, float));
extern float j0f _PARAMS((float));
extern float j1f _PARAMS((float));
extern float jnf _PARAMS((int, float));
/* GNU extensions */
# ifndef exp10
extern double exp10 _PARAMS((double));
# endif
# ifndef pow10
extern double pow10 _PARAMS((double));
# endif
# ifndef exp10f
extern float exp10f _PARAMS((float));
# endif
# ifndef pow10f
extern float pow10f _PARAMS((float));
# endif
#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) */
#ifndef __STRICT_ANSI__
/* The gamma functions use a global variable, signgam. */
#ifndef _REENT_ONLY
#define signgam (*__signgam())
extern int *__signgam _PARAMS((void));
#endif /* ! defined (_REENT_ONLY) */
#define __signgam_r(ptr) _REENT_SIGNGAM(ptr)
/* The exception structure passed to the matherr routine. */
/* We have a problem when using C++ since `exception' is a reserved
name in C++. */
#ifdef __cplusplus
struct __exception
#else
struct exception
#endif
{
int type;
char *name;
double arg1;
double arg2;
double retval;
int err;
};
#ifdef __cplusplus
extern int matherr _PARAMS((struct __exception *e));
#else
extern int matherr _PARAMS((struct exception *e));
#endif
/* Values for the type field of struct exception. */
#define DOMAIN 1
#define SING 2
#define OVERFLOW 3
#define UNDERFLOW 4
#define TLOSS 5
#define PLOSS 6
/* Useful constants. */
#define MAXFLOAT 3.40282347e+38F
#define M_E 2.7182818284590452354
#define M_LOG2E 1.4426950408889634074
#define M_LOG10E 0.43429448190325182765
#define M_LN2 0.69314718055994530942
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_TWOPI (M_PI * 2.0)
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962
#define M_3PI_4 2.3561944901923448370E0
#define M_SQRTPI 1.77245385090551602792981
#define M_1_PI 0.31830988618379067154
#define M_2_PI 0.63661977236758134308
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.70710678118654752440
#define M_LN2LO 1.9082149292705877000E-10
#define M_LN2HI 6.9314718036912381649E-1
#define M_SQRT3 1.73205080756887719000
#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */
#define M_LOG2_E _M_LOG2_E
#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */
/* Global control over fdlibm error handling. */
enum __fdlibm_version
{
__fdlibm_ieee = -1,
__fdlibm_svid,
__fdlibm_xopen,
__fdlibm_posix
};
#define _LIB_VERSION_TYPE enum __fdlibm_version
#define _LIB_VERSION __fdlib_version
extern __IMPORT _LIB_VERSION_TYPE _LIB_VERSION;
#define _IEEE_ __fdlibm_ieee
#define _SVID_ __fdlibm_svid
#define _XOPEN_ __fdlibm_xopen
#define _POSIX_ __fdlibm_posix
#endif /* ! defined (__STRICT_ANSI__) */
_END_STD_C
#ifdef __FAST_MATH__
#include <machine/fastmath.h>
#endif
#endif /* _MATH_H_ */

View File

@ -0,0 +1,162 @@
/* newlib.h. Generated by configure. */
/* newlib.hin. Generated from configure.in by autoheader. */
#ifndef __NEWLIB_H__
#define __NEWLIB_H__ 1
/* EL/IX level */
/* #undef _ELIX_LEVEL */
/* Newlib version */
#define _NEWLIB_VERSION "1.17.0"
/* C99 formats support (such as %a, %zu, ...) in IO functions like
* printf/scanf enabled */
/* #undef _WANT_IO_C99_FORMATS */
/* long long type support in IO functions like printf/scanf enabled */
/* #undef _WANT_IO_LONG_LONG */
/* long double type support in IO functions like printf/scanf enabled */
/* #undef _WANT_IO_LONG_DOUBLE */
/* Positional argument support in printf functions enabled. */
/* #undef _WANT_IO_POS_ARGS */
/* Optional reentrant struct support. Used mostly on platforms with
very restricted storage. */
/* #undef _WANT_REENT_SMALL */
/* Multibyte supported */
/* #undef _MB_CAPABLE */
/* MB_LEN_MAX */
#define _MB_LEN_MAX 1
/* ICONV enabled */
/* #undef _ICONV_ENABLED */
/* Enable ICONV external CCS files loading capabilities */
/* #undef _ICONV_ENABLE_EXTERNAL_CCS */
/* Define if the linker supports .preinit_array/.init_array/.fini_array
* sections. */
#define HAVE_INITFINI_ARRAY 1
/* True if atexit() may dynamically allocate space for cleanup
functions. */
#define _ATEXIT_DYNAMIC_ALLOC 1
/* Define if the compiler supports aliasing an array to an address. */
/* #undef _HAVE_ARRAY_ALIASING */
/*
* Iconv encodings enabled ("to" direction)
*/
/* #undef _ICONV_TO_ENCODING_BIG5 */
/* #undef _ICONV_TO_ENCODING_CP775 */
/* #undef _ICONV_TO_ENCODING_CP850 */
/* #undef _ICONV_TO_ENCODING_CP852 */
/* #undef _ICONV_TO_ENCODING_CP855 */
/* #undef _ICONV_TO_ENCODING_CP866 */
/* #undef _ICONV_TO_ENCODING_EUC_JP */
/* #undef _ICONV_TO_ENCODING_EUC_TW */
/* #undef _ICONV_TO_ENCODING_EUC_KR */
/* #undef _ICONV_TO_ENCODING_ISO_8859_1 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_10 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_11 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_13 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_14 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_15 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_2 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_3 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_4 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_5 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_6 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_7 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_8 */
/* #undef _ICONV_TO_ENCODING_ISO_8859_9 */
/* #undef _ICONV_TO_ENCODING_ISO_IR_111 */
/* #undef _ICONV_TO_ENCODING_KOI8_R */
/* #undef _ICONV_TO_ENCODING_KOI8_RU */
/* #undef _ICONV_TO_ENCODING_KOI8_U */
/* #undef _ICONV_TO_ENCODING_KOI8_UNI */
/* #undef _ICONV_TO_ENCODING_UCS_2 */
/* #undef _ICONV_TO_ENCODING_UCS_2_INTERNAL */
/* #undef _ICONV_TO_ENCODING_UCS_2BE */
/* #undef _ICONV_TO_ENCODING_UCS_2LE */
/* #undef _ICONV_TO_ENCODING_UCS_4 */
/* #undef _ICONV_TO_ENCODING_UCS_4_INTERNAL */
/* #undef _ICONV_TO_ENCODING_UCS_4BE */
/* #undef _ICONV_TO_ENCODING_UCS_4LE */
/* #undef _ICONV_TO_ENCODING_US_ASCII */
/* #undef _ICONV_TO_ENCODING_UTF_16 */
/* #undef _ICONV_TO_ENCODING_UTF_16BE */
/* #undef _ICONV_TO_ENCODING_UTF_16LE */
/* #undef _ICONV_TO_ENCODING_UTF_8 */
/* #undef _ICONV_TO_ENCODING_WIN_1250 */
/* #undef _ICONV_TO_ENCODING_WIN_1251 */
/* #undef _ICONV_TO_ENCODING_WIN_1252 */
/* #undef _ICONV_TO_ENCODING_WIN_1253 */
/* #undef _ICONV_TO_ENCODING_WIN_1254 */
/* #undef _ICONV_TO_ENCODING_WIN_1255 */
/* #undef _ICONV_TO_ENCODING_WIN_1256 */
/* #undef _ICONV_TO_ENCODING_WIN_1257 */
/* #undef _ICONV_TO_ENCODING_WIN_1258 */
/*
* Iconv encodings enabled ("from" direction)
*/
/* #undef _ICONV_FROM_ENCODING_BIG5 */
/* #undef _ICONV_FROM_ENCODING_CP775 */
/* #undef _ICONV_FROM_ENCODING_CP850 */
/* #undef _ICONV_FROM_ENCODING_CP852 */
/* #undef _ICONV_FROM_ENCODING_CP855 */
/* #undef _ICONV_FROM_ENCODING_CP866 */
/* #undef _ICONV_FROM_ENCODING_EUC_JP */
/* #undef _ICONV_FROM_ENCODING_EUC_TW */
/* #undef _ICONV_FROM_ENCODING_EUC_KR */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_1 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_10 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_11 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_13 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_14 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_15 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_2 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_3 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_4 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_5 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_6 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_7 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_8 */
/* #undef _ICONV_FROM_ENCODING_ISO_8859_9 */
/* #undef _ICONV_FROM_ENCODING_ISO_IR_111 */
/* #undef _ICONV_FROM_ENCODING_KOI8_R */
/* #undef _ICONV_FROM_ENCODING_KOI8_RU */
/* #undef _ICONV_FROM_ENCODING_KOI8_U */
/* #undef _ICONV_FROM_ENCODING_KOI8_UNI */
/* #undef _ICONV_FROM_ENCODING_UCS_2 */
/* #undef _ICONV_FROM_ENCODING_UCS_2_INTERNAL */
/* #undef _ICONV_FROM_ENCODING_UCS_2BE */
/* #undef _ICONV_FROM_ENCODING_UCS_2LE */
/* #undef _ICONV_FROM_ENCODING_UCS_4 */
/* #undef _ICONV_FROM_ENCODING_UCS_4_INTERNAL */
/* #undef _ICONV_FROM_ENCODING_UCS_4BE */
/* #undef _ICONV_FROM_ENCODING_UCS_4LE */
/* #undef _ICONV_FROM_ENCODING_US_ASCII */
/* #undef _ICONV_FROM_ENCODING_UTF_16 */
/* #undef _ICONV_FROM_ENCODING_UTF_16BE */
/* #undef _ICONV_FROM_ENCODING_UTF_16LE */
/* #undef _ICONV_FROM_ENCODING_UTF_8 */
/* #undef _ICONV_FROM_ENCODING_WIN_1250 */
/* #undef _ICONV_FROM_ENCODING_WIN_1251 */
/* #undef _ICONV_FROM_ENCODING_WIN_1252 */
/* #undef _ICONV_FROM_ENCODING_WIN_1253 */
/* #undef _ICONV_FROM_ENCODING_WIN_1254 */
/* #undef _ICONV_FROM_ENCODING_WIN_1255 */
/* #undef _ICONV_FROM_ENCODING_WIN_1256 */
/* #undef _ICONV_FROM_ENCODING_WIN_1257 */
/* #undef _ICONV_FROM_ENCODING_WIN_1258 */
#endif /* !__NEWLIB_H__ */

View File

@ -0,0 +1,87 @@
/* ANSI C namespace clean utility typedefs */
/* This file defines various typedefs needed by the system calls that support
the C library. Basically, they're just the POSIX versions with an '_'
prepended. This file lives in the `sys' directory so targets can provide
their own if desired (or they can put target dependant conditionals here).
*/
#ifndef _SYS__TYPES_H
#define _SYS__TYPES_H
#include <machine/_types.h>
#include <sys/lock.h>
#ifndef __off_t_defined
typedef long _off_t;
#endif
#if defined(__rtems__)
/* device numbers are 32-bit major and and 32-bit minor */
typedef unsigned long long __dev_t;
#else
#ifndef __dev_t_defined
typedef short __dev_t;
#endif
#endif
#ifndef __uid_t_defined
typedef unsigned short __uid_t;
#endif
#ifndef __gid_t_defined
typedef unsigned short __gid_t;
#endif
#ifndef __off64_t_defined
__extension__ typedef long long _off64_t;
#endif
/*
* We need fpos_t for the following, but it doesn't have a leading "_",
* so we use _fpos_t instead.
*/
#ifndef __fpos_t_defined
typedef long _fpos_t; /* XXX must match off_t in <sys/types.h> */
/* (and must be `long' for now) */
#endif
#ifdef __LARGE64_FILES
#ifndef __fpos64_t_defined
typedef _off64_t _fpos64_t;
#endif
#endif
#ifndef __ssize_t_defined
#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
typedef int _ssize_t;
#else
typedef long _ssize_t;
#endif
#endif
#define __need_wint_t
#include <stddef.h>
#ifndef __mbstate_t_defined
/* Conversion state information. */
typedef struct
{
int __count;
union
{
wint_t __wch;
unsigned char __wchb[4];
} __value; /* Value so far. */
} _mbstate_t;
#endif
#ifndef __flock_t_defined
typedef _LOCK_RECURSIVE_T _flock_t;
#endif
#ifndef __iconv_t_defined
/* Iconv descriptor type */
typedef void *_iconv_t;
#endif
#endif /* _SYS__TYPES_H */

View File

@ -0,0 +1,213 @@
#ifndef __SYS_CONFIG_H__
#define __SYS_CONFIG_H__
#include <machine/ieeefp.h> /* floating point macros */
/* exceptions first */
#if defined(__H8500__) || defined(__W65__)
#define __SMALL_BITFIELDS
/* ??? This conditional is true for the h8500 and the w65, defining H8300
in those cases probably isn't the right thing to do. */
#define H8300 1
#endif
/* 16 bit integer machines */
#if defined(__Z8001__) || defined(__Z8002__) || defined(__H8500__) || defined(__W65__) || defined (__mn10200__) || defined (__AVR__)
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX 32767
#define UINT_MAX 65535
#endif
#if defined (__H8300__) || defined (__H8300H__) || defined(__H8300S__) || defined (__H8300SX__)
#define __SMALL_BITFIELDS
#define H8300 1
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#endif
#ifdef __W65__
#define __SMALL_BITFIELDS
#endif
#if defined(__D10V__)
#define __SMALL_BITFIELDS
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#define _POINTER_INT short
#endif
#if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#define _POINTER_INT short
#endif
#ifdef ___AM29K__
#define _FLOAT_RET double
#endif
#ifdef __i386__
#ifndef __unix__
/* in other words, go32 */
#define _FLOAT_RET double
#endif
#if defined(__linux__) || defined(__RDOS__)
/* we want the reentrancy structure to be returned by a function */
#define __DYNAMIC_REENT__
#define HAVE_GETDATE
#define _HAVE_SYSTYPES
#define _READ_WRITE_RETURN_TYPE _ssize_t
#define __LARGE64_FILES 1
/* we use some glibc header files so turn on glibc large file feature */
#define _LARGEFILE64_SOURCE 1
#endif
#endif
#ifdef __mn10200__
#define __SMALL_BITFIELDS
#endif
#ifdef __AVR__
#define __SMALL_BITFIELDS
#define _POINTER_INT short
#endif
#ifdef __v850
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__))
#endif
/* For the PowerPC eabi, force the _impure_ptr to be in .sdata */
#if defined(__PPC__)
#if defined(_CALL_SYSV)
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif
#ifdef __SPE__
#define _LONG_DOUBLE double
#endif
#endif
#if defined(__mips__) && !defined(__rtems__)
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif
#ifdef __xstormy16__
#define __SMALL_BITFIELDS
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#define MALLOC_ALIGNMENT 8
#define _POINTER_INT short
#define __BUFSIZ__ 16
#define _REENT_SMALL
#endif
#ifdef __m32c__
#define __SMALL_BITFIELDS
#undef INT_MAX
#undef UINT_MAX
#define INT_MAX __INT_MAX__
#define UINT_MAX (__INT_MAX__ * 2U + 1)
#define MALLOC_ALIGNMENT 8
#if defined(__r8c_cpu__) || defined(__m16c_cpu__)
#define _POINTER_INT short
#else
#define _POINTER_INT long
#endif
#define __BUFSIZ__ 16
#define _REENT_SMALL
#endif /* __m32c__ */
#ifdef __thumb2__
/* Thumb-2 based ARMv7M devices are really small. */
#define _REENT_SMALL
#endif
#ifdef __SPU__
#define MALLOC_ALIGNMENT 16
#define __CUSTOM_FILE_IO__
#endif
/* This block should be kept in sync with GCC's limits.h. The point
of having these definitions here is to not include limits.h, which
would pollute the user namespace, while still using types of the
the correct widths when deciding how to define __int32_t and
__int64_t. */
#ifndef __INT_MAX__
# ifdef INT_MAX
# define __INT_MAX__ INT_MAX
# else
# define __INT_MAX__ 2147483647
# endif
#endif
#ifndef __LONG_MAX__
# ifdef LONG_MAX
# define __LONG_MAX__ LONG_MAX
# else
# if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) \
|| defined (__sparcv9)
# define __LONG_MAX__ 9223372036854775807L
# else
# define __LONG_MAX__ 2147483647L
# endif /* __alpha__ || sparc64 */
# endif
#endif
/* End of block that should be kept in sync with GCC's limits.h. */
#ifndef _POINTER_INT
#define _POINTER_INT long
#endif
#ifdef __frv__
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif
#undef __RAND_MAX
#if __INT_MAX__ == 32767
#define __RAND_MAX 32767
#else
#define __RAND_MAX 0x7fffffff
#endif
#if defined(__CYGWIN__)
#include <cygwin/config.h>
#endif
#if defined(__rtems__)
#define __FILENAME_MAX__ 255
#define _READ_WRITE_RETURN_TYPE _ssize_t
#endif
#ifndef __IMPORT
#define __IMPORT
#endif
/* Define return type of read/write routines. In POSIX, the return type
for read()/write() is "ssize_t" but legacy newlib code has been using
"int" for some time. If not specified, "int" is defaulted. */
#ifndef _READ_WRITE_RETURN_TYPE
#define _READ_WRITE_RETURN_TYPE int
#endif
#ifndef __WCHAR_MAX__
#if __INT_MAX__ == 32767 || defined (_WIN32)
#define __WCHAR_MAX__ 0xffffu
#endif
#endif
/* See if small reent asked for at configuration time and
is not chosen by the platform by default. */
#ifdef _WANT_REENT_SMALL
#ifndef _REENT_SMALL
#define _REENT_SMALL
#endif
#endif
#endif /* __SYS_CONFIG_H__ */

View File

@ -0,0 +1,24 @@
#ifndef __SYS_LOCK_H__
#define __SYS_LOCK_H__
/* dummy lock routines for single-threaded aps */
typedef int _LOCK_T;
typedef int _LOCK_RECURSIVE_T;
#include <_ansi.h>
#define __LOCK_INIT(class,lock) static int lock = 0;
#define __LOCK_INIT_RECURSIVE(class,lock) static int lock = 0;
#define __lock_init(lock) (_CAST_VOID 0)
#define __lock_init_recursive(lock) (_CAST_VOID 0)
#define __lock_close(lock) (_CAST_VOID 0)
#define __lock_close_recursive(lock) (_CAST_VOID 0)
#define __lock_acquire(lock) (_CAST_VOID 0)
#define __lock_acquire_recursive(lock) (_CAST_VOID 0)
#define __lock_try_acquire(lock) (_CAST_VOID 0)
#define __lock_try_acquire_recursive(lock) (_CAST_VOID 0)
#define __lock_release(lock) (_CAST_VOID 0)
#define __lock_release_recursive(lock) (_CAST_VOID 0)
#endif /* __SYS_LOCK_H__ */

View File

@ -0,0 +1,837 @@
/* This header file provides the reentrancy. */
/* WARNING: All identifiers here must begin with an underscore. This file is
included by stdio.h and others and we therefore must only use identifiers
in the namespace allotted to us. */
#ifndef _SYS_REENT_H_
#ifdef __cplusplus
extern "C" {
#endif
#define _SYS_REENT_H_
#include <_ansi.h>
#include <sys/_types.h>
#define _NULL 0
#ifndef __Long
#if __LONG_MAX__ == 2147483647L
#define __Long long
typedef unsigned __Long __ULong;
#elif __INT_MAX__ == 2147483647
#define __Long int
typedef unsigned __Long __ULong;
#endif
#endif
#if !defined( __Long)
#include <sys/types.h>
#endif
#ifndef __Long
#define __Long __int32_t
typedef __uint32_t __ULong;
#endif
struct _reent;
/*
* If _REENT_SMALL is defined, we make struct _reent as small as possible,
* by having nearly everything possible allocated at first use.
*/
struct _Bigint
{
struct _Bigint *_next;
int _k, _maxwds, _sign, _wds;
__ULong _x[1];
};
/* needed by reentrant structure */
struct __tm
{
int __tm_sec;
int __tm_min;
int __tm_hour;
int __tm_mday;
int __tm_mon;
int __tm_year;
int __tm_wday;
int __tm_yday;
int __tm_isdst;
};
/*
* atexit() support.
*/
#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */
struct _on_exit_args {
void * _fnargs[_ATEXIT_SIZE]; /* user fn args */
void * _dso_handle[_ATEXIT_SIZE];
/* Bitmask is set if user function takes arguments. */
__ULong _fntypes; /* type of exit routine -
Must have at least _ATEXIT_SIZE bits */
/* Bitmask is set if function was registered via __cxa_atexit. */
__ULong _is_cxa;
};
#ifdef _REENT_SMALL
struct _atexit {
struct _atexit *_next; /* next in list */
int _ind; /* next index in this table */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args * _on_exit_args_ptr;
};
#else
struct _atexit {
struct _atexit *_next; /* next in list */
int _ind; /* next index in this table */
/* Some entries may already have been called, and will be NULL. */
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
struct _on_exit_args _on_exit_args;
};
#endif
/*
* Stdio buffers.
*
* This and __FILE are defined here because we need them for struct _reent,
* but we don't want stdio.h included when stdlib.h is.
*/
struct __sbuf {
unsigned char *_base;
int _size;
};
/*
* Stdio state variables.
*
* The following always hold:
*
* if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
* _lbfsize is -_bf._size, else _lbfsize is 0
* if _flags&__SRD, _w is 0
* if _flags&__SWR, _r is 0
*
* This ensures that the getc and putc macros (or inline functions) never
* try to write or read from a file that is in `read' or `write' mode.
* (Moreover, they can, and do, automatically switch from read mode to
* write mode, and back, on "r+" and "w+" files.)
*
* _lbfsize is used only to make the inline line-buffered output stream
* code as compact as possible.
*
* _ub, _up, and _ur are used when ungetc() pushes back more characters
* than fit in the current _bf, or when ungetc() pushes back a character
* that does not match the previous one in _bf. When this happens,
* _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
*/
#ifdef _REENT_SMALL
/*
* struct __sFILE_fake is the start of a struct __sFILE, with only the
* minimal fields allocated. In __sinit() we really allocate the 3
* standard streams, etc., and point away from this fake.
*/
struct __sFILE_fake {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
struct _reent *_data;
};
/* Following is needed both in libc/stdio and libc/stdlib so we put it
* here instead of libc/stdio/local.h where it was previously. */
extern _VOID _EXFUN(__sinit,(struct _reent *));
# define _REENT_SMALL_CHECK_INIT(ptr) \
do \
{ \
if ((ptr) && !(ptr)->__sdidinit) \
__sinit (ptr); \
} \
while (0)
#else
# define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */
#endif
struct __sFILE {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
#ifdef _REENT_SMALL
struct _reent *_data;
#endif
/* operations */
_PTR _cookie; /* cookie passed to io functions */
_READ_WRITE_RETURN_TYPE _EXFUN((*_read),(struct _reent *, _PTR,
char *, int));
_READ_WRITE_RETURN_TYPE _EXFUN((*_write),(struct _reent *, _PTR,
const char *, int));
_fpos_t _EXFUN((*_seek),(struct _reent *, _PTR, _fpos_t, int));
int _EXFUN((*_close),(struct _reent *, _PTR));
/* separate buffer for long sequences of ungetc() */
struct __sbuf _ub; /* ungetc buffer */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
/* tricks to meet minimum requirements even when malloc() fails */
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
/* separate buffer for fgetline() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetline() */
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
int _offset; /* current lseek offset */
#ifndef _REENT_SMALL
struct _reent *_data; /* Here for binary compatibility? Remove? */
#endif
#ifndef __SINGLE_THREAD__
_flock_t _lock; /* for thread-safety locking */
#endif
_mbstate_t _mbstate; /* for wide char stdio functions. */
int _flags2; /* for future use */
};
#ifdef __CUSTOM_FILE_IO__
/* Get custom _FILE definition. */
#include <sys/custom_file.h>
#else /* !__CUSTOM_FILE_IO__ */
#ifdef __LARGE64_FILES
struct __sFILE64 {
unsigned char *_p; /* current position in (some) buffer */
int _r; /* read space left for getc() */
int _w; /* write space left for putc() */
short _flags; /* flags, below; this FILE is free if 0 */
short _file; /* fileno, if Unix descriptor, else -1 */
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
int _lbfsize; /* 0 or -_bf._size, for inline putc */
struct _reent *_data;
/* operations */
_PTR _cookie; /* cookie passed to io functions */
_READ_WRITE_RETURN_TYPE _EXFUN((*_read),(struct _reent *, _PTR,
char *, int));
_READ_WRITE_RETURN_TYPE _EXFUN((*_write),(struct _reent *, _PTR,
const char *, int));
_fpos_t _EXFUN((*_seek),(struct _reent *, _PTR, _fpos_t, int));
int _EXFUN((*_close),(struct _reent *, _PTR));
/* separate buffer for long sequences of ungetc() */
struct __sbuf _ub; /* ungetc buffer */
unsigned char *_up; /* saved _p when _p is doing ungetc data */
int _ur; /* saved _r when _r is counting ungetc data */
/* tricks to meet minimum requirements even when malloc() fails */
unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
unsigned char _nbuf[1]; /* guarantee a getc() buffer */
/* separate buffer for fgetline() when line crosses buffer boundary */
struct __sbuf _lb; /* buffer for fgetline() */
/* Unix stdio files get aligned to block boundaries on fseek() */
int _blksize; /* stat.st_blksize (may be != _bf._size) */
int _flags2; /* for future use */
_off64_t _offset; /* current lseek offset */
_fpos64_t _EXFUN((*_seek64),(struct _reent *, _PTR, _fpos64_t, int));
#ifndef __SINGLE_THREAD__
_flock_t _lock; /* for thread-safety locking */
#endif
_mbstate_t _mbstate; /* for wide char stdio functions. */
};
typedef struct __sFILE64 __FILE;
#else
typedef struct __sFILE __FILE;
#endif /* __LARGE64_FILES */
#endif /* !__CUSTOM_FILE_IO__ */
struct _glue
{
struct _glue *_next;
int _niobs;
__FILE *_iobs;
};
/*
* rand48 family support
*
* Copyright (c) 1993 Martin Birgmeier
* All rights reserved.
*
* You may redistribute unmodified or modified versions of this source
* code provided that the above copyright notice and this and the
* following conditions are retained.
*
* This software is provided ``as is'', and comes with no warranties
* of any kind. I shall in no event be liable for anything that happens
* to anyone/anything when using this software.
*/
#define _RAND48_SEED_0 (0x330e)
#define _RAND48_SEED_1 (0xabcd)
#define _RAND48_SEED_2 (0x1234)
#define _RAND48_MULT_0 (0xe66d)
#define _RAND48_MULT_1 (0xdeec)
#define _RAND48_MULT_2 (0x0005)
#define _RAND48_ADD (0x000b)
struct _rand48 {
unsigned short _seed[3];
unsigned short _mult[3];
unsigned short _add;
#ifdef _REENT_SMALL
/* Put this in here as well, for good luck. */
__extension__ unsigned long long _rand_next;
#endif
};
/* How big the some arrays are. */
#define _REENT_EMERGENCY_SIZE 25
#define _REENT_ASCTIME_SIZE 26
#define _REENT_SIGNAL_SIZE 24
/*
* struct _reent
*
* This structure contains *all* globals needed by the library.
* It's raison d'etre is to facilitate threads by making all library routines
* reentrant. IE: All state information is contained here.
*/
#ifdef _REENT_SMALL
struct _mprec
{
/* used by mprec routines */
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
};
struct _misc_reent
{
/* miscellaneous reentrant data */
char *_strtok_last;
_mbstate_t _mblen_state;
_mbstate_t _wctomb_state;
_mbstate_t _mbtowc_state;
char _l64a_buf[8];
int _getdate_err;
_mbstate_t _mbrlen_state;
_mbstate_t _mbrtowc_state;
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
};
/* This version of _reent is layed our with "int"s in pairs, to help
* ports with 16-bit int's but 32-bit pointers, align nicely. */
struct _reent
{
/* FILE is a big struct and may change over time. To try to achieve binary
compatibility with future versions, put stdin,stdout,stderr here.
These are pointers into member __sf defined below. */
__FILE *_stdin, *_stdout, *_stderr; /* XXX */
int _errno; /* local copy of errno */
int _inc; /* used by tmpnam */
char *_emergency;
int __sdidinit; /* 1 means stdio has been init'd */
int _current_category; /* used by setlocale */
_CONST char *_current_locale;
struct _mprec *_mp;
void _EXFUN((*__cleanup),(struct _reent *));
int _gamma_signgam;
/* used by some fp conversion routines */
int _cvtlen; /* should be size_t */
char *_cvtbuf;
struct _rand48 *_r48;
struct __tm *_localtime_buf;
char *_asctime_buf;
/* signal info */
void (**(_sig_func))(int);
/* atexit stuff */
struct _atexit *_atexit;
struct _atexit _atexit0;
struct _glue __sglue; /* root of glue chain */
__FILE *__sf; /* file descriptors */
struct _misc_reent *_misc; /* strtok, multibyte states */
char *_signal_buf; /* strsignal */
};
extern const struct __sFILE_fake __sf_fake_stdin;
extern const struct __sFILE_fake __sf_fake_stdout;
extern const struct __sFILE_fake __sf_fake_stderr;
#define _REENT_INIT(var) \
{ (__FILE *)&__sf_fake_stdin, \
(__FILE *)&__sf_fake_stdout, \
(__FILE *)&__sf_fake_stderr, \
0, \
0, \
_NULL, \
0, \
0, \
"C", \
_NULL, \
_NULL, \
0, \
0, \
_NULL, \
_NULL, \
_NULL, \
_NULL, \
_NULL, \
_NULL, \
{_NULL, 0, {_NULL}, _NULL}, \
{_NULL, 0, _NULL}, \
_NULL, \
_NULL, \
_NULL \
}
#define _REENT_INIT_PTR(var) \
{ (var)->_stdin = (__FILE *)&__sf_fake_stdin; \
(var)->_stdout = (__FILE *)&__sf_fake_stdout; \
(var)->_stderr = (__FILE *)&__sf_fake_stderr; \
(var)->_errno = 0; \
(var)->_inc = 0; \
(var)->_emergency = _NULL; \
(var)->__sdidinit = 0; \
(var)->_current_category = 0; \
(var)->_current_locale = "C"; \
(var)->_mp = _NULL; \
(var)->__cleanup = _NULL; \
(var)->_gamma_signgam = 0; \
(var)->_cvtlen = 0; \
(var)->_cvtbuf = _NULL; \
(var)->_r48 = _NULL; \
(var)->_localtime_buf = _NULL; \
(var)->_asctime_buf = _NULL; \
(var)->_sig_func = _NULL; \
(var)->_atexit = _NULL; \
(var)->_atexit0._next = _NULL; \
(var)->_atexit0._ind = 0; \
(var)->_atexit0._fns[0] = _NULL; \
(var)->_atexit0._on_exit_args_ptr = _NULL; \
(var)->__sglue._next = _NULL; \
(var)->__sglue._niobs = 0; \
(var)->__sglue._iobs = _NULL; \
(var)->__sf = 0; \
(var)->_misc = _NULL; \
(var)->_signal_buf = _NULL; \
}
/* Only built the assert() calls if we are built with debugging. */
#if DEBUG
#include <assert.h>
#define __reent_assert(x) assert(x)
#else
#define __reent_assert(x) ((void)0)
#endif
#ifdef __CUSTOM_FILE_IO__
#error Custom FILE I/O and _REENT_SMALL not currently supported.
#endif
/* Generic _REENT check macro. */
#define _REENT_CHECK(var, what, type, size, init) do { \
struct _reent *_r = (var); \
if (_r->what == NULL) { \
_r->what = (type)malloc(size); \
__reent_assert(_r->what); \
init; \
} \
} while (0)
#define _REENT_CHECK_TM(var) \
_REENT_CHECK(var, _localtime_buf, struct __tm *, sizeof *((var)->_localtime_buf), \
/* nothing */)
#define _REENT_CHECK_ASCTIME_BUF(var) \
_REENT_CHECK(var, _asctime_buf, char *, _REENT_ASCTIME_SIZE, \
memset((var)->_asctime_buf, 0, _REENT_ASCTIME_SIZE))
/* Handle the dynamically allocated rand48 structure. */
#define _REENT_INIT_RAND48(var) do { \
struct _reent *_r = (var); \
_r->_r48->_seed[0] = _RAND48_SEED_0; \
_r->_r48->_seed[1] = _RAND48_SEED_1; \
_r->_r48->_seed[2] = _RAND48_SEED_2; \
_r->_r48->_mult[0] = _RAND48_MULT_0; \
_r->_r48->_mult[1] = _RAND48_MULT_1; \
_r->_r48->_mult[2] = _RAND48_MULT_2; \
_r->_r48->_add = _RAND48_ADD; \
_r->_r48->_rand_next = 1; \
} while (0)
#define _REENT_CHECK_RAND48(var) \
_REENT_CHECK(var, _r48, struct _rand48 *, sizeof *((var)->_r48), _REENT_INIT_RAND48((var)))
#define _REENT_INIT_MP(var) do { \
struct _reent *_r = (var); \
_r->_mp->_result_k = 0; \
_r->_mp->_result = _r->_mp->_p5s = _NULL; \
_r->_mp->_freelist = _NULL; \
} while (0)
#define _REENT_CHECK_MP(var) \
_REENT_CHECK(var, _mp, struct _mprec *, sizeof *((var)->_mp), _REENT_INIT_MP(var))
#define _REENT_CHECK_EMERGENCY(var) \
_REENT_CHECK(var, _emergency, char *, _REENT_EMERGENCY_SIZE, /* nothing */)
#define _REENT_INIT_MISC(var) do { \
struct _reent *_r = (var); \
_r->_misc->_strtok_last = _NULL; \
_r->_misc->_mblen_state.__count = 0; \
_r->_misc->_mblen_state.__value.__wch = 0; \
_r->_misc->_wctomb_state.__count = 0; \
_r->_misc->_wctomb_state.__value.__wch = 0; \
_r->_misc->_mbtowc_state.__count = 0; \
_r->_misc->_mbtowc_state.__value.__wch = 0; \
_r->_misc->_mbrlen_state.__count = 0; \
_r->_misc->_mbrlen_state.__value.__wch = 0; \
_r->_misc->_mbrtowc_state.__count = 0; \
_r->_misc->_mbrtowc_state.__value.__wch = 0; \
_r->_misc->_mbsrtowcs_state.__count = 0; \
_r->_misc->_mbsrtowcs_state.__value.__wch = 0; \
_r->_misc->_wcrtomb_state.__count = 0; \
_r->_misc->_wcrtomb_state.__value.__wch = 0; \
_r->_misc->_wcsrtombs_state.__count = 0; \
_r->_misc->_wcsrtombs_state.__value.__wch = 0; \
_r->_misc->_l64a_buf[0] = '\0'; \
_r->_misc->_getdate_err = 0; \
} while (0)
#define _REENT_CHECK_MISC(var) \
_REENT_CHECK(var, _misc, struct _misc_reent *, sizeof *((var)->_misc), _REENT_INIT_MISC(var))
#define _REENT_CHECK_SIGNAL_BUF(var) \
_REENT_CHECK(var, _signal_buf, char *, _REENT_SIGNAL_SIZE, /* nothing */)
#define _REENT_SIGNGAM(ptr) ((ptr)->_gamma_signgam)
#define _REENT_RAND_NEXT(ptr) ((ptr)->_r48->_rand_next)
#define _REENT_RAND48_SEED(ptr) ((ptr)->_r48->_seed)
#define _REENT_RAND48_MULT(ptr) ((ptr)->_r48->_mult)
#define _REENT_RAND48_ADD(ptr) ((ptr)->_r48->_add)
#define _REENT_MP_RESULT(ptr) ((ptr)->_mp->_result)
#define _REENT_MP_RESULT_K(ptr) ((ptr)->_mp->_result_k)
#define _REENT_MP_P5S(ptr) ((ptr)->_mp->_p5s)
#define _REENT_MP_FREELIST(ptr) ((ptr)->_mp->_freelist)
#define _REENT_ASCTIME_BUF(ptr) ((ptr)->_asctime_buf)
#define _REENT_TM(ptr) ((ptr)->_localtime_buf)
#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
#define _REENT_STRTOK_LAST(ptr) ((ptr)->_misc->_strtok_last)
#define _REENT_MBLEN_STATE(ptr) ((ptr)->_misc->_mblen_state)
#define _REENT_MBTOWC_STATE(ptr)((ptr)->_misc->_mbtowc_state)
#define _REENT_WCTOMB_STATE(ptr)((ptr)->_misc->_wctomb_state)
#define _REENT_MBRLEN_STATE(ptr) ((ptr)->_misc->_mbrlen_state)
#define _REENT_MBRTOWC_STATE(ptr) ((ptr)->_misc->_mbrtowc_state)
#define _REENT_MBSRTOWCS_STATE(ptr) ((ptr)->_misc->_mbsrtowcs_state)
#define _REENT_WCRTOMB_STATE(ptr) ((ptr)->_misc->_wcrtomb_state)
#define _REENT_WCSRTOMBS_STATE(ptr) ((ptr)->_misc->_wcsrtombs_state)
#define _REENT_L64A_BUF(ptr) ((ptr)->_misc->_l64a_buf)
#define _REENT_GETDATE_ERR_P(ptr) (&((ptr)->_misc->_getdate_err))
#define _REENT_SIGNAL_BUF(ptr) ((ptr)->_signal_buf)
#else /* !_REENT_SMALL */
struct _reent
{
int _errno; /* local copy of errno */
/* FILE is a big struct and may change over time. To try to achieve binary
compatibility with future versions, put stdin,stdout,stderr here.
These are pointers into member __sf defined below. */
__FILE *_stdin, *_stdout, *_stderr;
int _inc; /* used by tmpnam */
char _emergency[_REENT_EMERGENCY_SIZE];
int _current_category; /* used by setlocale */
_CONST char *_current_locale;
int __sdidinit; /* 1 means stdio has been init'd */
void _EXFUN((*__cleanup),(struct _reent *));
/* used by mprec routines */
struct _Bigint *_result;
int _result_k;
struct _Bigint *_p5s;
struct _Bigint **_freelist;
/* used by some fp conversion routines */
int _cvtlen; /* should be size_t */
char *_cvtbuf;
union
{
struct
{
unsigned int _unused_rand;
char * _strtok_last;
char _asctime_buf[_REENT_ASCTIME_SIZE];
struct __tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
struct _rand48 _r48;
_mbstate_t _mblen_state;
_mbstate_t _mbtowc_state;
_mbstate_t _wctomb_state;
char _l64a_buf[8];
char _signal_buf[_REENT_SIGNAL_SIZE];
int _getdate_err;
_mbstate_t _mbrlen_state;
_mbstate_t _mbrtowc_state;
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
int _h_errno;
} _reent;
/* Two next two fields were once used by malloc. They are no longer
used. They are used to preserve the space used before so as to
allow addition of new reent fields and keep binary compatibility. */
struct
{
#define _N_LISTS 30
unsigned char * _nextf[_N_LISTS];
unsigned int _nmalloc[_N_LISTS];
} _unused;
} _new;
/* atexit stuff */
struct _atexit *_atexit; /* points to head of LIFO stack */
struct _atexit _atexit0; /* one guaranteed table, required by ANSI */
/* signal info */
void (**(_sig_func))(int);
/* These are here last so that __FILE can grow without changing the offsets
of the above members (on the off chance that future binary compatibility
would be broken otherwise). */
struct _glue __sglue; /* root of glue chain */
__FILE __sf[3]; /* first three file descriptors */
};
#define _REENT_INIT(var) \
{ 0, \
&(var).__sf[0], \
&(var).__sf[1], \
&(var).__sf[2], \
0, \
"", \
0, \
"C", \
0, \
_NULL, \
_NULL, \
0, \
_NULL, \
_NULL, \
0, \
_NULL, \
{ \
{ \
0, \
_NULL, \
"", \
{0, 0, 0, 0, 0, 0, 0, 0, 0}, \
0, \
1, \
{ \
{_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \
{_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, \
_RAND48_ADD \
}, \
{0, {0}}, \
{0, {0}}, \
{0, {0}}, \
"", \
"", \
0, \
{0, {0}}, \
{0, {0}}, \
{0, {0}}, \
{0, {0}}, \
{0, {0}} \
} \
}, \
_NULL, \
{_NULL, 0, {_NULL}, {{_NULL}, {_NULL}, 0, 0}}, \
_NULL, \
{_NULL, 0, _NULL} \
}
#define _REENT_INIT_PTR(var) \
{ (var)->_errno = 0; \
(var)->_stdin = &(var)->__sf[0]; \
(var)->_stdout = &(var)->__sf[1]; \
(var)->_stderr = &(var)->__sf[2]; \
(var)->_inc = 0; \
memset(&(var)->_emergency, 0, sizeof((var)->_emergency)); \
(var)->_current_category = 0; \
(var)->_current_locale = "C"; \
(var)->__sdidinit = 0; \
(var)->__cleanup = _NULL; \
(var)->_result = _NULL; \
(var)->_result_k = 0; \
(var)->_p5s = _NULL; \
(var)->_freelist = _NULL; \
(var)->_cvtlen = 0; \
(var)->_cvtbuf = _NULL; \
(var)->_new._reent._unused_rand = 0; \
(var)->_new._reent._strtok_last = _NULL; \
(var)->_new._reent._asctime_buf[0] = 0; \
memset(&(var)->_new._reent._localtime_buf, 0, sizeof((var)->_new._reent._localtime_buf)); \
(var)->_new._reent._gamma_signgam = 0; \
(var)->_new._reent._rand_next = 1; \
(var)->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
(var)->_new._reent._r48._seed[1] = _RAND48_SEED_1; \
(var)->_new._reent._r48._seed[2] = _RAND48_SEED_2; \
(var)->_new._reent._r48._mult[0] = _RAND48_MULT_0; \
(var)->_new._reent._r48._mult[1] = _RAND48_MULT_1; \
(var)->_new._reent._r48._mult[2] = _RAND48_MULT_2; \
(var)->_new._reent._r48._add = _RAND48_ADD; \
(var)->_new._reent._mblen_state.__count = 0; \
(var)->_new._reent._mblen_state.__value.__wch = 0; \
(var)->_new._reent._mbtowc_state.__count = 0; \
(var)->_new._reent._mbtowc_state.__value.__wch = 0; \
(var)->_new._reent._wctomb_state.__count = 0; \
(var)->_new._reent._wctomb_state.__value.__wch = 0; \
(var)->_new._reent._mbrlen_state.__count = 0; \
(var)->_new._reent._mbrlen_state.__value.__wch = 0; \
(var)->_new._reent._mbrtowc_state.__count = 0; \
(var)->_new._reent._mbrtowc_state.__value.__wch = 0; \
(var)->_new._reent._mbsrtowcs_state.__count = 0; \
(var)->_new._reent._mbsrtowcs_state.__value.__wch = 0; \
(var)->_new._reent._wcrtomb_state.__count = 0; \
(var)->_new._reent._wcrtomb_state.__value.__wch = 0; \
(var)->_new._reent._wcsrtombs_state.__count = 0; \
(var)->_new._reent._wcsrtombs_state.__value.__wch = 0; \
(var)->_new._reent._l64a_buf[0] = '\0'; \
(var)->_new._reent._signal_buf[0] = '\0'; \
(var)->_new._reent._getdate_err = 0; \
(var)->_atexit = _NULL; \
(var)->_atexit0._next = _NULL; \
(var)->_atexit0._ind = 0; \
(var)->_atexit0._fns[0] = _NULL; \
(var)->_atexit0._on_exit_args._fntypes = 0; \
(var)->_atexit0._on_exit_args._fnargs[0] = _NULL; \
(var)->_sig_func = _NULL; \
(var)->__sglue._next = _NULL; \
(var)->__sglue._niobs = 0; \
(var)->__sglue._iobs = _NULL; \
memset(&(var)->__sf, 0, sizeof((var)->__sf)); \
}
#define _REENT_CHECK_RAND48(ptr) /* nothing */
#define _REENT_CHECK_MP(ptr) /* nothing */
#define _REENT_CHECK_TM(ptr) /* nothing */
#define _REENT_CHECK_ASCTIME_BUF(ptr) /* nothing */
#define _REENT_CHECK_EMERGENCY(ptr) /* nothing */
#define _REENT_CHECK_MISC(ptr) /* nothing */
#define _REENT_CHECK_SIGNAL_BUF(ptr) /* nothing */
#define _REENT_SIGNGAM(ptr) ((ptr)->_new._reent._gamma_signgam)
#define _REENT_RAND_NEXT(ptr) ((ptr)->_new._reent._rand_next)
#define _REENT_RAND48_SEED(ptr) ((ptr)->_new._reent._r48._seed)
#define _REENT_RAND48_MULT(ptr) ((ptr)->_new._reent._r48._mult)
#define _REENT_RAND48_ADD(ptr) ((ptr)->_new._reent._r48._add)
#define _REENT_MP_RESULT(ptr) ((ptr)->_result)
#define _REENT_MP_RESULT_K(ptr) ((ptr)->_result_k)
#define _REENT_MP_P5S(ptr) ((ptr)->_p5s)
#define _REENT_MP_FREELIST(ptr) ((ptr)->_freelist)
#define _REENT_ASCTIME_BUF(ptr) ((ptr)->_new._reent._asctime_buf)
#define _REENT_TM(ptr) (&(ptr)->_new._reent._localtime_buf)
#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
#define _REENT_STRTOK_LAST(ptr) ((ptr)->_new._reent._strtok_last)
#define _REENT_MBLEN_STATE(ptr) ((ptr)->_new._reent._mblen_state)
#define _REENT_MBTOWC_STATE(ptr)((ptr)->_new._reent._mbtowc_state)
#define _REENT_WCTOMB_STATE(ptr)((ptr)->_new._reent._wctomb_state)
#define _REENT_MBRLEN_STATE(ptr)((ptr)->_new._reent._mbrlen_state)
#define _REENT_MBRTOWC_STATE(ptr)((ptr)->_new._reent._mbrtowc_state)
#define _REENT_MBSRTOWCS_STATE(ptr)((ptr)->_new._reent._mbsrtowcs_state)
#define _REENT_WCRTOMB_STATE(ptr)((ptr)->_new._reent._wcrtomb_state)
#define _REENT_WCSRTOMBS_STATE(ptr)((ptr)->_new._reent._wcsrtombs_state)
#define _REENT_L64A_BUF(ptr) ((ptr)->_new._reent._l64a_buf)
#define _REENT_SIGNAL_BUF(ptr) ((ptr)->_new._reent._signal_buf)
#define _REENT_GETDATE_ERR_P(ptr) (&((ptr)->_new._reent._getdate_err))
#endif /* !_REENT_SMALL */
/*
* All references to struct _reent are via this pointer.
* Internally, newlib routines that need to reference it should use _REENT.
*/
#ifndef __ATTRIBUTE_IMPURE_PTR__
#define __ATTRIBUTE_IMPURE_PTR__
#endif
extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
extern struct _reent *_CONST _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
void _reclaim_reent _PARAMS ((struct _reent *));
/* #define _REENT_ONLY define this to get only reentrant routines */
#ifndef _REENT_ONLY
#if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__)
#ifndef __getreent
struct _reent * _EXFUN(__getreent, (void));
#endif
# define _REENT (__getreent())
#else /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
# define _REENT _impure_ptr
#endif /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
#endif /* !_REENT_ONLY */
#define _GLOBAL_REENT _global_impure_ptr
#ifdef __cplusplus
}
#endif
#endif /* _SYS_REENT_H_ */

View File

@ -0,0 +1,558 @@
#!/bin/sh
# Submit a problem report to a GNATS site.
# Copyright (C) 1993, 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
# Contributed by Brendan Kehoe (brendan@cygnus.com), based on a
# version written by Heinz G. Seidl (hgs@cygnus.com).
#
# This file is part of GNU GNATS.
#
# GNU GNATS 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 3, or (at your option)
# any later version.
#
# GNU GNATS 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 GNU GNATS; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# The version of this send-pr.
VERSION=3.113
# The submitter-id for your site.
SUBMITTER=net
# The default mail address for PR submissions.
GNATS_ADDR=gcc-gnats@gcc.gnu.org
# The default release for this host.
# We have to guess at what program_transform_name might have done.
# "sed 1q" because neither "head -1" nor "head -n 1" is universal, argh.
DEFAULT_GCC="`echo $0 | sed -e 's/bug//'`"
DEFAULT_RELEASE="`$DEFAULT_GCC --version | sed 1q`"
# The default organization.
DEFAULT_ORGANIZATION=
# What mailer to use. This must come after the config file, since it is
# host-dependent.
# Copied from cvsbug
if [ -f /usr/sbin/sendmail ]; then
MAIL_AGENT="/usr/sbin/sendmail -oi -t"
else
MAIL_AGENT="/usr/lib/sendmail -oi -t"
fi
MAILER=`echo $MAIL_AGENT | sed -e 's, .*,,'`
if [ ! -f "$MAILER" ] ; then
echo "$COMMAND: Cannot file mail program \"$MAILER\"."
echo "$COMMAND: Please fix the MAIL_AGENT entry in the $COMMAND file."
exit 1
fi
# How to read the passwd database.
PASSWD="cat /etc/passwd"
ECHON=bsd
if [ $ECHON = bsd ] ; then
ECHON1="echo -n"
ECHON2=
elif [ $ECHON = sysv ] ; then
ECHON1=echo
ECHON2='\c'
else
ECHON1=echo
ECHON2=
fi
#
if [ -z "$TMPDIR" ]; then
TMPDIR=/tmp
else
if [ "`echo $TMPDIR | grep '/$'`" != "" ]; then
TMPDIR="`echo $TMPDIR | sed -e 's,/$,,'`"
fi
fi
if [ no = yes ]; then
TEMP0=`mktemp $TMPDIR/poXXXXXX` || exit 1
TEMP=`mktemp $TMPDIR/pXXXXXX` || exit 1
BAD=`mktemp $TMPDIR/pbadXXXXXX` || exit 1
REF=`mktemp $TMPDIR/pfXXXXXX` || exit 1
REMOVE_TEMP="rm -f $TEMP0 $TEMP $BAD $REF"
else
TEMPD=$TMPDIR/pd$$
TEMP0=$TEMPD/po$$
TEMP=$TEMPD/p$$
BAD=$TEMPD/pbad$$
REF=$TEMPD/pf$$
mkdir $TEMPD || exit 1
REMOVE_TEMP="rm -rf $TEMPD"
fi
# find a user name
if [ "$LOGNAME" = "" ]; then
if [ "$USER" != "" ]; then
LOGNAME="$USER"
else
LOGNAME="UNKNOWN"
fi
fi
FROM="$LOGNAME"
REPLY_TO="${REPLY_TO:-${REPLYTO:-$LOGNAME}}"
# Find out the name of the originator of this PR.
if [ -n "$NAME" ]; then
ORIGINATOR="$NAME"
elif [ -f $HOME/.fullname ]; then
ORIGINATOR="`sed -e '1q' $HOME/.fullname`"
else
# Must use temp file due to incompatibilities in quoting behavior
# and to protect shell metacharacters in the expansion of $LOGNAME
$PASSWD | grep "^$LOGNAME:" | awk -F: '{print $5}' | sed -e 's/,.*//' > $TEMP0
ORIGINATOR="`cat $TEMP0`"
rm -f $TEMP0
fi
if [ -n "$ORGANIZATION" ]; then
if [ -f "$ORGANIZATION" ]; then
ORGANIZATION="`cat $ORGANIZATION`"
fi
else
if [ -n "$DEFAULT_ORGANIZATION" ]; then
ORGANIZATION="$DEFAULT_ORGANIZATION"
elif [ -f $HOME/.organization ]; then
ORGANIZATION="`cat $HOME/.organization`"
fi
fi
# If they don't have a preferred editor set, then use
if [ -z "$VISUAL" ]; then
if [ -z "$EDITOR" ]; then
EDIT=vi
else
EDIT="$EDITOR"
fi
else
EDIT="$VISUAL"
fi
# Find out some information.
SYSTEM=`( [ -f /bin/uname ] && /bin/uname -a ) || \
( [ -f /usr/bin/uname ] && /usr/bin/uname -a ) || echo ""`
ARCH=`[ -f /bin/arch ] && /bin/arch`
MACHINE=`[ -f /bin/machine ] && /bin/machine`
COMMAND=`echo $0 | sed -e 's,.*/,,'`
USAGE="Usage: $COMMAND [-PVL] [-t address] [-f filename] [-s severity]
[-c address] [--request-id] [--version]"
REMOVE=
BATCH=
CC=
SEVERITY_C=
while [ $# -gt 0 ]; do
case "$1" in
-r) ;; # Ignore for backward compat.
-t | --to) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
shift ; GNATS_ADDR="$1"
EXPLICIT_GNATS_ADDR=true
;;
-f | --file) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
shift ; IN_FILE="$1"
if [ "$IN_FILE" != "-" -a ! -r "$IN_FILE" ]; then
echo "$COMMAND: cannot read $IN_FILE"
$REMOVE_TEMP
exit 1
fi
;;
-b | --batch) BATCH=true ;;
-c | --cc) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
shift ; CC="$1"
;;
-s | --severity) if [ $# -eq 1 ]; then echo "$USAGE"; $REMOVE_TEMP; exit 1; fi
shift ; SEVERITY_C="$1"
;;
-p | -P | --print) PRINT=true ;;
-L | --list) FORMAT=norm ;;
-l | -CL | --lisp) FORMAT=lisp ;;
--request-id) REQUEST_ID=true ;;
-h | --help) echo "$USAGE"; $REMOVE_TEMP; exit 0 ;;
-V | --version) cat <<EOF
gccbug (GCC) $DEFAULT_RELEASE
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
EOF
$REMOVE_TEMP; exit 0 ;;
-*) echo "$USAGE" ; $REMOVE_TEMP; exit 1 ;;
*) echo "$USAGE" ; $REMOVE_TEMP; exit 1
esac
shift
done
# spam does not need to be listed here
CATEGORIES="ada bootstrap c++ c debug driver fortran inline-asm java libgcj libobjc libstdc++ middle-end objc other pch preprocessor rtl-optimization target tree-optimization web"
case "$FORMAT" in
lisp) echo "$CATEGORIES" | \
awk 'BEGIN {printf "( "} {printf "(\"%s\") ",$0} END {printf ")\n"}'
$REMOVE_TEMP
exit 0
;;
norm) l=`echo "$CATEGORIES" | \
awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } }
END {print max + 1;}'`
c=`expr 70 / $l`
if [ $c -eq 0 ]; then c=1; fi
echo "$CATEGORIES" | \
awk 'BEGIN {print "Known categories:"; i = 0 }
{ printf ("%-'$l'.'$l's", $0); if ((++i % '$c') == 0) { print "" } }
END { print ""; }'
$REMOVE_TEMP
exit 0
;;
esac
ORIGINATOR_C='<name of the PR author (one line)>'
ORGANIZATION_C='<organization of PR author (multiple lines)>'
SYNOPSIS_C='<synopsis of the problem (one line)>'
if [ -z "$SEVERITY_C" ]; then
SEVERITY_C='<[ non-critical | serious | critical ] (one line)>'
fi
PRIORITY_C='<[ low | medium ] (one line)>'
CATEGORY_C='<choose from the top of this file (one line)>'
RELEASE_C='<release number or tag (one line)>'
ENVIRONMENT_C='<machine, os, target, libraries (multiple lines)>'
DESCRIPTION_C='<precise description of the problem (multiple lines)>'
HOW_TO_REPEAT_C='<When reporting a compiler error, preprocessor output must be included>'
FIX_C='<how to correct or work around the problem, if known (multiple lines)>'
# Catch some signals. ($xs kludge needed by Sun /bin/sh)
xs=0
trap '$REMOVE_TEMP; exit $xs' 0
trap 'echo "$COMMAND: Aborting ..."; $REMOVE_TEMP; xs=1; exit' 1 3 13 15
# If they told us to use a specific file, then do so.
if [ -n "$IN_FILE" ]; then
if [ "$IN_FILE" = "-" ]; then
# The PR is coming from the standard input.
if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" > $TEMP
else
cat > $TEMP
fi
else
# Use the file they named.
if [ -n "$EXPLICIT_GNATS_ADDR" ]; then
sed -e "s;^[Tt][Oo]:.*;To: $GNATS_ADDR;" $IN_FILE > $TEMP
else
cat $IN_FILE > $TEMP
fi
fi
else
if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
# If their PR_FORM points to a bogus entry, then bail.
if [ ! -f "$PR_FORM" -o ! -r "$PR_FORM" -o ! -s "$PR_FORM" ]; then
echo "$COMMAND: can't seem to read your template file (\`$PR_FORM'), ignoring PR_FORM"
sleep 1
PRINT_INTERN=bad_prform
fi
fi
if [ -n "$PR_FORM" -a -z "$PRINT_INTERN" ]; then
cp $PR_FORM $TEMP ||
( echo "$COMMAND: could not copy $PR_FORM" ; xs=1; exit )
else
for file in $TEMP $REF ; do
cat > $file << '__EOF__'
SEND-PR: -*- send-pr -*-
SEND-PR: Lines starting with `SEND-PR' will be removed automatically, as
SEND-PR: will all comments (text enclosed in `<' and `>').
SEND-PR:
SEND-PR: Please consult the GCC manual if you are not sure how to
SEND-PR: fill out a problem report.
SEND-PR: Note that the Synopsis field is mandatory. The Subject (for
SEND-PR: the mail) will be made the same as Synopsis unless explicitly
SEND-PR: changed.
SEND-PR:
SEND-PR: Choose from the following categories:
SEND-PR:
__EOF__
# Format the categories so they fit onto lines.
l=`echo "$CATEGORIES" | \
awk 'BEGIN {max = 0; } { if (length($0) > max) { max = length($0); } }
END {print max + 1;}'`
c=`expr 61 / $l`
if [ $c -eq 0 ]; then c=1; fi
echo "$CATEGORIES" | \
awk 'BEGIN {printf "SEND-PR: "; i = 0 }
{ printf ("%-'$l'.'$l's", $0);
if ((++i % '$c') == 0) { printf "\nSEND-PR: " } }
END { printf "\nSEND-PR:\n"; }' >> $file
cat >> $file << __EOF__
To: $GNATS_ADDR
Subject:
From: $FROM
Reply-To: $REPLYTO
Cc: $CC
X-send-pr-version: $VERSION
X-GNATS-Notify:
>Submitter-Id: $SUBMITTER
>Originator: $ORIGINATOR
>Organization: ${ORGANIZATION-$ORGANIZATION_C}
>Confidential: no
SEND-PR: Leave "Confidential" as "no"; all GCC PRs are public.
>Synopsis: $SYNOPSIS_C
>Severity: $SEVERITY_C
SEND-PR: critical GCC is completely not operational; no work-around known.
SEND-PR: serious GCC is not working properly; a work-around is possible.
SEND-PR: non-critical Report indicates minor problem.
>Priority: $PRIORITY_C
SEND-PR: medium The problem should be solved in the next release.
SEND-PR: low The problem should be solve in a future release.
>Category: $CATEGORY_C
>Class: <[ doc-bug | accepts-illegal | rejects-legal | wrong-code | ice-on-legal-code| ice-on-illegal-code | pessimizes-code | sw-bug | change-request | support ] (one line)>
SEND-PR: doc-bug The documentation is incorrect.
SEND-PR: accepts-illegal GCC fails to reject erroneous code.
SEND-PR: rejects-legal GCC gives an error message for correct code.
SEND-PR: wrong-code The machine code generated by gcc is incorrect.
SEND-PR: ice-on-legal-code GCC gives an Internal Compiler Error (ICE)
SEND-PR: for correct code
SEND-PR: ice-on-illegal-code GCC gives an ICE instead of reporting an error
SEND-PR: pessimizes-code GCC misses an important optimization opportunity
SEND-PR: sw-bug Software bug of some other class than above
SEND-PR: change-request A feature in GCC is missing.
SEND-PR: support I need help with gcc.
>Release: ${DEFAULT_RELEASE-$RELEASE_C}
>Environment:
`[ -n "$SYSTEM" ] && echo System: $SYSTEM`
`[ -n "$ARCH" ] && echo Architecture: $ARCH`
`[ -n "$MACHINE" ] && echo Machine: $MACHINE`
$ENVIRONMENT_C
host: i686-pc-mingw32
build: i686-pc-mingw32
target: arm-unknown-elf
__EOF__
cat >> $file << \__EOF__
configured with: ../gcc-4.4.1/configure --target=arm-elf --prefix=/home/yagarto/install --disable-nls --disable-shared --disable-threads --with-gcc --with-gnu-ld --with-gnu-as --with-dwarf2 --enable-languages=c,c++ --enable-interwork --enable-multilib --with-newlib --with-headers=../newlib-1.17.0/newlib/libc/include --disable-libssp --disable-libstdcxx-pch --disable-libmudflap --disable-libgomp -v
__EOF__
cat >> $file << __EOF__
>Description:
$DESCRIPTION_C
>How-To-Repeat:
$HOW_TO_REPEAT_C
>Fix:
$FIX_C
__EOF__
done
fi
if [ "$PRINT" = true -o "$PRINT_INTERN" = true ]; then
cat $TEMP
xs=0; exit
fi
chmod u+w $TEMP
if [ -z "$REQUEST_ID" ]; then
eval $EDIT $TEMP
else
ed -s $TEMP << '__EOF__'
/^Subject/s/^Subject:.*/Subject: request for a customer id/
/^>Category/s/^>Category:.*/>Category: send-pr/
w
q
__EOF__
fi
if cmp -s $REF $TEMP ; then
echo "$COMMAND: problem report not filled out, therefore not sent"
xs=1; exit
fi
fi
#
# Check the enumeration fields
# This is a "sed-subroutine" with one keyword parameter
# (with workaround for Sun sed bug)
#
SED_CMD='
/$PATTERN/{
s|||
s|<.*>||
s|^[ ]*||
s|[ ]*$||
p
q
}'
while [ -z "$REQUEST_ID" ]; do
CNT=0
# 1) Confidential
#
PATTERN=">Confidential:"
CONFIDENTIAL=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
case "$CONFIDENTIAL" in
no) CNT=`expr $CNT + 1` ;;
*) echo "$COMMAND: \`$CONFIDENTIAL' is not a valid value for \`Confidential'." ;;
esac
#
# 2) Severity
#
PATTERN=">Severity:"
SEVERITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
case "$SEVERITY" in
""|non-critical|serious|critical) CNT=`expr $CNT + 1` ;;
*) echo "$COMMAND: \`$SEVERITY' is not a valid value for \`Severity'."
esac
#
# 3) Priority
#
PATTERN=">Priority:"
PRIORITY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
case "$PRIORITY" in
""|low|medium) CNT=`expr $CNT + 1` ;;
high) echo "$COMMAND: \`Priority: high' is reserved for GCC maintainers." ;;
*) echo "$COMMAND: \`$PRIORITY' is not a valid value for \`Priority'."
esac
#
# 4) Category
#
PATTERN=">Category:"
CATEGORY=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
FOUND=
for C in $CATEGORIES
do
if [ "$C" = "$CATEGORY" ]; then FOUND=true ; break ; fi
done
if [ -n "$FOUND" ]; then
CNT=`expr $CNT + 1`
else
if [ -z "$CATEGORY" ]; then
echo "$COMMAND: you must include a Category: field in your report."
else
echo "$COMMAND: \`$CATEGORY' is not a known category."
fi
fi
#
# 5) Class
#
PATTERN=">Class:"
CLASS=`eval sed -n -e "\"$SED_CMD\"" $TEMP`
case "$CLASS" in
""|doc-bug|accepts-illegal|rejects-legal|wrong-code|ice-on-legal-code|ice-on-illegal-code|pessimizes-code|sw-bug|change-request|support) CNT=`expr $CNT + 1` ;;
*) echo "$COMMAND: \`$CLASS' is not a valid value for \`Class'."
esac
#
# 6) Check that synopsis is not empty
#
if grep "^>Synopsis:[ ]*${SYNOPSIS_C}\$" $TEMP > /dev/null
then
echo "$COMMAND: Synopsis must not be empty."
else
CNT=`expr $CNT + 1`
fi
[ $CNT -lt 6 -a -z "$BATCH" ] &&
echo "Errors were found with the problem report."
while true; do
if [ -z "$BATCH" ]; then
$ECHON1 "a)bort, e)dit or s)end? $ECHON2"
read input
else
if [ $CNT -eq 6 ]; then
input=s
else
input=a
fi
fi
case "$input" in
a*)
if [ -z "$BATCH" ]; then
echo "$COMMAND: the problem report remains in $BAD and is not sent."
REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF"
mv $TEMP $BAD
else
echo "$COMMAND: the problem report is not sent."
fi
xs=1; exit
;;
e*)
eval $EDIT $TEMP
continue 2
;;
s*)
break 2
;;
esac
done
done
#
# Make sure the mail has got a Subject. If not, use the same as
# in Synopsis.
#
if grep '^Subject:[ ]*$' $TEMP > /dev/null
then
SYNOPSIS=`grep '^>Synopsis:' $TEMP | sed -e 's/^>Synopsis:[ ]*//'`
ed -s $TEMP << __EOF__
/^Subject:/s/:.*\$/: $SYNOPSIS/
w
q
__EOF__
fi
#
# Remove comments and send the problem report
# (we have to use patterns, where the comment contains regex chars)
#
# /^>Originator:/s;$ORIGINATOR;;
sed -e "
/^SEND-PR:/d
/^>Organization:/,/^>[A-Za-z-]*:/s;$ORGANIZATION_C;;
/^>Confidential:/s;<.*>;;
/^>Synopsis:/s;$SYNOPSIS_C;;
/^>Severity:/s;<.*>;;
/^>Priority:/s;<.*>;;
/^>Category:/s;$CATEGORY_C;;
/^>Class:/s;<.*>;;
/^>Release:/,/^>[A-Za-z-]*:/s;$RELEASE_C;;
/^>Environment:/,/^>[A-Za-z-]*:/s;$ENVIRONMENT_C;;
/^>Description:/,/^>[A-Za-z-]*:/s;$DESCRIPTION_C;;
/^>How-To-Repeat:/,/^>[A-Za-z-]*:/s;$HOW_TO_REPEAT_C;;
/^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
" $TEMP > $REF
if $MAIL_AGENT < $REF; then
echo "$COMMAND: problem report sent"
xs=0; exit
else
echo "$COMMAND: mysterious mail failure."
if [ -z "$BATCH" ]; then
echo "$COMMAND: the problem report remains in $BAD and is not sent."
REMOVE_TEMP="rm -f $TEMP0 $TEMP $REF"
mv $REF $BAD
else
echo "$COMMAND: the problem report is not sent."
fi
xs=1; exit
fi

View File

@ -0,0 +1,416 @@
/* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002, 2004, 2009
Free Software Foundation, Inc.
This file is part of GCC.
GCC 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 3, or (at your option)
any later version.
GCC 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/*
* ISO C Standard: 7.17 Common definitions <stddef.h>
*/
#if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \
&& !defined(__STDDEF_H__)) \
|| defined(__need_wchar_t) || defined(__need_size_t) \
|| defined(__need_ptrdiff_t) || defined(__need_NULL) \
|| defined(__need_wint_t)
/* Any one of these symbols __need_* means that GNU libc
wants us just to define one data type. So don't define
the symbols that indicate this file's entire job has been done. */
#if (!defined(__need_wchar_t) && !defined(__need_size_t) \
&& !defined(__need_ptrdiff_t) && !defined(__need_NULL) \
&& !defined(__need_wint_t))
#define _STDDEF_H
#define _STDDEF_H_
/* snaroff@next.com says the NeXT needs this. */
#define _ANSI_STDDEF_H
/* Irix 5.1 needs this. */
#define __STDDEF_H__
#endif
#ifndef __sys_stdtypes_h
/* This avoids lossage on SunOS but only if stdtypes.h comes first.
There's no way to win with the other order! Sun lossage. */
/* On 4.3bsd-net2, make sure ansi.h is included, so we have
one less case to deal with in the following. */
#if defined (__BSD_NET2__) || defined (____386BSD____) || (defined (__FreeBSD__) && (__FreeBSD__ < 5)) || defined(__NetBSD__)
#include <machine/ansi.h>
#endif
/* On FreeBSD 5, machine/ansi.h does not exist anymore... */
#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
#include <sys/_types.h>
#endif
/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
defined if the corresponding type is *not* defined.
FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
#if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
#define _SIZE_T
#endif
#if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
#define _PTRDIFF_T
#endif
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
instead of _WCHAR_T_. */
#if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
#ifndef _BSD_WCHAR_T_
#define _WCHAR_T
#endif
#endif
/* Undef _FOO_T_ if we are supposed to define foo_t. */
#if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
#undef _PTRDIFF_T_
#undef _BSD_PTRDIFF_T_
#endif
#if defined (__need_size_t) || defined (_STDDEF_H_)
#undef _SIZE_T_
#undef _BSD_SIZE_T_
#endif
#if defined (__need_wchar_t) || defined (_STDDEF_H_)
#undef _WCHAR_T_
#undef _BSD_WCHAR_T_
#endif
#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
/* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
Just ignore it. */
#if defined (__sequent__) && defined (_PTRDIFF_T_)
#undef _PTRDIFF_T_
#endif
/* On VxWorks, <type/vxTypesBase.h> may have defined macros like
_TYPE_size_t which will typedef size_t. fixincludes patched the
vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
not defined, and so that defining this macro defines _GCC_SIZE_T.
If we find that the macros are still defined at this point, we must
invoke them so that the type is defined as expected. */
#if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_))
_TYPE_ptrdiff_t;
#undef _TYPE_ptrdiff_t
#endif
#if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
_TYPE_size_t;
#undef _TYPE_size_t
#endif
#if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
_TYPE_wchar_t;
#undef _TYPE_wchar_t
#endif
/* In case nobody has defined these types, but we aren't running under
GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
__WCHAR_TYPE__ have reasonable values. This can happen if the
parts of GCC is compiled by an older compiler, that actually
include gstddef.h, such as collect2. */
/* Signed type of difference of two pointers. */
/* Define this type if we are doing the whole job,
or if we want this type in particular. */
#if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
#ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */
#ifndef _T_PTRDIFF_
#ifndef _T_PTRDIFF
#ifndef __PTRDIFF_T
#ifndef _PTRDIFF_T_
#ifndef _BSD_PTRDIFF_T_
#ifndef ___int_ptrdiff_t_h
#ifndef _GCC_PTRDIFF_T
#define _PTRDIFF_T
#define _T_PTRDIFF_
#define _T_PTRDIFF
#define __PTRDIFF_T
#define _PTRDIFF_T_
#define _BSD_PTRDIFF_T_
#define ___int_ptrdiff_t_h
#define _GCC_PTRDIFF_T
#ifndef __PTRDIFF_TYPE__
#define __PTRDIFF_TYPE__ long int
#endif
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#endif /* _GCC_PTRDIFF_T */
#endif /* ___int_ptrdiff_t_h */
#endif /* _BSD_PTRDIFF_T_ */
#endif /* _PTRDIFF_T_ */
#endif /* __PTRDIFF_T */
#endif /* _T_PTRDIFF */
#endif /* _T_PTRDIFF_ */
#endif /* _PTRDIFF_T */
/* If this symbol has done its job, get rid of it. */
#undef __need_ptrdiff_t
#endif /* _STDDEF_H or __need_ptrdiff_t. */
/* Unsigned type of `sizeof' something. */
/* Define this type if we are doing the whole job,
or if we want this type in particular. */
#if defined (_STDDEF_H) || defined (__need_size_t)
#ifndef __size_t__ /* BeOS */
#ifndef __SIZE_T__ /* Cray Unicos/Mk */
#ifndef _SIZE_T /* in case <sys/types.h> has defined it. */
#ifndef _SYS_SIZE_T_H
#ifndef _T_SIZE_
#ifndef _T_SIZE
#ifndef __SIZE_T
#ifndef _SIZE_T_
#ifndef _BSD_SIZE_T_
#ifndef _SIZE_T_DEFINED_
#ifndef _SIZE_T_DEFINED
#ifndef _BSD_SIZE_T_DEFINED_ /* Darwin */
#ifndef _SIZE_T_DECLARED /* FreeBSD 5 */
#ifndef ___int_size_t_h
#ifndef _GCC_SIZE_T
#ifndef _SIZET_
#ifndef __size_t
#define __size_t__ /* BeOS */
#define __SIZE_T__ /* Cray Unicos/Mk */
#define _SIZE_T
#define _SYS_SIZE_T_H
#define _T_SIZE_
#define _T_SIZE
#define __SIZE_T
#define _SIZE_T_
#define _BSD_SIZE_T_
#define _SIZE_T_DEFINED_
#define _SIZE_T_DEFINED
#define _BSD_SIZE_T_DEFINED_ /* Darwin */
#define _SIZE_T_DECLARED /* FreeBSD 5 */
#define ___int_size_t_h
#define _GCC_SIZE_T
#define _SIZET_
#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
/* __size_t is a typedef on FreeBSD 5!, must not trash it. */
#else
#define __size_t
#endif
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ long unsigned int
#endif
#if !(defined (__GNUG__) && defined (size_t))
typedef __SIZE_TYPE__ size_t;
#ifdef __BEOS__
typedef long ssize_t;
#endif /* __BEOS__ */
#endif /* !(defined (__GNUG__) && defined (size_t)) */
#endif /* __size_t */
#endif /* _SIZET_ */
#endif /* _GCC_SIZE_T */
#endif /* ___int_size_t_h */
#endif /* _SIZE_T_DECLARED */
#endif /* _BSD_SIZE_T_DEFINED_ */
#endif /* _SIZE_T_DEFINED */
#endif /* _SIZE_T_DEFINED_ */
#endif /* _BSD_SIZE_T_ */
#endif /* _SIZE_T_ */
#endif /* __SIZE_T */
#endif /* _T_SIZE */
#endif /* _T_SIZE_ */
#endif /* _SYS_SIZE_T_H */
#endif /* _SIZE_T */
#endif /* __SIZE_T__ */
#endif /* __size_t__ */
#undef __need_size_t
#endif /* _STDDEF_H or __need_size_t. */
/* Wide character type.
Locale-writers should change this as necessary to
be big enough to hold unique values not between 0 and 127,
and not (wchar_t) -1, for each defined multibyte character. */
/* Define this type if we are doing the whole job,
or if we want this type in particular. */
#if defined (_STDDEF_H) || defined (__need_wchar_t)
#ifndef __wchar_t__ /* BeOS */
#ifndef __WCHAR_T__ /* Cray Unicos/Mk */
#ifndef _WCHAR_T
#ifndef _T_WCHAR_
#ifndef _T_WCHAR
#ifndef __WCHAR_T
#ifndef _WCHAR_T_
#ifndef _BSD_WCHAR_T_
#ifndef _BSD_WCHAR_T_DEFINED_ /* Darwin */
#ifndef _BSD_RUNE_T_DEFINED_ /* Darwin */
#ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */
#ifndef _WCHAR_T_DEFINED_
#ifndef _WCHAR_T_DEFINED
#ifndef _WCHAR_T_H
#ifndef ___int_wchar_t_h
#ifndef __INT_WCHAR_T_H
#ifndef _GCC_WCHAR_T
#define __wchar_t__ /* BeOS */
#define __WCHAR_T__ /* Cray Unicos/Mk */
#define _WCHAR_T
#define _T_WCHAR_
#define _T_WCHAR
#define __WCHAR_T
#define _WCHAR_T_
#define _BSD_WCHAR_T_
#define _WCHAR_T_DEFINED_
#define _WCHAR_T_DEFINED
#define _WCHAR_T_H
#define ___int_wchar_t_h
#define __INT_WCHAR_T_H
#define _GCC_WCHAR_T
#define _WCHAR_T_DECLARED
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
symbols in the _FOO_T_ family, stays defined even after its
corresponding type is defined). If we define wchar_t, then we
must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
we undef _WCHAR_T_, then we must also define rune_t, since
headers like runetype.h assume that if machine/ansi.h is included,
and _BSD_WCHAR_T_ is not defined, then rune_t is available.
machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
the same type." */
#ifdef _BSD_WCHAR_T_
#undef _BSD_WCHAR_T_
#ifdef _BSD_RUNE_T_
#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
typedef _BSD_RUNE_T_ rune_t;
#define _BSD_WCHAR_T_DEFINED_
#define _BSD_RUNE_T_DEFINED_ /* Darwin */
#if defined (__FreeBSD__) && (__FreeBSD__ < 5)
/* Why is this file so hard to maintain properly? In contrast to
the comment above regarding BSD/386 1.1, on FreeBSD for as long
as the symbol has existed, _BSD_RUNE_T_ must not stay defined or
redundant typedefs will occur when stdlib.h is included after this file. */
#undef _BSD_RUNE_T_
#endif
#endif
#endif
#endif
/* FreeBSD 5 can't be handled well using "traditional" logic above
since it no longer defines _BSD_RUNE_T_ yet still desires to export
rune_t in some cases... */
#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
#if __BSD_VISIBLE
#ifndef _RUNE_T_DECLARED
typedef __rune_t rune_t;
#define _RUNE_T_DECLARED
#endif
#endif
#endif
#endif
#ifndef __WCHAR_TYPE__
#define __WCHAR_TYPE__ int
#endif
#ifndef __cplusplus
typedef __WCHAR_TYPE__ wchar_t;
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif /* _WCHAR_T_DECLARED */
#endif /* _BSD_RUNE_T_DEFINED_ */
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif /* __WCHAR_T__ */
#endif /* __wchar_t__ */
#undef __need_wchar_t
#endif /* _STDDEF_H or __need_wchar_t. */
#if defined (__need_wint_t)
#ifndef _WINT_T
#define _WINT_T
#ifndef __WINT_TYPE__
#define __WINT_TYPE__ unsigned int
#endif
typedef __WINT_TYPE__ wint_t;
#endif
#undef __need_wint_t
#endif
/* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
are already defined. */
/* BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here. */
#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
/* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_
are probably typos and should be removed before 2.8 is released. */
#ifdef _GCC_PTRDIFF_T_
#undef _PTRDIFF_T_
#undef _BSD_PTRDIFF_T_
#endif
#ifdef _GCC_SIZE_T_
#undef _SIZE_T_
#undef _BSD_SIZE_T_
#endif
#ifdef _GCC_WCHAR_T_
#undef _WCHAR_T_
#undef _BSD_WCHAR_T_
#endif
/* The following ones are the real ones. */
#ifdef _GCC_PTRDIFF_T
#undef _PTRDIFF_T_
#undef _BSD_PTRDIFF_T_
#endif
#ifdef _GCC_SIZE_T
#undef _SIZE_T_
#undef _BSD_SIZE_T_
#endif
#ifdef _GCC_WCHAR_T
#undef _WCHAR_T_
#undef _BSD_WCHAR_T_
#endif
#endif /* _ANSI_H_ || _MACHINE_ANSI_H_ */
#endif /* __sys_stdtypes_h */
/* A null pointer constant. */
#if defined (_STDDEF_H) || defined (__need_NULL)
#undef NULL /* in case <stdio.h> has defined it. */
#ifdef __GNUG__
#define NULL __null
#else /* G++ */
#ifndef __cplusplus
#define NULL ((void *)0)
#else /* C++ */
#define NULL 0
#endif /* C++ */
#endif /* G++ */
#endif /* NULL not defined and <stddef.h> or need NULL. */
#undef __need_NULL
#ifdef _STDDEF_H
/* Offset of member MEMBER in a struct of type TYPE. */
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
#endif /* _STDDEF_H was defined this time */
#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
|| __need_XXX was not defined before */

View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 of the License, 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, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -0,0 +1,29 @@
make
=====
The make program is the original version which was taken from
"mingw32-make-3.81-1", you can find the package here:
http://prdownloads.sourceforge.net/mingw/mingw32-make-3.81-1.tar.gz
Also the source can be found here:
http://prdownloads.sourceforge.net/mingw/mingw32-make-3.81-1-src.tar.gz
sh, msys-1.0, echo, touch, and some of the fileutils
=====================================================
The tools are original version which was taken from "msys-1.0.8.exe".
You can find the "msys-1.0.8" package here:
http://prdownloads.sourceforge.net/mingw/MSYS-1.0.8.exe
And the source here:
http://prdownloads.sourceforge.net/mingw/msys-1.0.8-src.tar.bz2

View File

@ -0,0 +1,2 @@
[InternetShortcut]
URL=http://www.gnu.org/software/binutils/

View File

@ -0,0 +1,640 @@
The newlib subdirectory is a collection of software from several sources.
Each file may have its own copyright/license that is embedded in the source
file. Unless otherwise noted in the body of the source file(s), the following copyright
notices will apply to the contents of the newlib subdirectory:
(1) Red Hat Incorporated
Copyright (c) 1994-2007 Red Hat, Inc. All rights reserved.
This copyrighted material is made available to anyone wishing to use,
modify, copy, or redistribute it subject to the terms and conditions
of the BSD License. This program is distributed in the hope that
it will be useful, but WITHOUT ANY WARRANTY expressed or implied,
including the implied warranties of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. A copy of this license is available at
http://www.opensource.org/licenses. Any Red Hat trademarks that are
incorporated in the source code or documentation are not subject to
the BSD License and may only be used or replicated with the express
permission of Red Hat, Inc.
(2) University of California, Berkeley
Copyright (c) 1981-2000 The Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
(3) David M. Gay (AT&T 1991, Lucent 1998)
The author of this software is David M. Gay.
Copyright (c) 1991 by AT&T.
Permission to use, copy, modify, and distribute this software for any
purpose without fee is hereby granted, provided that this entire notice
is included in all copies of any software which is or includes a copy
or modification of this software and in all copies of the supporting
documentation for such software.
THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY
REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
-------------------------------------------------------------------
The author of this software is David M. Gay.
Copyright (C) 1998-2001 by Lucent Technologies
All Rights Reserved
Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
(4) Advanced Micro Devices
Copyright 1989, 1990 Advanced Micro Devices, Inc.
This software is the property of Advanced Micro Devices, Inc (AMD) which
specifically grants the user the right to modify, use and distribute this
software provided this notice is not removed or altered. All other rights
are reserved by AMD.
AMD MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS
SOFTWARE. IN NO EVENT SHALL AMD BE LIABLE FOR INCIDENTAL OR CONSEQUENTIAL
DAMAGES IN CONNECTION WITH OR ARISING FROM THE FURNISHING, PERFORMANCE, OR
USE OF THIS SOFTWARE.
So that all may benefit from your experience, please report any problems
or suggestions about this software to the 29K Technical Support Center at
800-29-29-AMD (800-292-9263) in the USA, or 0800-89-1131 in the UK, or
0031-11-1129 in Japan, toll free. The direct dial number is 512-462-4118.
Advanced Micro Devices, Inc.
29K Support Products
Mail Stop 573
5900 E. Ben White Blvd.
Austin, TX 78741
800-292-9263
(5) C.W. Sandmann
Copyright (C) 1993 C.W. Sandmann
This file may be freely distributed as long as the author's name remains.
(6) Eric Backus
(C) Copyright 1992 Eric Backus
This software may be used freely so long as this copyright notice is
left intact. There is no warrantee on this software.
(7) Sun Microsystems
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice is preserved.
(8) Hewlett Packard
(c) Copyright 1986 HEWLETT-PACKARD COMPANY
To anyone who acknowledges that this file is provided "AS IS"
without any express or implied warranty:
permission to use, copy, modify, and distribute this file
for any purpose is hereby granted without fee, provided that
the above copyright notice and this notice appears in all
copies, and that the name of Hewlett-Packard Company not be
used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
Hewlett-Packard Company makes no representations about the
suitability of this software for any purpose.
(9) Hans-Peter Nilsson
Copyright (C) 2001 Hans-Peter Nilsson
Permission to use, copy, modify, and distribute this software is
freely granted, provided that the above copyright notice, this notice
and the following disclaimer are preserved with no changes.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.
(10) Stephane Carrez (m68hc11-elf/m68hc12-elf targets only)
Copyright (C) 1999, 2000, 2001, 2002 Stephane Carrez (stcarrez@nerim.fr)
The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.
(11) Christopher G. Demetriou
Copyright (c) 2001 Christopher G. Demetriou
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(12) SuperH, Inc.
Copyright 2002 SuperH, Inc. All rights reserved
This software is the property of SuperH, Inc (SuperH) which specifically
grants the user the right to modify, use and distribute this software
provided this notice is not removed or altered. All other rights are
reserved by SuperH.
SUPERH MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO
THIS SOFTWARE. IN NO EVENT SHALL SUPERH BE LIABLE FOR INDIRECT, SPECIAL,
INCIDENTAL OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH OR ARISING FROM
THE FURNISHING, PERFORMANCE, OR USE OF THIS SOFTWARE.
So that all may benefit from your experience, please report any problems
or suggestions about this software to the SuperH Support Center via
e-mail at softwaresupport@superh.com .
SuperH, Inc.
405 River Oaks Parkway
San Jose
CA 95134
USA
(13) Royal Institute of Technology
Copyright (c) 1999 Kungliga Tekniska Högskolan
(Royal Institute of Technology, Stockholm, Sweden).
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of KTH nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(14) Alexey Zelkin
Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
(15) Andrey A. Chernov
Copyright (C) 1997 by Andrey A. Chernov, Moscow, Russia.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
(16) FreeBSD
Copyright (c) 1997-2002 FreeBSD Project.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
(17) S. L. Moshier
Author: S. L. Moshier.
Copyright (c) 1984,2000 S.L. Moshier
Permission to use, copy, modify, and distribute this software for any
purpose without fee is hereby granted, provided that this entire notice
is included in all copies of any software which is or includes a copy
or modification of this software and in all copies of the supporting
documentation for such software.
THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
(18) Citrus Project
Copyright (c)1999 Citrus Project,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
(19) Todd C. Miller
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(20) DJ Delorie (i386)
Copyright (C) 1991 DJ Delorie
All rights reserved.
Redistribution and use in source and binary forms is permitted
provided that the above copyright notice and following paragraph are
duplicated in all such forms.
This file is distributed WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
(21) Free Software Foundation LGPL License (*-linux* targets only)
Copyright (C) 1990-1999, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
The GNU C 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.
The GNU C 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 the GNU C Library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
(22) Xavier Leroy LGPL License (i[3456]86-*-linux* targets only)
Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License
as published by the Free Software Foundation; either version 2
of the License, 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 Library General Public License for more details.
(23) Intel (i960)
Copyright (c) 1993 Intel Corporation
Intel hereby grants you permission to copy, modify, and distribute this
software and its documentation. Intel grants this permission provided
that the above copyright notice appears in all copies and that both the
copyright notice and this permission notice appear in supporting
documentation. In addition, Intel grants this permission provided that
you prominently mark as "not part of the original" any modifications
made to this software or documentation, and that the name of Intel
Corporation not be used in advertising or publicity pertaining to
distribution of the software or the documentation without specific,
written prior permission.
Intel Corporation provides this AS IS, WITHOUT ANY WARRANTY, EXPRESS OR
IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY
OR FITNESS FOR A PARTICULAR PURPOSE. Intel makes no guarantee or
representations regarding the use of, or the results of the use of,
the software and documentation in terms of correctness, accuracy,
reliability, currentness, or otherwise; and you rely on the software,
documentation and results solely at your own risk.
IN NO EVENT SHALL INTEL BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS,
LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES
OF ANY KIND. IN NO EVENT SHALL INTEL'S TOTAL LIABILITY EXCEED THE SUM
PAID TO INTEL FOR THE PRODUCT LICENSED HEREUNDER.
(24) Hewlett-Packard (hppa targets only)
(c) Copyright 1986 HEWLETT-PACKARD COMPANY
To anyone who acknowledges that this file is provided "AS IS"
without any express or implied warranty:
permission to use, copy, modify, and distribute this file
for any purpose is hereby granted without fee, provided that
the above copyright notice and this notice appears in all
copies, and that the name of Hewlett-Packard Company not be
used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.
Hewlett-Packard Company makes no representations about the
suitability of this software for any purpose.
(25) Henry Spencer (only *-linux targets)
Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or of the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it, subject
to the following restrictions:
1. The author is not responsible for the consequences of use of this
software, no matter how awful, even if they arise from flaws in it.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Since few users ever read sources,
credits must appear in the documentation.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software. Since few users
ever read sources, credits must appear in the documentation.
4. This notice may not be removed or altered.
(26) Mike Barcroft
Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
(27) Konstantin Chuguev (--enable-newlib-iconv)
Copyright (c) 1999, 2000
Konstantin Chuguev. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
iconv (Charset Conversion Library) v2.0
(28) Artem Bityuckiy (--enable-newlib-iconv)
Copyright (c) 2003, Artem B. Bityuckiy, SoftMine Corporation.
Rights transferred to Franklin Electronic Publishers.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
(29) IBM, Sony, Toshiba (only spu-* targets)
(C) Copyright 2001,2006,
International Business Machines Corporation,
Sony Computer Entertainment, Incorporated,
Toshiba Corporation,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the names of the copyright holders nor the names of their
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 of the License, 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -0,0 +1,2 @@
[InternetShortcut]
URL=http://gcc.gnu.org/

View File

@ -0,0 +1,2 @@
[InternetShortcut]
URL=http://www.gnu.org/software/gdb/

View File

@ -0,0 +1,2 @@
[InternetShortcut]
URL=http://www.gnu.org/

View File

@ -0,0 +1,7 @@
[InternetShortcut]
URL=http://sources.redhat.com/newlib/
IDList=
IconFile=http://sources.redhat.com/favicon.ico
IconIndex=1
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2

View File

@ -0,0 +1,6 @@
The source for the YAGARTO toolchain can be found here:
www.yagarto.de/source
(17.08.2009, mifi)

View File

@ -0,0 +1,12 @@
This build of yagarto use the following versions:
binutils: 2.19.1
gcc: 4.4.1
newlib: 1.17.0
gdb: 6.8.50-20080308-cvs
And was built to support newlib with reentrant stubs.
For more information take a look in the yagarto_newlib.txt
(17.08.2009, mifi)

View File

@ -0,0 +1,7 @@
[InternetShortcut]
URL=http://www.yagarto.de/
IDList=
IconFile=http://www.yagarto.de/favicon.ico
IconIndex=1
[{000214A0-0000-0000-C000-000000000046}]
Prop3=19,2

View File

@ -0,0 +1,37 @@
!!! This version of YAGARTO was built to support newlib with reentrant stubs !!!
Therefore it is possible that you will get some undefined references from the
linker in case you use the printf function for example.
The undefined references could be:
_sbrk_r, _fstat_r, _isatty_r, _close_r, _lseek_r, _write_r, _read_r
To use functions from stdio (like printf) in own projects, the interface functions
for the newlib have to be provided. For more information take a look in chapter 13
from the "Red Hat newlib C Library" documentation.
(ftp://sources.redhat.com/pub/newlib/index.html)
You can find a good source about "Porting and Using Newlib in Embedded Systems"
on the page from Bill Gatliff (http://neptune.billgatliff.com/newlib.html).
The YAGARTO version of newlib was built with the following options:
-DREENTRANT_SYSCALLS_PROVIDED
--disable-newlib-supplied-syscalls
To make your life easier, an example "syscalls.c" can be find here:
http://www.yagarto.de/download/yagarto/syscalls.c
(29.03.2009, mifi)

24
Demo_C/Bin/_exec_cmd.bat Normal file
View File

@ -0,0 +1,24 @@
@echo off
if "%1"/ == ""/ exit
if "%ROOT_BATCH%"/ == ""/ %1\_start go %0 %1 %2 %3
set PATH=%1;%PATH%
set COM_PORT=%3
if "%3"/ == ""/ call set_port
4cmd_ft %2 %COM_PORT%
if errorlevel 1 goto end
goto exit
:end
echo.
echo ***** **** **** *** ****
echo * * * * * * * * *
echo *** **** **** * * ****
echo * * * * * * * * *
echo ***** * * * * *** * *
echo.
:exit
if exist "%1\ftlib.log" del "%1\ftlib.log"
if exist "%1\ftlib.bak" del "%1\ftlib.bak"

View File

@ -0,0 +1,25 @@
@echo off
if "%1"/ == ""/ exit
if "%ROOT_BATCH%"/ == ""/ %1\_start go %0 %1 %2
set PATH=%1;%PATH%
set COM_PORT=%2
if "%2"/ == ""/ call set_port
echo Loading program file ...
4load_ft *.bin flash %COM_PORT%
if errorlevel 1 goto end
goto exit
:end
echo.
echo ***** **** **** *** ****
echo * * * * * * * * *
echo *** **** **** * * ****
echo * * * * * * * * *
echo ***** * * * * *** * *
echo.
:exit
if exist "%1\ftlib.log" del "%1\ftlib.log"
if exist "%1\ftlib.bak" del "%1\ftlib.bak"

View File

@ -0,0 +1,25 @@
@echo off
if "%1"/ == ""/ exit
if "%ROOT_BATCH%"/ == ""/ %1\_start go %0 %1 %2
set PATH=%1;%PATH%
set COM_PORT=%2
if "%2"/ == ""/ call set_port
echo Loading program file ...
4load_ft *.bin %COM_PORT%
if errorlevel 1 goto end
goto exit
:end
echo.
echo ***** **** **** *** ****
echo * * * * * * * * *
echo *** **** **** * * ****
echo * * * * * * * * *
echo ***** * * * * *** * *
echo.
:exit
if exist "%1\ftlib.log" del "%1\ftlib.log"
if exist "%1\ftlib.bak" del "%1\ftlib.bak"

20
Demo_C/Bin/_start.bat Normal file
View File

@ -0,0 +1,20 @@
@echo off
if "%1"/ == ""/ exit
if "%1"/ == "begin"/ goto start
if "%OS%"/ == "Windows_NT"/ goto start
rem start second command shell to avoid problems
rem with environment size, then start batch again
rem with additional first parameter 'begin', goto
rem begin, readjust parameter list and proceed
command.com /E:4096 /C %0 begin %2 %3 %4 %5
exit
:start
set ROOT_BATCH=RUNNING
set START_PATH=%PATH%
call %2 %3 %4 %5
set ROOT_BATCH=
if "%OS%"/ == "Windows_NT"/ pause

6
Demo_C/Bin/set_port.bat Normal file
View File

@ -0,0 +1,6 @@
rem Default COM port, through which PC communicates with a ROBO TX Controller,
rem for example "set COM_PORT=COM6".
rem If no default port is set, i.e. "set COM_PORT=", then the virtual USB COM port,
rem to which ROBO TX Controller is connected, is used.
set COM_PORT=

120
Demo_C/Common/Makefile Normal file
View File

@ -0,0 +1,120 @@
include param.mk
COMMON_PATH = ../../Common
COMMON_OBJS = $(COMMON_PATH)/prg_bt.o $(COMMON_PATH)/prg_bt_addr.o
COMMON_LIB = $(COMMON_PATH)/libcommon.a
STARTUP_OBJS = $(COMMON_PATH)/prg_disp.o
PROJ_OBJS = $(STARTUP_OBJS) $(OBJS)
BIN_PATH = ../../Bin
GCC_PATH = $(BIN_PATH)/GNU/GNU_ARM
BIN_GCC_PATH = $(GCC_PATH)/bin
LIB_GCC_PATH = $(GCC_PATH)/lib/gcc/arm-elf
LIB_PATH = $(GCC_PATH)/arm-elf/lib
LD_SCRIPT = $(COMMON_PATH)/ld.lcf
TARGET_BIN = $(PROJ).bin
PROJ_ELF = $(PROJ).elf
PROJ_MAP = $(PROJ).map
CROSS_COMPILE = arm-elf
CROSS_COMPILE_PRE = $(CROSS_COMPILE)-
BIN_GCC_PATH_CROSS = $(CROSS_COMPILE_PRE)
CC = $(BIN_GCC_PATH_CROSS)gcc
AS_CPP = $(BIN_GCC_PATH_CROSS)gcc
AS = $(BIN_GCC_PATH_CROSS)as
AR = $(BIN_GCC_PATH_CROSS)ar
LD = $(BIN_GCC_PATH_CROSS)ld
OC = $(BIN_GCC_PATH_CROSS)objcopy
RM = $(BIN_PATH)/GNU/Tools/rm
O_LANG := -x c
GNU_ARM_M_ARCH := -mcpu=arm9e
GNU_ARM_L_ARCH := --architecture=armv5tej
O_OPTIM := -O3
C_INCL := . $(COMMON_PATH)
P_DEFS_GLOBAL := -DENDIAN_LITTLE
O_GDB := -gdwarf-2 -fno-dwarf2-cfi-asm
M_FLAGS_GLOBAL := $(GNU_ARM_M_ARCH)
__FLAGS_GLOBAL := $(M_FLAGS_GLOBAL) $(P_DEFS_GLOBAL) $(O_OPTIM) $(O_GDB)
C_FLAGS_GLOBAL := -S $(__FLAGS_GLOBAL) -fno-builtin $(O_LANG) -Wall
AS_CPP_FLAGS_GLOBAL := -c $(__FLAGS_GLOBAL) -Wa,-EL -x assembler-with-cpp -D __ASSEMBLY__ -Wall -Wa
A_FLAGS_GLOBAL := -EL
A_LST := -almns=
ARFLAGS := -rcuv
CFLAGS = \
-c \
$(addprefix -I,$(C_INCL))
LFLAGS = \
--cref \
--oformat elf32-littlearm \
--trace \
--nmagic \
$(GNU_ARM_L_ARCH)
S_INC = $(addprefix -I,$(C_INCL))
A_LST = -almns=
%.o : %.c
$(CC) $(C_FLAGS_GLOBAL) $(CFLAGS) -C -E $< > $(basename $@).p
$(CC) $(C_FLAGS_GLOBAL) $(CFLAGS) -o $(basename $@).asm $<
$(AS) $(A_FLAGS_GLOBAL) $(A_LST)$(basename $@).lst -o $@ $(basename $@).asm
%.o : %.S
$(AS_CPP) $(AS_CPP_FLAGS_GLOBAL) $(S_INC) -o $(basename $@).o -Wa,$(A_LST)$(basename $@).lst $<
$(COMMON_LIB): $(COMMON_OBJS)
$(AR) $(ARFLAGS) $(COMMON_LIB) $(COMMON_OBJS)
$(PROJ_ELF): $(PROJ_OBJS) $(LD_SCRIPT)
$(LD) $(LFLAGS) \
--library-path=$(COMMON_PATH) \
--library-path=$(LIB_PATH) \
--library-path=$(LIB_GCC_PATH) \
--script=$(LD_SCRIPT) \
$(PROJ_OBJS) \
--library=common \
--library=m \
--library=c \
--library=gcc \
-Map $(PROJ_MAP) \
-o $(PROJ_ELF)
$(TARGET_BIN): $(COMMON_LIB) $(PROJ_ELF)
$(OC) --output-target=binary $(PROJ_ELF) $(TARGET_BIN)
.PHONY: all
all: $(TARGET_BIN)
clean:
$(RM) -f \
$(PROJ_OBJS) \
$(PROJ_OBJS:.o=.lst) \
$(PROJ_OBJS:.o=.p) \
$(PROJ_OBJS:.o=.asm) \
$(COMMON_OBJS) \
$(COMMON_OBJS:.o=.lst) \
$(COMMON_OBJS:.o=.p) \
$(COMMON_OBJS:.o=.asm) \
$(COMMON_LIB) \
$(PROJ_MAP) \
$(PROJ_ELF) \
$(TARGET_BIN)

576
Demo_C/Common/ROBO_TX_FW.h Normal file
View File

@ -0,0 +1,576 @@
//=============================================================================
// Header file with definition of the software interface to the
// ROBO TX Controller firmware.
// Can be used for building C-programs which can run under control
// of the ROBO TX Controller firmware in download (local) mode or
// for building PC-programs which can communicate with the
// ROBO TX Controller firmware in online mode.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#ifndef __ROBO_TX_FW_H__
#define __ROBO_TX_FW_H__
#define N_CNT 4 // Number of counters
#define N_PWM_CHAN 8 // Number of PWM channels
#define N_MOTOR 4 // Number of motors
#define N_UNI 8 // Number of universal inputs
// 5kOhm range
#define R_MIN 10 // [Ohm]
#define R_MAX 4999 // [Ohm]
#define R_OVR 5000 // [Ohm] overload
// 10V range
#define U_MIN 0 // [mV]
#define U_MAX 9999 // [mV]
#define U_OVR 10000 // [mV] overload
// Ultrasonic Sensor range
#define ULTRASONIC_MIN 2 // [cm]
#define ULTRASONIC_MAX 1023 // [cm]
#define ULTRASONIC_OVR 1024 // [cm] overload
#define NO_ULTRASONIC 4096 // Not present
// Motor outputs PWM values range
#define DUTY_MIN 0
#define DUTY_MAX 512
// Length of strings
#define DEV_NAME_LEN_MAX 16 // "ROBO TX-xxxxxxxx"
#define BT_ADDR_STR_LEN 17 // "xx:xx:xx:xx:xx:xx"
#define DISPL_MSG_LEN_MAX 98 // Max. length of a pop-up display message
// Number of Bluetooth channels
#define BT_CNT_MAX 8
// Allowed values for channel index are 1...8
#define BT_CHAN_IDX_MIN 1
#define BT_CHAN_IDX_MAX 8
#define BT_ADDR_LEN 6 // Bluetooth address length
#define BT_MSG_LEN 16 // Max. Bluetooth message length
// Bluetooth connection states
enum BtConnState
{
BT_STATE_IDLE = 0, // BT channel is disconnected
BT_STATE_CONN_ONGOING, // BT channel is being connected
BT_STATE_CONNECTED, // BT channel is connected
BT_STATE_DISC_ONGOING // BT channel is being disconnected
};
// Status of Bluetooth inquiry scan
enum BtInquiryScanStatus
{
BT_INQUIRY_SCAN_NOT_POSSIBLE = 0,
BT_INQUIRY_SCAN_START,
BT_INQUIRY_SCAN_RESULT,
BT_INQUIRY_SCAN_BUSY,
BT_INQUIRY_SCAN_TIMEOUT,
BT_INQUIRY_SCAN_END
};
// Status codes for status field in Bluetooth callback functions
enum CB_BtStatus
{
/* 0 */ BT_SUCCESS = 0, // Successful end of command
/* 1 */ BT_CON_EXIST, // Already connected
/* 2 */ BT_CON_SETUP, // Establishing of connection is ongoing
/* 3 */ BT_SWITCHED_OFF, // Cannot connect/listen, Bluetooth is set to off
/* 4 */ BT_ALL_CHAN_BUSY, // Cannot connect, no more free Bluetooth channels
/* 5 */ BT_NOT_ROBOTX, // Cannot connect/listen, device is not a ROBO TX Controller
/* 6 */ BT_CON_TIMEOUT, // Cannot connect, timeout, no device with such a BT address
/* 7 */ BT_CON_INVALID, // Connection does not exist
/* 8 */ BT_CON_RELEASE, // Disconnecting is ongoing
/* 9 */ BT_LISTEN_ACTIVE, // Listen is already active
/* 10 */ BT_RECEIVE_ACTIVE, // Receive is already active
/* 11 */ BT_CON_INDICATION, // Passive connection establishment (incoming connection)
/* 12 */ BT_DISCON_INDICATION, // Passive disconnection (initiated by remote end)
/* 13 */ BT_MSG_INDICATION, // Received data (incoming message)
/* 14 */ BT_CHANNEL_BUSY, // No connect command is allowed when listen is active or
// no listen command is allowed when connected
/* 15 */ BT_BTADDR_BUSY, // BT address is already used by another channel
/* 16 */ BT_NO_LISTEN_ACTIVE // Cannot connect, no active listen on remote end
};
// Identifiers of the Transfer Area
enum ta_id_e
{
TA_LOCAL = 0, // Transfer Area for local Controller. Corresponds to the Controller
// on which program is currently running in download (local) mode or
// to the remotely controlled Controller (seen from controlled device,
// not from controlling device) in online mode.
TA_EXT_1, // Transfer Area for Extension 1 Controller
TA_EXT_2, // Transfer Area for Extension 2 Controller
TA_EXT_3, // Transfer Area for Extension 3 Controller
TA_EXT_4, // Transfer Area for Extension 4 Controller
TA_EXT_5, // Transfer Area for Extension 5 Controller
TA_EXT_6, // Transfer Area for Extension 6 Controller
TA_EXT_7, // Transfer Area for Extension 7 Controller
TA_EXT_8, // Transfer Area for Extension 8 Controller
TA_COUNT // Number of Transfer Areas in array = 9
};
#define N_EXT (TA_COUNT - 1) // Number of extension Controllers = 8
// Device (Controller) functioning modes
enum dev_mode_e
{
DEV_MODE_LOCAL = 0,
DEV_MODE_ONLINE,
DEV_MODE_INVALID
};
// State of connection to an extension device (Controller)
enum ext_dev_connect_state_e
{
EXT_DEV_OFFLINE = 0,
EXT_DEV_ONLINE,
EXT_DEV_INVALID
};
// Modes of universal inputs
enum input_mode_e
{
MODE_U = 0,
MODE_R = 1,
MODE_ULTRASONIC = 3,
MODE_INVALID
};
// Program states
enum pgm_state_e
{
PGM_STATE_INVALID = 0,
PGM_STATE_RUN,
PGM_STATE_STOP
};
// Timer units for GetSystemTime hook function
enum TimerUnit
{
TIMER_UNIT_INVALID = 0,
TIMER_UNIT_SECONDS = 2,
TIMER_UNIT_MILLISECONDS = 3,
TIMER_UNIT_MICROSECONDS = 4
};
// Bluetooth inquiry scan status
typedef struct bt_scan_status_s
{
UINT16 status; // Status code, see enum BtInquiryScanStatus
// Bluetooth device info, valid only when status == BT_INQUIRY_SCAN_RESULT
UCHAR8 bt_addr[BT_ADDR_LEN];
char dummy_1[2];
char bt_name[DEV_NAME_LEN_MAX + 1];
char dummy_2[3];
} BT_SCAN_STATUS;
// Structure for Bluetooth callback functions (other than receive)
typedef struct bt_cb_s
{
UINT16 chan_idx; // Channel index
UINT16 status; // Status code, see enum CB_BtStatus
} BT_CB;
// Structure for Bluetooth receive callback function
typedef struct bt_receive_cb_s
{
UINT16 chan_idx; // Channel index
UINT16 status; // Status code, see enum CB_BtStatus
UINT16 msg_len; // Bluetooth message length
UCHAR8 msg[BT_MSG_LEN];// Bluetooth message
} BT_RECV_CB;
// Status codes for status field in I2C callback functions
enum CB_I2cStatus
{
/* 0 */ I2C_SUCCESS = 0, // Successful end of command
/* 1 */ I2C_READ_ERROR, // read error
/* 2 */ I2C_WRITE_ERROR // write error
};
// Structure for I2C callback functions
typedef struct i2c_cb_s
{
UINT16 value; // read/write value
UINT16 status; // status code, see enum CB_I2Status
} I2C_CB;
struct ta_s;
// Pointer to the Bluetooth callback function (other than receive)
typedef void (*P_CB_FUNC)(struct ta_s *, BT_CB *);
// Pointer to the Bluetooth receive callback function
typedef void (*P_RECV_CB_FUNC)(struct ta_s *, BT_RECV_CB *);
// Pointer to the I2C callback function
typedef void (*P_I2C_CB_FUNC)(struct ta_s *, I2C_CB *);
//=============================================================================
// Structures for Transfer Area (TA)
//=============================================================================
// Bluetooth connection status structure, 8 bytes
typedef struct btstatus_s
{
UINT16 conn_state; // See enum BtConnState
BOOL16 is_listen; // If TRUE - BT channel is waiting for incoming connection (listening)
BOOL16 is_receive; // If TRUE - BT channel is ready to receive incoming messages
UINT16 link_quality; // 0...31, 0 - the worst, 31 - the best signal quality
} BT_STATUS;
// Program information, 8 bytes
typedef struct
{
char * name; // Name of a program with a full path, for example, "/ramdisk/Program_1"
UINT8 state; // See enum pgm_state_e
char reserved[3];
} PGM_INFO;
// Display message, 128 bytes. Used to show pop-up message box on the boards display
typedef struct
{
UINT8 id; // Should be increased by 1 each time a new pop-up message is to be shown
char text[DISPL_MSG_LEN_MAX + 1];
} DISPLAY_MSG;
// Display frame, 8 bytes. Used to refresh boards display with a bitmap image frame
typedef struct
{
UCHAR8 * frame; // Contents of a frame as a 128x64 pixels bitmap
UINT16 id; // Should be increased by 1 each time a new display frame is to be shown
BOOL16 is_pgm_master_of_display; // ++ if program wants to have control over display,
// i.e. image frame is displayed over firmware menus;
// -- if program wants to return control over display
// to the firmware menus
} DISPLAY_FRAME;
// Version structure definition, 4 bytes
typedef union
{
UINT32 abcd;
struct
{
UCHAR8 a;
UCHAR8 b;
UCHAR8 c;
UCHAR8 d;
} part;
} FT_VER;
// Versions of hardware and firmware components, 16 bytes
typedef struct
{
FT_VER hardware; // Version of hardware (hardware.part.a = 'A' or 'B' or 'C')
FT_VER firmware; // Version of firmware ("V %d.%02d, DLL %d", firmware.part.c,
// firmware.part.d, firmware.part.b)
FT_VER ta; // Version of transfer area ("V %d.%02d", ta.part.c, ta.part.d)
char reserved[4];
} FT_VERSION;
// Info structure, 64 bytes
typedef struct
{
char device_name[DEV_NAME_LEN_MAX + 1]; // Controller name
char bt_addr[BT_ADDR_STR_LEN + 1]; // Bluetooth address as a string
char reserved;
UINT32 ta_array_start_addr;
UINT32 pgm_area_start_addr;
UINT32 pgm_area_size;
FT_VERSION version;
} TA_INFO;
// State structure, 100 bytes
typedef struct
{
// Used by local program
BOOL8 pgm_initialized;
char reserved_1[7];
// Public state info
BOOL8 dev_mode; // See enum dev_mode_e
UINT8 id; // Should be increased by 1 each time something (except id fields and btstatus)
// is changed in this state structure
UINT8 info_id; // Should be increased by 1 each time something is changed in info structure
UINT8 config_id; // Should be increased by 1 each time something is changed in config structure
BOOL8 ext_dev_connect_state[N_EXT]; // See enum ext_dev_connect_state_e
BT_STATUS btstatus[BT_CNT_MAX]; // Status of Bluetooth connections
char reserved_2[8];
PGM_INFO local_pgm; // Corresponds to the program currently being in the program memory
} TA_STATE;
// Universal inputs configuration, 4 bytes
typedef struct
{
UINT8 mode; // See enum input_mode_e
BOOL8 digital; // FALSE = analog input, TRUE = digital input
char reserved[2];
} UNI_CONFIG;
// Counter inputs configuration, 4 bytes
typedef struct
{
UINT8 mode; // 0 = normal counter mode (change 0 -> 1 is counted)
// 1 = inverse counter mode (change 1 -> 0 is counted)
char reserved[3];
} CNT_CONFIG;
// Config structure, 88 bytes
typedef struct
{
UINT8 pgm_state_req; // See enum pgm_state_e, program state change request
char reserved_1[3];
BOOL8 motor[N_MOTOR]; // TRUE = corresponding outputs are used as a pair of motor outputs M1...M4,
// FALSE = corresponding outputs are used as a pair of separate digital
// PWM outputs O1...O8
UNI_CONFIG uni[N_UNI];
CNT_CONFIG cnt[N_CNT];
char reserved_2[32];
} TA_CONFIG;
// Input structure, 68 bytes
typedef struct
{
INT16 uni[N_UNI]; // Current values of the universal inputs
INT16 cnt_in[N_CNT]; // Current levels (0 or 1) on the counter inputs according
// to their configuration (normal or inverse)
INT16 counter[N_CNT]; // Current values of the counter inputs
INT16 display_button_left; // Number of milliseconds during which the left display button
// is being kept pressed
INT16 display_button_right; // Number of milliseconds during which the right display button
// is being kept pressed
BOOL16 cnt_resetted[N_CNT]; // Set to 1 when last requested counter reset was fulfilled
BOOL16 motor_pos_reached[N_MOTOR]; // Set to 1 by motor control if target position
// (distance from output structure) is reached
char reserved[16];
} TA_INPUT;
// Output structure, 44 bytes
typedef struct
{
UINT16 cnt_reset_cmd_id[N_CNT]; // Counter reset requests (should be increased by 1 each time
// counter reset is needed)
UINT8 master[N_MOTOR]; // If not 0, synchronize this channel with the given channel
// (1:channel 0, ...)
INT16 duty[N_PWM_CHAN]; // Selected motor outputs PWM values
UINT16 distance[N_MOTOR]; // Selected distance (counter value) at which motor shall stop
UINT16 motor_ex_cmd_id[N_MOTOR]; // Should be increased by 1 each time settings for extended
// motor control mode (duty and/or distance) are changed
} TA_OUTPUT;
// Display structure, 108 bytes
typedef struct
{
DISPLAY_MSG display_msg;
DISPLAY_FRAME display_frame;
} TA_DISPLAY;
// Status of Transfer Area (valid only for ftMscLib), 4 bytes
typedef struct
{
UINT8 status; // Status of transfer area
// TA_STATUS_STOP = 0 - Transfer Area is not running,
// TA_STATUS_RUN = 1 - Transfer Area is running,
// TA_STATUS_SYNC = 2 - Transfer Area is being synchronized
UINT8 iostatus; // Status of I/O communication
// SE_REMIO_REQ = 0 - Remote I/O Request was sent,
// SE_CONFIG_REQ = 1 - Set Configuration Request was sent
UINT16 ComErr; // System error code by COM port connection error
} TA_STATUS;
// Change structure (valid only for ftMscLib), 8 bytes
typedef struct
{
char reserved_1[2];
UINT8 ChangeStatus; // TRUE = there was a change in any of the following fields
UINT8 ChangeUni; // There was a change of the input value (bit 0 = I1, bit 1 = I2, ...)
UINT8 ChangeCntIn; // There was a change of the counter level (bit 0 = C1, bit 1 = C2, ...)
UINT8 ChangeCounter; // There was a change of the counter value (bit 0 = C1, bit 1 = C2, ...)
char reserved_2[2];
} TA_CHANGE;
// 16-bit timers, 12 bytes
typedef struct
{
UINT16 Timer1ms;
UINT16 Timer10ms;
UINT16 Timer100ms;
UINT16 Timer1s;
UINT16 Timer10s;
UINT16 Timer1min;
} TA_TIMER;
// Hook table with pointers to the firmware functions,
// that can be called by local program, 132 bytes
typedef struct
{
// Informs the calling program if it can still run (return TRUE) or should
// immediately return to the firmware in order not to destroy the multitasking
// mechanism of the firmware (return FALSE).
BOOL32 (*IsRunAllowed) (void);
// Returns system time in seconds, milliseconds or microseconds depending on the
// parameter unit.
UINT32 (*GetSystemTime) (enum TimerUnit unit);
// Display pop-up message on the display of the ROBO TX Controller. If p_msg
// is NULL, then all pop-up messages are removed from the display and its cache,
// and the main frame is displayed.
void (*DisplayMsg) (struct ta_s * p_ta, char * p_msg);
// Returns TRUE if display is currently being refreshed. A program should in such a
// case wait until the display finishes its refreshing before sending new output to it.
BOOL32 (*IsDisplayBeingRefreshed) (struct ta_s * p_ta);
// Connect to the Bluetooth device with the given Bluetooth address through the given
// channel (1...8). If p_cb_func (pointer to the callback function) is not NULL, then the
// callback function is called to inform about the result of this command.
void (*BtConnect) (UINT32 channel, UCHAR8 * btaddr, P_CB_FUNC p_cb_func);
// Disconnect from the Bluetooth device on the given channel (1...8). If p_cb_func
// (pointer to the callback function) is not NULL, then the callback function is called
// to inform about the result of this command.
void (*BtDisconnect) (UINT32 channel, P_CB_FUNC p_cb_func);
// Send a message (max 255 characters) through the given Bluetooth channel (1...8).
// If p_cb_func (pointer to the callback function) is not NULL, then the callback function is called
// to inform about the result of this command.
void (*BtSend) (UINT32 channel, UINT32 len, UCHAR8 * p_msg, P_CB_FUNC p_cb_func);
// Start wait for incoming messages on the given Bluetooth channel (1...8). If p_cb_func
// (pointer to the callback function) is not NULL, then the callback function is called
// to inform about the result of this command and about arrival of a Bluetooth message.
void (*BtStartReceive) (UINT32 channel, P_RECV_CB_FUNC p_cb_func);
// Stop wait for incoming messages on the given Bluetooth channel (1...8). If p_cb_func
// (pointer to the callback function) is not NULL, then the callback function is called
// to inform about the result of this command.
void (*BtStopReceive) (UINT32 channel, P_RECV_CB_FUNC p_cb_func);
// Start wait for incoming connection (i.e. listen) from the Bluetooth device with the given
// Bluetooth address on the given channel (1...8). If p_cb_func (pointer to the callback function)
// is not NULL, then the callback function is called to inform about the result of this command.
void (*BtStartListen) (UINT32 channel, UCHAR8 * btaddr, P_CB_FUNC p_cb_func);
// Stop wait for incoming connection (i.e. listen) on the given Bluetooth channel (1...8).
// If p_cb_func (pointer to the callback function) is not NULL, then the callback function is called
// to inform about the result of this command.
void (*BtStopListen) (UINT32 channel, P_CB_FUNC p_cb_func);
// Convert a Bluetooth address (6 bytes) to the string with the format "xx:xx:xx:xx:xx:xx".
// Returns pointer to the string with converted btaddr (same pointer as str parameter).
char *(*BtAddrToStr) (UCHAR8 * btaddr, char * str);
// Interface to I2C API functions
UINT32 (*I2cRead) (UCHAR8 devaddr, UINT32 offset, UCHAR8 protocol, P_I2C_CB_FUNC p_cb_func);
UINT32 (*I2cWrite) (UCHAR8 devaddr, UINT32 offset, UINT16 data, UCHAR8 protocol, P_I2C_CB_FUNC p_cb_func);
// Interface to some runtime library functions.
INT32 (*sprintf) (char * s, const char * format, ...);
INT32 (*memcmp) (const void * s1, const void * s2, UINT32 n);
void *(*memcpy) (void * s1, const void * s2, UINT32 n);
void *(*memmove) (void * s1, const void * s2, UINT32 n);
void *(*memset) (void * s, INT32 c, UINT32 n);
char *(*strcat) (char * s1, const char * s2);
char *(*strncat) (char * s1, const char * s2, UINT32 n);
char *(*strchr) (const char * s, INT32 c);
char *(*strrchr) (const char * s, INT32 c);
INT32 (*strcmp) (const char * s1, const char * s2);
INT32 (*strncmp) (const char * s1, const char * s2, UINT32 n);
INT32 (*stricmp) (const char * s1, const char * s2);
INT32 (*strnicmp) (const char * s1, const char * s2, UINT32 n);
char *(*strcpy) (char * s1, const char * s2);
char *(*strncpy) (char * s1, const char * s2, UINT32 n);
UINT32 (*strlen) (const char * s);
char *(*strstr) (const char * s1, const char * s2);
char *(*strtok) (char * s1, const char * s2);
char *(*strupr) (char * s);
char *(*strlwr) (char * s);
INT32 (*atoi) (const char * nptr);
} TA_HOOK_TABLE;
// ============================================================================
// Transfer Area (TA) of ROBO TX Controller (one element of TA array)
// ============================================================================
#define RESERVED_1_SIZE 28
#define RESERVED_2_SIZE \
(1024 - ( \
sizeof(TA_INFO) + \
sizeof(TA_STATE) + \
sizeof(TA_CONFIG) + \
sizeof(TA_INPUT) + \
sizeof(TA_OUTPUT) + \
sizeof(TA_DISPLAY) + \
sizeof(TA_STATUS) + \
sizeof(TA_CHANGE) + \
sizeof(TA_TIMER) + \
RESERVED_1_SIZE + \
sizeof(TA_HOOK_TABLE) \
))
typedef struct ta_s
{
TA_INFO info; // info structure
TA_STATE state; // state structure
TA_CONFIG config; // config structure
TA_INPUT input; // input structure
TA_OUTPUT output; // output structure
TA_DISPLAY display; // display structure
TA_STATUS status; // status structure
TA_CHANGE change; // change structure
TA_TIMER timer; // 16-bit timers
char reserved_1[RESERVED_1_SIZE];
TA_HOOK_TABLE hook_table; // hook table with functions pointers
char reserved_2[RESERVED_2_SIZE];
} TA;
#endif // __ROBO_TX_FW_H__

126
Demo_C/Common/ROBO_TX_PRG.h Normal file
View File

@ -0,0 +1,126 @@
//=============================================================================
// Header file with definition of the software interface to the
// ROBO TX Controller program.
// Can be used for building C-programs which can run under control
// of the ROBO TX Controller firmware in download (local) mode.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#ifndef __ROBO_TX_PRG_H__
#define __ROBO_TX_PRG_H__
#include <math.h>
#define CALL_CYCLE_MS 1 // firmware calls program each millisecond
#define MIN(a, b) ((a <= b) ? a : b)
#define MAX(a, b) ((a >= b) ? a : b)
#define TA_VERSION 0x08010101 // Transfer Area version. Is used by firmware to check if format of the
// Transfer Area used in program is the same as the one used in firmware.
#define PRG_MEM_START 0x30700000 // start address of the program memory
#define PRG_MEM_SIZE 0x000D0000 // size of the program memory
#define PRG_MAGIC 0x336699AA
#define MAX_FRAME_SIZE 1024 // maximum size of displayable frame (display buffer size)
#if defined(__cplusplus)
#define NULL 0L
#else
#define NULL ((void *)0)
#endif
#undef TRUE
#define TRUE (1 == 1)
#undef FALSE
#define FALSE (!TRUE)
#ifndef __cplusplus
typedef enum
{
false = FALSE,
true = TRUE
} bool;
#endif // __cplusplus
typedef signed char CHAR8;
typedef unsigned char UCHAR8;
typedef unsigned char BOOL8; // boolean variable (should be TRUE or FALSE)
typedef unsigned short BOOL16; // boolean variable (should be TRUE or FALSE)
typedef unsigned long BOOL32; // boolean variable (should be TRUE or FALSE)
typedef signed char INT8;
typedef signed short INT16;
typedef signed int INT32;
typedef unsigned char UINT8;
typedef unsigned short UINT16;
typedef unsigned long UINT32;
#include "ROBO_TX_FW.h"
enum bt_commands_e
{
CMD_NO_CMD,
CMD_CONNECT,
CMD_DISCONNECT,
CMD_START_LISTEN,
CMD_STOP_LISTEN,
CMD_START_RECEIVE,
CMD_STOP_RECEIVE,
CMD_SEND
};
extern UCHAR8 bt_address_table[BT_CNT_MAX][BT_ADDR_LEN];
// At the beginning of the program code should be this structure
struct prg_code_intro_s
{
unsigned long magic; // PRG_MAGIC
FT_VER ta_version; // TA_VERSION
unsigned long entry; // entry point of the program, usually address of
// the program dispatcher (PrgDisp) function
};
// This function is called only once by the program dispatcher (PrgDisp) at the very first call
// of the program dispatcher by the firmware
void PrgInit
(
TA * p_ta, // pointer to the array of transfer area parts
int n_ta // number of transfer area parts in array (equal to TA_COUNT)
);
// This function is called periodically by the program dispatcher (PrgDisp) with the period
// of CALL_CYCLE_MS
int PrgTic
(
TA * p_ta, // pointer to the array of transfer area parts
int n_ta // number of transfer area parts in array (equal to TA_COUNT)
);
// This function converts the status of the executed Bluetooth command to a string
// and displays this string on the display of a ROBO TX Controller
BOOL32 BtDisplayCommandStatus
(
TA * p_ta,
UCHAR8 * bt_address,
UINT32 channel,
enum bt_commands_e command,
CHAR8 command_status
);
#endif // __ROBO_TX_PRG_H__

171
Demo_C/Common/ld.lcf Normal file
View File

@ -0,0 +1,171 @@
PLC_APP_SIZE = 0x000D0000;
PLC_APP_PA_START = 0x20700000;
PLC_APP_VA_START = 0x30700000;
PLC_APP_PA_END = PLC_APP_PA_START + PLC_APP_SIZE;
PLC_APP_VA_END = PLC_APP_VA_START + PLC_APP_SIZE;
MEMORY
{
plc_app_area_pa (RXA) : ORIGIN = 0x20700000, LENGTH = 832K
plc_app_area_va (RXA) : ORIGIN = 0x30700000, LENGTH = 832K
}
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
PHDRS
{
code PT_LOAD ; /* segment containing all sections to load in program memory */
debug PT_LOAD ; /* segment containing all sections for gdb debug */
}
SECTIONS
{
/* ******************** code ******************** */
/* Code RO */
. = ALIGN(4);
.code :
{
_code_start = .;
*(.intro)
*(.code)
*(.text*)
*(.glue_7t)
*(.glue_7)
*(.vfp11_veneer)
*(.v4_bx)
. = ALIGN(4);
_code_end = .;
} >plc_app_area_va AT>plc_app_area_pa :code
/* ******************** const data ******************** */
/* Data RO */
. = ALIGN(4);
.data_const :
{
_rodata_start = .;
*(.rodata*) /* C-compiler output .read only data */
*(.eh_frame)
. = ALIGN(4);
_rodata_end = .;
} >plc_app_area_va AT>plc_app_area_pa :code
/* ******************** initialized data ******************** */
/* Data RW */
. = ALIGN(4);
.data_initialized :
{
_data_initialized_start = .;
*(.data) /* C-compiler output .data */
_data_initialized_end = .;
. = ALIGN(4);
} >plc_app_area_va AT>plc_app_area_pa :code
/* ******************** zero data ******************** */
/* Data RW */
. = ALIGN(4);
.data_zero :
{
. = ALIGN(4);
_data_zero_start = .;
*(.data_zero)
*(COMMON)
*(.dynbss) /* bss "Block Started by Symbol" */
*(.bss .bss.* .gnu.linkonce.b.*)
_data_zero_end = .;
/* Align here to ensure that the .bss section occupies space up to
_end. Align after .bss to ensure correct alignment even if the
.bss section disappears because there are no input sections. */
. = ALIGN(4);
} >plc_app_area_va :NONE
. = ALIGN(4);
/* ******************** .comment ******************** */
/DISCARD/ :
{
*(.comment)
} :NONE
/* ******************** gdb debug ******************** */
/* Stabs debugging sections. */
.stab 0 : { *(.stab) } :debug
.stabstr 0 : { *(.stabstr) } :debug
.stab.excl 0 : { *(.stab.excl) } :debug
.stab.exclstr 0 : { *(.stab.exclstr) } :debug
.stab.index 0 : { *(.stab.index) } :debug
.stab.indexstr 0 : { *(.stab.indexstr) } :debug
.comment 0 : { *(.comment) } :debug
/* DWARF debug sections.
Symbols in the DWARF debugging sections are relative to the beginning
of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) } :debug
.line 0 : { *(.line) } :debug
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) } :debug
.debug_sfnames 0 : { *(.debug_sfnames) } :debug
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) } :debug
.debug_pubnames 0 : { *(.debug_pubnames) } :debug
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } :debug
.debug_abbrev 0 : { *(.debug_abbrev) } :debug
.debug_line 0 : { *(.debug_line) } :debug
.debug_frame 0 : { *(.debug_frame) } :debug
.debug_str 0 : { *(.debug_str) } :debug
.debug_loc 0 : { *(.debug_loc) } :debug
.debug_macinfo 0 : { *(.debug_macinfo) } :debug
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) } :debug
.debug_funcnames 0 : { *(.debug_funcnames) } :debug
.debug_typenames 0 : { *(.debug_typenames) } :debug
.debug_varnames 0 : { *(.debug_varnames) } :debug
}

142
Demo_C/Common/prg_bt.c Normal file
View File

@ -0,0 +1,142 @@
//=============================================================================
// Helper functions for the programs which use Bluetooth.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.H"
static char str[128];
/*-----------------------------------------------------------------------------
* Function Name : BtCommandStatusToString
*
* Converts the status of the executed Bluetooth command to a string.
*-----------------------------------------------------------------------------*/
static char * BtCommandStatusToString
(
enum bt_commands_e command,
CHAR8 command_status
)
{
char * str = "";
switch (command_status)
{
case BT_SUCCESS: // Successful end of command
switch (command)
{
case CMD_CONNECT:
str = "Connected";
break;
case CMD_DISCONNECT:
str = "Disconnected";
break;
case CMD_START_LISTEN:
str = "Started listening";
break;
case CMD_STOP_LISTEN:
str = "Stopped listening";
break;
case CMD_START_RECEIVE:
str = "Started receiving";
break;
case CMD_STOP_RECEIVE:
str = "Stopped receiving";
break;
case CMD_SEND:
str = "Message sent";
break;
default:
break;
}
break;
case BT_CON_EXIST:
str = "Already connected";
break;
case BT_CON_SETUP:
str = "Establishing of connection is ongoing";
break;
case BT_SWITCHED_OFF:
str = "Cannot connect/listen, Bluetooth is set to off";
break;
case BT_ALL_CHAN_BUSY:
str = "Cannot connect, no more free Bluetooth channels";
break;
case BT_NOT_ROBOTX:
str = "Cannot connect/listen, device is not a ROBO TX Controller";
break;
case BT_CON_TIMEOUT:
str = "Cannot connect, timeout, no device with such a BT address";
break;
case BT_CON_INVALID:
str = "Connection does not exist";
break;
case BT_CON_RELEASE:
str = "Disconnecting is ongoing";
break;
case BT_LISTEN_ACTIVE:
str = "Listen is already active";
break;
case BT_RECEIVE_ACTIVE:
str = "Receive is already active";
break;
case BT_CON_INDICATION:
str = "Passive connection establishment (incoming connection)";
break;
case BT_DISCON_INDICATION:
str = "Passive disconnection (initiated by remote end)";
break;
case BT_MSG_INDICATION:
str = "Received data (incoming message)";
break;
case BT_CHANNEL_BUSY:
str = "BT channel is busy";
break;
case BT_BTADDR_BUSY:
str = "BT address is already used by another channel";
break;
case BT_NO_LISTEN_ACTIVE:
str = "Cannot connect, no active listen on remote end";
break;
default:
break;
}
return str;
}
/*-----------------------------------------------------------------------------
* Function Name : BtDisplayCommandStatus
*
* Converts the status of the executed Bluetooth command to a string
* and displays this string on the display of a ROBO TX Controller.
*-----------------------------------------------------------------------------*/
BOOL32 BtDisplayCommandStatus
(
TA * p_ta,
UCHAR8 * bt_address,
UINT32 channel,
enum bt_commands_e command,
CHAR8 command_status
)
{
BOOL32 rc = FALSE;
char bt_addr_str[BT_ADDR_STR_LEN + 1];
if (!p_ta->hook_table.IsDisplayBeingRefreshed(p_ta)) // wait until display is refreshed
{
p_ta->hook_table.sprintf(str, "Ch %u, %s\n%s", channel,
p_ta->hook_table.BtAddrToStr(bt_address, bt_addr_str),
BtCommandStatusToString(command, command_status));
p_ta->hook_table.DisplayMsg(p_ta, str);
rc = TRUE;
}
return rc;
}

View File

@ -0,0 +1,20 @@
//=============================================================================
// Table of Bluetooth addresses of all ROBO TX Controllers which are used
// for Bluetooth communicating programs. It should be adjusted to the concrete
// set of ROBO TX Controllers, planned to be used for Bluetooth communication.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.H"
UCHAR8 bt_address_table[BT_CNT_MAX][BT_ADDR_LEN] =
{
{0x00, 0x13, 0x7B, 0x53, 0x10, 0xE7}, // Bluetooth-Adresse von ROBO TX 1 (MASTER)
{0x00, 0x13, 0x7B, 0x52, 0xB2, 0x11} // Bluetooth-Adresse von ROBO TX 2 (SLAVE)
};

51
Demo_C/Common/prg_disp.c Normal file
View File

@ -0,0 +1,51 @@
//=============================================================================
// Program dispatcher.
// This function is an entry point to any ROBO TX Controller
// program. It is called periodically by the ROBO TX Controller
// firmware in download (local) mode.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.H"
static int PrgDisp
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
);
const struct prg_code_intro_s prg_code_intro __attribute__ ((section (".intro"))) =
{
/* magic */ PRG_MAGIC,
/* ta_version */ {TA_VERSION},
/* entry */ (unsigned long) PrgDisp
};
// This function is called periodically by the ROBO TX Controller firmware with the period
// of CALL_CYCLE_MS
static int PrgDisp
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
TA * p_ta = &p_ta_array[TA_LOCAL];
if (!p_ta->state.pgm_initialized)
{
PrgInit(p_ta_array, ta_count);
p_ta->state.pgm_initialized = TRUE;
}
return PrgTic(p_ta_array, ta_count);
}

View File

@ -0,0 +1,199 @@
//=============================================================================
// Demo program I2cTemp.c
//
// Can be run under control of the ROBO TX Controller
// firmware in download (local) mode.
// This example shows how to sense the temperature with the I2C temperature
// sensor DS1631. After writing some initialisation bytes the program enters
// a loop updating the measured value for the temperature every 1000ms.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.h"
#define LIGHT_ON DUTY_MAX
#define LIGHT_OFF 0
static enum
{
INIT_1,
WAIT_1,
INIT_2,
WAIT_2,
INIT_3,
WAIT_3,
INIT_4,
WAIT_4,
LOOP_WRITE,
LOOP_WRITE_WAIT,
LOOP_READ,
LOOP_READ_WAIT,
LOOP_CLEAR_PREV_SCREEN,
LOOP_DISP_RESULT,
LOOP_WAIT_NEXT_ACTION
} stage;
unsigned int ticks;
unsigned int next_action=0;
UINT16 status=0;
UINT16 value=0;
/*-----------------------------------------------------------------------------
* Function Name : I2cCallback
*
* This callback function is called to inform the program about result (status)
* of execution of any I2c command.
*-----------------------------------------------------------------------------*/
static void I2cCallback
(
TA * p_ta_array,
I2C_CB * p_data
)
{
//TA * p_ta = &p_ta_array[TA_LOCAL];
status = p_data->status;
value = p_data->value;
stage++;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgInit
*
* This it the program initialization.
* It is called once.
*-----------------------------------------------------------------------------*/
void PrgInit
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
//TA * p_ta = &p_ta_array[TA_LOCAL];
ticks = 0;
stage = INIT_1;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgTic
*
* This is the main function of this program.
* It is called every tic (1 ms) realtime.
*-----------------------------------------------------------------------------*/
int PrgTic
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
int rc = 0x7FFF; // return code: 0x7FFF - program should be further called by the firmware;
// 0 - program should be normally stopped by the firmware;
// any other value is considered by the firmware as an error code
// and the program is stopped.
TA * p_ta = &p_ta_array[TA_LOCAL];
char str[64];
int fraction=0;
unsigned char temp=0;
char sign = ' ';
ticks++;
while(1)
{
switch(stage)
{
case INIT_1:
p_ta->hook_table.I2cWrite (0x4F, 0xAC, 0x02, 0x85, I2cCallback);
stage++;
return rc;
case WAIT_1:
case WAIT_2:
case WAIT_3:
case WAIT_4:
// waiting for callback
return rc;
case INIT_2:
p_ta->hook_table.I2cWrite (0x4F, 0xA1, 0x2800, 0x89, I2cCallback);
stage++;
return rc;
case INIT_3:
p_ta->hook_table.I2cWrite (0x4F, 0xA2, 0x0A00, 0x89, I2cCallback);
stage++;
return rc;
case INIT_4:
p_ta->hook_table.I2cWrite (0x4F, 0x00, 0x51, 0x84, I2cCallback);
stage++;
return rc;
case LOOP_WRITE:
p_ta->hook_table.I2cWrite (0x4F, 0x00, 0xAA, 0x84, I2cCallback);
stage++;
return rc;
case LOOP_WRITE_WAIT:
// waiting for callback
return rc;
case LOOP_READ:
p_ta->hook_table.I2cRead (0x4F, 0x00, 0x88, I2cCallback);
stage++;
return rc;
case LOOP_READ_WAIT:
// waiting for callback
return rc;
case LOOP_CLEAR_PREV_SCREEN:
p_ta->hook_table.DisplayMsg(p_ta, NULL); // clear previous Msg output
next_action = ticks + 20;
stage++;
return rc;
case LOOP_DISP_RESULT:
if(ticks >= next_action) // wait for previous Msg output to be cleared
{
if(value & 0x0080) fraction = 5;
else fraction = 0;
if(value & 0x8000)
{
sign = '-';
temp = value >> 8;
temp = ~temp;
}
else
{
sign = '+';
temp = value >> 8;
}
p_ta->hook_table.sprintf(str, "Temperature: %c%d,%d C", sign, temp, fraction);
p_ta->hook_table.DisplayMsg(p_ta, str);
next_action = ticks + 1000;
stage++;
}
return rc;
case LOOP_WAIT_NEXT_ACTION:
if(ticks >= next_action)
{
stage = LOOP_WRITE;
}
return rc;
}
}
return rc;
}

View File

@ -0,0 +1,6 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
..\..\Bin\GNU\Tools\make -f ..\..\Common\Makefile clean

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_flash ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_ramdisk ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
call load_ramdisk.bat COM14

View File

@ -0,0 +1,11 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
set BIN_PATH=..\..\Bin
set BIN_GCC_PATH=%BIN_PATH%\GNU\GNU_ARM\bin
set TOOLS_PATH=%BIN_PATH%\GNU\Tools
set PATH=%BIN_GCC_PATH%;%TOOLS_PATH%;%PATH%
%TOOLS_PATH%\make -f ..\..\Common\Makefile all

View File

@ -0,0 +1,2 @@
PROJ = I2CTEMP
OBJS = I2CTEMP.o

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin run %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin stop %1

View File

@ -0,0 +1,234 @@
//=============================================================================
// Demo program "I2cTpa81.c".
//
// Can be run under control of the ROBO TX Controller
// firmware in download (local) mode.
// This example shows how to sense the temperature sensor array (thermopile) of
// the I2C thermopile sensor TPA81. After some initialisation the program enters
// a loop updating the measured values for the sensors every 1000ms.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.h"
#define LIGHT_ON DUTY_MAX
#define LIGHT_OFF 0
static enum
{
INIT_1,
WAIT_1,
LOOP_READ_AMB,
LOOP_READ_AMB_WAIT,
LOOP_READ_P1,
LOOP_READ_P1_WAIT,
LOOP_READ_P2,
LOOP_READ_P2_WAIT,
LOOP_READ_P3,
LOOP_READ_P3_WAIT,
LOOP_READ_P4,
LOOP_READ_P4_WAIT,
LOOP_READ_P5,
LOOP_READ_P5_WAIT,
LOOP_READ_P6,
LOOP_READ_P6_WAIT,
LOOP_READ_P7,
LOOP_READ_P7_WAIT,
LOOP_READ_P8,
LOOP_READ_P8_WAIT,
LOOP_CLEAR_PREV_SCREEN,
LOOP_DISP_RESULT,
LOOP_WAIT_NEXT_ACTION
} stage;
unsigned int ticks;
unsigned int next_action=0;
UINT16 status=0;
UINT16 value=0;
unsigned char amb=0;
unsigned char p[8]={0,0,0,0,0,0,0,0};
unsigned char pidx=255;
/*-----------------------------------------------------------------------------
* Function Name : I2cCallback
*
* This callback function is called to inform the program about result (status)
* of execution of any I2c command.
*-----------------------------------------------------------------------------*/
static void I2cCallback
(
TA * p_ta_array,
I2C_CB * p_data
)
{
//TA * p_ta = &p_ta_array[TA_LOCAL];
status = p_data->status;
value = p_data->value;
if(pidx == 128)
{
amb = (unsigned char)value;
}
else if(pidx != 255)
{
p[pidx] = (unsigned char)value;
}
stage++;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgInit
*
* This it the program initialization.
* It is called once.
*-----------------------------------------------------------------------------*/
void PrgInit
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
//TA * p_ta = &p_ta_array[TA_LOCAL];
ticks = 0;
stage = INIT_1;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgTic
*
* This is the main function of this program.
* It is called every tic (1 ms) realtime.
*-----------------------------------------------------------------------------*/
int PrgTic
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
int rc = 0x7FFF; // return code: 0x7FFF - program should be further called by the firmware;
// 0 - program should be normally stopped by the firmware;
// any other value is considered by the firmware as an error code
// and the program is stopped.
TA * p_ta = &p_ta_array[TA_LOCAL];
char str[64];
ticks++;
while(1)
{
switch(stage)
{
case INIT_1:
p_ta->hook_table.I2cRead (0x68, 0x00, 0xA5, I2cCallback);
stage++;
return rc;
case WAIT_1:
// waiting for callback
return rc;
case LOOP_READ_AMB:
p_ta->hook_table.I2cRead (0x68, 0x01, 0xA5, I2cCallback);
pidx = 128;
stage++;
return rc;
case LOOP_READ_P1:
p_ta->hook_table.I2cRead (0x68, 0x02, 0xA5, I2cCallback);
pidx = 0;
stage++;
return rc;
case LOOP_READ_P2:
p_ta->hook_table.I2cRead (0x68, 0x03, 0xA5, I2cCallback);
pidx = 1;
stage++;
return rc;
case LOOP_READ_P3:
p_ta->hook_table.I2cRead (0x68, 0x04, 0xA5, I2cCallback);
pidx = 2;
stage++;
return rc;
case LOOP_READ_P4:
p_ta->hook_table.I2cRead (0x68, 0x05, 0xA5, I2cCallback);
pidx = 3;
stage++;
return rc;
case LOOP_READ_P5:
p_ta->hook_table.I2cRead (0x68, 0x06, 0xA5, I2cCallback);
pidx = 4;
stage++;
return rc;
case LOOP_READ_P6:
p_ta->hook_table.I2cRead (0x68, 0x07, 0xA5, I2cCallback);
pidx = 5;
stage++;
return rc;
case LOOP_READ_P7:
p_ta->hook_table.I2cRead (0x68, 0x08, 0xA5, I2cCallback);
pidx = 6;
stage++;
return rc;
case LOOP_READ_P8:
p_ta->hook_table.I2cRead (0x68, 0x09, 0xA5, I2cCallback);
pidx = 7;
stage++;
return rc;
case LOOP_READ_AMB_WAIT:
case LOOP_READ_P1_WAIT:
case LOOP_READ_P2_WAIT:
case LOOP_READ_P3_WAIT:
case LOOP_READ_P4_WAIT:
case LOOP_READ_P5_WAIT:
case LOOP_READ_P6_WAIT:
case LOOP_READ_P7_WAIT:
case LOOP_READ_P8_WAIT:
// waiting for callback
return rc;
case LOOP_CLEAR_PREV_SCREEN:
p_ta->hook_table.DisplayMsg(p_ta, NULL); // clear previous Msg output
next_action = ticks + 20;
stage++;
return rc;
case LOOP_DISP_RESULT:
if(ticks >= next_action) // wait for previous Msg output to be cleared
{
p_ta->hook_table.sprintf(str, "Amb.Temp.: %d C\n%d, %d, %d, %d\n%d, %d, %d, %d",
amb, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
p_ta->hook_table.DisplayMsg(p_ta, str);
next_action = ticks + 1000;
stage++;
}
return rc;
case LOOP_WAIT_NEXT_ACTION:
if(ticks >= next_action)
{
stage = LOOP_READ_AMB;
}
return rc;
}
}
return rc;
}

View File

@ -0,0 +1,6 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
..\..\Bin\GNU\Tools\make -f ..\..\Common\Makefile clean

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_flash ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_ramdisk ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
call load_ramdisk.bat COM14

View File

@ -0,0 +1,11 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
set BIN_PATH=..\..\Bin
set BIN_GCC_PATH=%BIN_PATH%\GNU\GNU_ARM\bin
set TOOLS_PATH=%BIN_PATH%\GNU\Tools
set PATH=%BIN_GCC_PATH%;%TOOLS_PATH%;%PATH%
%TOOLS_PATH%\make -f ..\..\Common\Makefile all

View File

@ -0,0 +1,2 @@
PROJ = I2CTPA81
OBJS = I2CTPA81.o

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin run %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin stop %1

180
Demo_C/Demo/LED/LED.c Normal file
View File

@ -0,0 +1,180 @@
//=============================================================================
// Demo program "Light run".
//
// Can be run under control of the ROBO TX Controller
// firmware in download (local) mode.
// Switches one after another six lamps connected to the outputs O1...O6.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.h"
#define LIGHT_ON DUTY_MAX
#define LIGHT_OFF 0
#define BEG_LAMP_IDX 0
#define END_LAMP_IDX 0
static unsigned long cur_time;
static unsigned long prev_time;
static enum {ON_1, PAUSE_1, ON_2, PAUSE_2} stage;
static int lamp_idx;
static int n_loops;
static int wait;
/*-----------------------------------------------------------------------------
* Function Name : PrgInit
*
* This it the program initialization.
* It is called once.
*-----------------------------------------------------------------------------*/
void PrgInit
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
prev_time = 0;
stage = ON_2;
lamp_idx = BEG_LAMP_IDX;
n_loops = 10;
wait = 1000;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgTic
*
* This is the main function of this program.
* It is called every tic (1 ms) realtime.
*-----------------------------------------------------------------------------*/
int PrgTic
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
int rc = 0x7FFF; // return code: 0x7FFF - program should be further called by the firmware;
// 0 - program should be normally stopped by the firmware;
// any other value is considered by the firmware as an error code
// and the program is stopped.
TA * p_ta = &p_ta_array[TA_LOCAL];
// Get the current value of the system time
cur_time = p_ta->hook_table.GetSystemTime(TIMER_UNIT_MILLISECONDS);
while (1)
{
switch (stage)
{
case ON_1:
if (prev_time == 0)
{
// Switch the current lamp on
p_ta->output.duty[lamp_idx] = LIGHT_ON;
// Store the current value of the system time
prev_time = cur_time;
}
else
{
// The lamp should be on for the number of milliseconds from the variable "wait"
if (cur_time - prev_time >= wait)
{
// Switch the current lamp off
p_ta->output.duty[lamp_idx] = LIGHT_OFF;
if (lamp_idx + 1 <= END_LAMP_IDX)
{
prev_time = 0;
lamp_idx++; // switch to the next lamp
continue;
}
else
{
// Store the current value of the system time
prev_time = cur_time;
stage = PAUSE_1;
}
}
}
return rc;
case PAUSE_1:
// All lamps should be off for the number of milliseconds from the variable "wait"
if (cur_time - prev_time >= wait)
{
prev_time = 0;
stage = ON_2;
}
else
{
return rc;
}
case ON_2:
if (prev_time == 0)
{
// Switch the current lamp on
p_ta->output.duty[lamp_idx] = LIGHT_ON;
// Store the current value of the system time
prev_time = cur_time;
}
else
{
// The lamp should be on for the number of milliseconds from the variable "wait"
if (cur_time - prev_time >= wait)
{
// Switch the current lamp off
p_ta->output.duty[lamp_idx] = LIGHT_OFF;
if (lamp_idx - 1 >= BEG_LAMP_IDX)
{
prev_time = 0;
lamp_idx--; // switch to the previous lamp
continue;
}
else
{
// Store the current value of the system time
prev_time = cur_time;
stage = PAUSE_2;
}
}
}
return rc;
case PAUSE_2:
// All lamps should be off for 1 second
if (cur_time - prev_time >= 1000)
{
if (--n_loops <= 0)
{
rc = 0; // stop program
}
else
{
wait /= 2;
prev_time = 0;
stage = ON_1;
continue;
}
}
return rc;
default:
return rc;
}
}
return rc;
}

View File

@ -0,0 +1,6 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
..\..\Bin\GNU\Tools\make -f ..\..\Common\Makefile clean

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_flash ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_ramdisk ..\..\bin %1

12
Demo_C/Demo/LED/make.bat Normal file
View File

@ -0,0 +1,12 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
set BIN_PATH=..\..\Bin
set BIN_GCC_PATH=%BIN_PATH%\GNU\GNU_ARM\bin
set TOOLS_PATH=%BIN_PATH%\GNU\Tools
::set PATH=%BIN_GCC_PATH%;%TOOLS_PATH%;%PATH%
set PATH=%BIN_GCC_PATH%;%TOOLS_PATH%
%TOOLS_PATH%\make -f ..\..\Common\Makefile all

2
Demo_C/Demo/LED/param.mk Normal file
View File

@ -0,0 +1,2 @@
PROJ = LightRun
OBJS = LightRun.o

2
Demo_C/Demo/LED/run.bat Normal file
View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin run %1

2
Demo_C/Demo/LED/stop.bat Normal file
View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin stop %1

View File

@ -0,0 +1,180 @@
//=============================================================================
// Demo program "Light run".
//
// Can be run under control of the ROBO TX Controller
// firmware in download (local) mode.
// Switches one after another six lamps connected to the outputs O1...O6.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.h"
#define LIGHT_ON DUTY_MAX
#define LIGHT_OFF 0
#define BEG_LAMP_IDX 0
#define END_LAMP_IDX 0
static unsigned long cur_time;
static unsigned long prev_time;
static enum {ON_1, PAUSE_1, ON_2, PAUSE_2} stage;
static int lamp_idx;
static int n_loops;
static int wait;
/*-----------------------------------------------------------------------------
* Function Name : PrgInit
*
* This it the program initialization.
* It is called once.
*-----------------------------------------------------------------------------*/
void PrgInit
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
prev_time = 0;
stage = ON_2;
lamp_idx = BEG_LAMP_IDX;
n_loops = 10;
wait = 1000;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgTic
*
* This is the main function of this program.
* It is called every tic (1 ms) realtime.
*-----------------------------------------------------------------------------*/
int PrgTic
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
int rc = 0x7FFF; // return code: 0x7FFF - program should be further called by the firmware;
// 0 - program should be normally stopped by the firmware;
// any other value is considered by the firmware as an error code
// and the program is stopped.
TA * p_ta = &p_ta_array[TA_LOCAL];
// Get the current value of the system time
cur_time = p_ta->hook_table.GetSystemTime(TIMER_UNIT_MILLISECONDS);
while (1)
{
switch (stage)
{
case ON_1:
if (prev_time == 0)
{
// Switch the current lamp on
p_ta->output.duty[lamp_idx] = LIGHT_ON;
// Store the current value of the system time
prev_time = cur_time;
}
else
{
// The lamp should be on for the number of milliseconds from the variable "wait"
if (cur_time - prev_time >= wait)
{
// Switch the current lamp off
p_ta->output.duty[lamp_idx] = LIGHT_OFF;
if (lamp_idx + 1 <= END_LAMP_IDX)
{
prev_time = 0;
lamp_idx++; // switch to the next lamp
continue;
}
else
{
// Store the current value of the system time
prev_time = cur_time;
stage = PAUSE_1;
}
}
}
return rc;
case PAUSE_1:
// All lamps should be off for the number of milliseconds from the variable "wait"
if (cur_time - prev_time >= wait)
{
prev_time = 0;
stage = ON_2;
}
else
{
return rc;
}
case ON_2:
if (prev_time == 0)
{
// Switch the current lamp on
p_ta->output.duty[lamp_idx] = LIGHT_ON;
// Store the current value of the system time
prev_time = cur_time;
}
else
{
// The lamp should be on for the number of milliseconds from the variable "wait"
if (cur_time - prev_time >= wait)
{
// Switch the current lamp off
p_ta->output.duty[lamp_idx] = LIGHT_OFF;
if (lamp_idx - 1 >= BEG_LAMP_IDX)
{
prev_time = 0;
lamp_idx--; // switch to the previous lamp
continue;
}
else
{
// Store the current value of the system time
prev_time = cur_time;
stage = PAUSE_2;
}
}
}
return rc;
case PAUSE_2:
// All lamps should be off for 1 second
if (cur_time - prev_time >= 1000)
{
if (--n_loops <= 0)
{
rc = 0; // stop program
}
else
{
wait /= 2;
prev_time = 0;
stage = ON_1;
continue;
}
}
return rc;
default:
return rc;
}
}
return rc;
}

View File

@ -0,0 +1,6 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
..\..\Bin\GNU\Tools\make -f ..\..\Common\Makefile clean

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_flash ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_ramdisk ..\..\bin %1

View File

@ -0,0 +1,12 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
set BIN_PATH=..\..\Bin
set BIN_GCC_PATH=%BIN_PATH%\GNU\GNU_ARM\bin
set TOOLS_PATH=%BIN_PATH%\GNU\Tools
::set PATH=%BIN_GCC_PATH%;%TOOLS_PATH%;%PATH%
set PATH=%BIN_GCC_PATH%;%TOOLS_PATH%
%TOOLS_PATH%\make -f ..\..\Common\Makefile all

View File

@ -0,0 +1,2 @@
PROJ = LightRun
OBJS = LightRun.o

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin run %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin stop %1

View File

@ -0,0 +1,114 @@
//=============================================================================
// Demo program "Extended motor control mode with two motors on Master".
//
// Can be run under control of the ROBO TX Controller
// firmware in download (local) mode.
// Continuously starts two synchronized motors with changing rotation directions.
// Motors are connected to outputs M1 and M2. Pulses from the motors are
// calculated by the counters C1 and C2. The motors are stopped and rotation
// direction is changed after both counters reach the value of 200.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.h"
#define TA_IDX TA_LOCAL
#define MASTER_MOTOR_NUMBER 1
#define MASTER_MOTOR_IDX (MASTER_MOTOR_NUMBER - 1)
#define SLAVE_MOTOR_NUMBER 2
#define SLAVE_MOTOR_IDX (SLAVE_MOTOR_NUMBER - 1)
static BOOL32 rotation_direction;
static BOOL32 prev_rotation_direction;
/*-----------------------------------------------------------------------------
* Function Name : PrgInit
*
* This it the program initialization.
* It is called once.
*-----------------------------------------------------------------------------*/
void PrgInit
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
TA * p_ta = &p_ta_array[TA_IDX];
// Configure master motor output to be used as a motor output
p_ta->config.motor[MASTER_MOTOR_IDX] = TRUE;
// Configure slave motor output to be used as a motor output
p_ta->config.motor[SLAVE_MOTOR_IDX] = TRUE;
// Inform firmware that configuration was changed
p_ta->state.config_id += 1;
rotation_direction = FALSE;
prev_rotation_direction = !rotation_direction;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgTic
*
* This is the main function of this program.
* It is called every tic (1 ms) realtime.
*-----------------------------------------------------------------------------*/
int PrgTic
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
int rc = 0x7FFF; // return code: 0x7FFF - program should be further called by the firmware;
// 0 - program should be normally stopped by the firmware;
// any other value is considered by the firmware as an error code
// and the program is stopped.
TA * p_ta = &p_ta_array[TA_IDX];
if (rotation_direction != prev_rotation_direction)
{
// Set master motor duty depending on rotation_direction
p_ta->output.duty[2 * MASTER_MOTOR_IDX + 0] = (rotation_direction) ? DUTY_MAX : 0;
p_ta->output.duty[2 * MASTER_MOTOR_IDX + 1] = (rotation_direction) ? 0 : DUTY_MAX;
// Set slave motor duty depending on rotation_direction
p_ta->output.duty[2 * SLAVE_MOTOR_IDX + 0] = (rotation_direction) ? DUTY_MAX : 0;
p_ta->output.duty[2 * SLAVE_MOTOR_IDX + 1] = (rotation_direction) ? 0 : DUTY_MAX;
// Master motor should run until counter reaches 200
p_ta->output.distance[MASTER_MOTOR_IDX] = 200;
// Slave motor should run until counter reaches 200
p_ta->output.distance[SLAVE_MOTOR_IDX] = 200;
// Link slave motor to master motor
p_ta->output.master[SLAVE_MOTOR_IDX] = MASTER_MOTOR_IDX + 1;
p_ta->input.motor_pos_reached[MASTER_MOTOR_IDX] = FALSE;
p_ta->input.motor_pos_reached[SLAVE_MOTOR_IDX] = FALSE;
// Start extended motor control command for master motor
p_ta->output.motor_ex_cmd_id[MASTER_MOTOR_IDX]++;
// Start extended motor control command for slave motor
p_ta->output.motor_ex_cmd_id[SLAVE_MOTOR_IDX]++;
prev_rotation_direction = rotation_direction;
}
if (p_ta->input.motor_pos_reached[MASTER_MOTOR_IDX] && p_ta->input.motor_pos_reached[SLAVE_MOTOR_IDX])
{
rotation_direction = !rotation_direction;
}
return rc;
}

View File

@ -0,0 +1,6 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
..\..\Bin\GNU\Tools\make -f ..\..\Common\Makefile clean

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_flash ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_ramdisk ..\..\bin %1

View File

@ -0,0 +1,11 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
set BIN_PATH=..\..\Bin
set BIN_GCC_PATH=%BIN_PATH%\GNU\GNU_ARM\bin
set TOOLS_PATH=%BIN_PATH%\GNU\Tools
set PATH=%BIN_GCC_PATH%;%TOOLS_PATH%;%PATH%
%TOOLS_PATH%\make -f ..\..\Common\Makefile all

View File

@ -0,0 +1,2 @@
PROJ = MotorEx_2M_Master
OBJS = MotorEx_2M_Master.o

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin run %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin stop %1

View File

@ -0,0 +1,95 @@
//=============================================================================
// Demo program "Extended motor control mode on Extension 1".
//
// Can be run under control of the ROBO TX Controller
// firmware in download (local) mode.
// Continuously starts a motor with changing rotation directions.
// Motor is connected to outputs M1. Pulses from the motor are
// calculated by the counter C1. The motor is stopped and rotation
// direction is changed after the counter reaches the value of 200.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.h"
#define TA_IDX TA_EXT_1
#define MOTOR_NUMBER 1
#define MOTOR_IDX (MOTOR_NUMBER - 1)
static BOOL32 rotation_direction;
static BOOL32 prev_rotation_direction;
/*-----------------------------------------------------------------------------
* Function Name : PrgInit
*
* This it the program initialization.
* It is called once.
*-----------------------------------------------------------------------------*/
void PrgInit
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
TA * p_ta = &p_ta_array[TA_IDX];
// Configure motor output to be used as a motor output
p_ta->config.motor[MOTOR_IDX] = TRUE;
// Inform firmware that configuration was changed
p_ta->state.config_id += 1;
rotation_direction = FALSE;
prev_rotation_direction = !rotation_direction;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgTic
*
* This is the main function of this program.
* It is called every tic (1 ms) realtime.
*-----------------------------------------------------------------------------*/
int PrgTic
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
int rc = 0x7FFF; // return code: 0x7FFF - program should be further called by the firmware;
// 0 - program should be normally stopped by the firmware;
// any other value is considered by the firmware as an error code
// and the program is stopped.
TA * p_ta = &p_ta_array[TA_IDX];
if (rotation_direction != prev_rotation_direction)
{
// Set motor duty depending on rotation_direction
p_ta->output.duty[2 * MOTOR_IDX + 0] = (rotation_direction) ? DUTY_MAX : 0;
p_ta->output.duty[2 * MOTOR_IDX + 1] = (rotation_direction) ? 0 : DUTY_MAX;
// Motor should run until counter reaches 200
p_ta->output.distance[MOTOR_IDX] = 200;
p_ta->input.motor_pos_reached[MOTOR_IDX] = FALSE;
// Start extended motor control command
p_ta->output.motor_ex_cmd_id[MOTOR_IDX]++;
prev_rotation_direction = rotation_direction;
}
if (p_ta->input.motor_pos_reached[MOTOR_IDX])
{
rotation_direction = !rotation_direction;
}
return rc;
}

View File

@ -0,0 +1,6 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
..\..\Bin\GNU\Tools\make -f ..\..\Common\Makefile clean

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_flash ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_ramdisk ..\..\bin %1

View File

@ -0,0 +1,11 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
set BIN_PATH=..\..\Bin
set BIN_GCC_PATH=%BIN_PATH%\GNU\GNU_ARM\bin
set TOOLS_PATH=%BIN_PATH%\GNU\Tools
set PATH=%BIN_GCC_PATH%;%TOOLS_PATH%;%PATH%
%TOOLS_PATH%\make -f ..\..\Common\Makefile all

View File

@ -0,0 +1,2 @@
PROJ = MotorEx_Ext1
OBJS = MotorEx_Ext1.o

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin run %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin stop %1

View File

@ -0,0 +1,160 @@
//=============================================================================
// Demo program "Motor run".
//
// Can be run under control of the ROBO TX Controller
// firmware in download (local) mode.
// Controls motor connected to outputs M1 with different
// speeds and in different rotation directions.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.h"
#define TA_IDX TA_LOCAL
#define MOTOR_NUMBER 1
#define MOTOR_IDX (MOTOR_NUMBER - 1)
static unsigned long timer;
static enum {DIRECTION_1, PAUSE, DIRECTION_2, OFF} stage;
static int duty;
/*-----------------------------------------------------------------------------
* Function Name : PrgInit
*
* This it the program initialization.
* It is called once.
*-----------------------------------------------------------------------------*/
void PrgInit
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
TA * p_ta = &p_ta_array[TA_IDX];
// Configure motor output to be used as a motor output
p_ta->config.motor[MOTOR_IDX] = TRUE;
// Inform firmware that configuration was changed
p_ta->state.config_id += 1;
// Switch motor off
p_ta->output.duty[2 * MOTOR_IDX + 0] = 0;
p_ta->output.duty[2 * MOTOR_IDX + 1] = 0;
timer = 0;
stage = DIRECTION_1; // motor should start to rotate in the first direction
duty = 0;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgTic
*
* This is the main function of this program.
* It is called every tic (1 ms) realtime.
*-----------------------------------------------------------------------------*/
int PrgTic
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
int rc = 0x7FFF; // return code: 0x7FFF - program should be further called by the firmware;
// 0 - program should be normally stopped by the firmware;
// any other value is considered by the firmware as an error code
// and the program is stopped.
TA * p_ta = &p_ta_array[TA_IDX];
while (1)
{
switch (stage)
{
case DIRECTION_1:
if (timer == 0)
{
// Switch motor on in the first direction with the speed from the duty value
duty += DUTY_MAX / 4;
p_ta->output.duty[2 * MOTOR_IDX + 0] = duty;
p_ta->output.duty[2 * MOTOR_IDX + 1] = 0;
}
if (++timer >= 2000) // motor should rotate with such a speed for 2 seconds
{
timer = 0;
if (duty >= DUTY_MAX)
{
stage = PAUSE;
}
else
{
continue;
}
}
else
{
return rc;
}
case PAUSE:
if (timer == 0)
{
// Switch motor off
p_ta->output.duty[2 * MOTOR_IDX + 0] = 0;
p_ta->output.duty[2 * MOTOR_IDX + 1] = 0;
}
if (++timer >= 2000) // motor should be stopped for 2 seconds
{
stage = DIRECTION_2;
timer = 0;
}
else
{
return rc;
}
case DIRECTION_2:
if (timer == 0)
{
// Switch motor on in the second direction with the speed from the duty value
p_ta->output.duty[2 * MOTOR_IDX + 0] = 0;
p_ta->output.duty[2 * MOTOR_IDX + 1] = duty;
}
if (++timer >= 2000) // motor should rotate with such a speed for 2 seconds
{
duty -= DUTY_MAX / 4;
if (duty <= 0)
{
stage = OFF;
}
else
{
timer = 0;
continue;
}
}
else
{
return rc;
}
case OFF:
// Switch motor off
p_ta->output.duty[2 * MOTOR_IDX + 0] = 0;
p_ta->output.duty[2 * MOTOR_IDX + 1] = 0;
rc = 0; // stop program
return rc;
default:
return rc;
}
}
return rc;
}

View File

@ -0,0 +1,6 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
..\..\Bin\GNU\Tools\make -f ..\..\Common\Makefile clean

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_flash ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_ramdisk ..\..\bin %1

View File

@ -0,0 +1,11 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
set BIN_PATH=..\..\Bin
set BIN_GCC_PATH=%BIN_PATH%\GNU\GNU_ARM\bin
set TOOLS_PATH=%BIN_PATH%\GNU\Tools
set PATH=%BIN_GCC_PATH%;%TOOLS_PATH%;%PATH%
%TOOLS_PATH%\make -f ..\..\Common\Makefile all

View File

@ -0,0 +1,2 @@
PROJ = MotorRun
OBJS = MotorRun.o

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin run %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_exec_cmd ..\..\bin stop %1

123
Demo_C/Demo/StopGo/StopGo.c Normal file
View File

@ -0,0 +1,123 @@
//=============================================================================
// Demo program "Stop and go".
//
// Can be run under control of the ROBO TX Controller
// firmware in download (local) mode.
// Starts and stops motor connected to outputs M1 by means
// of the button connected to the input I8. Pulses from the
// motor are calculated by the counter C1. The motor is
// stopped after the counter reaches the value of 1000.
//
// Disclaimer - Exclusion of Liability
//
// This software 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. It can be used and modified by anyone
// free of any license obligations or authoring rights.
//=============================================================================
#include "ROBO_TX_PRG.h"
#define TA_IDX TA_LOCAL
//#define TA_IDX TA_EXT_1
#define MOTOR_NUMBER 1
#define MOTOR_IDX (MOTOR_NUMBER - 1)
#define BUTTON_NUMBER 8
#define BUTTON_IDX (BUTTON_NUMBER - 1)
static INT16 prev_button_state;
static char str[128];
/*-----------------------------------------------------------------------------
* Function Name : PrgInit
*
* This it the program initialization.
* It is called once.
*-----------------------------------------------------------------------------*/
void PrgInit
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
TA * p_ta = &p_ta_array[TA_IDX];
// Configure motor output to be used as a motor output
p_ta->config.motor[MOTOR_IDX] = TRUE;
// Configure button input to "Digital 5 kOhm" mode
p_ta->config.uni[BUTTON_IDX].mode = MODE_R;
p_ta->config.uni[BUTTON_IDX].digital = TRUE;
// Inform firmware that configuration was changed
p_ta->state.config_id += 1;
// Reset counter
p_ta->input.cnt_resetted[MOTOR_IDX] = FALSE;
p_ta->output.cnt_reset_cmd_id[MOTOR_IDX]++;
// Emulate button press in order to run at program start-up on
// program branch where the button release is noticed
prev_button_state = 1;
}
/*-----------------------------------------------------------------------------
* Function Name : PrgTic
*
* This is the main function of this program.
* It is called every tic (1 ms) realtime.
*-----------------------------------------------------------------------------*/
int PrgTic
(
TA * p_ta_array, // pointer to the array of transfer areas
int ta_count // number of transfer areas in array (equal to TA_COUNT)
)
{
int rc = 0x7FFF; // return code: 0x7FFF - program should be further called by the firmware;
// 0 - program should be normally stopped by the firmware;
// any other value is considered by the firmware as an error code
// and the program is stopped.
TA * p_ta = &p_ta_array[TA_IDX];
INT16 cur_button_state;
if (p_ta->input.cnt_resetted[MOTOR_IDX]) // wait until counter is resetted
{
if (!p_ta->hook_table.IsDisplayBeingRefreshed(p_ta)) // wait until display is refreshed
{
// Read current status of the button input
cur_button_state = p_ta->input.uni[BUTTON_IDX];
if (prev_button_state != cur_button_state)
{
if (prev_button_state && !cur_button_state) // if button was released
{
p_ta->hook_table.sprintf(str, "Press button I%d to run motor M%d",
BUTTON_NUMBER, MOTOR_NUMBER);
p_ta->hook_table.DisplayMsg(p_ta, str);
}
else // if button was pressed
{
// Drop all pop-up messages from display and return to the main frame
p_ta->hook_table.DisplayMsg(p_ta, NULL);
}
prev_button_state = cur_button_state;
}
// Start motor if button is pressed, otherwise stop it
p_ta->output.duty[2 * MOTOR_IDX] = (cur_button_state) ? DUTY_MAX : 0;
}
if (!p_ta->hook_table.IsDisplayBeingRefreshed(p_ta)) // wait until display is refreshed
{
// Program should be executed until counter reaches 1000
if (p_ta->input.counter[MOTOR_IDX] >= 1000)
{
p_ta->hook_table.sprintf(str, "Motor M%d reached position 1000", MOTOR_NUMBER);
p_ta->hook_table.DisplayMsg(p_ta, str);
rc = 0; // stop program
}
}
}
return rc;
}

View File

@ -0,0 +1,6 @@
@echo off
if not "%ROOT_BATCH%"/ == ""/ goto start
if "%ROOT_BATCH%"/ == ""/ ..\..\Bin\_start go %0
:start
..\..\Bin\GNU\Tools\make -f ..\..\Common\Makefile clean

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_flash ..\..\bin %1

View File

@ -0,0 +1,2 @@
@echo off
..\..\bin\_load_ramdisk ..\..\bin %1

Some files were not shown because too many files have changed in this diff Show More