voicecheckresult.c
1.06 KB
/*---------------------------------------------------------------------
Copyright (C) 1997,1998 Nintendo.
File voicecheckresult.c
Coded by Koji Mitsunari. Oct 9, 1997.
Modified by Koji Mitsunari. Jun 3, 1998.
Comments Voice Recognition System
$Id: voicecheckresult.c,v 1.1.1.1 2002/05/02 03:28:44 blythe Exp $
---------------------------------------------------------------------*/
#include "osint.h"
#include "controller.h"
#include "siint.h"
s32
__osVoiceCheckResult(OSVoiceHandle *hd, u8 *stat) {
s32 ret;
u8 buf[2];
if ( (ret = __osVoiceGetStatus(hd->__mq, hd->__channel, stat)) == 0 ) {
if (*stat & VOICE_READ_READY) { /* Read enable flag ? */
ret = CONT_ERR_VOICE_NO_RESPONSE;
} else {
if ((ret = __osVoiceContRead2(hd->__mq, hd->__channel,
VOICE_RW_ADDR, buf)) == 0){
hd->cmd_status = (buf[0] & 7);
if ( (buf[0] & 0x40) != 0 ) { /* not finished execution */
ret = CONT_ERR_VOICE_NO_RESPONSE;
} else { /* finished */
ret = ((s32)buf[1]<<8); /* Error code of board */
}
}
}
}
return(ret);
}