vfd_drv_mcu810.c
上传用户:poi891205
上传日期:2013-07-15
资源大小:9745k
文件大小:4k
源码类别:

DVD

开发平台:

C/C++

  1. //FUNCTION:  
  2. //1. Write SET cmd to MCU810 
  3. //2. Write IR customer ID and POWER KEY value 
  4. //note: if only set cmd ,call write_pmp_mcu810( bCmd, 0) 
  5. void write_pmp_mcu810(BYTE bCmd, BYTE bData) 
  6. {    
  7.     switch(bCmd) 
  8.     { 
  9.         case CMD_PMP_IS_BUSY: 
  10.              regs0->iop_data[2] = (bCmd<<8)|bData; 
  11.           regs0->iop_data[0] = (regs0->iop_data[0] & 0x0ff8) 
  12.            | (FUN_PMP_MCU810 | PMP_IS_BUSY);    
  13.           WaitIopFunRdy(IOP_RDY_WAIT);              
  14.              break; 
  15.         case CMD_PMP_IS_UNBUSY: 
  16.              regs0->iop_data[2] = (bCmd<<8)|bData; 
  17.           regs0->iop_data[0] = (regs0->iop_data[0] & 0x0ff8)  
  18.           | (FUN_PMP_MCU810 | PMP_IS_UNBUSY);    
  19.           WaitIopFunRdy(IOP_RDY_WAIT);                      
  20.              break; 
  21.         case CMD_PMP_POWER_OFF: 
  22.              regs0->iop_data[2] = (bCmd<<8)|bData; 
  23.           regs0->iop_data[0] = (regs0->iop_data[0] & 0x0ff8)  
  24.           | (FUN_PMP_MCU810 | PMP_POWER_OFF);   
  25.           WaitIopFunRdy(IOP_RDY_WAIT);                  
  26.              break; 
  27.         case CMD_WRITE_IR_HEAD_H: 
  28.              regs0->iop_data[2] = (bCmd<<8)|bData; 
  29.           regs0->iop_data[0] = (regs0->iop_data[0] & 0x0ff8)  
  30.           | (FUN_PMP_MCU810 | WRITE_IR_HEAD_H);  
  31.           WaitIopFunRdy(IOP_RDY_WAIT);   
  32.              break; 
  33.         case CMD_WRITE_IR_HEAD_L: 
  34.              regs0->iop_data[2] = (bCmd<<8)|bData; 
  35.           regs0->iop_data[0] = (regs0->iop_data[0] & 0x0ff8)  
  36.           | (FUN_PMP_MCU810 | WRITE_IR_HEAD_L);       
  37.           WaitIopFunRdy(IOP_RDY_WAIT);    
  38.              break; 
  39.         case CMD_WRITE_POWER_KEY: 
  40.              regs0->iop_data[2] = (bCmd<<8)|bData;              
  41.           regs0->iop_data[0] = (regs0->iop_data[0] & 0x0ff8)  
  42.           | (FUN_PMP_MCU810 | WRITE_POWER_KEY);     
  43.           WaitIopFunRdy(IOP_RDY_WAIT);  
  44.              break;         
  45.         default: 
  46.              regs0->iop_data[2] = (bCmd<<8)|bData; 
  47.           regs0->iop_data[0] = (regs0->iop_data[0] & 0x0ff8) 
  48.            | (FUN_PMP_MCU810 | PMP_IS_BUSY);    
  49.           WaitIopFunRdy(IOP_RDY_WAIT);              
  50.              break;   
  51.     } 
  52. #ifdef PMP_MCU810 
  53. BYTE Bat_Data;
  54. void polling_vfdr(void) 
  55.    BYTE keydata; 
  56.    keydata=(BYTE)(regs0->iop_data[3]&0x00ff); 
  57.    Bat_Data=(BYTE)((regs0->iop_data[7]&0xff00)>>8); 
  58. }
  59. int batflag=0;
  60. void Show_PMP_Bat(void)
  61. {int bat;
  62.   bat=Bat_Data;  
  63. if (bat>=(0xff-Bat_var))
  64.       {
  65.        batflag=3;Drawpic_Bat(batflag);
  66.       }
  67.    else if(((0xff-2*Bat_var)<=bat)&&(bat<(0xff-Bat_var)))
  68.       {
  69.        batflag=2;Drawpic_Bat(batflag);
  70.        }
  71.    else if(((0xff-3*Bat_var)<=bat)&&(bat<(0xff-2*Bat_var)))
  72.       {
  73.        batflag=1;Drawpic_Bat(batflag);
  74.        }
  75.    else if(bat<(0xff-3*Bat_var))
  76.       {
  77.        batflag=0;Drawpic_Bat(batflag);
  78.     } 
  79.    //s else if(bat<(0xff-4*Bat_var))
  80.     //psprintf(RegionValStr[REGION2], "KEY: %d bat:%x", batflag, Bat_Data); 
  81.   // PrintOsdMsg(STR_OS_SPACE, REGION2, 0, 1); 
  82.        // system_sleep();  
  83.    
  84. }
  85.  
  86.  
  87. void Drawpic_Bat( int flag)
  88. switch(flag) 
  89.     {
  90.      case 0:
  91.      DrawRect(280,18,40,20, 0,WHITE_Y,WHITE_CRCB);
  92.     DrawRectEdge(280, 18, 40,20, 0x40,BK_GROUNDCRCB);
  93.         DrawRectEdge(320, 25, 4,6, 0x40,BK_GROUNDCRCB);
  94.         //DrawRect(280,20,20,20, 0,0x40,BK_CRCB);
  95.         break;
  96.         case 1:
  97.         DrawRect(293,18,27,20, 0,WHITE_Y,WHITE_CRCB);
  98.         DrawRect(281,22,12,12, 0,0x60,0x7070);
  99.         DrawRectEdge(280, 18, 40,20, 0x40,BK_GROUNDCRCB);
  100.         DrawRectEdge(320, 25, 4,6, 0x40,BK_GROUNDCRCB);
  101.         break;
  102.         case 2:
  103.         DrawRect(307,18,13,20, 0,WHITE_Y,WHITE_CRCB);
  104.         DrawRect(281,20,12,16, 0,0x60,0x7070);
  105.         DrawRect(295,20,12,16, 0,0x60,0x7070);
  106.         DrawRectEdge(280, 18, 40,20, 0x40,BK_GROUNDCRCB);
  107.         DrawRectEdge(320, 25, 4,6, 0x40,BK_GROUNDCRCB);
  108.         break;
  109.         case 3:
  110.         DrawRect(281,20,12,16, 2,0x60,0x7070);
  111.         DrawRect(295,20,12,16, 2,0x60,0x7070);
  112.         DrawRect(309,20,11,16, 2,0x60,0x7070);
  113.         DrawRectEdge(280, 18, 40,20, 0x40,BK_GROUNDCRCB);
  114.         DrawRectEdge(320, 25, 4,6, 0x40,BK_GROUNDCRCB);
  115.         break;
  116.      }
  117. #endif