📄 ui_input_uart.c
字号:
//OEC_SMZ_0002G : Added UART communication for external ucom.
/* **************************************************************************************
*
* File: $Workfile: UART_LUT.c $
*
* Description:
* ============
* UART input sequence
*
**************************************************************************************** */
#include "Config.h" // Global Configuration - do not remove!
#include "Include\sysdefs.h"
#if (defined OEC_UART_SUPPORT)
#include "kernel\eventdef.h"
#include "UI_Manager\UI_Input\ui_input_fp.h"
#include "UI_Manager\UI_Input\ui_input_uart.h"
#include "UI_Manager\UIOP_Lib\uiop_lib.h"
//#include "Playcore\Coremain\corenvg.h"
#include "Playcore\Coremain\coregdef.h"
#include "CoreAPI\CoreAPI.h"
#include "CoreAPI\DeviceManager.h"
extern void usleep(unsigned long usec);
extern void delay_us(ULONG period_us );
static BOOL return_cmd = FALSE;
static BYTE return_tray_state_opening = 0;
static unsigned char reply_value_of_com[5];
static unsigned char reply_value_0 = 0xff;
static unsigned char reply_value_1 = 0xff;
static unsigned char reply_value_2 = 0xff;
static unsigned char reply_value_3 = 0x00;
static unsigned char reply_value_4 = 0x00;
UINT16 UI_ConvertUARTKeyToUICC( UINT16 wUARTKey)
{
UINT16 UIKey; // Hold the key code
static BYTE p_off_cnt = 1;
static char return_char = '+';
static BYTE display_status_cnt = 0;
static BYTE last_display_status = 1;
static UINT8 colorbar_status = FALSE;
BYTE display_status = 0;
colorbar_status = colorbar_status; //dummy
return_cmd = TRUE;
return_char = '+';
UIKey = UICC_NULL; //No define key input
usleep(1000L);
#if 0
if (wUARTKey<0) {
Putch2('-');
return UIKey;
}
#endif
// During power status is 'POWER_SEQUENCE_OFF_REQUESTED',we must only reply to PowerStatusRequest.
// We don't finish confirmation of this process yet, so we only apply it to RgbOutSystem.
if (g_power_state == POWER_SEQUENCE_OFF_REQUESTED) {
if (wUARTKey != '#') {
return UIKey;
}
}
if (g_power_state == POWER_SEQUENCE_IN_OFF_STATE) {
if ((wUARTKey == '%') || (wUARTKey == '$')) {
return UIKey;
}
}
/* --- process PowerStatusRequest Command --- */
if (wUARTKey == '#') {
switch (g_power_state){
case POWER_SEQUENCE_IN_OFF_STATE:
if ( p_off_cnt != 0 ) {
Putch2('=');
p_off_cnt --;
break;
}
Putch2(']'); /* 2nd Power Off */
break;
case POWER_SEQUENCE_OFF_REQUESTED:
Putch2('=');
break;
case POWER_SEQUENCE_IN_ON_STATE:
Putch2('['); /* 2nd Power On*/
break;
default:
break;
}
return UIKey;
}
/* --- process PlaybackStatusRequest Command --- */
else if (wUARTKey == '$') {
#if 0
if ((gcs.mstate == MST_UPDATE_DISC) && (get_power_on_first() == FALSE))
Putch2('*'); /* FW Update Ready */
else
{
#endif
switch (gcs.pstate){
case PST_PLAY:
case PST_PAUSE:
case PST_STILL:
case PST_SCAN:
case PST_SLOW:
case PST_WAIT_UI:
Putch2('{'); /* During Playback */
break;
case PST_STOP:
Putch2('}'); /* During Stop */
break;
default:
break;
}
// }
return UIKey;
}
/* --- process DisplayStatusRequest Command --- */
else if (wUARTKey == '%') {
if (SI_DVD_BUTTON_COUNT >= 1) // Check exist of DVD Button
display_status = 0;
else if (gcs.mZoomLevel != NO_ZOOM) // Check Zoom Mode
display_status = 0;
#if 0
else if ((osd_2nd_line & 0x60) != 0) // Check Spatializer & karaoke display
display_status = 0;
else if ( (g_disc_type == DEC_DISC_TYPE_CDDA) && PRESSED_AGAIN(UICC_AUDIO) && (gcs.pstate == PST_PLAY) ) /* O-I64-269 */
display_status = 0;
else
{
switch(g_ui_active_menu_id){ // Check Other Modes
case SETUP_MENU_ID: // Setup Mode
case MODE_MENU_ID: // Runtime Play Mode
case MODE_RUN_TIME_MENU_ID: // Play Mode
case TIME_MENU_ID: // Search Mode
case PASSWORD_MENU_ID: // for when change parental level during executing PGC process
case BOOKMARK_MENU_ID: // Marker Mode
case CLIPS_MENU_ID:
case TRACK_SEARCH_MENU_ID: // Jump Mode
case DIGEST_MENU_ID: // thumbnail menu
#ifdef D_DIVX_EXTERNAL_SUBTITLE_SELECTION
case DIVX_EXTERNAL_SUBTITLE_SELECTION_MENU_ID: // divx external subtitle menu // OEC_TAN_0688 I76-DivX-#40 : Modified the cursol key operation of external subtitle.(combo model)
case DIVX_AUTHORIZATION_ERROR_MSG_MENU_ID:
case DIVX_RENTAL_CONFIRM_MENU_ID:
case DIVX_RENTAL_EXPIRED_MSG_MENU_ID:
#endif
display_status = 0;
break;
default:
display_status = 1;
break;
}
}
#endif
if ( display_status == 0)
{
display_status_cnt = 5;
Putch2('[');
}
else
{
if (last_display_status == 0 )
display_status_cnt = 5;
if ( display_status_cnt != 0 )
Putch2('[');
else
Putch2(']');
}
last_display_status = display_status;
return UIKey;
}
/* --- for Other commands which are not corresponded now --- */
else if (wUARTKey == '('){ /* ScreenSizeRequest */
Putch2(']'); // Setting is not Wide or Picture is not Wide
return UIKey;
}
/* --- process TrayStatusRequest Command --- */
else if (wUARTKey == ')'){
switch(DeviceManager_GetDeviceState(DEVICE_DISC))
{
case DEVICE_TRAY_OPENED:
return_tray_state_opening = 0;
Putch2('>'); /* <- tray is opened */
break;
case DEVICE_LOADING:
case DEVICE_READY:
case DEVICE_UNKNOWN:
case DEVICE_NO_DEVICE:
Putch2('<'); /* <- tray is closed */
break;
default:
break;
}
return UIKey;
}
/* --- process OneTouchiReplya Command --- */
else if (wUARTKey == 'a') {
Putch2('+');
#ifdef ONE_TOUCH_REPLAY
ui_input_handler(UICC_ONE_TOUCH_REPLAY);
#endif //ONE_TOUCH_REPLAY
return UIKey;
}
/* --- process SetOsdLanguage Command --- */
else if (wUARTKey == 'b'){
int time_out = 50;
Putch2('+');
while( !(inport(SxSTS) & SER_RDR) && (time_out != 0) )
{
time_out --;
usleep( 20000L );
}
if (time_out)
{
wUARTKey = Getch2();
if ((wUARTKey >=0x30) &&
(wUARTKey <=0x39))
{
#if 0
wUARTKey = wUARTKey-0x30;
if (wUARTKey == 0x09)
wUARTKey = 0x05;
osd_lng_change(wUARTKey);
#endif
Putch2('+');
}
}
return UIKey;
}
/* --- process SetResumeStopTimer Command --- */
else if (wUARTKey == 'g'){
Putch2('+');
#ifdef ENABLE_PPK
if( (gcs.mstate != MST_TRAY_OPENING) && (gcs.mstate != MST_TRAY_OPEN) ){
ppk_control |= SRST_SET;
ppk_action( SET_STOP_TIMER );
if( gcs.pstate != PST_PAUSE )
set_resend_ppk_code(UICC_PAUSE);
}else if( gcs.mstate == MST_LOADING ){
ppk_control |= SRST_KEEP;
}
#endif
return UIKey;
}
/* --- process ReleaseStopTimer Command --- */
else if (wUARTKey == 'h'){
Putch2('+');
#ifdef ENABLE_PPK
ppk_control = RRST_SET;
ppk_timer = 0;
retry_ppk_code_interval = 0;
last_ppk_code = 0;
g_ui_tmp_msg_cnt = 2; // display current status
#endif
return UIKey;
}
/* --- process SETUP_WARNING_ON Command --- */
else if (wUARTKey == 'l'){
Putch2('+');
return UIKey;
}
/* --- process SETUP_WARNING_OFF Command --- */
else if (wUARTKey == 'm'){
Putch2('+');
return UIKey;
}
/* --- process PSO Warning Command --- */
else if (wUARTKey == 'u'){
Putch2('+');
#ifndef DONT_USE_PROGRESSIVE
// if (gps->prog_inter_select == 1)
// ui_tmp_msg_return_menu(S_PSO_PROHIBIT);
#endif
return UIKey;
}
/* --- process Spindle Down Command --- */
else if (wUARTKey == 'v'){
Putch2('+');
return UIKey;
}
/* --- process Start Reading Command --- */
else if (wUARTKey == 'w'){
Putch2('+');
return UIKey;
}
/* --- process TrayLock Command --- */
else if (wUARTKey == 'x'){
Putch2('+');
#ifdef ENABLE_TRAY_LOCK
#ifdef TRAY_LOCK_UART_COMMAND
check_active_menu();
tray_lock();
#endif
#endif
return UIKey;
}
/* --- process PlaybackStatusRequest2 Command --- */
else if (wUARTKey == '!'){
set_reply_value();
Putch2(reply_value_of_com[0]);
usleep(3000L);
if (return_cmd)
Putch2(reply_value_of_com[1]);
else
return UIKey;
usleep(3000L);
if (return_cmd)
Putch2(reply_value_of_com[2]);
else
return UIKey;
usleep(3000L);
if (return_cmd)
Putch2(reply_value_of_com[3]);
else
return UIKey;
usleep(3000L);
if (return_cmd)
Putch2(reply_value_of_com[4]);
return UIKey;
}
else if (wUARTKey == '0')
UIKey = UICC_0;
else if (wUARTKey == '1')
UIKey = UICC_1;
else if (wUARTKey == '2')
UIKey = UICC_2;
else if (wUARTKey == '3')
UIKey = UICC_3;
else if (wUARTKey == '4')
UIKey = UICC_4;
else if (wUARTKey == '5')
UIKey = UICC_5;
else if (wUARTKey == '6')
UIKey = UICC_6;
else if (wUARTKey == '7')
UIKey = UICC_7;
else if (wUARTKey == '8')
UIKey = UICC_8;
else if (wUARTKey == '9')
UIKey = UICC_9;
else if (wUARTKey == '@')
UIKey = UICC_POWER; //Power
else if (wUARTKey == 'A')
UIKey = UICC_EJECT; //Open/Close
// else if (wUARTKey == 'a')
// UIKey = UICC_ONE_TOUCH_REPLAY; //one_touch_replay
else if (wUARTKey == 'B')
UIKey = UICC_PLAY; //Play
else if (wUARTKey == 'C')
UIKey = UICC_STOP; //Stop
else if (wUARTKey == 'D')
UIKey = UICC_FASTF; //Search+
else if (wUARTKey == 'd')
UIKey = UICC_FASTR; //Search-
else if (wUARTKey == 'E')
UIKey = UICC_SKIPF; //Skip+
else if (wUARTKey == 'e')
UIKey = UICC_SKIPB; //Skip-
else if (wUARTKey == 'F')
UIKey = UICC_SLOWF; //Slow+
else if (wUARTKey == 'f')
UIKey = UICC_SLOWB; //Slow-
else if (wUARTKey == 'G')
UIKey = UICC_PAUSE; //Still/Pause
else if (wUARTKey == 'H')
UIKey = UICC_DISPLAY; //Display
else if (wUARTKey == 'I')
UIKey = UICC_CLEAR; //Clear
else if (wUARTKey == 'J')
UIKey = UICC_AUDIO; //Audio
else if (wUARTKey == 'K')
UIKey = UICC_ANGLE; //Angle
else if (wUARTKey == 'L')
UIKey = UICC_SUBTITLE; //Subtitle
else if (wUARTKey == 'M')
UIKey = UICC_TITLE; //Title
else if (wUARTKey == 'N')
UIKey = UICC_SETUP; //Setup
else if (wUARTKey == 'O')
UIKey = UICC_RETURN; //Return
else if (wUARTKey == 'P')
UIKey = UICC_MENU; //Menu
else if (wUARTKey == 'Q')
UIKey = UICC_UP; //Up
else if (wUARTKey == 'R')
UIKey = UICC_DOWN; //Down
else if (wUARTKey == 'S')
UIKey = UICC_LEFT; //Left
else if (wUARTKey == 'T')
UIKey = UICC_RIGHT; //Right
else if (wUARTKey == 'U')
UIKey = UICC_ENTER; //Select
else if (wUARTKey == 'V')
UIKey = UICC_MODE; //Playmode
// else if (wUARTKey == 'W')
// UIKey = UICC_MARK; //Marker
else if (wUARTKey == 'X')
UIKey = UICC_MARKAB; //Repeat a-b
else if (wUARTKey == 'Y')
UIKey = UICC_ZOOM; //Zoom
else if (wUARTKey == 'Z')
UIKey = UICC_SEARCH; //Jump
// else if (wUARTKey == ':')
// UIKey = UICC_OSD_OFF; //Set OSD Display Prohibit Mode
// else if (wUARTKey == ';')
// UIKey = UICC_OSD_ON; //Release OSD Display Prohibit Mode
// else if (wUARTKey == 'l')
// UIKey = UICC_SETUP_WARNING_ON; //setup warning display on
// else if (wUARTKey == 'm')
// UIKey = UICC_SETUP_WARNING_OFF; //setup warning display off
#ifdef OEC_I76_I77_BOARD
else if (wUARTKey == 'p')
UIKey = UICC_HDMI; //select HDMI output
#endif
else if (wUARTKey == 'q')
{
int time_out = 50;
Putch2('+');
while( !(inport(SxSTS) & SER_RDR) && (time_out != 0) )
{
time_out --;
usleep( 20000L );
}
#if 0
if (time_out)
{
wUARTKey = Getch2();
if ((wUARTKey >=0x30) &&
(wUARTKey <=0x39))
{
Putch2('+');
uicc_initial_num = wUARTKey-0x30;
switch ( SETTING_NUM )
{
case 0:
break;
case 1:
if ((uicc_initial_num != 1) &&
(uicc_initial_num != 2) &&
(uicc_initial_num != 3) &&
(uicc_initial_num != 6) &&
(uicc_initial_num != 7) &&
(uicc_initial_num != 9) )
uicc_initial_num = 0xff;
break;
case 4:
if (uicc_initial_num != 4)
uicc_initial_num = 0xff;
break;
case 5:
if (uicc_initial_num != 5)
uicc_initial_num = 0xff;
break;
case 8:
if (uicc_initial_num != 8)
uicc_initial_num = 0xff;
break;
default:
uicc_initial_num = 0xff;
break;
}
if ((gcs.mstate == MST_NO_DISC) || (gcs.mstate == MST_TRAY_OPEN))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -