PSXSDK
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
sio.c File Reference
#include <psx.h>
#include <psxsio.h>
#include <stdio.h>

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 ()
 Shuts down SIO communication.
 
unsigned char SIOReadByte ()
 Read a single byte from the input buffer.
 
void SIOSendByte (unsigned char data)
 Send a single byte to the output buffer.
 
int SIOCheckInBuffer ()
 Check if any data is waiting in the input buffer.
 
int SIOCheckOutBuffer ()
 Check if port is ready to send data (previous operation finished).
 

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.