initial "working" version
This should print something on the UART. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
@ -1,6 +0,0 @@
|
||||
#ifndef __ASSERT_H
|
||||
#define __ASSERT_H
|
||||
|
||||
#define assert(x)
|
||||
|
||||
#endif /* __ASSERT_H */
|
@ -1,63 +0,0 @@
|
||||
#ifndef __CTYPE_H
|
||||
#define __CTYPE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NOTE! This ctype does not handle EOF like the standard C
|
||||
* library is required to.
|
||||
*/
|
||||
|
||||
#define _U 0x01 /* upper */
|
||||
#define _L 0x02 /* lower */
|
||||
#define _D 0x04 /* digit */
|
||||
#define _C 0x08 /* cntrl */
|
||||
#define _P 0x10 /* punct */
|
||||
#define _S 0x20 /* white space (space/lf/tab) */
|
||||
#define _X 0x40 /* hex digit */
|
||||
#define _SP 0x80 /* hard space (0x20) */
|
||||
|
||||
extern const unsigned char _ctype[];
|
||||
|
||||
#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
|
||||
|
||||
#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0)
|
||||
#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0)
|
||||
#define iscntrl(c) ((__ismask(c)&(_C)) != 0)
|
||||
#define isdigit(c) ((__ismask(c)&(_D)) != 0)
|
||||
#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0)
|
||||
#define islower(c) ((__ismask(c)&(_L)) != 0)
|
||||
#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
|
||||
#define ispunct(c) ((__ismask(c)&(_P)) != 0)
|
||||
/* Note: isspace() must return false for %NUL-terminator */
|
||||
#define isspace(c) ((__ismask(c)&(_S)) != 0)
|
||||
#define isupper(c) ((__ismask(c)&(_U)) != 0)
|
||||
#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0)
|
||||
|
||||
#define isascii(c) (((unsigned char)(c))<=0x7f)
|
||||
#define toascii(c) (((unsigned char)(c))&0x7f)
|
||||
|
||||
static inline unsigned char __tolower(unsigned char c)
|
||||
{
|
||||
if (isupper(c))
|
||||
c -= 'A'-'a';
|
||||
return c;
|
||||
}
|
||||
|
||||
static inline unsigned char __toupper(unsigned char c)
|
||||
{
|
||||
if (islower(c))
|
||||
c -= 'a'-'A';
|
||||
return c;
|
||||
}
|
||||
|
||||
#define tolower(c) __tolower(c)
|
||||
#define toupper(c) __toupper(c)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __CTYPE_H */
|
@ -1,30 +0,0 @@
|
||||
#ifndef __ENDIAN_H
|
||||
#define __ENDIAN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __LITTLE_ENDIAN 0
|
||||
#define __BIG_ENDIAN 1
|
||||
#define __BYTE_ORDER __BIG_ENDIAN
|
||||
|
||||
static inline unsigned int le32toh(unsigned int val)
|
||||
{
|
||||
return (val & 0xff) << 24 |
|
||||
(val & 0xff00) << 8 |
|
||||
(val & 0xff0000) >> 8 |
|
||||
(val & 0xff000000) >> 24;
|
||||
}
|
||||
|
||||
static inline unsigned short le16toh(unsigned short val)
|
||||
{
|
||||
return (val & 0xff) << 8 |
|
||||
(val & 0xff00) >> 8;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ENDIAN_H */
|
261
include/errno.h
261
include/errno.h
@ -1,261 +0,0 @@
|
||||
#ifndef __ERRNO_H
|
||||
#define __ERRNO_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int errno;
|
||||
|
||||
#define EPERM 1
|
||||
#define EPERM_STR "Operation not permitted"
|
||||
#define ENOENT 2
|
||||
#define ENOENT_STR "No such file or directory"
|
||||
#define ESRCH 3
|
||||
#define ESRCH_STR "No such process"
|
||||
#define EINTR 4
|
||||
#define EINTR_STR "Interrupted system call"
|
||||
#define EIO 5
|
||||
#define EIO_STR "I/O error"
|
||||
#define ENXIO 6
|
||||
#define ENXIO_STR "No such device or address"
|
||||
#define E2BIG 7
|
||||
#define E2BIG_STR "Arg list too long"
|
||||
#define ENOEXEC 8
|
||||
#define ENOEXEC_STR "Exec format error"
|
||||
#define EBADF 9
|
||||
#define EBADF_STR "Bad file number"
|
||||
#define ECHILD 10
|
||||
#define ECHILD_STR "No child processes"
|
||||
#define EAGAIN 11
|
||||
#define EWOULDBLOCK EAGAIN
|
||||
#define EAGAIN_STR "Try again"
|
||||
#define ENOMEM 12
|
||||
#define ENOMEM_STR "Out of memory"
|
||||
#define EACCES 13
|
||||
#define EACCES_STR "Permission denied"
|
||||
#define EFAULT 14
|
||||
#define EFAULT_STR "Bad address"
|
||||
#define ENOTBLK 15
|
||||
#define ENOTBLK_STR "Block device required"
|
||||
#define EBUSY 16
|
||||
#define EBUSY_STR "Device or resource busy"
|
||||
#define EEXIST 17
|
||||
#define EEXIST_STR "File exists"
|
||||
#define EXDEV 18
|
||||
#define EXDEV_STR "Cross-device link"
|
||||
#define ENODEV 19
|
||||
#define ENODEV_STR "No such device"
|
||||
#define ENOTDIR 20
|
||||
#define ENOTDIR_STR "Not a directory"
|
||||
#define EISDIR 21
|
||||
#define EISDIR_STR "Is a directory"
|
||||
#define EINVAL 22
|
||||
#define EINVAL_STR "Invalid argument"
|
||||
#define ENFILE 23
|
||||
#define ENFILE_STR "File table overflow"
|
||||
#define EMFILE 24
|
||||
#define EMFILE_STR "Too many open files"
|
||||
#define ENOTTY 25
|
||||
#define ENOTTY_STR "Not a typewriter"
|
||||
#define ETXTBSY 26
|
||||
#define ETXTBSY_STR "Text file busy"
|
||||
#define EFBIG 27
|
||||
#define EFBIG_STR "File too large"
|
||||
#define ENOSPC 28
|
||||
#define ENOSPC_STR "No space left on device"
|
||||
#define ESPIPE 29
|
||||
#define ESPIPE_STR "Illegal seek"
|
||||
#define EROFS 30
|
||||
#define EROFS_STR "Read-only file system"
|
||||
#define EMLINK 31
|
||||
#define EMLINK_STR "Too many links"
|
||||
#define EPIPE 32
|
||||
#define EPIPE_STR "Broken pipe"
|
||||
#define EDOM 33
|
||||
#define EDOM_STR "Math argument out of domain of func"
|
||||
#define ERANGE 34
|
||||
#define ERANGE_STR "Math result not representable"
|
||||
#define EDEADLK 35
|
||||
#define EDEADLOCK EDEADLK
|
||||
#define EDEADLK_STR "Resource deadlock would occur"
|
||||
#define ENAMETOOLONG 36
|
||||
#define ENAMETOOLONG_STR "File name too long"
|
||||
#define ENOLCK 37
|
||||
#define ENOLCK_STR "No record locks available"
|
||||
#define ENOSYS 38
|
||||
#define ENOSYS_STR "Function not implemented"
|
||||
#define ENOTEMPTY 39
|
||||
#define ENOTEMPTY_STR "Directory not empty"
|
||||
#define ELOOP 40
|
||||
#define ELOOP_STR "Too many symbolic links encountered"
|
||||
#define ENOMSG 42
|
||||
#define ENOMSG_STR "No message of desired type"
|
||||
#define EIDRM 43
|
||||
#define EIDRM_STR "Identifier removed"
|
||||
#define ECHRNG 44
|
||||
#define ECHRNG_STR "Channel number out of range"
|
||||
#define EL2NSYNC 45
|
||||
#define EL2NSYNC_STR "Level 2 not synchronized"
|
||||
#define EL3HLT 46
|
||||
#define EL3HLT_STR "Level 3 halted"
|
||||
#define EL3RST 47
|
||||
#define EL3RST_STR "Level 3 reset"
|
||||
#define ELNRNG 48
|
||||
#define ELNRNG_STR "Link number out of range"
|
||||
#define EUNATCH 49
|
||||
#define EUNATCH_STR "Protocol driver not attached"
|
||||
#define ENOCSI 50
|
||||
#define ENOCSI_STR "No CSI structure available"
|
||||
#define EL2HLT 51
|
||||
#define EL2HLT_STR "Level 2 halted"
|
||||
#define EBADE 52
|
||||
#define EBADE_STR "Invalid exchange"
|
||||
#define EBADR 53
|
||||
#define EBADR_STR "Invalid request descriptor"
|
||||
#define EXFULL 54
|
||||
#define EXFULL_STR "Exchange full"
|
||||
#define ENOANO 55
|
||||
#define ENOANO_STR "No anode"
|
||||
#define EBADRQC 56
|
||||
#define EBADRQC_STR "Invalid request code"
|
||||
#define EBADSLT 57
|
||||
#define EBADSLT_STR "Invalid slot"
|
||||
#define EBFONT 59
|
||||
#define EBFONT_STR "Bad font file format"
|
||||
#define ENOSTR 60
|
||||
#define ENOSTR_STR "Device not a stream"
|
||||
#define ENODATA 61
|
||||
#define ENODATA_STR "No data available"
|
||||
#define ETIME 62
|
||||
#define ETIME_STR "Timer expired"
|
||||
#define ENOSR 63
|
||||
#define ENOSR_STR "Out of streams resources"
|
||||
#define ENONET 64
|
||||
#define ENONET_STR "Machine is not on the network"
|
||||
#define ENOPKG 65
|
||||
#define ENOPKG_STR "Package not installed"
|
||||
#define EREMOTE 66
|
||||
#define EREMOTE_STR "Object is remote"
|
||||
#define ENOLINK 67
|
||||
#define ENOLINK_STR "Link has been severed"
|
||||
#define EADV 68
|
||||
#define EADV_STR "Advertise error"
|
||||
#define ESRMNT 69
|
||||
#define ESRMNT_STR "Srmount error"
|
||||
#define ECOMM 70
|
||||
#define ECOMM_STR "Communication error on send"
|
||||
#define EPROTO 71
|
||||
#define EPROTO_STR "Protocol error"
|
||||
#define EMULTIHOP 72
|
||||
#define EMULTIHOP_STR "Multihop attempted"
|
||||
#define EDOTDOT 73
|
||||
#define EDOTDOT_STR "RFS specific error"
|
||||
#define EBADMSG 74
|
||||
#define EBADMSG_STR "Not a data message"
|
||||
#define EOVERFLOW 75
|
||||
#define EOVERFLOW_STR "Value too large for defined data type"
|
||||
#define ENOTUNIQ 76
|
||||
#define ENOTUNIQ_STR "Name not unique on network"
|
||||
#define EBADFD 77
|
||||
#define EBADFD_STR "File descriptor in bad state"
|
||||
#define EREMCHG 78
|
||||
#define EREMCHG_STR "Remote address changed"
|
||||
#define ELIBACC 79
|
||||
#define ELIBACC_STR "Can not access a needed shared library"
|
||||
#define ELIBBAD 80
|
||||
#define ELIBBAD_STR "Accessing a corrupted shared library"
|
||||
#define ELIBSCN 81
|
||||
#define ELIBSCN_STR ".lib section in a.out corrupted"
|
||||
#define ELIBMAX 82
|
||||
#define ELIBMAX_STR "Attempting to link in too many shared libraries"
|
||||
#define ELIBEXEC 83
|
||||
#define ELIBEXEC_STR "Cannot exec a shared library directly"
|
||||
#define EILSEQ 84
|
||||
#define EILSEQ_STR "Illegal byte sequence"
|
||||
#define ERESTART 85
|
||||
#define ERESTART_STR "Interrupted system call should be restarted"
|
||||
#define ESTRPIPE 86
|
||||
#define ESTRPIPE_STR "Streams pipe error"
|
||||
#define EUSERS 87
|
||||
#define EUSERS_STR "Too many users"
|
||||
#define ENOTSOCK 88
|
||||
#define ENOTSOCK_STR "Socket operation on non-socket"
|
||||
#define EDESTADDRREQ 89
|
||||
#define EDESTADDRREQ_STR "Destination address required"
|
||||
#define EMSGSIZE 90
|
||||
#define EMSGSIZE_STR "Message too long"
|
||||
#define EPROTOTYPE 91
|
||||
#define EPROTOTYPE_STR "Protocol wrong type for socket"
|
||||
#define ENOPROTOOPT 92
|
||||
#define ENOPROTOOPT_STR "Protocol not available"
|
||||
#define EPROTONOSUPPORT 93
|
||||
#define EPROTONOSUPPORT_STR "Protocol not supported"
|
||||
#define ESOCKTNOSUPPORT 94
|
||||
#define ESOCKTNOSUPPORT_STR "Socket type not supported"
|
||||
#define EOPNOTSUPP 95
|
||||
#define EOPNOTSUPP_STR "Operation not supported on transport endpoint"
|
||||
#define EPFNOSUPPORT 96
|
||||
#define EPFNOSUPPORT_STR "Protocol family not supported"
|
||||
#define EAFNOSUPPORT 97
|
||||
#define EAFNOSUPPORT_STR "Address family not supported by protocol"
|
||||
#define EADDRINUSE 98
|
||||
#define EADDRINUSE_STR "Address already in use"
|
||||
#define EADDRNOTAVAIL 99
|
||||
#define EADDRNOTAVAIL_STR "Cannot assign requested address"
|
||||
#define ENETDOWN 100
|
||||
#define ENETDOWN_STR "Network is down"
|
||||
#define ENETUNREACH 101
|
||||
#define ENETUNREACH_STR "Network is unreachable"
|
||||
#define ENETRESET 102
|
||||
#define ENETRESET_STR "Network dropped connection because of reset"
|
||||
#define ECONNABORTED 103
|
||||
#define ECONNABORTED_STR "Software caused connection abort"
|
||||
#define ECONNRESET 104
|
||||
#define ECONNRESET_STR "Connection reset by peer"
|
||||
#define ENOBUFS 105
|
||||
#define ENOBUFS_STR "No buffer space available"
|
||||
#define EISCONN 106
|
||||
#define EISCONN_STR "Transport endpoint is already connected"
|
||||
#define ENOTCONN 107
|
||||
#define ENOTCONN_STR "Transport endpoint is not connected"
|
||||
#define ESHUTDOWN 108
|
||||
#define ESHUTDOWN_STR "Cannot send after transport endpoint shutdown"
|
||||
#define ETOOMANYREFS 109
|
||||
#define ETOOMANYREFS_STR "Too many references: cannot splice"
|
||||
#define ETIMEDOUT 110
|
||||
#define ETIMEDOUT_STR "Connection timed out"
|
||||
#define ECONNREFUSED 111
|
||||
#define ECONNREFUSED_STR "Connection refused"
|
||||
#define EHOSTDOWN 112
|
||||
#define EHOSTDOWN_STR "Host is down"
|
||||
#define EHOSTUNREACH 113
|
||||
#define EHOSTUNREACH_STR "No route to host"
|
||||
#define EALREADY 114
|
||||
#define EALREADY_STR "Operation already in progress"
|
||||
#define EINPROGRESS 115
|
||||
#define EINPROGRESS_STR "Operation now in progress"
|
||||
#define ESTALE 116
|
||||
#define ESTALE_STR "Stale NFS file handle"
|
||||
#define EUCLEAN 117
|
||||
#define EUCLEAN_STR "Structure needs cleaning"
|
||||
#define ENOTNAM 118
|
||||
#define ENOTNAM_STR "Not a XENIX named type file"
|
||||
#define ENAVAIL 119
|
||||
#define ENAVAIL_STR "No XENIX semaphores available"
|
||||
#define EISNAM 120
|
||||
#define EISNAM_STR "Is a named type file"
|
||||
#define EREMOTEIO 121
|
||||
#define EREMOTEIO_STR "Remote I/O error"
|
||||
#define EDQUOT 122
|
||||
#define EDQUOT_STR "Quota exceeded"
|
||||
#define ENOMEDIUM 123
|
||||
#define ENOMEDIUM_STR "No medium found"
|
||||
#define EMEDIUMTYPE 124
|
||||
#define EMEDIUMTYPE_STR "Wrong medium type"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ERRNO_H */
|
@ -1,216 +0,0 @@
|
||||
|
||||
/* @(#)fdlibm.h 1.5 04/04/22 */
|
||||
/*
|
||||
* ====================================================
|
||||
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this
|
||||
* software is freely granted, provided that this notice
|
||||
* is preserved.
|
||||
* ====================================================
|
||||
*/
|
||||
|
||||
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
|
||||
but these catch some common cases. */
|
||||
|
||||
#if defined(i386) || defined(i486) || \
|
||||
defined(intel) || defined(x86) || defined(i86pc) || \
|
||||
defined(__alpha) || defined(__osf__)
|
||||
#define __LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
#define __HI(x) *(1+(int*)&x)
|
||||
#define __LO(x) *(int*)&x
|
||||
#define __HIp(x) *(1+(int*)x)
|
||||
#define __LOp(x) *(int*)x
|
||||
#else
|
||||
#define __HI(x) *(int*)&x
|
||||
#define __LO(x) *(1+(int*)&x)
|
||||
#define __HIp(x) *(int*)x
|
||||
#define __LOp(x) *(1+(int*)x)
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
#define __P(p) p
|
||||
#else
|
||||
#define __P(p) ()
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ANSI/POSIX
|
||||
*/
|
||||
|
||||
extern int signgam;
|
||||
|
||||
#define MAXFLOAT ((float)3.40282346638528860e+38)
|
||||
|
||||
enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
|
||||
|
||||
#define _LIB_VERSION_TYPE enum fdversion
|
||||
#define _LIB_VERSION _fdlib_version
|
||||
|
||||
/* if global variable _LIB_VERSION is not desirable, one may
|
||||
* change the following to be a constant by:
|
||||
* #define _LIB_VERSION_TYPE const enum version
|
||||
* In that case, after one initializes the value _LIB_VERSION (see
|
||||
* s_lib_version.c) during compile time, it cannot be modified
|
||||
* in the middle of a program
|
||||
*/
|
||||
extern _LIB_VERSION_TYPE _LIB_VERSION;
|
||||
|
||||
#define _IEEE_ fdlibm_ieee
|
||||
#define _SVID_ fdlibm_svid
|
||||
#define _XOPEN_ fdlibm_xopen
|
||||
#define _POSIX_ fdlibm_posix
|
||||
|
||||
struct exception {
|
||||
int type;
|
||||
char *name;
|
||||
double arg1;
|
||||
double arg2;
|
||||
double retval;
|
||||
};
|
||||
|
||||
#define HUGE MAXFLOAT
|
||||
|
||||
/*
|
||||
* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
|
||||
* (one may replace the following line by "#include <values.h>")
|
||||
*/
|
||||
|
||||
#define X_TLOSS 1.41484755040568800000e+16
|
||||
|
||||
#define DOMAIN 1
|
||||
#define SING 2
|
||||
#define OVERFLOW 3
|
||||
#define UNDERFLOW 4
|
||||
#define TLOSS 5
|
||||
#define PLOSS 6
|
||||
|
||||
/*
|
||||
* ANSI/POSIX
|
||||
*/
|
||||
extern double acos __P((double));
|
||||
extern double asin __P((double));
|
||||
extern double atan __P((double));
|
||||
extern double atan2 __P((double, double));
|
||||
extern double cos __P((double));
|
||||
extern double sin __P((double));
|
||||
extern double tan __P((double));
|
||||
|
||||
extern double cosh __P((double));
|
||||
extern double sinh __P((double));
|
||||
extern double tanh __P((double));
|
||||
|
||||
extern double exp __P((double));
|
||||
extern double frexp __P((double, int *));
|
||||
extern double ldexp __P((double, int));
|
||||
extern double log __P((double));
|
||||
extern double log10 __P((double));
|
||||
extern double modf __P((double, double *));
|
||||
|
||||
extern double pow __P((double, double));
|
||||
extern double sqrt __P((double));
|
||||
|
||||
extern double ceil __P((double));
|
||||
extern double fabs __P((double));
|
||||
extern double floor __P((double));
|
||||
extern double fmod __P((double, double));
|
||||
|
||||
extern double erf __P((double));
|
||||
extern double erfc __P((double));
|
||||
extern double gamma __P((double));
|
||||
extern double hypot __P((double, double));
|
||||
extern int isnan __P((double));
|
||||
extern int finite __P((double));
|
||||
extern double j0 __P((double));
|
||||
extern double j1 __P((double));
|
||||
extern double jn __P((int, double));
|
||||
extern double lgamma __P((double));
|
||||
extern double y0 __P((double));
|
||||
extern double y1 __P((double));
|
||||
extern double yn __P((int, double));
|
||||
|
||||
extern double acosh __P((double));
|
||||
extern double asinh __P((double));
|
||||
extern double atanh __P((double));
|
||||
extern double cbrt __P((double));
|
||||
extern double logb __P((double));
|
||||
extern double nextafter __P((double, double));
|
||||
extern double remainder __P((double, double));
|
||||
#ifdef _SCALB_INT
|
||||
extern double scalb __P((double, int));
|
||||
#else
|
||||
extern double scalb __P((double, double));
|
||||
#endif
|
||||
|
||||
extern int matherr __P((struct exception *));
|
||||
|
||||
/*
|
||||
* IEEE Test Vector
|
||||
*/
|
||||
extern double significand __P((double));
|
||||
|
||||
/*
|
||||
* Functions callable from C, intended to support IEEE arithmetic.
|
||||
*/
|
||||
extern double copysign __P((double, double));
|
||||
extern int ilogb __P((double));
|
||||
extern double rint __P((double));
|
||||
extern double scalbn __P((double, int));
|
||||
|
||||
/*
|
||||
* BSD math library entry points
|
||||
*/
|
||||
extern double expm1 __P((double));
|
||||
extern double log1p __P((double));
|
||||
|
||||
/*
|
||||
* Reentrant version of gamma & lgamma; passes signgam back by reference
|
||||
* as the second argument; user must allocate space for signgam.
|
||||
*/
|
||||
#ifdef _REENTRANT
|
||||
extern double gamma_r __P((double, int *));
|
||||
extern double lgamma_r __P((double, int *));
|
||||
#endif /* _REENTRANT */
|
||||
|
||||
/* ieee style elementary functions */
|
||||
extern double __ieee754_sqrt __P((double));
|
||||
extern double __ieee754_acos __P((double));
|
||||
extern double __ieee754_acosh __P((double));
|
||||
extern double __ieee754_log __P((double));
|
||||
extern double __ieee754_atanh __P((double));
|
||||
extern double __ieee754_asin __P((double));
|
||||
extern double __ieee754_atan2 __P((double,double));
|
||||
extern double __ieee754_exp __P((double));
|
||||
extern double __ieee754_cosh __P((double));
|
||||
extern double __ieee754_fmod __P((double,double));
|
||||
extern double __ieee754_pow __P((double,double));
|
||||
extern double __ieee754_lgamma_r __P((double,int *));
|
||||
extern double __ieee754_gamma_r __P((double,int *));
|
||||
extern double __ieee754_lgamma __P((double));
|
||||
extern double __ieee754_gamma __P((double));
|
||||
extern double __ieee754_log10 __P((double));
|
||||
extern double __ieee754_sinh __P((double));
|
||||
extern double __ieee754_hypot __P((double,double));
|
||||
extern double __ieee754_j0 __P((double));
|
||||
extern double __ieee754_j1 __P((double));
|
||||
extern double __ieee754_y0 __P((double));
|
||||
extern double __ieee754_y1 __P((double));
|
||||
extern double __ieee754_jn __P((int,double));
|
||||
extern double __ieee754_yn __P((int,double));
|
||||
extern double __ieee754_remainder __P((double,double));
|
||||
extern int __ieee754_rem_pio2 __P((double,double*));
|
||||
#ifdef _SCALB_INT
|
||||
extern double __ieee754_scalb __P((double,int));
|
||||
#else
|
||||
extern double __ieee754_scalb __P((double,double));
|
||||
#endif
|
||||
|
||||
/* fdlibm kernel function */
|
||||
extern double __kernel_standard __P((double,double,int));
|
||||
extern double __kernel_sin __P((double,double,int));
|
||||
extern double __kernel_cos __P((double,double));
|
||||
extern double __kernel_tan __P((double,double,int));
|
||||
extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));
|
@ -1,58 +0,0 @@
|
||||
#ifndef __FLOAT_H
|
||||
#define __FLOAT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
#define FLT_ROUNDS (__builtin_flt_rounds())
|
||||
#define FLT_RADIX __FLT_RADIX__
|
||||
|
||||
#define FLT_MANT_DIG __FLT_MANT_DIG__
|
||||
#define DBL_MANT_DIG __DBL_MANT_DIG__
|
||||
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
|
||||
|
||||
#define DECIMAL_DIG __DECIMAL_DIG__
|
||||
|
||||
#define FLT_DIG __FLT_DIG__
|
||||
#define DBL_DIG __DBL_DIG__
|
||||
#define LDBL_DIG __LDBL_DIG__
|
||||
|
||||
#define FLT_MIN_EXP __FLT_MIN_EXP__
|
||||
#define DBL_MIN_EXP __DBL_MIN_EXP__
|
||||
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
|
||||
|
||||
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
|
||||
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
|
||||
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
|
||||
|
||||
#define FLT_MAX_EXP __FLT_MAX_EXP__
|
||||
#define DBL_MAX_EXP __DBL_MAX_EXP__
|
||||
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
|
||||
|
||||
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
|
||||
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
|
||||
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
|
||||
|
||||
#define FLT_MAX __FLT_MAX__
|
||||
#define DBL_MAX __DBL_MAX__
|
||||
#define LDBL_MAX __LDBL_MAX__
|
||||
|
||||
#define FLT_EPSILON __FLT_EPSILON__
|
||||
#define DBL_EPSILON __DBL_EPSILON__
|
||||
#define LDBL_EPSILON __LDBL_EPSILON__
|
||||
|
||||
#define FLT_MIN __FLT_MIN__
|
||||
#define DBL_MIN __DBL_MIN__
|
||||
#define LDBL_MIN __LDBL_MIN__
|
||||
|
||||
#define FLT_TRUE_MIN __FLT_DENORM_MIN__
|
||||
#define DBL_TRUE_MIN __DBL_DENORM_MIN__
|
||||
#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FLOAT_H */
|
@ -1,11 +0,0 @@
|
||||
#ifndef __HW_ETHMAC_MEM_H
|
||||
#define __HW_ETHMAC_MEM_H
|
||||
|
||||
#include <generated/mem.h>
|
||||
|
||||
#define ETHMAC_RX0_BASE ETHMAC_BASE
|
||||
#define ETHMAC_RX1_BASE (ETHMAC_BASE+0x0800)
|
||||
#define ETHMAC_TX0_BASE (ETHMAC_BASE+0x1000)
|
||||
#define ETHMAC_TX1_BASE (ETHMAC_BASE+0x1800)
|
||||
|
||||
#endif
|
15
include/id.h
15
include/id.h
@ -1,15 +0,0 @@
|
||||
#ifndef __ID_H
|
||||
#define __ID_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define IDENT_SIZE 256
|
||||
void get_ident(char *ident);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ID_H */
|
@ -1,52 +0,0 @@
|
||||
/* Copyright © 2005-2014 Rich Felker, et al.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef __INET_H
|
||||
#define __INET_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static __inline uint16_t __bswap_16(uint16_t __x)
|
||||
{
|
||||
return (__x<<8) | (__x>>8);
|
||||
}
|
||||
|
||||
static __inline uint32_t __bswap_32(uint32_t __x)
|
||||
{
|
||||
return (__x>>24) | ((__x>>8)&0xff00) | ((__x<<8)&0xff0000) | (__x<<24);
|
||||
}
|
||||
|
||||
static __inline uint64_t __bswap_64(uint64_t __x)
|
||||
{
|
||||
return (__bswap_32(__x)+(0ULL<<32)) | __bswap_32(__x>>32);
|
||||
}
|
||||
|
||||
#define bswap_16(x) __bswap_16(x)
|
||||
#define bswap_32(x) __bswap_32(x)
|
||||
#define bswap_64(x) __bswap_64(x)
|
||||
|
||||
uint16_t htons(uint16_t n);
|
||||
uint32_t htonl(uint32_t n);
|
||||
uint16_t ntohs(uint16_t n);
|
||||
uint32_t ntohl(uint32_t n);
|
||||
|
||||
#endif /* __INET_H */
|
@ -1,26 +0,0 @@
|
||||
#ifndef __LIMITS_H
|
||||
#define __LIMITS_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ULONG_MAX 0xffffffff
|
||||
|
||||
#define UINT_MAX 0xffffffff
|
||||
#define INT_MIN 0x80000000
|
||||
#define INT_MAX 0x7fffffff
|
||||
|
||||
#define USHRT_MAX 0xffff
|
||||
#define SHRT_MIN 0x8000
|
||||
#define SHRT_MAX 0x7fff
|
||||
|
||||
#define UCHAR_MAX 0xff
|
||||
|
||||
#define CHAR_BIT 8
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __LIMITS_H */
|
@ -1,14 +0,0 @@
|
||||
#ifndef __MATH_H
|
||||
#define __MATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <fdlibm/fdlibm.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MATH_H */
|
124
include/printf.h
Normal file
124
include/printf.h
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
File: printf.h
|
||||
|
||||
Copyright (c) 2004,2012 Kustaa Nyholm / SpareTimeLabs
|
||||
|
||||
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 Kustaa Nyholm or SpareTimeLabs 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 HOLDER 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
This library is realy just two files: 'printf.h' and 'printf.c'.
|
||||
|
||||
They provide a simple and small (+200 loc) printf functionality to
|
||||
be used in embedded systems.
|
||||
|
||||
I've found them so usefull in debugging that I do not bother with a
|
||||
debugger at all.
|
||||
|
||||
They are distributed in source form, so to use them, just compile them
|
||||
into your project.
|
||||
|
||||
Two printf variants are provided: printf and sprintf.
|
||||
|
||||
The formats supported by this implementation are: 'd' 'u' 'c' 's' 'x' 'X'.
|
||||
|
||||
Zero padding and field width are also supported.
|
||||
|
||||
If the library is compiled with 'PRINTF_SUPPORT_LONG' defined then the
|
||||
long specifier is also
|
||||
supported. Note that this will pull in some long math routines (pun intended!)
|
||||
and thus make your executable noticably longer.
|
||||
|
||||
The memory foot print of course depends on the target cpu, compiler and
|
||||
compiler options, but a rough guestimate (based on a H8S target) is about
|
||||
1.4 kB for code and some twenty 'int's and 'char's, say 60 bytes of stack space.
|
||||
Not too bad. Your milage may vary. By hacking the source code you can
|
||||
get rid of some hunred bytes, I'm sure, but personally I feel the balance of
|
||||
functionality and flexibility versus code size is close to optimal for
|
||||
many embedded systems.
|
||||
|
||||
To use the printf you need to supply your own character output function,
|
||||
something like :
|
||||
|
||||
void putc ( void* p, char c)
|
||||
{
|
||||
while (!SERIAL_PORT_EMPTY) ;
|
||||
SERIAL_PORT_TX_REGISTER = c;
|
||||
}
|
||||
|
||||
Before you can call printf you need to initialize it to use your
|
||||
character output function with something like:
|
||||
|
||||
init_printf(NULL,putc);
|
||||
|
||||
Notice the 'NULL' in 'init_printf' and the parameter 'void* p' in 'putc',
|
||||
the NULL (or any pointer) you pass into the 'init_printf' will eventually be
|
||||
passed to your 'putc' routine. This allows you to pass some storage space (or
|
||||
anything realy) to the character output function, if necessary.
|
||||
This is not often needed but it was implemented like that because it made
|
||||
implementing the sprintf function so neat (look at the source code).
|
||||
|
||||
The code is re-entrant, except for the 'init_printf' function, so it
|
||||
is safe to call it from interupts too, although this may result in mixed output.
|
||||
If you rely on re-entrancy, take care that your 'putc' function is re-entrant!
|
||||
|
||||
The printf and sprintf functions are actually macros that translate to
|
||||
'tfp_printf' and 'tfp_sprintf'. This makes it possible
|
||||
to use them along with 'stdio.h' printf's in a single source file.
|
||||
You just need to undef the names before you include the 'stdio.h'.
|
||||
Note that these are not function like macros, so if you have variables
|
||||
or struct members with these names, things will explode in your face.
|
||||
Without variadic macros this is the best we can do to wrap these
|
||||
fucnction. If it is a problem just give up the macros and use the
|
||||
functions directly or rename them.
|
||||
|
||||
For further details see source code.
|
||||
|
||||
regs Kusti, 23.10.2004
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __TFP_PRINTF__
|
||||
#define __TFP_PRINTF__
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
void init_printf(void* putp,void (*putf) (void*,char));
|
||||
|
||||
void tfp_printf(char *fmt, ...);
|
||||
void tfp_sprintf(char* s,char *fmt, ...);
|
||||
|
||||
void tfp_format(void* putp,void (*putf) (void*,char),char *fmt, va_list va);
|
||||
|
||||
#define printf tfp_printf
|
||||
#define sprintf tfp_sprintf
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,27 +0,0 @@
|
||||
#ifndef __PTHREAD_H
|
||||
#define __PTHREAD_H
|
||||
|
||||
typedef int pthread_rwlock_t;
|
||||
|
||||
#define PTHREAD_RWLOCK_INITIALIZER 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
inline int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
|
||||
{ return 0; }
|
||||
inline int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
|
||||
{ return 0; }
|
||||
inline int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
|
||||
{ return 0; }
|
||||
inline int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
|
||||
{ return 0; }
|
||||
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
|
||||
{ return 0; }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PTHREAD_H */
|
@ -1,25 +0,0 @@
|
||||
#ifndef __STDARG_H
|
||||
#define __STDARG_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define va_start(v, l) __builtin_va_start((v), l)
|
||||
#define va_arg(ap, type) __builtin_va_arg((ap), type)
|
||||
#define va_copy(aq, ap) __builtin_va_copy((aq), (ap))
|
||||
#define va_end(ap) __builtin_va_end(ap)
|
||||
#define va_list __builtin_va_list
|
||||
|
||||
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
||||
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
||||
int vsprintf(char *buf, const char *fmt, va_list args);
|
||||
int vprintf(const char *format, va_list ap);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STDARG_H */
|
@ -1,8 +0,0 @@
|
||||
#ifndef __STDBOOL_H
|
||||
#define __STDBOOL_H
|
||||
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#endif /* __STDBOOL_H */
|
@ -1,23 +0,0 @@
|
||||
#ifndef __STDDEF_H
|
||||
#define __STDDEF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define NULL 0
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
typedef unsigned long size_t;
|
||||
typedef long ptrdiff_t;
|
||||
|
||||
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STDDEF_H */
|
@ -1,34 +0,0 @@
|
||||
#ifndef __STDINT_H
|
||||
#define __STDINT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned char uint8_t;
|
||||
|
||||
typedef long long int64_t;
|
||||
typedef int int32_t;
|
||||
typedef short int16_t;
|
||||
typedef char int8_t;
|
||||
|
||||
#define __int_c_join(a, b) a ## b
|
||||
#define __int_c(v, suffix) __int_c_join(v, suffix)
|
||||
#define __uint_c(v, suffix) __int_c_join(v##U, suffix)
|
||||
|
||||
#define INT64_C(v) __int_c(v, LL)
|
||||
#define UINT64_C(v) __uint_c(v, LL)
|
||||
#define INT32_C(v) v
|
||||
#define UINT32_C(v) v##U
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STDINT_H */
|
@ -1,77 +0,0 @@
|
||||
#ifndef __STDIO_H
|
||||
#define __STDIO_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int putchar(int c);
|
||||
int puts(const char *s);
|
||||
|
||||
int snprintf(char *buf, size_t size, const char *fmt, ...);
|
||||
int scnprintf(char *buf, size_t size, const char *fmt, ...);
|
||||
int sprintf(char *buf, const char *fmt, ...);
|
||||
|
||||
int printf(const char *fmt, ...);
|
||||
|
||||
/* Not sure this belongs here... */
|
||||
typedef long long loff_t;
|
||||
typedef long off_t;
|
||||
typedef int mode_t;
|
||||
typedef int dev_t;
|
||||
|
||||
/*
|
||||
* Note: this library does not provide FILE operations.
|
||||
* User code must implement them.
|
||||
*/
|
||||
|
||||
#ifndef BUFSIZ
|
||||
#define BUFSIZ 1024
|
||||
#endif
|
||||
|
||||
#ifndef EOF
|
||||
#define EOF -1
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_SET
|
||||
#define SEEK_SET 0
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_CUR
|
||||
#define SEEK_CUR 1
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_END
|
||||
#define SEEK_END 2
|
||||
#endif
|
||||
|
||||
typedef int FILE;
|
||||
|
||||
extern FILE *stdin;
|
||||
extern FILE *stdout;
|
||||
extern FILE *stderr;
|
||||
|
||||
int fprintf(FILE *stream, const char *format, ...);
|
||||
int fflush(FILE *stream);
|
||||
|
||||
FILE *fopen(const char *path, const char *mode);
|
||||
FILE *freopen(const char *path, const char *mode, FILE *stream);
|
||||
char *fgets(char *s, int size, FILE *stream);
|
||||
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||
int getc(FILE *stream);
|
||||
int fputc(int c, FILE *stream);
|
||||
int ferror(FILE *stream);
|
||||
int feof(FILE *stream);
|
||||
int fclose(FILE *fp);
|
||||
|
||||
int fseek(FILE *stream, long offset, int whence);
|
||||
long ftell(FILE *stream);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __STDIO_H */
|
@ -1,15 +0,0 @@
|
||||
#ifndef __TIME_H
|
||||
#define __TIME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void time_init(void);
|
||||
int elapsed(int *last_event, int period);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TIME_H */
|
Reference in New Issue
Block a user