EE-SIO rx

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
apache37
Posts: 76
Joined: Fri Jun 04, 2004 3:13 pm

EE-SIO rx

Post by apache37 »

Hello,

I've built and installed the ps2 ee-sio per mrbrowns instructions. The tx works fine and I can see the messages pop thru securecrt and within my own code. The probelem I have is how to really test the rx side. I've looked through the other thread on the serial cable and are pretty sure I'm on the right via (directly below the tx).

Can someone provide a small code snippet on how to test? I've used sio_getc() and seems to return just the same funky "y" character all the time. I'm sure I'm just stupid. Right now I'm typing into the terminal app and trying to echo the input thru serial via printf to inlink.

Thanks in advance :)
redcoat
Posts: 21
Joined: Wed Aug 11, 2004 9:30 am

Re: EE-SIO rx

Post by redcoat »

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&#40;args...&#41; printf&#40;args&#41;
#define dbgscr_printf&#40;args...&#41; scr_printf&#40;args&#41;
#else
#define dbgprintf&#40;args...&#41; do &#123; &#125; while&#40;0&#41;
#define dbgscr_printf&#40;args...&#41; do &#123; &#125; while&#40;0&#41;
#endif

int main&#40;int argc, char *argv&#91;&#93;&#41;
&#123;
  int ch;

  // Not sure if this is still necessary, but doesn't appear to be done by ps2lib's "crt0"
  sif_rpc_init&#40;0&#41;;

  // Initialize screen display
  init_scr&#40;&#41;;

  scr_printf&#40;"SIO Communications Tester v1.0 &#91;2004-09-20&#93; by tyranid, modified by redcoat\n\n"&#41;;

  for&#40;;;&#41; &#123;
    ch = sio_getc&#40;&#41;;
    if&#40;ch != -1&#41; &#123;
      sio_putc&#40;ch&#41;;
      scr_printf&#40;"%c", &#40;unsigned char&#41;ch&#41;;
      dbgprintf&#40;"%c", &#40;unsigned char&#41;ch&#41;;
    &#125;
  &#125;

  return 0; 
&#125;
File: Makefile

Code: Select all

######################################################################
# ps2siotest - Now uses the standard macros names from
#  Makefile.pref & Makefile.eeglobal &#40;see dir. $PS2LIB&#41;

# 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 += $&#40;LDPARAMS&#41; -s

EE_LIBS = -lc -lgcc

######################################################################
#

all&#58;	$&#40;EE_BIN&#41;

clean&#58;
	rm -f $&#40;EE_OBJS&#41; $&#40;EE_BIN&#41;


include $&#40;PS2LIB&#41;/Makefile.pref
include $&#40;PS2LIB&#41;/Makefile.eeglobal
Post Reply