⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gdi_main.c

📁 Gui of OSD programming
💻 C
📖 第 1 页 / 共 4 页
字号:
         GDI_SetGdw(GDW_CC);
      }
   }
#else
   GDI_SetGdw(GDW_TV);
#endif
#ifdef __PFONT__
   GDI_ResetDrcs1Pointers();     /* reset to start of DRCS1 character space */
#endif
}



/******************************************************************************/
/**
 * @brief   Sets bytes 0-9 of global display word.
 *
 * @param   type  [in]  GDW_VIEW, GDW_SERVICE, GDW_SERVICE_TRANSP_OFF, GDW_OSD,
 *                      GDW_INIT, GDW_TV, GDW_TEXT, GDW_CC
 *
 * @return  --
 ******************************************************************************/

void GDI_SetGdw(const uint8_t type)
{
/* gdw bit 7  | bit 6  | bit 5  | bit 4   | bit 3  | bit 2  | bit 1  |  bit 0  |
--------------+--------+--------+---------+------- +--------+--------+---------+
       VCT:    VCT:
gdw0 CHINA    |CAPTION |PROGRESS|DISALH4-0:count of display col. in hor. dir.  |
--------------+--------+--------+---------+----- --+--------+--------+---------+
gdw1 CURVER2-0:ver. pixel shift |CURHOR3-0:hor.pixel shift of cursor |CURSEN   |
--------------+--------+--------+---------+-- -----+--------+--------+---------+
gdw2 POSVER0  |POSHOR5 |POSHOR4 |POSHOR3  |POSHOR2 |POSHOR1 |POSHOR0 |CURVER3  |
--------------+--------+--------+---------+------- +--------+--------+---------+
gdw3     -    |GLBT2_B1|GLBT1_B1|GLBT0_B1 |POSVER4 |POSVER3 |POSVER2 |POSVER1  |
--------------+--------+--------+---------+------- +--------+--------+---------+
gdw4  CorBox1 |BlaBox1 |BrdCol5 |BrdCol4  |BrdCol3 |BrdCol2 |BrdCol1 |BrdCol0  |
--------------+--------+--------+---------+------- +--------+--------+---------+
gdw5  CorBox0 |BlaBox0 |GLBT2B0 |GLBT1B0  |GLBT0B0 |GDDH2   |GDDH1   |GDDH0    |
--------------+--------+--------+---------+------- +--------+--------+---------+
gdw6  DRCSB0  |CHAAC   |CHAROM2 |CHAROM1  |CHAROM0 |CHADRC2 |CHADRC1 |CHADRC0  |
--------------+--------+--------+---------+------- +--------+--------+---------+
gdw7  DRCSB2_3|DRCSB2_2|DRCSB2_1|DRCSB2_0 |DRCSB1_3|DRCSB1_2|DRCSB1_1|DRCSB1_0 |
--------------+--------+--------+---------+------- +--------+--------+---------+
gdw8  SHCOL5  |SHCOL4  |SHCOL3  |SHCOL2   |SHCOL1  |SHCOL0  |SHEAWE  |SHEN     |
--------------+--------+--------+---------+------- +--- ----+--------+---------+
gdw9      -   |HdwClBl |HdwClCo |FlRate1  |FlRate0 |CurCl2  |CurCl1  |CurCl0   |
--------------+--------+--------+---------+------- +--------+--------+---------+
*/


   OSD_CTRL &= ~EN_LD_GDW;                           /* download GDW disable */

   GlobalDisplayWord[0] = (NUM_COLS-33)&0x3F;  /* (no progress;) set columns */
   GlobalDisplayWord[1] = 0x00;           /* (cursor shift;) cursor disabled */
   GlobalDisplayWord[2] = 0x00;               /* (cursor position and shift) */
   GlobalDisplayWord[3] = 0x00;           /* transparency of box 1 disabled; */

#ifdef __PFONT__
   GlobalDisplayWord[6]=0x49;          /* character access mode DRCS1 */
#else
   GlobalDisplayWord[6]=0x09;          /* character access mode ROM */
#endif

#ifdef __CAPTION__
   GlobalDisplayWord[6] &= 0x40; /*reset "DRCS bound off" and resolution bits*/
   GlobalDisplayWord[6] |= 0x09;       /*  set character resolution 10 lines */
#endif

   /* DRCS boundaries 0x*16 DRCS1, (y+x)0*16 DCRS2 */
   GlobalDisplayWord[7] = (((NUM_DRCS2/16)+1) + ((NUM_DRCS1/16)+1)) << 4
                            | ((NUM_DRCS1/16)+1);

   GlobalDisplayWord[8] = 0x00;     /* (shadow definitions;) shadow disabled */

   switch (type)
   {
      case GDW_VIEW:                                    /* set gdw for views */
         GlobalDisplayWord[4] = 0x10;           /* border colour transparent */
         GlobalDisplayWord[5] = 0x28; /* box transparency enabled:
                                        background pixels for rom characters */
         GlobalDisplayWord[8] = 0x51;          /* east shadow with colour 20 */
         GlobalDisplayWord[9] = 0x00;                    /*  no hdwclutblank */
         break;

      case GDW_SERVICE:                         /*  set gdw for service menu */
         GlobalDisplayWord[4] = 0x10;           /* border colour transparent */
         GlobalDisplayWord[5] = 0x38; /* box enabled:
                                        background pixels for rom characters */
         GlobalDisplayWord[9] = 0x40;                     /* no hdwclutblank */
         break;

      case GDW_SERVICE_TRANSP_OFF:  /* set gdw for service menu (BG visible) */
         GlobalDisplayWord[4] = 0x10;           /* border colour transparent */
         GlobalDisplayWord[5] = 0x00;  /* box transparency enabled:
                                        background pixels for rom characters */
         GlobalDisplayWord[9] = 0x40;                     /* no hdwclutblank */
         break;

      case GDW_OSD:                                  /* set gdw for menu/osd */
         GlobalDisplayWord[4] = 0x10;           /* border colour transparent */
         GlobalDisplayWord[5] = 0x28;  /* box transparency enabled:
                                        background pixels for rom characters */
         GlobalDisplayWord[8] = 0x51;       /* colour 20 (black) east shadow */
         GlobalDisplayWord[9] = 0x48;                     /* no hdwclutblank */
         break;
      case GDW_INIT:                     /* gdw init after power on/ tv mode */
         GlobalDisplayWord[6] = 0x09;          /* ROM character access mode;
                                                    resolution of characters */
      case GDW_TV:                                   /*  set gdw for tv mode */
         GlobalDisplayWord[4] = 0x10;          /*  border colour transparent */
         GlobalDisplayWord[5] = 0x28;  /* box transparency enabled:
                                        background pixels for rom characters */
         GlobalDisplayWord[9] = 0x00;                        /* hdwclutblank */
         break;

      case GDW_TEXT:                                     /* set gdw for text */
         GlobalDisplayWord[4] = 0x40;                 /* border colour black */
      /* GlobalDisplayWord[4] = 0x10;              border colour transparent */
         GlobalDisplayWord[5] = 0x40;  /* box transparency enabled:
                                        background pixels for rom characters */
         GlobalDisplayWord[9] = 0x40;        /* hdwclutblank=1  hdwclutcor=0 */
#ifdef __PFONT__
         GlobalDisplayWord[6]=0x09; /* char access mode ROM */
#endif
         break;

      case GDW_CC:                                       /* set gdw for text */
         GlobalDisplayWord[0] |= 0x40;                     /* enable caption */
         GlobalDisplayWord[3] = 0x10;     /* box1: overrule foreground pixel */
         GlobalDisplayWord[4] = 0x50;  /* border colour transparent; 
                                                          overrule box1 bits */
         GlobalDisplayWord[5] = 0x28;  /* box transparency enabled:
                                        background pixels for rom characters */
      /* GlobalDisplayWord[6] = 0x24;         character access mode;
                                            resolution of characters 12 x 13 */
         GlobalDisplayWord[6] = 0xa0 | (CC_DRCS_HEIGTH - 9);
                                    /* DRCS boundary off and
                                       ROM character access mode;
                                       resolution of ROM and DRCS characters */
         GlobalDisplayWord[9] = 0x00;                     /* no hdwclutblank */
         break;

      default:                                            /* set default gdw */
         GlobalDisplayWord[4] = 0x10;           /* border colour transparent */
         GlobalDisplayWord[5] = 0x28;  /* box transparency enabled:
                                        background pixels for rom characters */
         GlobalDisplayWord[9] = 0x00;                        /* hdwclutblank */
         break;
   }


#if __BE_CONFIG__ == VCTP_BE_CRT
/* chinaburger_beg */

                                              /* update PROGRESS bit for osd */
   if (API_Vid_GetVerticalFreqMode() == 1 || !API_Vid_Is50Hz())
   {
      GlobalDisplayWord[0] |= 0x20;   /* Progressive */
   }
   else
   {
      GlobalDisplayWord[0] &= 0xDF;   /* Interlaced */
   }

/* chinaburger_end */
#endif

   /* use gdw extension bits of VCTP */
   GlobalDisplayWord[9] |=  0x80;          /* set gdw extension bit */
   /* set highbit of columns and number of rows */
#ifdef DEBUG_IN_OSD
#ifdef __CAPTION__
   if (type == GDW_CC)
   {
#ifdef CC_DISPLAY_STATUS_ENABLE
      if (PREF_GetCCStatusDisplay())
      {
         GlobalDisplayWord[10] = (((NUM_COLS-33) & 0x20) << 1) |
                                                            (DEBUG_NUM_ROWS-1);
      }
      else
#endif
      {
         GlobalDisplayWord[10] = (((NUM_COLS-33) & 0x20) << 1) | (CC_LINES - 1);
      }
   }
   else
#endif
   {
      GlobalDisplayWord[10] = (((NUM_COLS-33) & 0x20) << 1) | 
                                                          (DEBUG_NUM_ROWS - 1);
   }
#else
#ifdef __CAPTION__
   if (type == GDW_CC)
   {
#ifdef CC_DISPLAY_STATUS_ENABLE
      if (PREF_GetCCStatusDisplay())
      {
         GlobalDisplayWord[10] = (((NUM_COLS-33) & 0x20) << 1) | 
                                                            (CC_LINES - 1 + 3);
      }
      else
#endif
      {
         GlobalDisplayWord[10] = (((NUM_COLS-33) & 0x20) << 1) | (CC_LINES - 1);
      }
   }
   else
#endif
   {
      GlobalDisplayWord[10] = (((NUM_COLS-33) & 0x20) << 1) | (NUM_ROWS - 1);
   }
#endif
   /* set vertical and horizontal scaling inside display generator */
   GlobalDisplayWord[11] = (PIXEL_REPITITION << 4) | (LINE_REPITION << 1);          // zsp  osd 06-11-11
   OSD_CTRL |= EN_LD_GDW;                             /* download GDW enable */
}



/******************************************************************************/
/**
 * @brief   Sets a new colour look up table.
 *
 * @param   clutNumber  [in] 0...1
 *
 * @return  --
 ******************************************************************************/

void GDI_SetClut(const int8_t clutNumber)
{
   GDI_DownloadClut(clutNumber);
   PREF_SetColorSet(clutNumber);
}



/******************************************************************************/
/**
 * @brief   Gets the value of colour look up table.
 *
 * @param   --
 *
 * @return  range : 0 ... 1
 ******************************************************************************/

uint8_t GDI_GetClut(void)
{
   return PREF_GetColorSet();
}



/******************************************************************************/
/**
 * @brief   Sets different colour look-up tables.
 *
 * @param   colourSet [in] number of the color set
 *
 * @return  --
 ******************************************************************************/

void GDI_DownloadClut(const uint8_t colourSet)
{
   switch (colourSet)
   {
/*
      case (1):
         API_Tvt_Mx3Decompress((uint8_t*)srcClut002, Clut2, LINES_10);
         break;
      case (2):
         API_Tvt_Mx3Decompress((uint8_t*)srcClut003, Clut2, LINES_10);
         break;
*/
      default:
         API_Tvt_Mx3Decompress((uint8_t*)srcClut001, Clut2, LINES_10);
         break;
   }
#ifdef __RADIO_MODE__
   /* set menu BG colour for TvText to middle blue / opal */
   if (radioMode_g == RADIOMODE_ON)
   {
      Clut2[2] = 0x48;
      Clut2[3] = 0x10;
      Clut2[30] = 0x48;
      Clut2[31] = 0x10;
      Clut2[40] = 0x48;
      Clut2[41] = 0x10;
      Clut2[48] = 0x48;
      Clut2[49] = 0x10;
   }
#endif

   prevEditMode = SYS_TRUE;   /* set SYS_TRUE to enable 1st edit mode change */
}



/******************************************************************************/
/**
 * @brief   Sets new value for horizontal display delay (only fine adjustment).
 *
 * @param   sdhLevel [in] value to be set
 *
 * @return  --
 ******************************************************************************/

void GDI_SetSdh(const uint8_t sdhLevel)
{
   SDH0 = sdhLevel;
   PREF_SetDhdLevel(sdhLevel);
#ifdef __ENABLE_BITMAP_ICONS__
   GDI_Calculate_Bmp_Position();
#endif
}



/******************************************************************************/
/**
 * @brief   Sets new value for horizontal display delay for split screen mode.
 *
 * @param   sdhLevel [in] value to be set
 *
 * @return  --
 ******************************************************************************/

void GDI_SetSdhSplit(const int16_t sdhLevel)
{
   PREF_SetDhdSplitLevel((uint16_t)sdhLevel);
}



/******************************************************************************/
/**
 * @brief   Gets value of horizontal display delay (SDH lower 8 bits).
 *
 * @param   --
 *
 * @return  range : 0 ... 255
 ******************************************************************************/

uint8_t GDI_GetSdh(void)
{
   return PREF_GetDhdLevel();
}



/******************************************************************************/
/**
 * @brief   Gets value of horizontal display delay (SDH lower 8 bits) for
 *          split screen mode.
 *
 * @param   --
 *
 * @return  range : 0 ... 255
 ******************************************************************************/

uint16_t GDI_GetSdhSplit(void)
{
   return PREF_GetDhdSplitLevel();
}



/******************************************************************************/
/**
 * @brief   Sets new value for vertical display delay (only fine adjustment).
 *
 * @param   sdvLevel [in] value to be set
 *
 * @return  --
 ******************************************************************************/

void GDI_SetSdv(const uint8_t sdvLevel)
{
   SDV0 = sdvLevel;
   /* prevent jump in active 60Hz service menue */
   if (isTvMode50Hz_g == SYS_FALSE)
      SDV0 -= OFFSET_FOR_60HZ;
   PREF_SetDvdLevel(sdvLevel);
#ifdef __ENABLE_BITMAP_ICONS__
   GDI_Calculate_Bmp_Position();
#endif
}



/******************************************************************************/
/**
 * @brief   Gets value of vertical display delay (SDV lower 8 bits).
 *
 * @param   --
 *
 * @return  range : 0 ... 255
 *
 ******************************************************************************/

uint8_t GDI_GetSdv(void)
{
   return PREF_GetDvdLevel();
}



/******************************************************************************/
/**
 * @brief   Sets new value for vertical display delay (only fine adjustment).
 *
 * @param   pclk [in]  value to be set
 *
 * @return  --
 ******************************************************************************/

void GDI_SetPixelClock(uint8_t pclk)
{
   pclk = pclk;
}



/******************************************************************************/
/**
 * @brief   Gets value of pixel clock (PCLK0 lower 8 bits).
 *
 * @param   --
 *
 * @return  range : 0 ... 255
 ******************************************************************************/

uint8_t GDI_GetPixelClock(void)
{
   return PREF_GetPixelClock();
}



/******************************************************************************/
/**
 * @brief   Sets DRCS1 osd characters to 9 or 10 lines height. Reloads DRCS1
 *          caracters from ROM into RAM.
 *
 * @param   lines   [in] LINES_9, LINES_10
 *

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -