about summary refs log tree commit diff stats
path: root/source/link.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/link.c')
-rw-r--r--source/link.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/source/link.c b/source/link.c index 27837f8..c627039 100644 --- a/source/link.c +++ b/source/link.c
@@ -12,7 +12,7 @@
12 12
13//from my tests 50us seems to be the lowest 13//from my tests 50us seems to be the lowest
14//safe si transfer delay in between calls 14//safe si transfer delay in between calls
15#define SI_TRANS_DELAY 50 15#define SI_TRANS_DELAY 500
16 16
17static u8* resbuf; 17static u8* resbuf;
18static u8* cmdbuf; 18static u8* cmdbuf;
@@ -61,7 +61,7 @@ u32 recv()
61 SI_Transfer(1, cmdbuf, 1, resbuf, 5, transcb, SI_TRANS_DELAY); 61 SI_Transfer(1, cmdbuf, 1, resbuf, 5, transcb, SI_TRANS_DELAY);
62 62
63 while (transval == 0); 63 while (transval == 0);
64 printf("%08lx\n", *(vu32*)resbuf); 64 //printf("%08lx\n", *(vu32*)resbuf);
65 return *(vu32*)resbuf; 65 return *(vu32*)resbuf;
66} 66}
67 67
@@ -82,14 +82,7 @@ void send(u32 msg)
82 82
83u32 getMsg() 83u32 getMsg()
84{ 84{
85 u32 val = 0; 85 u32 val = __builtin_bswap32(recv());
86 while (val == 0)
87 {
88 val = __builtin_bswap32(recv());
89 }
90
91 send(0);
92 while (recv()!=0);
93 send(0); 86 send(0);
94 87
95 return val; 88 return val;
@@ -105,10 +98,7 @@ void getMsgArr(u32* arr, int len)
105 98
106void sendMsg(u32 msg) 99void sendMsg(u32 msg)
107{ 100{
108 while (recv()==0);
109 send(msg); 101 send(msg);
110 while (recv()!=0);
111 send(0);
112} 102}
113 103
114void waitForGBA() 104void waitForGBA()
@@ -157,5 +147,4 @@ void waitForGame()
157void waitForAck() 147void waitForAck()
158{ 148{
159 while (recv() != 0) {sleep(1);} 149 while (recv() != 0) {sleep(1);}
160 send(0);
161} 150}