I don't claim to be an expert, but I've had a lot of experience with the SIO board over the last several days.
apache37 wrote:Can someone provide a small code snippet on how to test?
Sure, see the code and makefile below. My thanks to "tyranid" for sending the original code to me ;)
The makefile needs makefiles from PS2LIB (and hence the PS2LIB environment string needs to be defined)--I'm assuming you have PS2DEV setup on your system, right?
Haven't tried "ps2siotest.elf" with InLink, only with ps2client, but I suspect that it will work.
apache37 wrote:I've used sio_getc() and seems to return just the same funky "y" character all the time.
A consistent "y" character sounds bad, but at least it is consistently bad. :-{
apache37 wrote:I'm sure I'm just stupid.
Quote:
Ignorance is curable, stupidity that's for life -- author unknown
(in case you're wondering this means you ain't stupid! ;) )
File:
main.c
Code: Select all
#include <tamtypes.h>
#include <kernel.h>
#include <sifrpc.h>
#include <iopheap.h>
#include <loadfile.h>
#include <iopcontrol.h>
#include <fileio.h>
#include <compat.h>
#include <sio.h>
// Macros
#define DEBUG
#ifdef DEBUG
#define dbgprintf(args...) printf(args)
#define dbgscr_printf(args...) scr_printf(args)
#else
#define dbgprintf(args...) do { } while(0)
#define dbgscr_printf(args...) do { } while(0)
#endif
int main(int argc, char *argv[])
{
int ch;
// Not sure if this is still necessary, but doesn't appear to be done by ps2lib's "crt0"
sif_rpc_init(0);
// Initialize screen display
init_scr();
scr_printf("SIO Communications Tester v1.0 [2004-09-20] by tyranid, modified by redcoat\n\n");
for(;;) {
ch = sio_getc();
if(ch != -1) {
sio_putc(ch);
scr_printf("%c", (unsigned char)ch);
dbgprintf("%c", (unsigned char)ch);
}
}
return 0;
}
File:
Makefile
Code: Select all
######################################################################
# ps2siotest - Now uses the standard macros names from
# Makefile.pref & Makefile.eeglobal (see dir. $PS2LIB)
# Customize the standard macro names used
EE_BIN = ps2siotest.elf
EE_OBJS = main.o
######################################################################
# Paths and flags
#
EE_ASFLAGS = -march=r5900 -EL
EE_CFLAGS = -march=r5900 -ffreestanding -fno-builtin -fshort-double -mno-memcpy \
-nostartfiles -nodefaultlibs -mlong64 -mhard-float -mno-abicalls -EL
# Strip debug info., but leave some symbols
EE_LDFLAGS += $(LDPARAMS) -s
EE_LIBS = -lc -lgcc
######################################################################
#
all: $(EE_BIN)
clean:
rm -f $(EE_OBJS) $(EE_BIN)
include $(PS2LIB)/Makefile.pref
include $(PS2LIB)/Makefile.eeglobal