contchannelreset OK (#428)

* contchannelreset OK

* Add to functions.h

* Rename argument
This commit is contained in:
EllipticEllipsis 2021-12-27 03:42:31 +00:00 committed by GitHub
parent 8ebdb50470
commit 76c39482bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 2 deletions

View File

@ -381,7 +381,7 @@ void guRotateF(float mf[4][4], f32 a, f32 x, f32 y, f32 z);
void guRotate(Mtx* m, f32 a, f32 x, f32 y, f32 z);
void __osSetGlobalIntMask(u32 mask);
// void osVoiceInit(void);
// void __osContChannelReset(void);
s32 __osContChannelReset(OSMesgQueue* mq, s32 channel);
// void __osVoiceSetADConverter(void);
s32 osAiSetFrequency(u32 frequency);
s32 __osContRamRead(OSMesgQueue* mq, s32 channel, u16 address, u8* buffer);

View File

@ -1,3 +1,27 @@
#include "global.h"
#pragma GLOBAL_ASM("asm/non_matchings/boot/contchannelreset/__osContChannelReset.s")
s32 __osContChannelReset(OSMesgQueue* mq, s32 channel) {
s32 i;
s32 ret;
u8* bufptr = (u8*)&__osPfsPifRam;
__osSiGetAccess();
__osPfsPifRam.pifstatus = 1;
for (i = 0; i < channel; i++) {
*bufptr++ = 0;
}
*bufptr++ = 0xFD;
*bufptr = CONT_CMD_END;
__osSiRawStartDma(OS_WRITE, &__osPfsPifRam);
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
ret = __osSiRawStartDma(OS_READ, &__osPfsPifRam);
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
__osSiRelAccess();
return ret;
}