tw88.lst
来自「显示屏驱动源代码」· LST 代码 · 共 1,576 行 · 第 1/5 页
LST
1,576 行
596 #endif
597 }
598
599 /*
600 void MakeStartInt(void)
601 {
602 MaskOffSYNCInt();
603
C51 COMPILER V7.06 TW88 02/21/2008 14:00:30 PAGE 11
604 WriteDecoder(0xd3, 0x02); // IRQ mask 2
605 WriteDecoder(0x4e, ReadDecoder(0x4e) | 0x08); // IRQ pin, active low
606 WriteDecoder(0x5b, 0x01); // Start measure
607 //WriteDecoder(0x5b, 0x00); // clear measure self cleared bit
608 WriteDecoder(0x5c, 0x07); // change error tolerance and enable V/HSYNC change/loss detection
609
610 SetEnDet(); // Set enable-detection
611 }
612 */
613 void Clear_bypass()
614 {
615 1 BYTE dat;
616 1
617 1 dat = ReadDecoder(TW88_XYSCALEHI);
618 1 WriteDecoder(TW88_XYSCALEHI, dat & 0xef); // xxx0 xxxx
619 1 }
620
621
622 WORD GetHactiveStart(void)
623 {
624 1 WORD buf;
625 1 BYTE val;
626 1
627 1 val = ReadDecoder(0x49);
628 1 buf = (WORD)(val & 0x07) << 8;
629 1 buf += ReadDecoder(0x47);
630 1
631 1 return buf;
632 1 }
633
634 /**** Not used */
635 WORD GetHactiveEnd(void)
636 {
637 1 WORD buf;
638 1 BYTE val;
639 1
640 1 val = ReadDecoder(0x49);
641 1 buf = (WORD)(val & 0xf0) << 4;
642 1 buf += ReadDecoder(0x48);
643 1
644 1 return buf;
645 1 }
646 /****/
647
648 //#ifdef DEBUG_TW88
649 WORD GetVactiveStart(void)
650 {
651 1 WORD buf;
652 1 BYTE val;
653 1
654 1 val = ReadDecoder(0x4d); // high 2 bits
655 1 buf = (WORD)(val & 0x03) << 8;
656 1 buf |= ReadDecoder(0x4a); // Vactive Odd field Line start position
657 1
658 1 return buf;
659 1 }
660 //#endif
661
662 #include "osdmenu.h"
663 extern CODE struct RegisterInfo UserRange;
664 extern CODE struct RegisterInfo PanelContrastRange;
665 extern CODE struct RegisterInfo PanelBrightnessRange;
C51 COMPILER V7.06 TW88 02/21/2008 14:00:30 PAGE 12
666 extern CODE struct RegisterInfo PanelSharpnessRange;
667 extern CODE struct RegisterInfo PanelHueRange;
668 extern CODE struct RegisterInfo PanelSaturationRange;
669
670 void GetInitPanelAttribute1(void)
671 {
672 1 BYTE rdata;
673 1 int regv;
674 1
675 1 rdata = GetPanelContrastEE();
676 1 Mapping1( rdata, &UserRange ,®v, &PanelContrastRange);
677 1 SetRGBContrast( GetPCColorTempModeEE(), (BYTE)regv );
678 1
679 1 rdata = GetPanelBrightnessEE() ;
680 1 Mapping1( rdata, &UserRange , ®v, &PanelBrightnessRange );
681 1 SelectPanelAttrRegGroup(GROUP_RGB); // Need to refresh "INDX_CB" bit // Hans
682 1 SetPanelBrightnessReg(RED, (BYTE)regv);
683 1 SetPanelBrightnessReg(GREEN, (BYTE)regv);
684 1 SetPanelBrightnessReg(BLUE, (BYTE)regv);
685 1
686 1 SelectPanelAttrRegGroup(GROUP_YCbCr);
687 1 SetDTVBrightnessReg(0x80);
688 1 SetDTVContrastReg(0x80);
689 1 SetPanelSaturationReg(U_SAT, 0x80);
690 1 SetPanelSaturationReg(V_SAT, 0x80);
691 1 }
692
693 #endif // SUPPORT_PC
694
695 //-------------------------------------------------------------------
696 // Set Active Region Functions
697 //-------------------------------------------------------------------
698 void SetHactiveStart(WORD hstart)
699 {
700 1 BYTE val;
701 1
702 1 #ifdef DEBUG_PC
dPrintf("\r\n === SetHactiveStart(%d)", hstart);
#endif
705 1 // TW8804 write LSByte first
706 1 val = ReadDecoder(0x49);
707 1 val = val & 0xf8;
708 1 val = val | (hstart>>8);
709 1
710 1 WriteDecoder(0x49, val);
711 1 WriteDecoder(0x47, (BYTE)hstart);
712 1 }
713
714 void SetHactiveEnd(WORD hend)
715 {
716 1 BYTE val, buf;
717 1
718 1 #ifdef DEBUG_PC
dPrintf("\r\n === SetHactiveEnd(%d)", hend);
#endif
721 1 // TW8804 write LSByte first
722 1 buf = (BYTE)(hend>>8)<<4;
723 1 val = ReadDecoder(0x49);
724 1 val = val & 0x0f;
725 1 val = val | buf;
726 1
727 1 WriteDecoder(0x49, val);
C51 COMPILER V7.06 TW88 02/21/2008 14:00:30 PAGE 13
728 1 WriteDecoder(0x48, (BYTE)hend);
729 1 }
730
731 void SetVactiveStart(WORD vstart)
732 {
733 1 BYTE val, v_h, v_l;
734 1
735 1 #ifdef DEBUG_PC
dPrintf("\r\n === SetVactiveStart(%d)", vstart);
#endif
738 1 // TW8804 write LSByte first
739 1 v_l = (BYTE)vstart;
740 1 v_h = (BYTE)(vstart>>8);
741 1
742 1 val = ReadDecoder(0x4d); // high 2 bits
743 1 val = (val & 0xf0);
744 1 val = val | (v_h<<2);
745 1 val = val | v_h;
746 1 WriteDecoder(0x4d, val);
747 1
748 1 WriteDecoder(0x4a, v_l); // Vactive Odd field Line start position
749 1 WriteDecoder(0x4b, v_l); // Vactive Even field Line start position
750 1 }
751
752 void SetVactiveLen(WORD van)
753 {
754 1 // WORD vstop;
755 1 BYTE val, buf;
756 1
757 1 van += 1; // HHY add 1, because of bottom line garbage
758 1 #ifdef DEBUG_PC
dPrintf("\r\n === SetVactiveLen(%d)", van);
#endif
761 1
762 1 // TW8804 write LSByte first
763 1 buf = (BYTE)(van>>8) << 4;
764 1 val = ReadDecoder(0x4d);
765 1 val = val & 0x8f;
766 1 val = val | buf;
767 1 WriteDecoder(0x4d, val);
768 1 WriteDecoder(0x4c, (BYTE)van);
769 1
770 1 }
771
772 void DefaultPanelAttributeForVideo(void)
773 {
774 1 SelectPanelAttrRegGroup(GROUP_RGB);
775 1
776 1 SetPanelContrastReg(RED, 0x80);
777 1 SetPanelContrastReg(GREEN,0x80);
778 1 SetPanelContrastReg(BLUE, 0x80);
779 1
780 1 SetPanelBrightnessReg(RED, 0x80);
781 1 SetPanelBrightnessReg(GREEN,0x80);
782 1 SetPanelBrightnessReg(BLUE, 0x80);
783 1
784 1 SelectPanelAttrRegGroup(GROUP_YCbCr);
785 1
786 1 SetDTVBrightnessReg(0x70); // 0x80
787 1 SetDTVContrastReg(0x80);
788 1 SetPanelSaturationReg(U_SAT, 0xB0); // 0x80
789 1 SetPanelSaturationReg(V_SAT, 0xB0); // 0x80
C51 COMPILER V7.06 TW88 02/21/2008 14:00:30 PAGE 14
790 1
791 1 }
792
793 #ifdef SUPPORT_PC
794
795 //=============================================================================
796 // Invert Polarity Functions
797 //=============================================================================
798 /*
799 void InvertHSYNCPolarity(void)
800 {
801 BYTE val;
802
803 val = ReadDecoder(0x40);
804 if( val & 0x04 ) {
805 val &= 0xfb;
806
807 #ifdef DEBUG_PC
808 dPuts("\r\nInvert H Pol: N->P ");
809 #endif
810
811 }
812 else {
813 val |= 0x04;
814
815 #ifdef DEBUG_PC
816 dPuts("\r\nInvert H Pol: P->N ");
817 #endif
818
819 }
820 WriteDecoder(0x40, val);
821 }
822 */
823 void InvertVSYNCPolarity(void)
824 {
825 1 BYTE val;
826 1
827 1 val = ReadDecoder(0x40);
828 1 if( val & 0x02 ) {
829 2 val &= 0xfd;
830 2
831 2 #ifdef DEBUG_PC
dPuts("\r\nInvert V Pol: N->P ");
#endif
834 2
835 2 }
836 1 else {
837 2 val |= 0x02;
838 2
839 2 #ifdef DEBUG_PC
dPuts("\r\nInvert V Pol: P->N ");
#endif
842 2
843 2 }
844 1 WriteDecoder(0x40, val);
845 1 }
846
847 //=============================================================================
848 // get sync pulse Functions
849 //=============================================================================
850 WORD GetVSYNCPulse(void)
851 {
C51 COMPILER V7.06 TW88 02/21/2008 14:00:30 PAGE 15
852 1 WORD buf;
853 1
854 1 WriteDecoder(0x5b, 0x70); // VSYNC
855 1 delay(10);
856 1 buf = (WORD)ReadDecoder(0x58) << 8;
857 1 buf |= ReadDecoder(0x57);
858 1
859 1 #ifdef DEBUG_PC
dPrintf("\r\nGetVSYNCPulse():%d ", buf);
#endif
862 1 return buf;
863 1 }
864
865 /* Not used right now!!
866 WORD GetRelativePosition(void)
867 {
868 WORD buf;
869
870 WriteDecoder(0x5b, 0x70); // VSYNC
871
872 buf = (WORD)ReadDecoder(0x5a) << 8;
873 buf |= ReadDecoder(0x59);
874
875 return buf;
876 }
877 //*/
878
879 WORD GetHSYNCPulse(void)
880 {
881 1 WORD buf;
882 1
883 1 WriteDecoder(0x5b, 0x60); // HSYNC
884 1 buf = (WORD)ReadDecoder(0x58) << 8; // from MSB
885 1 buf |= ReadDecoder(0x57);
886 1
887 1 return buf;
888 1 }
889
890 #endif // SUPPORT_PC
891
892 //=============================================================================
893 // Internal PLL
894 //=============================================================================
895 #if defined SUPPORT_PC || defined SUPPORT_DTV
896
897 BYTE GetPOST(void)
898 {
899 1 BYTE post;
900 1
901 1 post = ReadDecoder(TW88_PLL_DIV);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?