sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
sio.h
Go to the documentation of this file.
1
/*
2
# _____ ___ ____ ___ ____
3
# ____| | ____| | | |____|
4
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5
#-----------------------------------------------------------------------
6
# (c) 2003 Marcus R. Brown <mrbrown@0xd6.org>
7
# Licenced under Academic Free License version 2.0
8
# Review ps2sdk README & LICENSE files for further details.
9
*/
10
16
17
#ifndef __SIO_H__
18
#define __SIO_H__
19
20
#include <
tamtypes.h
>
21
#include <stddef.h>
22
23
/* SIO Registers. */
24
/* Most of these are based off of Toshiba documentation for the TX49 and the
25
TX79 companion chip. However, looking at the kernel SIOP (Debug) exception
26
handler, it looks like some registers are borrowed from the TX7901 UART
27
(0x1000f110 or LSR, in particular). I'm still trying to find the correct
28
register names and values. */
30
#define SIO_LCR 0x1000f100
32
#define SIO_LCR_UMODE_8BIT 0x00
33
#define SIO_LCR_UMODE_7BIT 0x01
35
#define SIO_LCR_USBL_1BIT 0x00
36
#define SIO_LCR_USBL_2BITS 0x01
38
#define SIO_LCR_UPEN_OFF 0x00
39
#define SIO_LCR_UPEN_ON 0x01
41
#define SIO_LCR_UEPS_ODD 0x00
42
#define SIO_LCR_UEPS_EVEN 0x01
43
45
#define SIO_LSR 0x1000f110
47
#define SIO_LSR_DR 0x01
49
#define SIO_LSR_OE 0x02
51
#define SIO_LSR_PE 0x04
53
#define SIO_LSR_FE 0x08
54
56
#define SIO_IER 0x1000f120
58
#define SIO_IER_ERDAI 0x01
60
#define SIO_IER_ELSI 0x04
61
63
#define SIO_ISR 0x1000f130
64
#define SIO_ISR_RX_DATA 0x01
65
#define SIO_ISR_TX_EMPTY 0x02
66
#define SIO_ISR_RX_ERROR 0x04
67
69
#define SIO_FCR 0x1000f140
71
#define SIO_FCR_FRSTE 0x01
73
#define SIO_FCR_RFRST 0x02
75
#define SIO_FCR_TFRST 0x04
76
78
#define SIO_BGR 0x1000f150
79
81
#define SIO_TXFIFO 0x1000f180
83
#define SIO_RXFIFO 0x1000f1c0
84
86
#define SIO_CAUSE_BIT (1 << 12)
87
88
#ifdef __cplusplus
89
extern
"C"
{
90
#endif
91
92
/* Initialize the SIO.
93
* The lcr_* parameters are passed as is, so you'll need to use the SIO_LCR_* register values.
94
* You can pass 0 for all of the lcr_* params to get the standard 8N1 setting (8 data bits, no parity checking, 1 stop bit).
95
* Note: Unlike the BIOS sio_init() routine, we always base the baud rate on the CPU clock.
96
*/
97
extern
void
sio_init(u32 baudrate, u8 lcr_ueps, u8 lcr_upen, u8 lcr_usbl, u8 lcr_umode);
98
99
extern
int
sio_putc(
int
c);
100
extern
int
sio_getc(
void
);
104
extern
int
sio_getc_block
(
void
);
105
110
extern
size_t
sio_write
(
void
*buf,
size_t
size);
112
extern
size_t
sio_read
(
void
*buf,
size_t
size);
113
114
extern
int
sio_puts(
const
char
*str);
115
extern
int
sio_putsn(
const
char
*str);
// no newline for this one
117
extern
char
*
sio_gets
(
char
*str);
118
120
extern
void
sio_flush
(
void
);
121
122
#ifdef __cplusplus
123
}
124
#endif
125
126
#endif
/* __SIO_H__ */
sio_flush
void sio_flush(void)
Definition
sio.c:167
sio_getc_block
int sio_getc_block(void)
Definition
sio.c:91
sio_read
size_t sio_read(void *buf, size_t size)
Definition
sio.c:110
sio_gets
char * sio_gets(char *str)
Definition
sio.c:148
sio_write
size_t sio_write(void *buf, size_t size)
Definition
sio.c:99
tamtypes.h
core
kernel
include
sio.h
Generated by
1.18.0