Definition in file read.c.
#include <yfuns.h>
#include <avr32/io.h>
#include "usart.h"
Go to the source code of this file.
Functions | |
size_t | __read (int handle, unsigned char *buffer, size_t size) |
Reads a number of bytes, at most size, into the memory area pointed to by buffer. | |
Variables | |
_STD_BEGIN volatile avr32_usart_t *volatile | stdio_usart_base |
Pointer to the base of the USART module instance to use for stdio. |
size_t __read | ( | int | handle, | |
unsigned char * | buffer, | |||
size_t | size | |||
) |
Reads a number of bytes, at most size, into the memory area pointed to by buffer.
handle | File handle to read from. | |
buffer | Pointer to buffer to write read bytes to. | |
size | Number of bytes to read. |
0
at the end of the file, or _LLIO_ERROR
on failure. Definition at line 71 of file read.c.
References stdio_usart_base.
00072 { 00073 int nChars = 0; 00074 00075 // This implementation only reads from stdin. 00076 // For all other file handles, it returns failure. 00077 if (handle != _LLIO_STDIN) 00078 { 00079 return _LLIO_ERROR; 00080 } 00081 00082 for (; size > 0; --size) 00083 { 00084 int c = usart_getchar(stdio_usart_base); 00085 if (c < 0) 00086 break; 00087 00088 *buffer++ = c; 00089 ++nChars; 00090 } 00091 00092 return nChars; 00093 }
_STD_BEGIN volatile avr32_usart_t* volatile stdio_usart_base |
Pointer to the base of the USART module instance to use for stdio.
Definition at line 59 of file write.c.
Referenced by __low_level_init(), __read(), and __write().