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 && (SPLS&0x78)==0)
\r
73 if((SPLS&0x78)!=0) SPLS=0x78;
\r
74 if((SPHS&0xc0)!=0) SPHS=0xc0;
\r
80 void outbyte(int byte)
\r
82 while((SPLS&4)!=4) ;
\r
86 void byteout(unsigned char val, unsigned long addr)
\r
90 int bytein(unsigned long addr)
\r
96 /* returns -1 if character waiting, 0 if not */
\r
99 if((SPLS&128)==0) return(0);
\r
104 int __srget(FILE *stream)
\r
109 int rget(FILE *stream)
\r
115 int link(const char *oldpath, const char *newpath) { return(-1); }
\r
119 static int _errorno_;
\r
120 return(&_errorno_);
\r
124 void prs(char *str)
\r
127 for(i=0; i<99999; i++)
\r
129 if(str[i]==0) break;
\r
131 if(str[i]=='\n') outbyte('\r');
\r
132 if(str[i]=='\r') outbyte('\n');
\r
139 prs("<abort>-- exit to OS\n");
\r
148 void _exit(int _status )
\r
150 prs("<normal exit>-- returning to OS\n");
\r
157 int gettimeofday(struct timeval *tv, struct timezone *tz)
\r
161 clock_t times(struct tms *buf)
\r
165 int ftime(struct timeb *tp)
\r