More minor cleanup, use macros from gba.h

This commit is contained in:
Phillip Stephens 2022-10-15 23:26:42 -07:00
parent 8a35c9640a
commit 903d979c05
4 changed files with 10 additions and 10 deletions

View File

@ -51,7 +51,7 @@ s32 GBAGetStatusAsync(s32 chan, u8* status, GBACallback callback) {
s32 ret; s32 ret;
gba = &__GBA[chan]; gba = &__GBA[chan];
if (gba->callback != NULL) { if (gba->callback != NULL) {
ret = 2; ret = GBA_BUSY;
} else { } else {
gba->command = 0; gba->command = 0;
gba->status = status; gba->status = status;
@ -67,7 +67,7 @@ s32 GBAGetStatus(s32 chan, u8* status) {
s32 ret; s32 ret;
ret = GBAGetStatusAsync(chan, status, __GBASyncCallback); ret = GBAGetStatusAsync(chan, status, __GBASyncCallback);
if (ret != 0) { if (ret != GBA_READY) {
return ret; return ret;
} }
@ -80,7 +80,7 @@ s32 GBAResetAsync(s32 chan, u8* status, GBACallback callback) {
s32 ret; s32 ret;
gba = &__GBA[chan]; gba = &__GBA[chan];
if (gba->callback != NULL) { if (gba->callback != NULL) {
ret = 2; ret = GBA_BUSY;
} else { } else {
gba->command = 0xFF; gba->command = 0xFF;
gba->status = status; gba->status = status;
@ -96,7 +96,7 @@ s32 GBAReset(s32 chan, u8* status) {
s32 ret; s32 ret;
ret = GBAResetAsync(chan, status, __GBASyncCallback); ret = GBAResetAsync(chan, status, __GBASyncCallback);
if (ret != 0) { if (ret != GBA_READY) {
return ret; return ret;
} }

View File

@ -34,7 +34,7 @@ s32 GBARead(s32 chan, u8* dst, u8* status) {
s32 tmp; s32 tmp;
s32 ret; s32 ret;
ret = GBAReadAsync(chan, dst, status, __GBASyncCallback); ret = GBAReadAsync(chan, dst, status, __GBASyncCallback);
if (ret != 0) { if (ret != GBA_READY) {
return ret; return ret;
} }

View File

@ -17,7 +17,7 @@ s32 GBAWriteAsync(s32 chan, u8* src, u8* status, GBACallback callback) {
gba = &__GBA[chan]; gba = &__GBA[chan];
if (gba->callback != NULL) { if (gba->callback != NULL) {
ret = 2; ret = GBA_BUSY;
} else { } else {
gba->command = 0x15; gba->command = 0x15;
memcpy(gba->src, src, 4); memcpy(gba->src, src, 4);
@ -35,7 +35,7 @@ s32 GBAWrite(s32 chan, u8* src, u8* status) {
s32 ret; s32 ret;
s32 tmp; s32 tmp;
ret = GBAWriteAsync(chan, src, status, __GBASyncCallback); ret = GBAWriteAsync(chan, src, status, __GBASyncCallback);
if (ret != 0) { if (ret != GBA_READY) {
return ret; return ret;
} }
return __GBASync(chan); return __GBASync(chan);

View File

@ -69,12 +69,12 @@ void TypeAndStatusCallback(s32 chan, u32 type) {
} }
if ((type & 0xFF) != 0 || (type & 0xffff0000) != 0x40000) { if ((type & 0xFF) != 0 || (type & 0xffff0000) != 0x40000) {
gba->result = 1; gba->result = GBA_NOT_READY;
} else { } else {
if (SITransfer(chan, &gba->command, gba->_0c, gba->dst, gba->_10, __GBAHandler, gba->delay)) { if (SITransfer(chan, &gba->command, gba->_0c, gba->dst, gba->_10, __GBAHandler, gba->delay)) {
return; return;
} }
gba->result = 2; gba->result = GBA_BUSY;
} }
if (gba->_38 != NULL) { if (gba->_38 != NULL) {
@ -107,7 +107,7 @@ s32 __GBATransfer(s32 chan, s32 w1, s32 w2, GBATransferCallback callback) {
SIGetTypeAsync(chan, TypeAndStatusCallback); SIGetTypeAsync(chan, TypeAndStatusCallback);
OSRestoreInterrupts(enabled); OSRestoreInterrupts(enabled);
return 0; return GBA_READY;
} }
OSTime __GBASetDelay(s32 chan, OSTime delay) { OSTime __GBASetDelay(s32 chan, OSTime delay) {