mirror of
https://github.com/polyfractal/rustl8710.git
synced 2026-07-06 03:15:40 +00:00
Initial checkin
This commit is contained in:
parent
d4f581cea3
commit
34016a7bd3
1285 changed files with 536346 additions and 0 deletions
46
component/soc/realtek/8195a/misc/driver/low_level_io.c
Normal file
46
component/soc/realtek/8195a/misc/driver/low_level_io.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#include <stdio.h>
|
||||
#include "hal_api.h"
|
||||
|
||||
#if !defined (__ICCARM__)
|
||||
extern u8 RAM_IMG1_VALID_PATTEN[];
|
||||
void *tmp = RAM_IMG1_VALID_PATTEN;
|
||||
#endif
|
||||
|
||||
#if defined ( __ICCARM__ )
|
||||
size_t __write(int Handle, const unsigned char * Buf, size_t Bufsize)
|
||||
{
|
||||
int nChars = 0;
|
||||
/* Check for stdout and stderr
|
||||
(only necessary if file descriptors are enabled.) */
|
||||
if (Handle != 1 && Handle != 2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
for (/*Empty */; Bufsize > 0; --Bufsize)
|
||||
{
|
||||
DiagPutChar(*Buf++);
|
||||
++nChars;
|
||||
}
|
||||
return nChars;
|
||||
}
|
||||
|
||||
size_t __read(int Handle, unsigned char * Buf, size_t Bufsize)
|
||||
{
|
||||
int nChars = 0;
|
||||
/* Check for stdin
|
||||
(only necessary if FILE descriptors are enabled) */
|
||||
if (Handle != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
for (/*Empty*/; Bufsize > 0; --Bufsize)
|
||||
{
|
||||
int c = DiagGetChar(_FALSE);
|
||||
if (c < 0)
|
||||
break;
|
||||
*(Buf++) = c;
|
||||
++nChars;
|
||||
}
|
||||
return nChars;
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue