www.pudn.com > Bit1611_demo_code.rar > OSD.C


/* ********************************************************************** 
 
         Copyright (c) 2002-2006 Beyond Innovation Technology Co., Ltd 
 
         All rights are reserved. Reproduction in whole or in parts is 
    prohibited without the prior written consent of the copyright owner. 
   ---------------------------------------------------------------------- 
 
    Module: OSD.C 
 
    Purpose: Implementation of OSD module. 
 
    Version: 0.01                                   11:01AM  2005/11/17 
 
    Compiler: Keil 8051 C Compiler v8.01 
 
    Reference: 
    [1] BIT1611B Datasheet Version 1.0, 2005-11-10, Beyond Innovation Technology 
    [2] MTV121 Super On-Screen-Display for LCD Monitor, Revision 5.0 
        06/29/1999 Myson Technology 
 
   ---------------------------------------------------------------------- 
    Modification: 
 
    R0.01 09:48AM  2005/11/17 Jeffrey Chang 
    Reason: 
        1. Original. 
    Solution: 
 
   ********************************************************************** */ 
 
#define _OSD_C_ 
 
/* ------------------------------------ 
    Header Files 
   ------------------------------------ */ 
#include "bitek.h" 
#include "eeprom.h" 
#include "intrins.h" 
#include "led.h" 
#include "osd.h" 
#include "platform.h" 
#include "timer.h" 
 
/* ------------------------------------ 
    Macro Definitions 
   ------------------------------------ */ 
 
/* ------------------------------------ 
    Type Definitions 
   ------------------------------------ */ 
 
/* ------------------------------------ 
    Variables Definitions 
   ------------------------------------ */ 
#if (OSD_CFG == OSD_BIT1611B) 
    static UB8 CODE abProgressBarTV[] =         { OSD_00_DASH_0,    OSD_01_DASH_1,  OSD_02_DASH_2   }; 
    static UB8 CODE abProgressBarMONITOR[] =    { OSD_10_BAR_0,     OSD_11_BAR_1,   OSD_12_BAR_2, 
                                                  OSD_13_BAR_3,     OSD_14_BAR_4,   OSD_15_BAR_5    }; 
    static UB8 CODE abTrackBar[] =              { OSD_01_TRACK_1,   OSD_06_TRACK_2, OSD_07_TRACK_3  }; 
#endif 
 
 
/* ------------------------------------ 
    Function Prototypes 
   ------------------------------------ */ 
 
 
#pragma OPTIMIZE (6) 
/* ------------------------------------------------------------------- 
    Name: OSD_DisplayAddress - (OSD_BIT1611B) 
    Purpose: To calculate OSD Display Address. 
    Passed: 
        UB8     bWindow = OSD Window Identifier. 
        UB8     bRow    = Position in rows 
        UB8     bCol    = Position in columns 
 
    Returns: OSD Display Address. 
    Notes: 
   ------------------------------------------------------------------- */ 
UW16 OSD_DisplayAddress ( 
UB8     bWindow, 
UB8     bRow, 
UB8     bCol 
) 
{ 
    switch (bWindow) 
    { 
        case OSD_WINDOW1: 
            return(VP_0500_057F_DISPLAY_CODE + OSD_WINDOW1_BASE + 
                   bRow * OSD_WINDOW1_WIDTH + bCol                  ); 
            break; 
 
        case OSD_WINDOW2: 
            return(VP_0500_057F_DISPLAY_CODE + OSD_WINDOW2_BASE + 
                   bRow * OSD_WINDOW2_WIDTH + bCol                  ); 
            break; 
 
        case OSD_WINDOW3: 
        default: 
            return(VP_0500_057F_DISPLAY_CODE + OSD_WINDOW3_BASE + 
                   bRow * OSD_WINDOW3_WIDTH + bCol                  ); 
            break; 
    } 
} /* OSD_DisplayAddress */ 
#pragma OPTIMIZE (9) 
 
 
#if (OSD_DSP_PROGRESSBAR) 
/* ------------------------------------------------------------------- 
    Name: OSD_DspProgressBar - (OSD_BIT1611B) 
    Purpose: To display a progress bar at specified position in OSD window. 
    Passed: 
        UB8     bWindow     = OSD Window Identifier. 
        UB8     bCol,       = Progress bar horizontal position in columns. 
        UB8     bRow,       = Progress bar vertical position in rows. 
        UW16    wMin,       = Progress bar minimal value. 
        UW16    wMax,       = Progress bar maximal value. 
        UW16    wValue      = Progress bar indicative value. 
        UB8     bWidth,     = Progress bar width 
        UB8     bStyle      = Progress bar Style 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_DspProgressBar ( 
UB8     bWindow, 
UB8     bCol,       // Progress bar horizontal position in columns 
UB8     bRow,       // Progress bar vertical position in rows 
UW16    wMin,       // Progress bar minimal value 
UW16    wMax,       // Progress bar maximal value 
UW16    wValue,     // Progress bar indicative value 
UB8     bWidth,     // Progress bar width 
UB8     bStyle      // Progress bar style 
) 
{ 
    UB8     bFull; 
    UB8     bUnit; 
    UW16    wAddr; 
 
 
    wAddr = OSD_DisplayAddress(bWindow, bRow, bCol); 
 
    // Note: MONITOR Style contains LEFT and RIGHT ! 
    if (bStyle != OSD_STYLE_TV1) 
        bWidth -= 2; 
 
    switch (bStyle) 
    { 
        case OSD_STYLE_TV1: 
        default: 
            // Dash Type 
 
            // Rounding 
            bUnit = (UW32)(wValue - wMin) * OSD_DASH_TOTAL * bWidth / 
                    (wMax - wMin); 
 
            bFull = bUnit / OSD_DASH_TOTAL; 
 
            // Fill FULL Dash Bar ! 
            BITEK_TxRepeat(OSD_MAD, wAddr, bFull, OSD_03_DASH_FULL); 
 
            if (bFull != bWidth) 
            { 
                // Fill Dash 0 Bar ! 
                BITEK_TxRepeat(OSD_MAD, wAddr + bFull, bWidth - bFull, OSD_00_DASH_0); 
 
                // Show Dash Bar ! 
                BITEK_TxByte(OSD_MAD, wAddr + bFull, abProgressBarTV[ bUnit % OSD_DASH_TOTAL ]); 
            } 
            break; 
 
        case OSD_STYLE_MONITOR1: 
            // Bar Type 
 
            // Rounding 
            bUnit = (UW32)(wValue - wMin) * OSD_BAR_TOTAL * bWidth / 
                   (wMax - wMin); 
 
            bFull = bUnit / OSD_BAR_TOTAL; 
 
 
            // LEFT/RIGHT BAR ! 
            BITEK_TxByte(OSD_MAD, wAddr,          OSD_5B_BAR_LEFT); 
            BITEK_TxByte(OSD_MAD, wAddr+bWidth+1, OSD_5D_BAR_RIGHT); 
 
            // Fill FULL BAR ! 
            wAddr++; 
            BITEK_TxRepeat(OSD_MAD, wAddr, bFull, OSD_16_BAR_FULL); 
 
            if (bFull != bWidth) 
            { 
                // Fill Dash 0 Bar ! 
                BITEK_TxRepeat(OSD_MAD, wAddr + bFull, bWidth - bFull, OSD_10_BAR_0); 
 
                // Show Dash Bar ! 
                BITEK_TxByte(OSD_MAD, wAddr + bFull, abProgressBarMONITOR[ bUnit % OSD_BAR_TOTAL ]); 
            } 
            break; 
    } 
} /* OSD_DspProgressBar */ 
#endif 
 
 
#if (OSD_DSP_TRACKBAR) 
/* ------------------------------------------------------------------- 
    Name: OSD_DspTrackBar - (OSD_BIT1611B) 
    Purpose: To display a track bar at specified position in OSD window. 
    Passed: 
        UB8     bWindow     = OSD Window Identifier. 
        UB8     bCol,       = Track bar horizontal position in columns 
        UB8     bRow,       = Track bar vertical position in rows 
        UW16    wMin,       = Track bar minimal value 
        UW16    wMax,       = Track bar maximal value 
        UW16    wValue      = Track bar indicative value 
        UB8     bWidth      = Track bar width 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_DspTrackBar ( 
UB8     bWindow, 
UB8     bCol,       // Track bar horizontal position in columns 
UB8     bRow,       // Track bar vertical position in rows 
UW16    wMin,       // Track bar minimal value 
UW16    wMax,       // Track bar maximal value 
UW16    wValue,     // Track bar indicative value 
UB8     bWidth      // Track bar width 
) 
{ 
    UB8     bUnit; 
    UW16    wAddr; 
 
 
    wAddr = OSD_DisplayAddress(bWindow, bRow, bCol); 
 
    // Rounding 
    bUnit = ((UW32)(wValue - wMin) * OSD_TRACK_TOTAL * bWidth) / 
            (wMax - wMin); 
 
    if (bUnit == OSD_TRACK_TOTAL * bWidth) 
        bUnit--; 
 
    // Fill Track 0 Bar ! 
    BITEK_TxRepeat(OSD_MAD, wAddr, bWidth, OSD_00_TRACK_0); 
 
    // Show Track Bar ! 
    BITEK_TxByte(OSD_MAD, wAddr + bUnit / OSD_TRACK_TOTAL, abTrackBar[ bUnit % OSD_TRACK_TOTAL ]); 
} /* OSD_DspTrackBar */ 
#endif 
 
 
/* ------------------------------------------------------------------- 
    Name: OSD_EnableWindow - (OSD_BIT1611B) 
    Purpose: To enable/disable OSD Windows. 
    Passed: 
        UB8     bWindow = OSD Window Identifier. 
        BOOL    fOn = Enable (TRUE) or Disable (FALSE). 
    Returns: None. 
    Notes: [1]118 
   ------------------------------------------------------------------- */ 
void OSD_EnableWindow ( 
UB8     bWindow, 
BOOL    fOn 
) 
{ 
    UB8 bData; 
 
 
    if (bWindow & OSD_WINDOW1) 
    { 
        //////////////////////////////////////////////////////// 
        // [JC010] OSD Image Retention issue fixed by JC 09:15AM  2006/04/25 
        #ifdef NOT_JUNK 
        bData = BITEK_RxByte(OSD_MAD, VP_143_OSD1_ATTR4); 
 
        if ( fOn ) 
            bData |= VP_MASK_OSD1_EN; 
        else 
            bData &= (~VP_MASK_OSD1_EN); 
 
        BITEK_TxByte(OSD_MAD, VP_143_OSD1_ATTR4, bData); 
        #endif 
 
        bData = BITEK_RxByte(OSD_MAD, VP_13A_OSD1_POSITION_MSB); 
 
        if ( fOn ) 
            bData &= (~VP_MASK_H_POSITION_OFF); 
        else 
            bData |= VP_MASK_H_POSITION_OFF; 
 
        BITEK_TxByte(OSD_MAD, VP_13A_OSD1_POSITION_MSB, bData); 
        //////////////////////////////////////////////////////// 
    } 
 
    if (bWindow & OSD_WINDOW2) 
    { 
        bData = BITEK_RxByte(OSD_MAD, VP_151_OSD2_ATTR4); 
 
        if ( fOn ) 
            bData |= VP_MASK_OSD2_EN; 
        else 
            bData &= (~VP_MASK_OSD2_EN); 
 
        BITEK_TxByte(OSD_MAD, VP_151_OSD2_ATTR4, bData); 
    } 
 
    if (bWindow & OSD_WINDOW3) 
    { 
        bData = BITEK_RxByte(OSD_MAD, VP_15F_OSD3_ATTR4); 
 
        if ( fOn ) 
            bData |= VP_MASK_OSD3_EN; 
        else 
            bData &= (~VP_MASK_OSD3_EN); 
 
        BITEK_TxByte(OSD_MAD, VP_15F_OSD3_ATTR4, bData); 
    } 
} /* OSD_EnableWindow */ 
 
 
 
/* ------------------------------------------------------------------- 
    Name: OSD_FillCharAttr - (OSD_BIT1611B) 
    Purpose: 
        To fill OSD display RAM with the same character attribute. 
 
    Passed: 
        bOffset = The character attribute start location. 
        bCnt = The number of filled characters (1..255). 
        bCharAttr =  The same character attribute. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_FillCharAttr ( 
UB8     bOffset, 
UB8     bCnt,           // 1..255 
UB8     bCharAttr       // Char Attribute 
) 
{ 
    BITEK_TxRepeat(OSD_MAD, VP_0580_05FF_DISPLAY_ATTR + bOffset, bCnt, bCharAttr); 
} /* OSD_FillCharAttr */ 
 
 
/* ------------------------------------------------------------------- 
    Name: OSD_FillCharCode - (OSD_BIT1611B) 
    Purpose: 
        To fill OSD display RAM with the same character code. 
 
    Passed: 
        bOffset = The character code start location. 
        bCnt = The number of filled characters (1..255). 
        bCharCode = The same character code. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_FillCharCode ( 
UB8     bOffset, 
UB8     bCnt,           // 1..255 
UB8     bCharCode       // Character Code 
) 
{ 
    BITEK_TxRepeat(OSD_MAD, VP_0500_057F_DISPLAY_CODE + bOffset, bCnt, bCharCode); 
} /* OSD_FillCharCode */ 
 
 
/* ------------------------------------------------------------------- 
    Name: OSD_FillCharCodeAttr - (OSD_BIT1611B) 
    Purpose: 
        To fill OSD display RAM with the same character code and attribute. 
 
    Passed: 
        bOffset = The character start location. 
        bCnt = The number of filled characters (1..255). 
        bCharCode = The same character code. 
        bCharAttr = The same character attribute. 
                    5 4 3 2 1 0 
                    | | | |_|_|_ Foregound Attribute Index (0..7) 
                    |_|_|_______ Backgound Attribute Index (0..7) 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_FillCharCodeAttr ( 
UB8     bOffset, 
UB8     bCnt,           // 1..255 
UB8     bCharCode,      // Char Code 
UB8     bCharAttr       // Char Attribute 
) 
{ 
    BITEK_TxRepeat(OSD_MAD, VP_0500_057F_DISPLAY_CODE + bOffset, bCnt, bCharCode); 
    BITEK_TxRepeat(OSD_MAD, VP_0580_05FF_DISPLAY_ATTR + bOffset, bCnt, bCharAttr); 
} /* OSD_FillCharCodeAttr */ 
 
 
/* ------------------------------------------------------------------- 
    Name: OSD_Init - (OSD_BIT1611B) 
    Purpose: To initialize OSD module. 
    Passed: None. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_Init (void) 
{ 
    // [1]116 Setup Palette for Background and Foregound ! 
    BITEK_TxBurst(OSD_MAD, VP_0600_063F_PALETTE, sizeof(abOSD_Palette), abOSD_Palette); 
 
 
    /* #################################### 
        Windows 1 
       #################################### */ 
    OSD_FillCharCodeAttr(OSD_WINDOW1_BASE, 
                         OSD_WINDOW1_AREA, 
                         ' ', 
                         OSD1_COLOR_HILIGHT); 
 
    // To normal row #0 of Window 1 
    OSD_FillCharAttr(OSD_WINDOW1_BASE, 
                     OSD_WINDOW1_WIDTH, 
                     OSD1_COLOR_NORMAL      ); 
 
 
    // [1]118 OSD1 Display RAM Start Index 
    BITEK_TxByte(OSD_MAD, VP_13D_OSD1_RAM_INDEX, OSD_WINDOW1_BASE); 
 
    // [1]118 OSD1 OSD Fade Level 
    BITEK_TxByte(OSD_MAD, VP_13E_OSD1_FADE_LEVEL, OSD1_FADE_LEVEL); 
 
    // [1]118 OSD1 OSD BORDER 
    BITEK_TxByte(OSD_MAD, VP_13F_OSD1_BORDER_SEL, OSD1_BORDER); 
 
    // [1]118 OSD1 OSD BORDER Attr 
    BITEK_TxByte(OSD_MAD, VP_140_OSD1_ATTR1, OSD1_BORDER_ATTR); 
 
    // [1]118 OSD1 Attribute 1 
    BITEK_TxByte(OSD_MAD, VP_141_OSD1_ATTR2, OSD1_CHAR_SIZE); 
 
    // [1]118 OSD1 Attribute 2 
 
    //////////////////////////////////////////////////////// 
    // [JC010] OSD Image Retention issue fixed by JC 09:15AM  2006/04/25 
    //BITEK_TxByte(OSD_MAD, VP_143_OSD1_ATTR4, OSD1_LINE_BLINK); 
    BITEK_TxByte(OSD_MAD, VP_143_OSD1_ATTR4, OSD1_LINE_BLINK | VP_MASK_OSD1_EN); 
    //////////////////////////////////////////////////////// 
 
    OSD_SetWindow(OSD_WINDOW1, 
                  OSD_WINDOW1_H,                // in clocks 
                  OSD_WINDOW1_V,                // in horizontal lines 
                  OSD_WINDOW1_WIDTH,            // in characters 
                  OSD_WINDOW1_HEIGHT    );      // in rows 
 
 
    /* #################################### 
        Windows 2 
       #################################### */ 
    OSD_FillCharCodeAttr(OSD_WINDOW2_BASE, 
                         OSD_WINDOW2_AREA, 
                         ' ', 
                         OSD2_COLOR_NORMAL); 
 
    // [1]119 OSD2 Display RAM Start Index 
    BITEK_TxByte(OSD_MAD, VP_14B_OSD2_RAM_INDEX, OSD_WINDOW2_BASE); 
 
    // [1]119 OSD2 OSD Fade Level 
    BITEK_TxByte(OSD_MAD, VP_14C_OSD2_FADE_LEVEL, OSD2_FADE_LEVEL); 
 
    // [1]119 OSD2 OSD BORDER 
    BITEK_TxByte(OSD_MAD, VP_14D_OSD2_BORDER_SEL, OSD2_BORDER); 
 
    // [1]119 OSD2 OSD BORDER Attr 
    BITEK_TxByte(OSD_MAD, VP_14E_OSD2_ATTR1, OSD2_BORDER_ATTR); 
 
 
    // [1]119 OSD2 Attribute 1 
    BITEK_TxByte(OSD_MAD, VP_14F_OSD2_ATTR2, OSD2_CHAR_SIZE); 
 
    // [1]119 OSD2 Attribute 2 
    BITEK_TxByte(OSD_MAD, VP_151_OSD2_ATTR4, OSD2_LINE_BLINK); 
 
    OSD_SetWindow(OSD_WINDOW2, 
                  OSD_WINDOW2_H,                // in clocks 
                  OSD_WINDOW2_V,                // in horizontal lines 
                  OSD_WINDOW2_WIDTH,            // in characters 
                  OSD_WINDOW2_HEIGHT    );      // in rows 
 
 
    /* #################################### 
        Windows 3 
       #################################### */ 
    OSD_FillCharCodeAttr(OSD_WINDOW3_BASE, 
                         OSD_WINDOW3_AREA, 
                         ' ', 
                         OSD3_COLOR_NORMAL      ); 
 
    // To HILIGHT row #0 of Window 3 
    OSD_FillCharAttr(OSD_WINDOW3_BASE, 
                     OSD_WINDOW3_WIDTH, 
                     OSD3_COLOR_HILIGHT         ); 
 
    #if (MENU_STYLE_CFG == MENU_STYLE_SCROLLING_3) 
    // Nothing 
 
    #else 
    // ICON of Window 3 
    OSD_FillCharAttr(OSD_WINDOW3_BASE + OSD_X_ICON, 
                     1, 
                     OSD3_COLOR_ICON                ); 
    #endif 
 
    // [1]120 OSD3 Display RAM Start Index 
    BITEK_TxByte(OSD_MAD, VP_159_OSD3_RAM_INDEX, OSD_WINDOW3_BASE); 
 
    // [1]120 OSD3 OSD Fade Level 
    BITEK_TxByte(OSD_MAD, VP_15A_OSD3_FADE_LEVEL, OSD3_FADE_LEVEL); 
 
    // [1]120 OSD3 OSD BORDER 
    BITEK_TxByte(OSD_MAD, VP_15B_OSD3_BORDER_SEL, OSD3_BORDER); 
 
    // [1]120 OSD3 OSD BORDER Attr 
    BITEK_TxByte(OSD_MAD, VP_15C_OSD3_ATTR1, OSD3_BORDER_ATTR); 
 
 
    // [1]120 OSD3 Attribute 1 
    BITEK_TxByte(OSD_MAD, VP_15D_OSD3_ATTR2, OSD3_CHAR_SIZE); 
 
    // [1]120 OSD3 Attribute 2 
    BITEK_TxByte(OSD_MAD, VP_15F_OSD3_ATTR4, OSD3_LINE_BLINK); 
 
    OSD_SetWindow(OSD_WINDOW3, 
                  OSD_WINDOW3_H, 
                  OSD_WINDOW3_V, 
                  OSD_WINDOW3_WIDTH, 
                  OSD_WINDOW3_HEIGHT    ); 
} /* OSD_Init */ 
 
 
/* ------------------------------------------------------------------- 
    Name: OSD_SetWindow - (OSD_BIT1611B) 
    Purpose: To setup OSD window position and size on the panel screen. 
    Passed: 
        UB8     bWindow     = OSD Window Identifier. 
        UW16    wH_Pos      = Horizontal position in clocks. 
        UW16    wV_Pos      = Vertical position in horizontal lines. 
        UB8     bWidth      = Horizontal size in characters. 
        UB8     bHeight     = Vertical size in rows. 
    Returns: None 
    Notes: [1]115 
   ------------------------------------------------------------------- */ 
void OSD_SetWindow ( 
UB8     bWindow,        // WINDOW 1, WINDOW 2 or WINDOW 3 
UW16    wH_Pos,         // Horizontal position in clocks (0..2047) 
UW16    wV_Pos,         // Vertical position in horizontal lines (0..511) 
UB8     bWidth,         // Horizontal size in characters (0..63) 
UB8     bHeight         // Vertical size in rows (0..31) 
) 
{ 
    switch (bWindow) 
    { 
        case OSD_WINDOW1: 
            // [1]115 Horizontal Position 
            BITEK_TxByte(OSD_MAD, VP_13813A_OSD1_H_POSITION, wH_Pos); 
 
            // [1]115 Vertical Position 
            BITEK_TxByte(OSD_MAD, VP_13913A_OSD1_V_POSITION, wV_Pos); 
 
            BITEK_TxByte(OSD_MAD, 
                         VP_13A_OSD1_POSITION_MSB, 
                         (wV_Pos >> 8) | ((wH_Pos >> 4) & 0x30) 
                        ); 
 
            // [1]115 Width 
            BITEK_TxByte(OSD_MAD, VP_13B_OSD1_WIDTH, bWidth - 1); 
 
            // [1]115 Height 
            BITEK_TxByte(OSD_MAD, VP_13C_OSD1_HEIGHT, bHeight - 1); 
            break; 
 
        case OSD_WINDOW2: 
            // [1]115 Horizontal Position 
            BITEK_TxByte(OSD_MAD, VP_146148_OSD2_H_POSITION, wH_Pos); 
 
            // [1]115 Vertical Position 
            BITEK_TxByte(OSD_MAD, VP_147148_OSD2_V_POSITION, wV_Pos); 
 
            BITEK_TxByte(OSD_MAD, 
                         VP_148_OSD2_POSITION_MSB, 
                         (wV_Pos >> 8) | ((wH_Pos >> 4) & 0x30) 
                        ); 
 
            // [1]115 Width 
            BITEK_TxByte(OSD_MAD, VP_149_OSD2_WIDTH, bWidth - 1); 
 
            // [1]115 Hieght 
            BITEK_TxByte(OSD_MAD, VP_14A_OSD2_HEIGHT, bHeight - 1); 
            break; 
 
        case OSD_WINDOW3: 
            // [1]115 Horizontal Position 
            BITEK_TxByte(OSD_MAD, VP_154156_OSD3_H_POSITION, wH_Pos); 
 
            // [1]115 Vertical Position 
            BITEK_TxByte(OSD_MAD, VP_155156_OSD3_V_POSITION, wV_Pos); 
 
            BITEK_TxByte(OSD_MAD, 
                         VP_156_OSD3_POSITION_MSB, 
                         (wV_Pos >> 8) | ((wH_Pos >> 4) & 0x30) 
                        ); 
 
            // [1]115 Width 
            BITEK_TxByte(OSD_MAD, VP_157_OSD3_WIDTH, bWidth - 1); 
 
            // [1]115 Hieght 
            BITEK_TxByte(OSD_MAD, VP_158_OSD3_HEIGHT, bHeight - 1); 
            break; 
    } 
} /* OSD_SetWindow */ 
 
 
/* ------------------------------------------------------------------- 
    Name: OSD_ShowChar - (OSD_BIT1611B) 
    Purpose: To show a character at specified position in OSD window. 
    Passed: 
        UB8 bWindow     = OSD Window Identifier. 
        UB8 bCol        = Horizontal position in columns (0..OSD_WINDOW_WIDTH - 1). 
        UB8 bRow        = Vertical position in rows (0..OSD_WINDOW_HEIGHT - 1). 
        UB8 bCharCode   = The displayed character code. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_ShowChar ( 
UB8 bWindow, 
UB8 bCol,     // 0..OSD_WINDOW_WIDTH - 1 
UB8 bRow,     // 0..OSD_WINDOW_HEIGHT - 1 
UB8 bCharCode 
) 
{ 
    UW16    wAddr; 
 
 
    wAddr = OSD_DisplayAddress(bWindow, bRow, bCol); 
    BITEK_TxByte(OSD_MAD, wAddr, bCharCode); 
} /* OSD_ShowChar */ 
 
 
#if (OSD_SHOW_HEX) 
/* ------------------------------------------------------------------- 
    Name: OSD_ShowHex - (OSD_BIT1611B) 
    Purpose: To show one byte value in hexadecimal format at 
        specified position of OSD window. 
    Passed: 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_ShowHex ( 
UB8     bWindow, 
UB8     bCol, 
UB8     bRow, 
UB8     bValue 
) 
{ 
    UB8 bChar; 
 
 
    bChar = bValue / 16; 
    if (bChar <= 9) 
        OSD_ShowChar(bWindow, bCol, bRow, '0' + bChar); 
    else 
        OSD_ShowChar(bWindow, bCol, bRow, 'A' + bChar - 10); 
 
    bChar = bValue % 16; 
    if (bChar <= 9) 
        OSD_ShowChar(bWindow, bCol+1, bRow, '0' + bChar); 
    else 
        OSD_ShowChar(bWindow, bCol+1, bRow, 'A' + bChar - 10); 
} /* OSD_ShowHex */ 
#endif 
 
 
/* ------------------------------------------------------------------- 
    Name: OSD_ShowMsg - (OSD_BIT1611B) 
    Purpose: To show a message string with zero at specified position in OSD window. 
    Passed: 
        UB8 bWindow     = OSD Window Identifier. 
        UB8 bCol        = Horizontal position in columns (0..OSD_WINDOW_WIDTH - 1). 
        UB8 bRow        = Vertical position in rows (0..OSD_WINDOW_HEIGHT - 1). 
        UB8 abMsg[]     = The displayed message string. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_ShowMsg ( 
UB8     bWindow, 
UB8     bCol, 
UB8     bRow, 
UB8     abMsg[] 
) 
{ 
    UW16    wAddr; 
    UB8     bIdx; 
 
 
    wAddr = OSD_DisplayAddress(bWindow, bRow, bCol); 
 
    for (bIdx = 0; abMsg[ bIdx ]; bIdx++) 
    { 
        BITEK_TxByte(OSD_MAD, wAddr + bIdx, abMsg[ bIdx ]); 
    } /* for */ 
} /* OSD_ShowMsg */ 
 
 
#if (OSD_SHOW_VALUE) 
/* ------------------------------------------------------------------- 
    Name: OSD_ShowValue - (OSD_BIT1611B) 
    Purpose: To show a specified width value at specified position in OSD window. 
    Passed: 
        UB8     bWindow     = OSD Window Identifier. 
        UB8     bCol,       = Horizontal position in columns. 
        UB8     bRow,       = Vertical position in rows. 
        UW16    wValue      = The displayed value. 
        UB8     bWidth      = The displayed width. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
void OSD_ShowValue ( 
UB8     bWindow, 
UB8     bCol, 
UB8     bRow, 
UW16    wValue, 
UB8     bWidth 
) 
{ 
    UB8 bChar; 
    UB8 bIdx; 
 
 
    for (bIdx = bWidth; bIdx; bIdx--) 
    { 
        bChar = wValue % 10; 
        wValue /= 10; 
 
        if ((wValue == 0)   && 
            (bChar == 0)        ) 
        { 
            if (bIdx == bWidth) 
                OSD_ShowChar(bWindow, bCol + bIdx - 1, bRow, '0'); 
            else 
                OSD_ShowChar(bWindow, bCol + bIdx - 1, bRow, ' '); 
        } 
        else 
            OSD_ShowChar(bWindow, bCol + bIdx - 1, bRow, bChar + '0'); 
    } 
 
} /* OSD_ShowValue */ 
#endif 
 
 
 
/* ------------------------------------------------------------------- 
    Name:  - 
    Purpose: . 
    Passed: None. 
    Returns: None. 
    Notes: 
   ------------------------------------------------------------------- */ 
 
 
/* ********************************************************************** 
 
    Description: 
 
 
   ********************************************************************** */ 
 
/* %% End Of File %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */