#include <tamtypes.h>
#include <stddef.h>
Go to the source code of this file.
|
|
void | sio_init (u32 baudrate, u8 lcr_ueps, u8 lcr_upen, u8 lcr_usbl, u8 lcr_umode) |
| |
|
int | sio_putc (int c) |
| |
|
int | sio_getc (void) |
| |
| int | sio_getc_block (void) |
| |
| size_t | sio_write (void *buf, size_t size) |
| |
| size_t | sio_read (void *buf, size_t size) |
| |
|
int | sio_puts (const char *str) |
| |
|
int | sio_putsn (const char *str) |
| |
| char * | sio_gets (char *str) |
| |
| void | sio_flush (void) |
| |
EE Serial I/O
Definition in file sio.h.
◆ SIO_LCR
| #define SIO_LCR 0x1000f100 |
Line Control Register.
Definition at line 29 of file sio.h.
◆ SIO_LCR_UMODE_8BIT
| #define SIO_LCR_UMODE_8BIT 0x00 |
UART Mode.
Definition at line 31 of file sio.h.
◆ SIO_LCR_USBL_1BIT
| #define SIO_LCR_USBL_1BIT 0x00 |
UART Stop Bit Length.
Definition at line 34 of file sio.h.
◆ SIO_LCR_UPEN_OFF
| #define SIO_LCR_UPEN_OFF 0x00 |
UART Parity Enable.
Definition at line 37 of file sio.h.
◆ SIO_LCR_UEPS_ODD
| #define SIO_LCR_UEPS_ODD 0x00 |
UART Even Parity Select.
Definition at line 40 of file sio.h.
◆ SIO_LSR
| #define SIO_LSR 0x1000f110 |
Line Status Register.
Definition at line 44 of file sio.h.
◆ SIO_LSR_DR
Data Ready. (Not tested)
Definition at line 46 of file sio.h.
◆ SIO_LSR_OE
Overrun Error.
Definition at line 48 of file sio.h.
◆ SIO_LSR_PE
Parity Error.
Definition at line 50 of file sio.h.
◆ SIO_LSR_FE
Framing Error.
Definition at line 52 of file sio.h.
◆ SIO_IER
| #define SIO_IER 0x1000f120 |
Interrupt Enable Register.
Definition at line 55 of file sio.h.
◆ SIO_IER_ERDAI
| #define SIO_IER_ERDAI 0x01 |
Enable Received Data Available Interrupt
Definition at line 57 of file sio.h.
◆ SIO_IER_ELSI
| #define SIO_IER_ELSI 0x04 |
Enable Line Status Interrupt.
Definition at line 59 of file sio.h.
◆ SIO_ISR
| #define SIO_ISR 0x1000f130 |
Interrupt Status Register (?).
Definition at line 62 of file sio.h.
◆ SIO_FCR
| #define SIO_FCR 0x1000f140 |
FIFO Control Register.
Definition at line 68 of file sio.h.
◆ SIO_FCR_FRSTE
| #define SIO_FCR_FRSTE 0x01 |
FIFO Reset Enable.
Definition at line 70 of file sio.h.
◆ SIO_FCR_RFRST
| #define SIO_FCR_RFRST 0x02 |
RX FIFO Reset.
Definition at line 72 of file sio.h.
◆ SIO_FCR_TFRST
| #define SIO_FCR_TFRST 0x04 |
TX FIFO Reset.
Definition at line 74 of file sio.h.
◆ SIO_BGR
| #define SIO_BGR 0x1000f150 |
Baud Rate Control Register.
Definition at line 77 of file sio.h.
◆ SIO_TXFIFO
| #define SIO_TXFIFO 0x1000f180 |
Transmit FIFO.
Definition at line 80 of file sio.h.
◆ SIO_RXFIFO
| #define SIO_RXFIFO 0x1000f1c0 |
Receive FIFO.
Definition at line 82 of file sio.h.
◆ SIO_CAUSE_BIT
| #define SIO_CAUSE_BIT (1 << 12) |
The bit in the EE cause register which indicates an SIO exception
Definition at line 85 of file sio.h.
◆ sio_getc_block()
| int sio_getc_block |
( |
void |
| ) |
|
Same as sio_getc, but blocking. Note that getc should be blocking by default. Ho well.
Definition at line 52 of file sior.c.
◆ sio_write()
| size_t sio_write |
( |
void * |
buf, |
|
|
size_t |
size |
|
) |
| |
Not really much to do in the way of error-handling. sio_putc() already checks to see if there's room in the TX FIFO, and my cable doesn't support hardware flow control.
◆ sio_read()
| size_t sio_read |
( |
void * |
buf, |
|
|
size_t |
size |
|
) |
| |
This will read from the serial port until size characters have been read or EOF (RX FIFO is empty).
◆ sio_gets()
| char* sio_gets |
( |
char * |
str | ) |
|
Will block until it recieves
or \r.
Definition at line 83 of file sior.c.
◆ sio_flush()
Flushes the input buffer.
Definition at line 89 of file sior.c.