PSXSDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Enumerations | Functions
psxsio.h File Reference

Go to the source code of this file.

Macros

#define SIO_TX_RX   *((volatile unsigned char*)0x1F801050)
 SIO FIFO Buffer (TX/RX) Register [Read/Write].
 
#define SIO_STAT   *((volatile unsigned short*)0x1F801054)
 SIO Status Register [Read Only].
 
#define SIO_MODE   *((volatile unsigned short*)0x1F801058)
 SIO Mode Register [Read/Write].
 
#define SIO_CTRL   *((volatile unsigned short*)0x1F80105A)
 SIO Control Register [Read/Write].
 
#define SIO_BPSV   *((volatile unsigned short*)0x1F80105E)
 SIO Baud Rate Register [Read/Write].
 

Enumerations

enum  sio_reload_factors { SIO_REL_STOP = 0, SIO_REL_MUL1 = 1, SIO_REL_MUL16 = 2, SIO_REL_MUL64 = 3 }
 Bitrate reload factors. More...
 
enum  sio_data_len { SIO_DATA_LEN_5 = 0, SIO_DATA_LEN_6 = 1, SIO_DATA_LEN_7 = 2, SIO_DATA_LEN_8 = 3 }
 Character (data) length settings. More...
 
enum  sio_stop_bit { SIO_STOP_BIT_1 = 1, SIO_STOP_BIT_1_5 = 2, SIO_STOP_BIT_2 = 3 }
 Stop bit length settings. More...
 
enum  sio_parity { SIO_PARITY_NONE = 0, SIO_PARITY_ODD = 1, SIO_PARITY_EVEN = 3 }
 Parity settings. More...
 

Functions

void SIOStart (int bitrate)
 Initialize SIO communication at the specified bitrate (baud rate).
 
void SIOStartEx (int bitrate, int datalength, int parity, int stopbit)
 Same as SIOStart() but with more control.
 
void SIOStop (void)
 Shuts down SIO communication.
 
unsigned char SIOReadByte (void)
 Read a single byte from the input buffer.
 
void SIOSendByte (unsigned char data)
 Send a single byte to the output buffer.
 
int SIOCheckInBuffer (void)
 Check if any data is waiting in the input buffer.
 
int SIOCheckOutBuffer (void)
 Check if port is ready to send data (previous operation finished).
 

Macro Definition Documentation

#define SIO_BPSV   *((volatile unsigned short*)0x1F80105E)

SIO Baud Rate Register [Read/Write].

#define SIO_CTRL   *((volatile unsigned short*)0x1F80105A)

SIO Control Register [Read/Write].

#define SIO_MODE   *((volatile unsigned short*)0x1F801058)

SIO Mode Register [Read/Write].

#define SIO_STAT   *((volatile unsigned short*)0x1F801054)

SIO Status Register [Read Only].

#define SIO_TX_RX   *((volatile unsigned char*)0x1F801050)

SIO FIFO Buffer (TX/RX) Register [Read/Write].

Enumeration Type Documentation

Character (data) length settings.

Enumerator:
SIO_DATA_LEN_5 

Data Length = 5 bits.

SIO_DATA_LEN_6 

Data Length = 6 bits.

SIO_DATA_LEN_7 

Data Length = 7 bits.

SIO_DATA_LEN_8 

Data Length = 8 bits.

enum sio_parity

Parity settings.

Enumerator:
SIO_PARITY_NONE 

No parity.

SIO_PARITY_ODD 

Odd parity.

SIO_PARITY_EVEN 

Even parity.

Bitrate reload factors.

Enumerator:
SIO_REL_STOP 

STOP.

SIO_REL_MUL1 

MUL1.

SIO_REL_MUL16 

MUL16.

SIO_REL_MUL64 

MUL64.

Stop bit length settings.

Enumerator:
SIO_STOP_BIT_1 

Length = 1 bit.

SIO_STOP_BIT_1_5 

Length = 1.5 bits.

SIO_STOP_BIT_2 

Length = 2 bits.

Function Documentation

int SIOCheckInBuffer ( void  )

Check if any data is waiting in the input buffer.

Must be used when fetching data otherwise incorrect data could be read (usually 0x00).

Returns
Non-zero if there is data waiting in the input buffer, zero otherwise.
int SIOCheckOutBuffer ( void  )

Check if port is ready to send data (previous operation finished).

Must be used when sending data as the output buffer is only 2 bytes long.

Returns
Non-zero if port is ready to send data, zero otherwise.
unsigned char SIOReadByte ( void  )

Read a single byte from the input buffer.

Returns
Data byte from input buffer
void SIOSendByte ( unsigned char  data)

Send a single byte to the output buffer.

Parameters
dataByte to send
void SIOStart ( int  bitrate)

Initialize SIO communication at the specified bitrate (baud rate).

Mode is 8N1. (Data Length = 8 bit, No parity, Stop bit Length = 1 bit)

Parameters
bitrateBitrate (baud rate)
void SIOStartEx ( int  bitrate,
int  datalength,
int  parity,
int  stopbit 
)

Same as SIOStart() but with more control.

IMPORTANT: Must use defined macros. For example setting datalength to 5 should be done with "SIO_DATA_LEN_5" and not by simply passing 5 as an argument.

Parameters
bitrateBit rate (baud rate)
datalengthCharacter (data) length
parityParity
stopbitStop bit length
void SIOStop ( void  )

Shuts down SIO communication.