1 /* Collection of various routines needed by the GCC when no OS is present
\r
3 Works for the PowerPC 403 series currently
\r
5 Released under the GNU Public License 4/98 with no guarantee or statement
\r
6 for fitness of purpose for any application
\r
9 (battraw@cicddal.com)
\r
14 #include <sys/timeb.h>
\r
15 #include <sys/times.h>
\r
16 #include <sys/time.h>
\r
20 void outbyte(int byte);
\r
24 #define spbase 0x40000000
\r
36 #define SPLS (*(volatile unsigned char*) (spbase+_spls))
\r
37 #define SPHS (*(volatile unsigned char*) (spbase+_sphs))
\r
38 #define SPBRDH (*(volatile unsigned char*) (spbase+_spbrdh))
\r
39 #define SPBRDL (*(volatile unsigned char*) (spbase+_spbrdl))
\r
40 #define SPCTL (*(volatile unsigned char*) (spbase+_spctl))
\r
41 #define SPRC (*(volatile unsigned char*) (spbase+_sprc))
\r
42 #define SPTC (*(volatile unsigned char*) (spbase+_sptc))
\r
43 #define SPRB (*(volatile unsigned char*) (spbase+_sprb))
\r
44 #define SPTB (*(volatile unsigned char*) (spbase+_sptb))
\r
45 #define SPRB (*(volatile unsigned char*) (spbase+_sprb))
\r
71 while((SPLS&128)==0) ;
\r
75 void outbyte(int byte)
\r
77 while((SPLS&4)!=4) ;
\r
81 void byteout(unsigned char val, unsigned long addr)
\r
85 int bytein(unsigned long addr)
\r
91 /* returns -1 if character waiting, 0 if not */
\r
94 if((SPLS&128)==0) return(0);
\r
99 int __srget(FILE *stream)
\r
104 int rget(FILE *stream)
\r
110 int link(const char *oldpath, const char *newpath) { return(-1); }
\r
114 static int _errorno_;
\r
115 return(&_errorno_);
\r
119 void prs(char *str)
\r
122 for(i=0; i<99999; i++)
\r
124 if(str[i]==0) break;
\r
126 if(str[i]=='\n') outbyte('\r');
\r
127 if(str[i]=='\r') outbyte('\n');
\r
134 prs("<abort>-- exit to OS\n");
\r
143 void _exit(int _status )
\r
145 prs("<normal exit>-- returning to OS\n");
\r
152 int gettimeofday(struct timeval *tv, struct timezone *tz)
\r
156 clock_t times(struct tms *buf)
\r
160 int ftime(struct timeb *tp)
\r