Yesterday I setup my developing environment:
+ laptop
+ visual studio
+ my own makefile
+ ps2sdk linkfile
+ inlink
+ network adaptor
+ ps2
+ ps2link
- without ps2sdk
And I wrote some timer code (I was thinking that is good starting point). I set up T0 and it's works but when I try to add interrupts handler - I stuck :(
I wrote own procedure to enable interrupts from given pheriperial and ee hangs when I call 'syscall'. Heres the code
Code: Select all
// add handler procedure - I think that procedure works ok
int add_intc_handler(int n, int(func *)(int), int next){
int ret;
__asm__ __volatile__ (
"li $3, 0x10 \n"
"add $4, $0, %1 \n"
"add $5, $0, %2 \n"
"add $6, $0, %3 \n"
"syscall \n"
"nop \n"
"add %0, $0, $2 \n"
: "=r"(ret)
: "r"(n), "r"(func), "r"(next)
);
return ret; //
}
// enable interrupt handlers - this procedure hang on syscall
int enable_intc(int n){
__asm__ __volatile__ (
"li $3, 0x14 \n"
"add $4, $0, %1\n"
"syscall \n" // here ps2 show me "Exception handler" screen
"nop \n"
"add %0, $0, $2"
: "=r"(ret)
: "r"(n)
);
return ret;
}
// simple handler
int t0_handler(int test){
printf("hello from handler\n");
}
// and in main i call this procedures
int h_no = add_intc_handler(0x09, t0_handler, 0);
enable_intc(0x09); // hangs
So if someone could help me, that will be great :)
ps1. I don't know mips assembler very well so I use add instruction instead of mov or something to pass data between registers (I saw this on ooPo's ee-syscalls.txt :) )
ps2. sorry for my poor english skills.