Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
sleep.c
Upload User: caisangzi8
Upload Date: 2013-10-25
Package Size: 15756k
Code Size: 19k
Category:
DVD
Development Platform:
C/C++
- //
- // FILE
- // sleep.c
- //
- // DESCRIPTION
- // provide sleep functionality
- //
- //terry,2004/9/21 10:16PM , add risc can work when standby mode
- //
- #include "config.h"
- #include "global.h"
- #include "regmap.h"
- #include "pu8560.h"
- #include "cpu.h"
- #include "func.h"
- #include "gpio.h"
- #include "hwif.h"
- #include "tvif.h"
- #ifdef PMP_MCU810
- #include "vfd.h"
- #endif
- #ifdef TP6317_PANNEL //yaowh add 04-10-25
- extern BYTE TP6317_Power ;
- #endif
- #ifdef RISC_ALIVE_STANDBY // 2004/10/01 yltseng
- #include "iop.h"
- #include "uartsup.h"
- #include "ircode.h"
- #endif
- //#include "auddac.h"
- //#include "ircode.h" /* alan 02-05-21 added for IRC_POWER */
- #ifndef DVDRELEASE
- #include "sio.h"
- #include "emuio.h"
- #endif
- #ifdef DVD_SERVO_REAL_TURN_OFF//nono rename 4-12-30 11:18//NO_DVD_SERVO //ycwen 2004/08/10
- extern void servo_turn_off(void);
- #endif
- #define SAFE_AUTO_POWEROFF//nono set it. 4-7-22 23:46 Because servo need longer time to finish when trayout.
- #define ROM_ISA_ENABLE (1<<15)
- #define HW_RESET_GLOBAL (1<<0) // 1-shot global reset
- #define HW_RESET_AGDC_MMU (1<<1) // will/may hang up system
- #define HW_RESET_STC (1<<2)
- #define HW_RESET_IOP (1<<3)
- #define HW_RESET_HOST (1<<4) // ATAPI/UDE/CSS/CDDSP
- #define HW_RESET_AUD (1<<5) // DSP/DSP3IF/DVDAUD
- #define HW_RESET_VDEC (1<<6) // VLD/INVQ/IDCT/MC/OGT(?)
- #define HW_RESET_DISPLAY (1<<7) // VPP/OSD
- #define HW_RESET_SIO0 (1<<8)
- #define HW_RESET_UART0 (1<<9)
- #define HW_RESET_UART1 (1<<10)
- #ifdef SCART_TV
- #define SET_SCART_RGB(d) ((d) ? (regs0->gpio_out[39 / 16] |= (0x1 << (39 % 16))) : (regs0->gpio_out[39 / 16] &= ~(0x1 << (39 % 16))))
- #define SET_SCART_SW(d) ((d) ? (regs0->gpio_out[38 / 16] |= (0x1 << (38 % 16))) : (regs0->gpio_out[38 / 16] &= ~(0x1 << (38 % 16))))
- #define SET_SCART_TV(d) ((d) ? (regs0->gpio_out[37 / 16] |= (0x1 << (37 % 16))) : (regs0->gpio_out[37 / 16] &= ~(0x1 << (37 % 16))))
- #elif defined(KSD_SCART_TV)
- #define SET_SCART_RGB(d) ((d) ? (regs0->gpio_out[57 / 16] |= (0x1 << (57 % 16))) : (regs0->gpio_out[57 / 16] &= ~(0x1 << (57 % 16))))
- //#define SET_SCART_SW(d) ((d) ? (regs0->gpio_out[18 / 16] |= (0x1 << (18 % 16))) : (regs0->gpio_out[18 / 16] &= ~(0x1 << (18 % 16))))
- #elif defined(SCART_TV_2) //wanghaoying 2003-8-13 15:11 added
- #define SET_SCART_RGB(d) ((d) ? (regs0->gpio_out[57 / 16] |= (0x1 << (57 % 16))) : (regs0->gpio_out[57 / 16] &= ~(0x1 << (57 % 16))))
- #define SET_SCART_SW(d) ((d) ? (regs0->gpio_out[18 / 16] |= (0x1 << (18 % 16))) : (regs0->gpio_out[18 / 16] &= ~(0x1 << (18 % 16))))
- #ifdef NIN_SCART_TV //fangang added 4-2-11 17:02
- #define SET_SCART_TV(d) ((d) ? (regs0->gpio_out[2 / 16] |= (0x1 << (2 % 16))) : (regs0->gpio_out[2 / 16] &= ~(0x1 << (2 % 16))))
- #endif
- #ifdef YILI_SCART_TV //hq add, use 31 pin control TV-AV switch, 4-2-17 9:40
- #define SET_SCART_TV(d) ((d) ? (regs0->gpio_out[4 / 16] |= (0x1 << (4 % 16))) : (regs0->gpio_out[4 / 16] &= ~(0x1 << (4 % 16))))
- #endif
- #elif defined(SCART_TV_3) //wanghaoying 2003-9-12 11:28 added
- #define SET_SCART_RGB(d) ((d) ? (regs0->gpio_out[57 / 16] |= (0x1 << (57 % 16))) : (regs0->gpio_out[57 / 16] &= ~(0x1 << (57 % 16))))
- #define SET_SCART_SW(d) ((d) ? (regs0->gpio_out[18 / 16] |= (0x1 << (18 % 16))) : (regs0->gpio_out[18 / 16] &= ~(0x1 << (18 % 16))))
- #define SET_SCART_SW1(d) ((d) ? (regs0->gpio_out[14 / 16] |= (0x1 << (14 % 16))) : (regs0->gpio_out[14 / 16] &= ~(0x1 << (14 % 16))))
- #elif defined(SCART_TV_4) //nono 2003-9-26 1:44 for himage HJ-018
- #define SET_SCART_RGB(d) ((d) ? (regs0->gpio_out[3 / 16] |= (0x1 << (3 % 16))) : (regs0->gpio_out[3 / 16] &= ~(0x1 << (3 % 16))))
- #ifdef HJ_021_SCART
- #define SET_SCART_SW1(d) ((d) ? (regs0->gpio_out[4 / 16] |= (0x1 << (4 % 16))) : (regs0->gpio_out[4 / 16] &= ~(0x1 << (4 % 16))))
- #define SET_SCART_SW(d) ((d) ? (regs0->gpio_out[2 / 16] |= (0x1 << (2 % 16))) : (regs0->gpio_out[2 / 16] &= ~(0x1 << (2 % 16))))
- #else//#ifdef HJ_021_SCART
- #define SET_SCART_SW(d) ((d) ? (regs0->gpio_out[4 / 16] |= (0x1 << (4 % 16))) : (regs0->gpio_out[4 / 16] &= ~(0x1 << (4 % 16))))
- #define SET_SCART_SW1(d) ((d) ? (regs0->gpio_out[2 / 16] |= (0x1 << (2 % 16))) : (regs0->gpio_out[2 / 16] &= ~(0x1 << (2 % 16))))
- #endif//#ifdef HJ_021_SCART
- #elif defined(SCART_TV_5)//wangfeng 2003-12-2 11:43 for himage HJ-023
- #define SET_SCART_RGB(d) ((d) ? (regs0->gpio_out[63 / 16] |= (0x1 << (63 % 16))) : (regs0->gpio_out[63 / 16] &= ~(0x1 << (63 % 16))))
- #define SET_SCART_SW(d) ((d) ? (regs0->gpio_out[62 / 16] |= (0x1 << (62 % 16))) : (regs0->gpio_out[62 / 16] &= ~(0x1 << (62 % 16))))
- #define SET_SCART_SW1(d) //((d) ? (regs0->gpio_out[2 / 16] |= (0x1 << (2 % 16))) : (regs0->gpio_out[2 / 16] &= ~(0x1 << (2 % 16))))
- #endif
- extern int atapi_standby_mode(void);
- extern void run_close_tray(UINT8);
- extern int atapi_p_mechanism_status(void);
- extern void ircmd_trayin(void);
- extern void reset_iop();
- extern int standby_cnt;
- extern const BYTE vfd_keycode[40];
- #if 0 //terry,2004/7/23 10:23PM, it's seem no use.
- void __system_stop(void)
- {
- //init_vfd_clear();
- run_close_tray(1); // loader
- #if !defined(SUPPORT_TUNER_MV114) && !defined(SUPPORT_TUNER_ALPS) //xyy 2003-9-22 10:50
- regs0->reset =
- HW_RESET_HOST | // atapi
- HW_RESET_AUD | // audio DSP
- HW_RESET_VDEC | // video decoder
- HW_RESET_SIO0 |
- //HW_RESET_DISPLAY | // video
- HW_RESET_UART0;
- //HW_RESET_UART1 // debug port
- #endif
- }
- #endif
- static inline void system_tuner_sleep(void)
- {
- tv_sleep();
- #if 0
- regs0->rom_config = (1 << 15) // rom run slow
- | (15 << 0)
- | (15 << 4)
- | (15 << 8);
- #endif
- delay_srv_10ms(10);
- cpu_intr_disable();
- regs0->intr_mask = 0;
- regs0->intr_flag = -1;
- }
- static inline void disable_tv(void)
- {
- // disable tv-encoder
- tv_sleep();
- #ifdef YILI_SCART_TV //hq added, use 31 pin control TV-AV switch, 4-2-11 16:59
- SET_SCART_TV(1);
- #endif
- #ifdef NIN_SCART_TV //fangang added 4-2-11 16:59
- SET_SCART_TV(1);
- #endif
- #ifdef SUPPORT_SCART_TV//SPHE8202//nono 4-3-27 21:35
- SET_SCART_GPIO_SFT_CFG_CTRL();
- SET_SCART_TO_TV();
- #endif//SPHE8202
- }
- static inline void close_tray_func(void)
- {
- #ifdef GBM_DVD
- run_close_tray(0); // gerry for gbm use old servo code,if we update servo,maybe we need not this. 2004-2-7 15:42
- #elif !defined(TOP_DOOR_FOR_NGAILIK) //hq add for ngailik, in order to wake up the system after power off-on quickly switch. 2004-3-3 17:38
- #ifdef SAFE_AUTO_POWEROFF//nono 20040327
- if (atapi_p_mechanism_status()==0/*ATAPI_DOOR_OPEN*/)
- ircmd_trayin();//nono 2004-3-27 16:27 for auto_poweroff.
- else
- run_close_tray(1); // Robert 2003/12/16
- #else//SAFE_AUTO_POWEROFF
- run_close_tray(1); // Robert 2003/12/16
- #endif//SAFE_AUTO_POWEROFF
- #endif
- }
- static inline void led_light(void)
- {
- #ifdef USE_VFD_LED_AS_IO //xyy add for Oritron
- write_vfd_led(0x01);
- #endif
- #ifdef KENLOON_PANEL3
- write_vfd_led(0xff); //wangap add 2004/6/29
- #endif
- #ifdef USE_VFD_LED_POWER
- #ifdef USE_VFD_LED_POWER_LOW
- write_vfd_led(0);
- #else
- #ifdef PROVIEW_DV_509
- write_vfd_led(0x8);
- #elif defined(VTREK_DVD)
- write_vfd_led(0x7);
- #else
- write_vfd_led(0xf);
- #endif
- #endif
- #endif
- #ifdef KSD_SCART_TV
- GPIO_O_SET(18,1);
- #endif
- #ifdef USE_CD_SENSE_PIN_AS_LED_GPIO //gerry,2004-2-10 18:33
- GPIO_O_SET(4,1);
- #endif//USE_CD_SENSE_PIN_AS_LED_GPIO
- #ifdef NINTAUS_612 //linrc add for nintaus 2004-7-6 13:57 when standby,the LED must light
- GPIO_O_SET(4,1);
- GPIO_O_SET(3,0);
- #endif
- #if defined(USE_VFDPORT_TO_KEYLIGHT_GBM)
- regs0->gpio_master[56 / 16] |= (0x1 << (56 % 16));//pin156
- regs0->gpio_oe[56 / 16] |= (0x7 << (56 % 16));
- regs0->gpio_out[56 / 16] |= (0x7 << (56 % 16));
- #elif defined(GPIO14_STANDBY_LED) //hq, 2004-3-20 15:52
- GPIO_O_SET(14,1);//turn on the Standby LED.
- #elif defined(USE_VFDPORT_TO_KEYLIGHT_MINTON)
- GPIO_O_SET(14,0);//off
- regs0->gpio_oe[54 / 16] |= (0x7 << (54 % 16));//nono 2003-9-1 23:50
- GPIO_O_SET(54,1);//off
- GPIO_O_SET(55,1);//off
- GPIO_O_SET(56,1);//off
- #elif defined(USE_VFD_GAME_PORT_TO_KEYBOARD_HJ_2290)
- GPIO_O_SET(54,1);//off
- GPIO_O_SET(55,1);//off
- GPIO_O_SET(56,1);//off
- #elif defined(USE_VFD_GAME_PORT_TO_KEYBOARD_HJ_DP313)
- GPIO_O_SET(3,1);
- GPIO_O_SET(62,1);
- GPIO_O_SET(63,1);
- #endif
- #ifdef GBM_SET_VFD_PIN_LOW_WHEN_STANDBY //set vfd pin low when standby for GBM TOP_DOOR_LOADER,gerry,2004/2/11 08:48