⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 po4tact.c

📁 一个不错的硬盘播放器程序,包含VFD显示程序,红外线遥控程序,硬盘读写程序,及解码程序等.
💻 C
📖 第 1 页 / 共 5 页
字号:
/* Copyright 1996, ESS Technology, Inc.					*/
/* SCCSID @(#)po4tact.c	1.90 1/27/98 */

/*
 * This is modified from version 1.75 of po4tact.c to use on mvd board
 */

/*
 * This file is customized for play-only machine.
 *
 * AUX pins are connected as follows:
 *	AUX0:	JP11 (general purpose I/O)
 *	AUX1:	JP15 (general purpose I/O)
 *	AUX2:	output. PAL(0)/NTSC(1) encoder control
 *	AUX3:	output. 0 in order to disable the XOR gate (XOR is now
 *		built into 3208)
 *	AUX4:	IR input (and control of internal XOR gate)
 *	AUX5:	3207/9 communication.
 *	AUX6:	N/C
 *	AUX7:	JP19 output. Optional IR receiver output
 * All AUX pins are externally connected to pull-up resistors. Therefore,
 * they are normally high, and a low means the switch is pressed.
 *
 *
 * Host port is reserved for the following input controls.
 *	HD0      NTSC/PAL jumper status input
 *	HD1      audio L/R clock input
 *	HD2      video EVEN/ODD sync input
 *	HD3
 *	HD4      Composite/S-Video switch
 *	HD5      Key DOWN
 *	HD6      Key NEUTRAL
 *	HD7      Key UP
 *	HD8      Audio mode toggle
 *	HD9      Video mode toggle
 *	HD10     Mute toggle			JP17
 *	HD11     Scan toggle			JP13
 *	HD12     Vocal assist toggle		JP9
 *	HD13     Micphone in toggle		JP16
 *	HD14     general purpose input          JP12
 *	HD15     Zoom toggle			
 */

#include "common.h"
#include "digest.h"
#include "display.h"
#include "kara.h"
#include "fsosd.h"
#include "sysinfo.h"
#include "tact.h"
#include "tdm.h"
#include "util.h"
#include "mvd.h"
#include "audio.h"
#include "ioport.h"
#include "timedef.h"
#include "vcxi.h"
#include "constvar.h"
#include "const.h"
#include "mpeg1vid.h"
#include "xport.h"
#include "vp.h"

#include <stdio.h>
#include "macros.h"
#include "ir.h"
#include "buffer.h"

#ifdef DSC
#include "dsc.h"
#endif

#ifdef ZOOM
#include "zoom.h"
#endif

#ifdef ECHO
#include "echo.h"
#endif

#include "Hm612ndi.h"

/*
 * Key variables:
 *    playMode:
 *	This variable determines the "mode" that we are playing in.
 *	Following modes are defined:
 *		1) NORMAL (normal play mode)
 *		2) SLOW (slow motion mode)
 *		3) FAST (fast motion mode)
 *		4) PAUSE (pause mode)
 *	At any given time, we can only be in one mode. 
 *	
 *	Keys are divide into two major categories:
 *	1) Mode changing keys: these keys will change playMode in most
 *	   case (see below). These keys are: number keys, next/previous,
 *	   FF/FB/slow, intro/view, pause/play, open/close/stop.
 *	2) Non-mode changing keys: these keys will change some internal
 *	   parameters yet they will not change play mode. These keys are:
 *	   volume up/ddown, pitch up/down/resume, audio left/right.
 *
 *	PAUSE mode is a bit special: only stop/open/close/pause/play key 
 *	will get you out of PAUSE mode; most other keys will take their 
 *	action yet still keep you in PAUSE mode (e.g. number key, 
 *	next/previous, FF/FB)
 *
 *
 *    scanMode:
 *	This variable determines whether are in one form of digesting
 *	or another. While in digest, we can be playing normal, doing
 *	FF/FB, or pausing, so we need a separate variable to keep
 *	track of this info.
 *
 *	We can enter digesting while pausing, we can also pause
 *	while inside digest. If we are in fast/slow mode when digest
 *	key is pressed, then we'll quit fast/slow first. If FF/FB/pause
 *	is pressed inside digest, appropriate action will take place
 *	yet we'll still be in digest mode.
 */


/*
 * #define PBCON
 * if you want 2.0 lookalike
 *
 * #undef PBCON
 * if you don't want 2.0 lookalike
 */
#define PBCON

/************************************************************************ 
 * Local defines.                                                       * 
 ************************************************************************/ 
/*
 * If you want to get customers' key code, then use
 *
 * #define GETKEYCODE
 *
 * in which case, we will not respond to the input key but OSD will
 * display the key code so you can customize ir.h easily.
 */

/* 
 * Defines specific for our play-only board.
 *
 * All tact switches are normally high; a low means the switch is being
 * pressed.
 */
/* To read from host port, we need to read Bank2 first	*/

#ifdef AUX_AS_HOSTPORT
#define READ_HOSTPORT(x) {						\
    x = 0;								\
    x = GET_EAUX15_8 << 8;						\
    x |= GET_EAUX7_0;							\
}
#else
#define READ_HOSTPORT(x) x = 0xffff;
#endif

#define	BD0_LOW(x)	(!(x & 0x1))
#define	BD1_LOW(x)	(!(x & 0x2))
#define	BD2_LOW(x)	(!(x & 0x4))
#define	BD3_LOW(x)	(!(x & 0x8))
#define	BD4_LOW(x)	(!(x & 0x10))
#define	BD5_LOW(x)	(!(x & 0x20))
#define	BD6_LOW(x)	(!(x & 0x40))
#define	BD7_LOW(x)	(!(x & 0x80))
#define	BD8_LOW(x)	(!(x & 0x100))
#define	BD9_LOW(x)	(!(x & 0x200))
#define	BD10_LOW(x)	(!(x & 0x400))
#define	BD11_LOW(x)	(!(x & 0x800))
#define	BD12_LOW(x)	(!(x & 0x1000))
#define	BD13_LOW(x)	(!(x & 0x2000))
#define	BD14_LOW(x)	(!(x & 0x4000))
#define	BD15_LOW(x)	(!(x & 0x8000))

/************************************************************************
 * !!!!! Please customize for your TACT switch configurations !!!!!!!	*
 ************************************************************************/
#define GETPO4JUMPER_PAL(x)	(BD0_LOW(x))
#ifdef SVIDEO
#define PO4_SVIDEO(x)	(BD4_LOW(x))	/* S-Video detect		*/
#endif
#define PO4_SHIFTDN(x)	(BD5_LOW(x))	/* Key shift down		*/
#define PO4_RESUME(x)	(BD6_LOW(x))	/* Key shift resume		*/
#define PO4_SHIFTUP(x)	(BD7_LOW(x))	/* Key shift up			*/
#define	PO4_AUDIO(x)	(BD8_LOW(x))	/* Change audio output mode	*/
#define PO4_SELECT(x)	(BD9_LOW(x))	/* PAL / MULTI SYNC		*/

#define PO4_MUTE(x)	(BD10_LOW(x))	/* Toggle mute 			*/
#define PO4_SCAN(x)	(BD11_LOW(x))	/* Change scan mode 		*/
#define PO4_VOCAL(x)	(BD12_LOW(x))	/* Toggle vocal assist		*/
#define PO4_MICIN(x)	(BD13_LOW(x))	/* Toggle Micphone in 		*/
#ifdef ZOOM
#define PO4_ZOOM(x)	(BD15_LOW(x))	/* Zoom key pad 		*/
#endif

#ifdef ECHO
#define PO4_ECHOUP(x)	0		/* Echo plus	*/
#define PO4_ECHODN(x)	0		/* Echo minus	*/
#endif

#define FAST_KEY_NUM	10 /* 0x2800 */

#ifndef MKROM
#ifdef READ_HOSTPORT
#undef READ_HOSTPORT
#define READ_HOSTPORT(x) { x = 0xffff; }
#endif
#endif

#define SEL_NUM_POS	7
#define CSEL_NUM_POS	5

/*
 * Macro to do debouncing. 
 *	FUNC: PO4_##FUNC to test whether the key is pressed/released
 *	func: po_##func structure for flags
 *	tact: All TACT switch inputs
 */
#define	DEBOUNCE(FUNC, func, tact) {					\
    if (!PO4_##FUNC(tact)) po_##func##.inactive++;			\
									\
    /* Enough times to believe that key has been released */		\
    if (po_##func##.inactive >= 3) {					\
	po_##func##.determine = po_##func##.done  			\
			      = po_##func##.inactive = 0;		\
    }									\
}

/************************************************************************
 * Remote control related customizations.				*
 ************************************************************************/
#define IR_SYSCODE		0x00ff
#define IRKEY_1			0x09
#define IRKEY_2			0x1d
#define IRKEY_3			0x1f
#define IRKEY_4			0x0d
#define IRKEY_5			0x19
#define IRKEY_6			0x1b
#define IRKEY_7			0x11
#define IRKEY_8			0x15
#define IRKEY_9			0x17
#define IRKEY_10		0x12
#define IRKEY_10PLUS		0x16
#define IRKEY_EJECT		0x10	/* Open/close			*/
#define IRKEY_FB		0x0a
#define IRKEY_FF		0x1e
#define IRKEY_NEXT		0x1a
#define IRKEY_PAUSE		0x14
#define IRKEY_PAUSE2		0x0b	/* Pause key in front panel	*/
#define IRKEY_PLAY		0x13	/* Play key in front panel	*/
#define IRKEY_PREVIOUS		0x0e
#define IRKEY_RETURN		0x0f	/* Return/stop			*/

#if 0
/*
 * Debugging assignments. They are according to the new ESS remote control
 * assignment. Therefore, if you modify ir.c to recognize ESS' system
 * code as well, then you'll be able to test a lot of functions using
 * ESS's remote control
 */
#define IRKEY_INTRO		0x00	/* Digest			*/
#define	IRKEY_SURROUND		0x40
#define	IRKEY_PBCON		0x41
#define IRKEY_ECHO_PLUS		0x44
#define IRKEY_ECHO_MINUS	0x45
#define IRKEY_KEYPLUS		0x48
#define IRKEY_KEYMINUS		0x49
#define IRKEY_SLOW		0x4a
#define	IRKEY_VIDEO		0x4c	/* NTSC/PAL			*/
#define	IRKEY_MUTE		0x4d
#define	IRKEY_OSD		0x4e
#define IRKEY_ZOOM		0x50
#define IRKEY_MODE		0x51	/* BM (audio L/R etc)		*/
#define IRKEY_DECVOL		0x52	/* Disc 1			*/
#define IRKEY_ZOOM_UP		IRKEY_2	/* F1 (0x54)			*/
#define IRKEY_KEYRESUME 	0x56	/* Disc 2			*/
#define IRKEY_ZOOM_LEFT		IRKEY_5	/* F3 (0x59)			*/
#define IRKEY_INCVOL		0x5a	/* Disc 3			*/
#define IRKEY_ZOOM_DOWN		IRKEY_6	/* F2 (0x5c)			*/
#define IRKEY_ZOOM_RIGHT	IRKEY_7	/* F4 (0x5d)			*/


/* Using the orignal box */
#define IRKEY_REP		0x01	/* Repeat 1/all/none		*/
#define IRKEY_REM		0x02	/* Normal/single/total remain	*/
#define IRKEY_SETAB		0x06	/* Set A/Repeat A TO B		*/

/* Dummy keys */
#define IRKEY_VIEW		0x20

/*
 * Following table keep track of which customer codes should be "killed"
 * vs. which ones should be passed to the CD controller. Since we can
 * have a total of 256 opcodes, we use 256 bits to keep track of all
 * opcodes. Therefore, the first byte:
 *	0xb9	= 1011 1001
 * which indicates:
 *	00	kill (MODE)
 *	01	send (REPEAT)
 *	02	send (REMAIN)
 *	03	kill (SLOW)
 *	04	kill (INTRO)
 *	05 	kill (KEYRESUME)
 *	06	send (SETAB)
 *	07	kill (DECVOL)
 *
 * You want to kill opcodes that have no meaning to the CD loader (otherwise,
 * existing load can't add new functions)
 *
 * NOTE: If PBCON is set, then we'll kill all the number keys as well
 *       so we can do a smart number retransmission!
 */
char tblKillIR[] = {
#ifdef BROWSER1
    /* For the browser application, kill REM key (use it to switch) */
  #ifdef PBCON
    0xbd, 0x33, 0xa6, 0xbb, 0xff, 0xff, 0xff, 0xff, 
  #else
    0xbd, 0x11, 0x00, 0x11, 0xff, 0xff, 0xff, 0xff, 
  #endif /* PBCON */
#else
  #ifdef PBCON
    0xb9, 0x33, 0xa6, 0xbb, 0xff, 0xff, 0xff, 0xff, 
  #else
    0xb9, 0x11, 0x00, 0x11, 0xff, 0xff, 0xff, 0xff, 
  #endif /* PBCON */
#endif /* BORWSER1 */
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
};

#else

/* Alternative I/R key assignments (for the same loader) */
#define IRKEY_DECVOL		0x02	/* Volume down			*/
#define IRKEY_INCVOL		0x05	/* Volume up			*/
#define IRKEY_INTRO		0x00	/* SFL/Digest			*/
#define IRKEY_KEYMINUS		0x03
#define IRKEY_KEYPLUS		0x06
#define IRKEY_KEYRESUME 	0x01
#define IRKEY_MODE		0x1c	/* R/C 'VOCAL'; F/P R/L		*/
#define IRKEY_SLOW		0x08	/* R/C 'PRO'; F/P 'SLOW'	*/
#define	IRKEY_VIDEO		0x0c	/* Video mode toggle		*/

/* Dummy (run out of remote control keys) */
#define	IRKEY_REM		0x20	/* Should be 0x02		*/
#define	IRKEY_REP		0x21	/* Should be 0x01		*/
#define	IRKEY_SETAB		0x22	/* Should be 0x06		*/
#define	IRKEY_SURROUND		0x23
#define	IRKEY_VIEW		0x24
#define	IRKEY_BROWSER		0x25
#define	IRKEY_PBCON		0x26

#ifdef ECHO
#define IRKEY_ECHO_PLUS		0x27
#define IRKEY_ECHO_MINUS	0x28
#endif

#define	IRKEY_MUTE		0x29
#define	IRKEY_OSD		0x2a

#ifdef ZOOM
#define IRKEY_ZOOM		0x04	/* Zoom key */
#define IRKEY_ZOOM_UP		IRKEY_2
#define IRKEY_ZOOM_DOWN		IRKEY_6
#define IRKEY_ZOOM_LEFT		IRKEY_5
#define IRKEY_ZOOM_RIGHT	IRKEY_7
#endif 

/*
 * Following table keep track of which customer codes should be "killed"
 * vs. which ones should be passed to the CD controller. Since we can
 * have a total of 256 opcodes, we use 256 bits to keep track of all
 * opcodes. Therefore, the second byte:
 *	0x33	= 0011 0011
 * which indicates:
 *	08	kill (undefined)
 *	09	kill (1)
 *	0a	send (FF)
 *	0b	send (PAUSE2)
 *	0c	kill (video toggle)
 *	0d 	kill (4)
 *	0e	send (previous)
 *	0f	send (return/stop)
 *
 * You want to kill opcodes that have no meaning to the CD loader (otherwise,
 * existing load can't add new functions)
 *
 * NOTE: If PBCON is set, then we'll kill all the number keys as well
 *       so we can do a smart number retransmission!
 */
char tblKillIR[] = {
#ifdef PBCON
    0xff, 0x33, 0xa6, 0xbb, 0xff, 0xff, 0xff, 0xff,
#else
    0xff, 0x11, 0x00, 0x11, 0xff, 0xff, 0xff, 0xff, 
#endif
    0x9d, 0xbf, 0xbf, 0xbb, 0xff, 0xff, 0xff, 0xff, 
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
};
#endif

#ifdef SVIDEO
int	svideo = 0;	/* default boot up is Composite Video */
#endif

#ifdef ZOOM
int	zoom_dir = 1;	/* direction : zoom in or zoom out */
#endif

/************************************************************************
 * Local typedef's							*
 ************************************************************************/
/*
 * Structure to do debouncing. Assuming the mechanical part will not
 * do debouncing, we need to keep track whether an actual pulse has
 * happened.
 */
typedef struct {
    char determine;	/* 0: no new key; 1: determining new key	*/
    char inactive;	/* Number of inactives we see while determining	*/
    char done;		/* Action has been taken.			*/
} TACTSWITCH;

/************************************************************************
 * Local variables							*
 ************************************************************************/
PRIVATE char		msgError[] = "#";	/* Show a hand */
PRIVATE char            msgNull[]= " ";
PRIVATE	char		msgSelect[10] = "SELECT   ";
#ifdef BILINGUAL_OSD
PRIVATE	char		c_msgSelect[10] = {CN_XUAN3, ' ', ' ',
					   CN_ZE2, ' ', ' ', ' ',
					   '\0'};
#endif
PRIVATE	char *		ptrIntro;
#ifdef BILINGUAL_OSD
PRIVATE	char *		c_ptrIntro;
#endif
PRIVATE TACTSWITCH	po_audio, 	/* Audio left/right		*/
			po_mute,	/* Mute On/Off			*/
			po_scan,	/* SCAN B / SCAN OFF		*/
			po_vocal,	/* Vocal assist ON/OFF		*/
#if 0
			po_mic,		/* Micphone NO/YES		*/
#endif
			po_shiftup, 	/* Karaoke shift up		*/
			po_resume, 	/* Karaoke resume		*/
			po_shiftdn,  	/* Karaoke shift down		*/
#ifdef ZOOM
			po_zoom,	/* Zoom in-out 			*/
#endif
#ifdef ECHO
			po_echoup,	/* Echo plus			*/
			po_echodn,	/* Echo minus			*/
#endif
#ifdef SVIDEO
			po_svideo,	/* Turn S-video on/off		*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -