voicecheckresult.c
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*---------------------------------------------------------------------
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.2 2003/03/25 20:42:04 blythe Exp $
---------------------------------------------------------------------*/
#include "osint.h"
#include "controller.h"
#include "siint.h"
#ifndef BBPLAYER
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);
}
#endif