voicecheckresult.c 1.08 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.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