diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-07-11 16:37:21 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-07-11 16:37:21 -0400 |
commit | 57afb4058710a978bd7b07a368125d04378c62f1 (patch) | |
tree | 7a06f1679f0612c58d5a209a013261ff5ad6cb82 /gba/source/link.c | |
parent | 004575f7cec14946c1936aceca6efee38b7f8a74 (diff) | |
download | gen3uploader-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.c | 41 |
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 | |||
7 | void 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 | |||
14 | void 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 | |||
23 | void sendS32(s32 val) | ||
24 | { | ||
25 | REG_JOYTR = val; | ||
26 | //waitForWriteAccess(); | ||
27 | } | ||
28 | |||
29 | void sendU32(u32 val) | ||
30 | { | ||
31 | REG_JOYTR = val; | ||
32 | //waitForWriteAccess(); | ||
33 | } | ||
34 | |||
35 | u32 recieveU32() | ||
36 | { | ||
37 | while ((REG_HS_CTRL & JOY_WRITE) == 0); | ||
38 | REG_HS_CTRL |= JOY_RW; | ||
39 | return REG_JOYRE; | ||
40 | } | ||
41 | |||