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

📄 lcd_reg.c

📁 嵌入式系统
💻 C
📖 第 1 页 / 共 2 页
字号:
@@                        APD_LCD_IPC_EN1
@@                        APD_LCD_IPC_EN2
@@                        APD_LCD_IPC_EN3
@@                        Set the value, which is operated 'or' each symbols,
@@                        to argument when you disable two or more output
@@                        controls.
@@                        Example)
@@                        disable output controls of SPS and CLS.
@@                        APD_LCD_IPC_SPS | APD_LCD_IPC_CLS
@@
@@ [Return]     : None
@@
@@ [Desc]       : Disable the corresponding enable bits of LCD interface
@@                peripheral control to the argument.
@@
@@ [History]    : Date        Modifier        Comment
@@
@@ [END]
******************************************************************************/
/*#ifdef LH79531		// GongXiaoXiong 28/10/2002
void apd_LCDIPCDisable(APD_LCD_IPC_OUT_TYPE    state)
{
    unsigned long mask;

    mask = state & LCDIPC_ENABLEMASK;
    apd_WriteRegByMask(LCDIPC_Control, ~state, mask);
}
#endif
*/

/******************************************************************************
@@
@@ [Name]       : apd_LCDSetUpbase
@@
@@ [Summary]    : Set base address of the upper panel's data
@@
@@ [Argument]   : adrs : Base address of the upper panel's data
@@
@@ [Return]     : None
@@
@@ [Desc]       : Set the upper panel's base address of LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDSetUpbase(unsigned long adrs)
{
#ifndef WIN32
    apd_WriteReg(LCDC_UpBase, adrs);
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDSetLpbase
@@
@@ [Summary]    : Set base address of the lower panel's data
@@
@@ [Argument]   : adrs : Base address of the lower panel's data
@@
@@ [Return]     : None
@@
@@ [Desc]       : Set the lower panel's base address of LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDSetLpbase(unsigned long adrs)
{
#ifndef WIN32
    apd_WriteReg(LCDC_LpBase, adrs);
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetUpbase
@@
@@ [Summary]    : Get base address of the upper panel's data
@@
@@ [Argument]   : None
@@
@@ [Return]     : Address of the upper panel's data
@@
@@ [Desc]       : Read the upper panel's base address of LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
unsigned long apd_LCDGetUpbase(void)
{
#ifndef WIN32
    return(apd_ReadReg(LCDC_UpBase));
#else//WIN32
    return (unsigned long)lcdemu_GetVideoRam();
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetLpbase
@@
@@ [Summary]    : Get base address of the lower panel's data
@@
@@ [Argument]   : None
@@
@@ [Return]     : Address of the lower panel's data
@@
@@ [Desc]       : Read the lower panel's base address of LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
unsigned long apd_LCDGetLpbase(void)
{
#ifndef WIN32
    return(apd_ReadReg(LCDC_LpBase));
#else//WIN32
    return (unsigned long)lcdemu_GetVideoRamLow();
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetUpcurr
@@
@@ [Summary]    : Get current values of the upper panel DMA address
@@
@@ [Argument]   : None
@@
@@ [Return]     : Current DMA address of the upper panel
@@
@@ [Desc]       : Read the upper panel's drawing address of LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
unsigned long apd_LCDGetUpcurr(void)
{
#ifndef WIN32
    return(apd_ReadReg(LCDC_UpCurr));
#else//WIN32
    return (unsigned long)lcdemu_GetVideoRam();
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetLpcurr
@@
@@ [Summary]    : Get current values of the lower panel DMA address
@@
@@ [Argument]   : None
@@
@@ [Return]     : Current DMA address of the lower panel
@@
@@ [Desc]       : Read the lower panel's drawing address of LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
unsigned long apd_LCDGetLpcurr(void)
{
#ifndef WIN32
    return(apd_ReadReg(LCDC_LpCurr));
#else//WIN32
    return (unsigned long)lcdemu_GetVideoRamLow();
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDSetVcomp
@@
@@ [Summary]    : Set timing for the Vertical Compare interrupt
@@
@@ [Argument]   : vcomp : Type of timing for Vertical Compare interrupt.
@@                        (either of the following.)
@@                        APD_LCD_VCOMP_VSYNC
@@                        APD_LCD_VCOMP_BPORCH
@@                        APD_LCD_VCOMP_AVIDEO
@@                        APD_LCD_VCOMP_FPORCH
@@
@@ [Return]     : None
@@
@@ [Desc]       : Set timing for the Vertical Compare interrupt of
@@                LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDSetVcomp(APD_LCD_VCOMP_TYPE vcomp)
{
#ifndef WIN32
    apd_WriteRegByMask(LCDC_Control, (unsigned long)vcomp, LCD_VCOMP_MASK);
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetVcomp
@@
@@ [Summary]    : Get timing for Vertical Compare interrupt
@@
@@ [Argument]   : None
@@
@@ [Return]     : Type of timing for Vertical Compare interrupt
@@                0x0000 : Start of vertical synchronization
@@                0x0100 : Start of back porch
@@                0x0200 : Start of active video
@@                0x0300 : Start of front porch
@@
@@ [Desc]       : Read timing for Vertical Compare interrupt of LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
APD_LCD_VCOMP_TYPE apd_LCDGetVcomp(void)
{
#ifndef WIN32
    return((APD_LCD_VCOMP_TYPE)apd_ReadRegByMask(LCDC_Control,LCD_VCOMP_MASK));
#else//WIN32
    return 0;
#endif//WIN32

}

/******************************************************************************
@@
@@ [Name]       : apd_LCDSetPalette
@@
@@ [Summary]    : Set color palette for LCD controller
@@
@@ [Argument]   : palette : Pointer to buffer of color palette data
@@
@@ [Return]     : None
@@
@@ [Desc]       : Set data to color palette for LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDSetPalette(APD_LCD_RGB_COLOR *palette)
{
    volatile    unsigned long *palette_adrs;
    APD_LCD_RGB_COLOR *palette_data;
    APD_USHORT color[2];
    int i;

    palette_adrs = LCDC_Palette;
    palette_data = palette;
    for (i = 0; i < LCD_PALETTE_MAX / 2; i++) {
        color[0] = LCDPackPalette(palette_data);
        palette_data++;
        color[1] = LCDPackPalette(palette_data);
        palette_data++;
        LCDSetPalette(palette_adrs, color);
        palette_adrs++;
    }
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetPalette
@@
@@ [Summary]    : Get data of color palette for LCD controller
@@
@@ [Argument]   : palette : Pointer to buffer of color palette data
@@
@@ [Return]     : Data of color palette
@@
@@ [Desc]       : Read data of color palette for LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDGetPalette(APD_LCD_RGB_COLOR *palette)
{
    volatile unsigned long *palette_adrs;
    APD_LCD_RGB_COLOR *palette_data;
    APD_USHORT color[2];
    int i;

    palette_adrs = LCDC_Palette;
    palette_data = palette;
    for (i = 0; i < LCD_PALETTE_MAX / 2; i++) {
        LCDGetPalette(palette_adrs, color);
        palette_adrs++;
        LCDUnpackPalette(palette_data, color[0]);
        palette_data++;
        LCDUnpackPalette(palette_data, color[1]);
        palette_data++;
    }
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDSetPaletteByID
@@
@@ [Summary]    : Set color palette for LCD controller by ID
@@
@@ [Argument]   : id      : Color palette ID
@@                palette : Pointer to buffer of color palette data
@@
@@ [Return]     : None
@@
@@ [Desc]       : Set data to color palette specified by ID for LCD controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDSetPaletteByID(APD_USHORT id,APD_LCD_RGB_COLOR *palette)
{
    volatile unsigned long *palette_adrs;
    APD_USHORT c, color[2];

    c = LCDPackPalette(palette);
    palette_adrs = LCDC_Palette + (id >> 1);
    LCDGetPalette(palette_adrs, color);
    color[id & 0x0001] = c;
    LCDSetPalette(palette_adrs, color);
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetPaletteByID
@@
@@ [Summary]    : Get data of color palette for LCD controller by ID.
@@
@@ [Argument]   : id      : Color palette ID
@@                palette : Pointer to buffer of color palette data
@@
@@ [Return]     : Data of color palette
@@
@@ [Desc]       : Read data of color palette specified by ID for LCD
@@                controller.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDGetPaletteByID(APD_USHORT id,APD_LCD_RGB_COLOR *palette)
{
    volatile unsigned long *palette_adrs;
    APD_USHORT color[2];

    palette_adrs = LCDC_Palette + (id >> 1);
    LCDGetPalette(palette_adrs, color);
    LCDUnpackPalette(palette, color[id & 0x0001]);
}

⌨️ 快捷键说明

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