about summary refs log tree commit diff stats
path: root/gba/source/link.c
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-07-11 16:37:21 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-07-11 16:37:21 -0400
commit57afb4058710a978bd7b07a368125d04378c62f1 (patch)
tree7a06f1679f0612c58d5a209a013261ff5ad6cb82 /gba/source/link.c
parent004575f7cec14946c1936aceca6efee38b7f8a74 (diff)
downloadgen3uploader-57afb4058710a978bd7b07a368125d04378c62f1.tar.gz
gen3uploader-57afb4058710a978bd7b07a368125d04378c62f1.tar.bz2
gen3uploader-57afb4058710a978bd7b07a368125d04378c62f1.zip
started tweaking with stuff
Diffstat (limited to 'gba/source/link.c')
-rw-r--r--gba/source/link.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/gba/source/link.c b/gba/source/link.c new file mode 100644 index 0000000..e695622 --- /dev/null +++ b/gba/source/link.c
@@ -0,0 +1,41 @@
1#include "link.h"
2
3#define JOY_WRITE 2
4#define JOY_READ 4
5#define JOY_RW 6
6
7void waitForWriteAccess()
8{
9 //while ((REG_HS_CTRL & JOY_READ) == 0);
10 while ((REG_HS_CTRL & JOY_WRITE) == 0);
11 REG_HS_CTRL |= JOY_RW;
12}
13
14void waitForAck()
15{
16 while ((REG_HS_CTRL & JOY_WRITE) == 0);
17 REG_HS_CTRL |= JOY_RW;
18 REG_JOYTR = 0;
19 while ((REG_HS_CTRL & JOY_WRITE) == 0);
20 REG_HS_CTRL |= JOY_RW;
21}
22
23void sendS32(s32 val)
24{
25 REG_JOYTR = val;
26 //waitForWriteAccess();
27}
28
29void sendU32(u32 val)
30{
31 REG_JOYTR = val;
32 //waitForWriteAccess();
33}
34
35u32 recieveU32()
36{
37 while ((REG_HS_CTRL & JOY_WRITE) == 0);
38 REG_HS_CTRL |= JOY_RW;
39 return REG_JOYRE;
40}
41