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

DVD

开发平台:

C/C++

  1. /*
  2. ** FUNCTION
  3. ** polling_vfdr
  4. **
  5. ** DESCRIPTION
  6. ** check if polling-ready
  7. ** 
  8. ** history:
  9. ** 2004-7-19 15:09
  10. ** wanghaoying move the following functio for ht1621 here
  11. */
  12. void reset_vfd(void)
  13. {
  14. UINT16 nIndex = 0;
  15. init_vfd_clear();
  16. /* display mode ? 13d15s or 6d16s add by chichang 2001/6/6 */
  17. #ifndef TEST_VFD //shawn modify at 910131
  18. regs0->iop_data[VFD_CMD] = VFDC_SET_DISP | VFD_DISPLAY_MODE; //2001/10/23
  19. #else
  20. regs0->iop_data[VFD_CMD] = VFDC_SET_DISP | COMMAND_MODE; //2002/01/31
  21. #endif
  22. regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  23. (FUN_VFD_WRITE | VFD_DAT_LEN0);
  24. //erase_vfd_mem();
  25. WaitIopFunRdy(IOP_RDY_WAIT);
  26. vfd_set_idle_state(nIndex);
  27. WaitIopFunRdy(IOP_RDY_WAIT);
  28. }
  29. void polling_vfdr(void) 
  30. #ifdef SUPPORT_SPI_QSI
  31.   //not use
  32. #endif
  33. #ifndef  SUPPORT_SPI_QSI
  34.     
  35. #ifdef SUPPORT_VFD
  36.     UINT8   i;
  37.     UINT32  temp;
  38.     UINT32  key_data;
  39.     static UINT8 count = 0;
  40.     static UINT32 key_previ = 0;
  41.     
  42.     static BYTE bWriteState=0;
  43.         
  44.     UINT32 *VfdReadData;
  45.     
  46.     if(regs0->iop_data[0] & FUN_MASK)       return;
  47.        
  48.     if(vfd_state == VFD_READ)
  49.     {
  50.         #ifndef USE_C_IOP//2004-2-12 12:08 lijd     
  51.         VfdReadData = ((UINT32 *) (SDRAM_BASE_UNCACHED + regs0->iopya * 1024 + 0x688));       //fengjl edit 2004-07-02 18:05
  52.         
  53.         //current is read 3 byte on io
  54.         key_data = *VfdReadData & 0x00ffffff;
  55.         *VfdReadData = 0; // Robert 030313
  56.         #else//USE_C_IOP
  57.         key_data =(regs0->iop_data[3]);
  58.         #endif//USE_C_IOP
  59.         
  60.         if(key_data == 0xffffff)
  61.             return;
  62.         if(key_data != key_previ)
  63.         {
  64.             
  65. #ifdef TWO_FUN_IN_ONE_VFD_KEY
  66.             //num_add_flag = 0;   //dingzhy 
  67.             key_previ_temp = key_previ;
  68. #endif //TWO_FUN_IN_ONE_VFD_KEY
  69.             key_previ = key_data;
  70.             if(key_data != 0)
  71.             {
  72.                 #ifdef TWO_FUN_IN_ONE_VFD_KEY
  73.                 key_press_time_count=0;
  74.                 #endif
  75.                                 
  76.                 for(i = 0; i < 24; i++)
  77.                 {
  78.                     temp = 0x01 << i;
  79.                     if(key_data & temp)
  80.                     {
  81.                         if (key_data > temp) // Robert 030224 for preventing illegal key_data
  82.                         {
  83.                             key_data = 0;
  84.                             return;
  85.                         }
  86.                         else
  87.                         {
  88.                             key_data = i + 1;
  89.                             break;
  90.                         }
  91.                     }
  92.                 }
  93.                 
  94.                 save_srn_start_t = get_rtc_val();
  95.                 
  96. #ifdef VFD_KEY_TEST
  97.                 psprintf(RegionValStr[REGION1], "KEY %02d F:%d", key_data, vfd_keycode[key_data - 1]);
  98.                 PrintOsdMsg(STR_OS_SPACE, REGION1, 1, 1);
  99. #else
  100.                 if((Is_JPEG_SlideMode()) && (vfd_keycode[key_data - 1] == IRC_PAUSE))
  101.                 {
  102.                     //Jeff 20020523
  103.                     bJpgVFDPause = 1;
  104.                 }
  105.                 else if((Is_JPEG_SlideMode()) &&
  106.                     ((vfd_keycode[key_data - 1] == IRC_PLAY) ||
  107.                     (vfd_keycode[key_data - 1] == IRC_PLAY_SELECT) ||
  108.                     (vfd_keycode[key_data - 1] == IRC_PLAY_RESUME)))
  109.                 {
  110.                     //bJpgVFDPause=0;
  111.                     bJpgVFDPause = 2;           //Jeff 20020525
  112.                     PrintOsdMsg(STR_OS_PLAY,REGION1,1,0);//nono 20030804
  113.                     ircmd_play();//nono 20031210
  114.                 }
  115.                 else if((Is_JPEG_SlideMode()) &&    //Jeff 20020527
  116.                     (vfd_keycode[key_data - 1] == IRC_PAUSEPLAY))
  117.                 {
  118.                     if(bJpgVFDPause == 0)
  119.                     {
  120.                         //bJpgVFDPause = 1;
  121.                         if(play_state == VCD_STATE_PAUSE)   //nono 2-6-28 14:00
  122.                             //bJpgVFDPause = 2;
  123.                             
  124.                         {
  125.                             bJpgVFDPause = 2;
  126.                             PrintOsdMsg(STR_OS_PLAY,REGION1,1,0);//nono 20030804
  127.                             ircmd_play();//nono 20031210
  128.                         }                            
  129.                         else
  130.                             bJpgVFDPause = 1;
  131.                     }
  132.                     else if(bJpgVFDPause == 1)
  133.                     {
  134.                         bJpgVFDPause = 2;
  135.                     }
  136.                 }
  137.                 else if(key_data<40)
  138.                 {
  139.                     extern UINT8 power_on;
  140.                     #ifdef NEXT_FORWARD_IN_A_KEY                    
  141.                     key_data_flag = 1;
  142.                     #endif
  143.                     if(power_on == 2)           //2-6-18 13:36 to avoid accepting a VFD_key in the beginning. 
  144.                     {
  145.                         power_on--;
  146.                         if(key_data != 1)
  147.                         {
  148. #ifdef TWO_FUN_IN_ONE_VFD_KEY                           
  149.                             if((vfd_keycode[key_data-1]!=IRC_NEXT) && (vfd_keycode[key_data-1]!=IRC_PREV))
  150. #endif //TWO_FUN_IN_ONE_VFD_KEY
  151.                             //save_srn_start_t = get_rtc_val();//axel moved to top 2004/2/4 06:13PM
  152.                             call_ir_func(vfd_keycode[key_data - 1]);
  153.                         }
  154.                     }
  155.                     else
  156.                     {
  157.                         //save_srn_start_t = get_rtc_val(); //axel moved to top 2004/2/4 06:13PM
  158. #ifdef USE_VFD_LED_TO_KEY_SOUND_INDICATE        //gerry for PANDA6950,3-8-23 17:19                  
  159.                         write_vfd_led(0);
  160. #elif defined(USE_VFD_LED_TO_KEY_SOUND_INDICATE_HI_ON)      //NONO 2003-10-15 16:14
  161.                         write_vfd_led(0xf);
  162. #endif                      
  163.                     
  164. #ifdef TWO_FUN_IN_ONE_VFD_KEY
  165.                         if((vfd_keycode[key_data-1]!=IRC_NEXT) && (vfd_keycode[key_data-1]!=IRC_PREV))
  166. #endif //TWO_FUN_IN_ONE_VFD_KEY
  167.                         call_ir_func(vfd_keycode[key_data - 1]);
  168.                     }
  169. #ifdef NEXT_FORWARD_IN_A_KEY                    
  170.                     key_data_flag = 0;
  171. #endif//#ifdef NEXT_FORWARD_IN_A_KEY
  172.                 }
  173. #endif
  174.         }
  175.         else{
  176. #ifdef TWO_FUN_IN_ONE_VFD_KEY
  177.             if((key_press_time_count>0)&&(key_press_time_count<15))
  178.             {
  179.                 if(vfd_keycode[keycode_to_num(key_previ_temp)-1]==IRC_NEXT)
  180.                     call_ir_func(IRC_VFD_NEXT);                 
  181.                 else if(vfd_keycode[keycode_to_num(key_previ_temp)-1]==IRC_PREV)
  182.                     call_ir_func(IRC_VFD_PREV);
  183.             }
  184.             key_press_time_count=0;  
  185. #endif //TWO_FUN_IN_ONE_VFD_KEY
  186. #ifdef QISHENG_DVD           
  187.              standby_cnt = 0;
  188. #endif 
  189.            }
  190.         }
  191. #ifdef QISHENG_DVD
  192.         else if ((key_data!=0))
  193.         {
  194.             if(standby_cnt)
  195.             {
  196.                 standby_cnt++;
  197.                 printf("*");
  198.                 if(standby_cnt==50)
  199.                 {
  200.                     vfd_state = VFD_WRITE;
  201.                     call_ir_func(IRC_POWER);
  202.                 }
  203.             }
  204.         }
  205. #endif      
  206.                 
  207.         vfd_state = VFD_WRITE;
  208.     }
  209.     
  210.     else
  211.     {
  212.         update_vfd_data();
  213. #if defined(SUPPORT_APOGEE_AMP) && defined(AMPVOL_ADJUST_TYPE1)//xyy 2004-4-14
  214.         if(full_scrn==APOGEEAMPVOL && timeout_osd[REGION1] == 0)
  215.         {
  216.             full_scrn = 0;
  217.             erase_vfd_mem();
  218.         }
  219. #endif
  220.         //int i;
  221. #ifdef AUTO_INTO_STANDBY   //for tonic dvd//20040206
  222.         //if(play_state==VCD_STATE_STOP||system_state==SYSTEM_NODISC)
  223.         if(system_state==SYSTEM_STOP||system_state==SYSTEM_NODISC||play_state==VCD_STATE_STOP)
  224.         {
  225.             //auto_standby_timer++;
  226.             //if(auto_standby_timer==100*60*30)
  227.             if(auto_standby_timer==100*60*25)
  228.             ircmd_power();
  229.         }
  230.         else
  231.             auto_standby_timer=0;
  232. #endif
  233.         switch (bWriteState)
  234.         {
  235.         case 0:
  236.             //update to reset mode
  237. #ifndef TEST_VFD
  238.             regs0->iop_data[VFD_CMD] = VFDC_SET_DISP | VFD_DISPLAY_MODE;
  239. #else
  240.             regs0->iop_data[VFD_CMD] = VFDC_SET_DISP | COMMAND_MODE;
  241. #endif      
  242.             
  243.             regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  244.                 (FUN_VFD_WRITE | VFD_DAT_LEN0);
  245.             
  246.             bWriteState++;
  247.             break;
  248.             
  249.         case 1:
  250.             regs0->iop_data[VFD_CMD] =
  251.                 VFDC_DISP_CTRL | VFDC_DISP_CTRL_ON | VFDC_DISP_CTRL_10_16;
  252.             
  253.             regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  254.                 (FUN_VFD_WRITE | VFD_DAT_LEN0);
  255.             
  256.             bWriteState++;
  257.             break;
  258. #ifdef  SM1623_DRIVER_VFD
  259.         case 2:             
  260.             
  261. //#if 1
  262.         //update in one polling
  263.             for(i=0;i<VFD_DISPLAY_SIZE;i+=4)       // fengjl upload  3-11-23 17:33
  264.             {
  265.                 regs0->iop_data[VFD_CMD] = (0xc0 | i);   // transfer  address   
  266.                 if((VFD_DISPLAY_SIZE-i)<=4)//modefied by wangfeng,2003-11-24 10:41
  267.                 {
  268.                     regs0->iop_data[VFD_DAT0] = vfd_mem[i + 1] << 8 | vfd_mem[i];
  269.                     regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  270.                     (FUN_VFD_WRITE | VFD_DAT_LEN2);
  271.                 }
  272.                 else
  273.                 {
  274.                     regs0->iop_data[VFD_DAT0] = vfd_mem[i + 1] << 8 | vfd_mem[i];
  275.                     regs0->iop_data[VFD_DAT1] = vfd_mem[i + 3] << 8 | vfd_mem[i + 2];
  276.                     regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  277.                     (FUN_VFD_WRITE | VFD_DAT_LEN4);
  278.                 }
  279.                 
  280.                 WaitIopFunRdy(IOP_RDY_WAIT);
  281.             }           
  282.             vfd_state = VFD_READ;
  283. /*#else//#if 1
  284.             //update by polling 10ms
  285.             regs0->iop_data[VFD_CMD] = (0xc0 | count);
  286.             if(count>=12)
  287.             {
  288.                 regs0->iop_data[VFD_DAT0] = vfd_mem[count + 1] << 8 | vfd_mem[count];
  289.             }
  290.             else
  291.             {
  292.                     regs0->iop_data[VFD_DAT0] = vfd_mem[count + 1] << 8 | vfd_mem[count];
  293.                     regs0->iop_data[VFD_DAT1] = vfd_mem[count + 3] << 8 | vfd_mem[count + 2];
  294.             }
  295.             //regs0->iop_data[VFD_DAT2] = vfd_mem[count + 5] << 8 | vfd_mem[count + 4];
  296.             if(count>=12)
  297.             {
  298.                     regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  299.                 (FUN_VFD_WRITE | VFD_DAT_LEN2);
  300.             }
  301.             else
  302.             {
  303.                 regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  304.                 (FUN_VFD_WRITE | VFD_DAT_LEN4);
  305.                 
  306.                 }
  307.             // transfer data size add by chichang 2001 6/6 
  308.             count += 4;
  309.             if(count >= VFD_DISPLAY_SIZE)
  310.             {
  311.                 count = 0;
  312.                 vfd_state = VFD_READ;
  313.             }
  314. #endif//#if 1*/
  315.             bWriteState=0;
  316.             break;
  317. #elif defined(GBM_LED6961_PANEL)            //gerry for GBM_LED_PANEL,2004-2-4 22:41
  318.         case 2:             
  319.             for(i=0;i<VFD_DISPLAY_SIZE;i+=2)
  320.             {
  321.                 regs0->iop_data[VFD_CMD] = (0xc0 | i);
  322.                 regs0->iop_data[VFD_DAT0] = vfd_mem[i + 1] << 8 | vfd_mem[i];
  323.                 regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  324.                 (FUN_VFD_WRITE | VFD_DAT_LEN2);
  325.                 WaitIopFunRdy(IOP_RDY_WAIT);        
  326.             }   
  327.             vfd_state = VFD_READ;   
  328.             bWriteState=0;
  329.             break;
  330. #else//GBM_LED6961_PANEL
  331.             
  332.         case 2:             
  333.             
  334. #if !defined(TP6311_DRIVER_VFD) && !defined(XINGQIU_RECEIVER_PANNEL)    //xyy
  335.             regs0->iop_data[VFD_CMD] = (0xc0 | count);
  336.             regs0->iop_data[VFD_DAT0] = vfd_mem[count + 1] << 8 | vfd_mem[count];
  337.             regs0->iop_data[VFD_DAT1] = vfd_mem[count + 3] << 8 | vfd_mem[count + 2];
  338.             #ifndef SKYWORTH_DVD
  339.             regs0->iop_data[VFD_DAT2] = vfd_mem[count + 5] << 8 | vfd_mem[count + 4];
  340.             #endif
  341.             regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  342.             #ifndef SKYWORTH_DVD
  343.                 (FUN_VFD_WRITE | VFD_DAT_LEN6);
  344.             
  345.             /* transfer data size add by chichang 2001 6/6 */
  346.             count += 6;
  347.             #else
  348.             (FUN_VFD_WRITE | VFD_DAT_LEN4);
  349.             /* transfer data size add by chichang 2001 6/6 */
  350.             count += 4;
  351.             #endif
  352.             
  353.             if(count == VFD_DISPLAY_SIZE)
  354.             {
  355.                 count = 0;
  356.                 vfd_state = VFD_READ;
  357.             }
  358. #else//#ifndef TP6311_DRIVER_VFD                                                     //marked by xyy 2003-10-31 19:42   
  359.             for(i = 0; i < VFD_DISPLAY_SIZE; i += 6)    //xyy 2003-10-31 19:42
  360.             {
  361.                 regs0->iop_data[VFD_CMD] = (0xc0 | i);
  362.                 regs0->iop_data[VFD_DAT0] = vfd_mem[i + 1] << 8 | vfd_mem[i];
  363.                 regs0->iop_data[VFD_DAT1] = vfd_mem[i + 3] << 8 | vfd_mem[i + 2];
  364.                 regs0->iop_data[VFD_DAT2] = vfd_mem[i + 5] << 8 | vfd_mem[i + 4];
  365.                 
  366.                 regs0->iop_data[0] = (regs0->iop_data[0] & VFD_DATLEN_MASK) |
  367.                     (FUN_VFD_WRITE | VFD_DAT_LEN6);
  368.                 
  369.                 WaitIopFunRdy(IOP_RDY_WAIT);
  370.             }
  371.             vfd_state = VFD_READ;
  372. #endif//#ifndef TP6311_DRIVER_VFD
  373.             bWriteState=0;
  374.             break;
  375. #endif//#ifdef  SM1623_DRIVER_VFD
  376.         }//write state control
  377.     }
  378. #elif defined(GPIO_KEY_LIGHT)//SUPPORT_VFD nono 3-8-18 14:41
  379.     check_gpio_keylight_status();
  380. #elif defined(USE_VFDPORT_TRANDATA)
  381.     Communication_And_MCU4051();       
  382. #endif//SUPPORT_VFD
  383. #endif//spi qsi
  384. }