voicecleardictionary.c
1.37 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
39
40
41
42
43
44
45
46
47
/*---------------------------------------------------------------------
Copyright (C) 1997,1998 Nintendo.
File voicecleardictionary.c
Coded by Koji Mitsunari. Oct 8, 1997.
Modified by Koji Mitsunari. Jun 22, 1998.
Comments Voice Recognition System
$Id: voicecleardictionary.c,v 1.1.1.1 2002/05/02 03:28:44 blythe Exp $
---------------------------------------------------------------------*/
/**************************************************************************
*
* $Revision: 1.1.1.1 $
* $Date: 2002/05/02 03:28:44 $
* $Source:
*
**************************************************************************/
#include "osint.h"
#include "controller.h"
#include "siint.h"
s32
osVoiceClearDictionary(OSVoiceHandle *hd, u8 words) {
s32 ret;
u8 stat;
u8 buf[4]; /*--- 4バイトライト用のバッファ ---*/
if ((ret = __osVoiceGetStatus(hd->__mq, hd->__channel, &stat)) != 0 ) {
return(ret);
} else if (stat & VOICE_WRITE_READY) {
return(CONT_ERR_VOICE_NO_RESPONSE);
}
/*--- 辞書クリア用コマンドのセット ---*/
((u32 *)buf)[0] = 0x02000000; /*--- クリアコマンド ---*/
buf[2] = words; /*--- 登録単語数 ---*/
ret = __osVoiceContWrite4(hd->__mq, hd->__channel, VOICE_RW_ADDR, buf);
if (ret != 0 ) {
return(ret);
}
ret = __osVoiceCheckResult(hd, &stat);
if (ret & 0xff00) {
ret = CONT_ERR_INVALID;
}
return(ret);
}