This module provide low-level stubs for retargetting stdio for all supported toolchains. More...
![]() |
Defines | |
#define | RXBUFSIZE 8 |
Buffer size for RX. | |
Functions | |
int | RETARGET_ReadChar (void) |
Receive a byte from USART/LEUART and put into global buffer. | |
int | RETARGET_WriteChar (char c) |
Transmit single byte to USART/LEUART. | |
int | _close (int file) |
Close a file. | |
int | _fstat (int file, struct stat *st) |
Status of an open file. | |
int | _isatty (int file) |
Query whether output stream is a terminal. | |
int | _lseek (int file, int ptr, int dir) |
Set position in a file. | |
int | _read (int file, char *ptr, int len) |
Read from a file. | |
caddr_t | _sbrk (int incr) |
Increase heap. | |
int | _write (int file, const char *ptr, int len) |
Write to a file. | |
void | _exit (int status) |
Exit the program. | |
int | _getpid (void) |
Get process ID. | |
int | _kill (int pid, int sig) |
Send signal to process. | |
void | RETARGET_IRQ_NAME (void) |
UART/LEUART IRQ Handler. | |
void | RETARGET_SerialCrLf (int on) |
UART/LEUART toggle LF to CRLF conversion. | |
void | RETARGET_SerialInit (void) |
Intializes UART/LEUART. | |
void | RETARGET_TFTTX (int c) |
Transmit/display a character. | |
void | RETARGET_TFTUpdate (bool fullFrame) |
Display framebuffer. | |
Variables | |
char | _end |
Defined by the linker. | |
static volatile int | rxReadIndex = 0 |
Index in buffer to be read. | |
static volatile int | rxWriteIndex = 0 |
Index in buffer to be written to. | |
static volatile int | rxCount = 0 |
Keeps track of how much data which are stored in the buffer. | |
static volatile uint8_t | rxBuffer [RXBUFSIZE] |
Buffer to store data. | |
static uint8_t | LFtoCRLF = 0 |
LF to CRLF conversion disabled. | |
static bool | initialized = false |
Initialize UART/LEUART. |
This module provide low-level stubs for retargetting stdio for all supported toolchains.
The stubs are minimal yet sufficient implementations. Refer to chapter 12 in the reference manual for newlib 1.17.0 for details on implementing newlib stubs.
#define RXBUFSIZE 8 |
Buffer size for RX.
Definition at line 56 of file retargetserial.c.
Referenced by RETARGET_IRQ_NAME(), and RETARGET_ReadChar().
int _close | ( | int | file | ) |
Close a file.
[in] | file | File you want to close. |
Definition at line 80 of file retargetio.c.
void _exit | ( | int | status | ) |
Exit the program.
[in] | status | The value to return to the parent process as the exit status (not used). |
Definition at line 91 of file retargetio.c.
int _fstat | ( | int | file, | |
struct stat * | st | |||
) |
Status of an open file.
[in] | file | Check status for this file. |
[in] | st | Status information. |
Definition at line 110 of file retargetio.c.
int _getpid | ( | void | ) |
Get process ID.
Definition at line 120 of file retargetio.c.
int _isatty | ( | int | file | ) |
Query whether output stream is a terminal.
[in] | file | Descriptor for the file. |
Definition at line 135 of file retargetio.c.
int _kill | ( | int | pid, | |
int | sig | |||
) |
Send signal to process.
[in] | pid | Process id (not used). |
[in] | sig | Signal to send (not used). |
Definition at line 146 of file retargetio.c.
int _lseek | ( | int | file, | |
int | ptr, | |||
int | dir | |||
) |
Set position in a file.
[in] | file | Descriptor for the file. |
[in] | ptr | Poiter to the argument offset. |
[in] | dir | Directory whence. |
Definition at line 169 of file retargetio.c.
int _read | ( | int | file, | |
char * | ptr, | |||
int | len | |||
) |
Read from a file.
[in] | file | Descriptor for the file you want to read from. |
[in] | ptr | Pointer to the chacaters that are beeing read. |
[in] | len | Number of characters to be read. |
Definition at line 193 of file retargetio.c.
References RETARGET_ReadChar(), and rxCount.
caddr_t _sbrk | ( | int | incr | ) |
Increase heap.
[in] | incr | Number of bytes you want increment the program's data space. |
Definition at line 230 of file retargetio.c.
References _end, and _write().
int _write | ( | int | file, | |
const char * | ptr, | |||
int | len | |||
) |
Write to a file.
[in] | file | Descriptor for the file you want to write to. |
[in] | ptr | Pointer to the text you want to write |
[in] | len | Number of characters to be written. |
Definition at line 268 of file retargetio.c.
References RETARGET_WriteChar().
Referenced by _sbrk().
void RETARGET_IRQ_NAME | ( | void | ) |
UART/LEUART IRQ Handler.
Definition at line 67 of file retargetserial.c.
References rxBuffer, RXBUFSIZE, rxCount, rxReadIndex, and rxWriteIndex.
int RETARGET_ReadChar | ( | void | ) |
Receive a byte from USART/LEUART and put into global buffer.
Receive a byte from USART/LEUART and put into global buffer.
Definition at line 198 of file retargetserial.c.
References initialized, RETARGET_SerialInit(), rxBuffer, RXBUFSIZE, rxCount, and rxReadIndex.
Referenced by _read().
void RETARGET_SerialCrLf | ( | int | on | ) |
UART/LEUART toggle LF to CRLF conversion.
on | If non-zero, automatic LF to CRLF conversion will be enabled |
Definition at line 101 of file retargetserial.c.
References LFtoCRLF.
void RETARGET_SerialInit | ( | void | ) |
Intializes UART/LEUART.
Definition at line 113 of file retargetserial.c.
References BC_SSD2119_BASE, BSP_Display_EBI, BSP_Display_Mode8080, BSP_Display_PowerDisable, BSP_Display_PowerEnable, BSP_Display_ResetAssert, BSP_Display_ResetRelease, BSP_DisplayControl(), bufferReset, charBuffer, CHARS, initialized, LINES, rgbColor, tftReset, xpos, and ypos.
Referenced by RETARGET_ReadChar(), and RETARGET_WriteChar().
void RETARGET_TFTTX | ( | int | c | ) |
Transmit/display a character.
[in] | c | ASCII character to output |
Definition at line 168 of file retargettft.c.
References charBuffer, CHARS, LINES, rgbColor, scrollUp(), xpos, and ypos.
Referenced by RETARGET_WriteChar().
void RETARGET_TFTUpdate | ( | bool | fullFrame | ) |
Display framebuffer.
[in] | fullFrame | If true, draw entire screen, if false, draw incremental update (faster) |
Definition at line 230 of file retargettft.c.
References charBuffer, CHARS, LINES, rgbColor, xpos, and ypos.
Referenced by RETARGET_WriteChar().
int RETARGET_WriteChar | ( | char | c | ) |
Transmit single byte to USART/LEUART.
c | Character to transmit |
Transmit single byte to USART/LEUART.
c | Character to transmit |
Definition at line 228 of file retargetserial.c.
References BC_ARB_CTRL_EBI, BC_REGISTER, BC_UIF_AEM_EFM, BSP_RegisterRead(), bufferReset, fullUpdate, initialized, LFtoCRLF, RETARGET_SerialInit(), RETARGET_TFTTX(), RETARGET_TFTUpdate(), and tftReset.
Referenced by _write().
bool initialized = false [static] |
Initialize UART/LEUART.
Definition at line 62 of file retargetserial.c.
Referenced by RETARGET_ReadChar(), RETARGET_SerialInit(), and RETARGET_WriteChar().
uint8_t LFtoCRLF = 0 [static] |
LF to CRLF conversion disabled.
Definition at line 61 of file retargetserial.c.
Referenced by RETARGET_SerialCrLf(), and RETARGET_WriteChar().
volatile uint8_t rxBuffer[RXBUFSIZE] [static] |
Buffer to store data.
Definition at line 60 of file retargetserial.c.
Referenced by ETHSPI_ReadFifoContinue(), ETHSPI_ReadRegister(), RETARGET_IRQ_NAME(), and RETARGET_ReadChar().
volatile int rxCount = 0 [static] |
Keeps track of how much data which are stored in the buffer.
Definition at line 59 of file retargetserial.c.
Referenced by _read(), RETARGET_IRQ_NAME(), and RETARGET_ReadChar().
volatile int rxReadIndex = 0 [static] |
Index in buffer to be read.
Definition at line 57 of file retargetserial.c.
Referenced by RETARGET_IRQ_NAME(), and RETARGET_ReadChar().
volatile int rxWriteIndex = 0 [static] |
Index in buffer to be written to.
Definition at line 58 of file retargetserial.c.
Referenced by RETARGET_IRQ_NAME().