www.pudn.com > VoiceRecognition.zip > recog.h


/********************************************************************* 
  
  (c) copyright Extell Company 2001  
  ALL RIGHTS RESERVED 
  
 ********************************************************************* 
        ESR-700 Demonstration Program for Voice Recognition Application 
 ********************************************************************* 
 
  File:		recog.h 
  
  Project:      ESR-700 demo program for Voice Recognition Application 
  
  Description:  Definition of External Fuctions 
  
  Date:         Sep. 2001 
    
 ********************************************************************/ 
  
typedef 	unsigned char	BYTE; 
typedef		bit				BOOL; 
typedef		unsigned int	UINT; 
 
 
//********* 7/3  RecogSD()/RecogSI return value define 
// rnp_state 
#define		RNP_NONE			0 
#define		RNP_RECORD			1 
#define		RNP_PLAYBACK		2 
#define 	PLAYBACK_12K		3 
#define		READ_ADC_VALUE		4 
#define		SOFT_SHIFT			5 
#define		PLAYBACK_6K			7 
#define		APM_PLAY_12K		8 
 
 
//********* 7/3  RecogSD()/RecogSI return value define 
#define	OK				0 
#define	OK1				1 
#define	OK2				2 
#define THINK_OK		3 
#define	REJECT_ERROR	4 
//********************************************** 
 
//********* 10/15  RecogSD/RecogSV method parameter value define 
#define		INTERNAL			0 
#define		EXTERNAL			1 
#define		EXT_FLASH			2 
//********************************************** 
 
//********* 10/15  GetFeatSD/GetFeatSV() method parameter define 
#define 	RECODE_NONE			0 
#define 	RECODE_EPD			1 
//********************************************** 
 
//********* 9/3  GetFeatSI/GetFeatSD/GetFeatSV() return value define 
#define		OK				0 
#define		TIMEOVER_ERROR	1 
#define		STOP_BREAK		2 
#define		TOO_LOUD		3 
#define		TOO_SOFT		4 
#define		TOO_LONG		5 
#define		TOO_NOISE		6 
//********************************************** 
 
//********* 9/15  MemorySpeed parameter value define 
#define	CLOCK2				0 
#define	CLOCK4				1 
#define	CLOCK8				2 
#define	CLOCK16				3 
//********************************************** 
 
//********* 9/17  PowerDown parameter value define 
#define	PR2_PD				0x01 
#define MUL_PD				0x02 
#define	EXP_PD				0x04 
#define	PR1_PD				0x08 
 
#define	PRE_AMP_PD			0x80 
#define	I2C_PD				0x40 
#define	DAC_PD				0x20 
#define	ADC_PD				0x10 
//********************************************** 
 
//********* 9/17  record() method parameter value define 
#define	IMM_RECORD			0 
#define	LEVEL_RECORD		1 
//********************************************** 
 
//********* 10/29  PlayBack() return value define 
#define		OK					0 
#define		NONE_RECORD_DATA	1 
#define		STOP_BREAK			2 
//********************************************** 
 
//********* 9/17  SetStopCondition() Device parameter value define 
#define	GETFEATURE_STATE			0x80 
#define	RECORD_STATE				0x40 
#define	PLAYBACK_STATE				0x20 
#define	PLAYPROMPT_STATE			0x10 
		// method define 
#define		IO							1 
#define		NONE						0 
//********************************************** 
 
//********* 9/17  Stop Port value define 
#define	PORT0			0 
#define	PORT1			1 
#define	PORT2			2 
#define	PORT3			3 
//********************************************** 
 
//********* 9/26  AMDflash/SSTflash return value define 
#define		OK				0 
#define		ERROR			1 
//********************************************** 
 
//********************************************** 
//		DEMO BOARD DEFINE 
//********************************************** 
#define GreenOn		P1_4 = 0; P1_5 = 0; 
#define GreenOff	P1_4 = 1; P1_5 = 1; 
#define BlueOn		P1_0 = 0; P1_1 = 0; 
#define BlueOff		P1_0 = 1; P1_1 = 1; 
#define YellowOn	P1_2 = 0; P1_3 = 0; 
#define YellowOff	P1_2 = 1; P1_3 = 1; 
#define RedOn		P1_6 = 0; P1_7 = 0; 
#define RedOff		P1_6 = 1; P1_7 = 1; 
#define	AllOff		P1 = 0xff; 
#define	AllOn		P1 = 0; 
 
sbit	DA16	= P1^0; 
sbit	DA17	= P1^1; 
sbit	DA18	= P1^2; 
sbit	SW1		= P3^2; 
sbit	SW2		= P1^3; 
sbit	SW3		= P1^4; 
sbit	SCL		= P1^5; 
sbit	SDA 	= P1^6; 
sbit	SEL		= P1^7; 
sbit	A16		= P3^3; 
sbit	A17		= P3^4; 
sbit	A18		= P3^5; 
 
#define read_XDATA(address)         (((char volatile xdata *)0x0)[address])  
#define write_XDATA(address,value)  (((char volatile xdata *)0x0)[address] = value)  
 
 
/********************************************************************* 
// FUNCTION DEFINE 
/*********************************************************************/ 
extern void Adaptive(unsigned char *dist); 
extern unsigned char PlayBack(unsigned char *record_start_addr,unsigned char method); 
extern unsigned char PlayPrompt(unsigned char *prompt,unsigned char method); 
extern unsigned char Record(unsigned char *pRecordStartAddr, unsigned int RecordLength, unsigned char method); 
//********************************** 
// RecogSD function 
//********************************** 
extern unsigned char RecogSD(unsigned char *templete,unsigned char start_word, unsigned char total_word, unsigned char method); 
extern unsigned char GetFeatSD(unsigned char *record_start_addr,unsigned char method); 
//********************************** 
// RecogSI function 
//********************************** 
extern unsigned char RecogSI(unsigned char *templete,unsigned char *var, char *weight, unsigned char total_word,unsigned char nHidden); 
extern unsigned char GetFeatSI(); 
//********************************** 
// RecogSV function 
//********************************** 
extern unsigned char RecogSV(unsigned char *templete,unsigned char start_word, unsigned char total_word, unsigned char method); 
extern unsigned char GetFeatSV(unsigned char *record_start_addr,unsigned char method); 
 
//********************************** 
// utility function 
//********************************** 
extern void SetMemSpeed(unsigned char param); 
extern void SetPowerDown(unsigned char Device, unsigned char state); 
extern void SetStopCondition(unsigned char Device, unsigned char method); 
extern void SetStopIO(unsigned char Port, unsigned char PortMask, bit bcondition); 
extern void ESRInitial(void); 
 
//********************************** 
//		Flash Memory 
//********************************** 
extern void ManuIdSelect(void); 
extern void DeviceIdSelect(void); 
extern void SectorProtectIdSelect(unsigned int SectorAddr); 
extern void FlashWrite(unsigned int addr, unsigned char fdata); 
extern unsigned char FlashWriteConfirm(unsigned int addr, unsigned char fdata); 
extern void UnlockBypass(void); 
extern void UnlockBypassProg(unsigned int addr, unsigned char fdata); 
extern void UnlockBypassReset(void); 
extern unsigned char ChipErase(void); 
extern unsigned char SectorErase(unsigned int SectorAddr); 
extern void EraseSuspend(void); 
extern void EraseResume(void); 
#define read_XDATA(address)         (((char volatile xdata *)0x0)[address])  
#define write_XDATA(address,value)  (((char volatile xdata *)0x0)[address] = value)  
 
//********************************** 
//		Serial EEPROM Memory 
//********************************** 
extern unsigned char read_1byte(unsigned char device, unsigned int address); 
extern void write_1byte(unsigned char device, unsigned int address, unsigned char wr_data);