PS2SDK
PS2 Homebrew Libraries
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
#ifndef __SIO_H__
17
#define __SIO_H__
18
19
#include <
tamtypes.h
>
20
#include <stddef.h>
21
22
/* SIO Registers. */
23
/* Most of these are based off of Toshiba documentation for the TX49 and the
24
TX79 companion chip. However, looking at the kernel SIOP (Debug) exception
25
handler, it looks like some registers are borrowed from the TX7901 UART
26
(0x1000f110 or LSR, in particular). I'm still trying to find the correct
27
register names and values. */
29
#define SIO_LCR 0x1000f100
31
#define SIO_LCR_UMODE_8BIT 0x00
32
#define SIO_LCR_UMODE_7BIT 0x01
34
#define SIO_LCR_USBL_1BIT 0x00
35
#define SIO_LCR_USBL_2BITS 0x01
37
#define SIO_LCR_UPEN_OFF 0x00
38
#define SIO_LCR_UPEN_ON 0x01
40
#define SIO_LCR_UEPS_ODD 0x00
41
#define SIO_LCR_UEPS_EVEN 0x01
42
44
#define SIO_LSR 0x1000f110
46
#define SIO_LSR_DR 0x01
48
#define SIO_LSR_OE 0x02
50
#define SIO_LSR_PE 0x04
52
#define SIO_LSR_FE 0x08
53
55
#define SIO_IER 0x1000f120
57
#define SIO_IER_ERDAI 0x01
59
#define SIO_IER_ELSI 0x04
60
62
#define SIO_ISR 0x1000f130
63
#define SIO_ISR_RX_DATA 0x01
64
#define SIO_ISR_TX_EMPTY 0x02
65
#define SIO_ISR_RX_ERROR 0x04
66
68
#define SIO_FCR 0x1000f140
70
#define SIO_FCR_FRSTE 0x01
72
#define SIO_FCR_RFRST 0x02
74
#define SIO_FCR_TFRST 0x04
75
77
#define SIO_BGR 0x1000f150
78
80
#define SIO_TXFIFO 0x1000f180
82
#define SIO_RXFIFO 0x1000f1c0
83
85
#define SIO_CAUSE_BIT (1 << 12)
86
87
#ifdef __cplusplus
88
extern
"C"
{
89
#endif
90
91
/* Initialize the SIO.
92
* The lcr_* parameters are passed as is, so you'll need to use the SIO_LCR_* register values.
93
* 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).
94
* Note: Unlike the BIOS sio_init() routine, we always base the baud rate on the CPU clock.
95
*/
96
void
sio_init(u32 baudrate, u8 lcr_ueps, u8 lcr_upen, u8 lcr_usbl, u8 lcr_umode);
97
98
int
sio_putc(
int
c);
99
int
sio_getc(
void
);
103
int
sio_getc_block
(
void
);
104
109
size_t
sio_write
(
void
*buf,
size_t
size);
111
size_t
sio_read
(
void
*buf,
size_t
size);
112
113
int
sio_puts(
const
char
*str);
114
int
sio_putsn(
const
char
*str);
// no newline for this one
116
char
*
sio_gets
(
char
*str);
117
119
void
sio_flush
(
void
);
120
121
#ifdef __cplusplus
122
}
123
#endif
124
125
#endif
/* __SIO_H__ */
sio_flush
void sio_flush(void)
Definition
sior.c:89
sio_getc_block
int sio_getc_block(void)
Definition
sior.c:52
sio_read
size_t sio_read(void *buf, size_t size)
sio_gets
char * sio_gets(char *str)
Definition
sior.c:83
sio_write
size_t sio_write(void *buf, size_t size)
tamtypes.h
ee
kernel
include
sio.h
Generated on Thu Nov 14 2024 05:25:24 for PS2SDK by
1.9.8