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

📄 lcd_reg.c

📁 嵌入式系统
💻 C
📖 第 1 页 / 共 2 页
字号:
/*-----------------------------------------------------------------------------
@@
@@ (Summary)    : The file to read and write register for LCD controller
@@
@@ (Comment)    :
@@
@@ (Author)     : 
@@
@@ (History)    : Date          Modifier    Comment
@@
@@ (RCS ID)     :
@@
-----------------------------------------------------------------------------*/
#include "type_def.h"
#include "amba_io.h"
#include "dev_def.h"
#include "pio.h"
#include "lcd_sys_def.h"
#include "lcd_def.h"
#include "lcd_param.h"
#include "lcd.h"
#include "lcd_palette.h"
#ifdef WIN32
#include "lcdcemu.h"
#endif//WIN32

/******************************************************************************
@@
@@ [Name]       : apd_LCDEnableIntr
@@
@@ [Summary]    : Enable interrupt of LCD controller
@@
@@ [Argument]   : flg : Interrupt flag to enable
@@                      APD_LCD_INTR_MBERR
@@                      APD_LCD_INTR_VCOMP
@@                      APD_LCD_INTR_LNBU
@@                      APD_LCD_INTR_FUF
@@                      Set the value, which is operated 'or' each symbols,
@@                      to argument when you enable two or more interrupts.
@@                      Example)
@@                      Enable interrupts of AMBA bus error and FIFO underflow.
@@                      APD_LCD_INTR_MBERR | APD_LCD_INTR_FUF
@@
@@ [Return]     : None
@@
@@ [Desc]       : Enable the specified interrupt
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDEnableIntr(APD_LCD_INTR_FLG flg)
{
#ifndef WIN32
    apd_WriteRegByMask(LCDC_IntrEnable, (unsigned long)flg, LCD_INTR_MASK);
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDDisableIntr
@@
@@ [Summary]    : Disable interrupt for LCD controller
@@
@@ [Argument]   : flg : Interrupt flag to disable
@@                      APD_LCD_INTR_MBERR
@@                      APD_LCD_INTR_VCOMP
@@                      APD_LCD_INTR_LNBU
@@                      APD_LCD_INTR_FUF
@@                      Set the value, which is operated 'or' each symbols,
@@                      to argument when you disable two or more interrupts.
@@                      Example)
@@                      Disable interrupts of AMBA bus error and FIFO
@@                      underflow.
@@                      APD_LCD_INTR_MBERR | APD_LCD_INTR_FUF
@@
@@ [Return]     : None
@@
@@ [Desc]       : Disable the specified interrupt
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDDisableIntr(APD_LCD_INTR_FLG flg)
{
#ifndef WIN32
    apd_WriteRegByMask(LCDC_IntrEnable, (unsigned long)0, flg & LCD_INTR_MASK);
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetEnableIntrState
@@
@@ [Summary]    : Get interrupt enable state of LCD controller
@@
@@ [Argument]   : None
@@
@@ [Return]     : Interrupt enable state.
@@                bit
@@                 4  AMBA bus error interrupt enable
@@                 3  Vertical compare interrupt enable
@@                 2  Next base update interrupt enable
@@                 1  FIFO underflow interrupt enable
@@
@@ [Desc]       : Get state of interrupt enable.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
unsigned long apd_LCDGetEnableIntrState(void)
{
#ifndef WIN32
    return (apd_ReadReg(LCDC_IntrEnable));
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDClearIntr
@@
@@ [Summary]    : Clear interrupt factor of LCD controller
@@
@@ [Argument]   : flg : Interrupt flag to clear
@@                      APD_LCD_INTR_MBERR
@@                      APD_LCD_INTR_VCOMP
@@                      APD_LCD_INTR_LNBU
@@                      APD_LCD_INTR_FUF
@@                      Set the value, which is operated 'or' each symbols,
@@                      to argument when you clear two or more interrupts.
@@                      Example)
@@                      Clear interrupts of AMBA bus error and FIFO
@@                      underflow.
@@                      APD_LCD_INTR_MBERR | APD_LCD_INTR_FUF
@@
@@ [Return]     : None
@@
@@ [Desc]       : Clear the specified interrupt factor
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDClearIntr(APD_LCD_INTR_FLG flg)
{
#ifndef WIN32
    apd_WriteRegByMask(LCDC_Status, (unsigned long)flg, LCD_INTR_MASK);
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetIntr
@@
@@ [Summary]    : Get interrupt factor of LCD controller
@@
@@ [Argument]   : None
@@
@@ [Return]     : The value of interrupt register for LCD controller
@@                bit
@@                 4  AMBA bus error interrupt
@@                 3  Vertical compare interrupt
@@                 2  Next base update interrupt
@@                 1  FIFO underflow interrupt
@@
@@ [Desc]       : Read interrupt register for LCD controller
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
unsigned long apd_LCDGetIntr(void)
{
#ifndef WIN32
    return(apd_ReadReg(LCDC_Interrupt));
#else//WIN32
    return 0;
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDGetStatus
@@
@@ [Summary]    : Get raw interrupt status for LCD controller
@@
@@ [Argument]   : None
@@
@@ [Return]     : The value of raw interrupt status
@@                bit
@@                 4  AMBA bus error interrupt
@@                 3  Vertical compare interrupt
@@                 2  Next base update interrupt
@@                 1  FIFO underflow interrupt
@@
@@ [Desc]       : Read interrupt status register for LCD controller
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
unsigned long apd_LCDGetStatus(void)
{
#ifndef WIN32
    return(apd_ReadReg(LCDC_Status));
#else//WIN32
    return 0;
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDEnable
@@
@@ [Summary]    : Enable LCD controller
@@
@@ [Argument]   : None
@@
@@ [Return]     : None
@@
@@ [Desc]       : Enable LCD controller
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDEnable(void)
{
#ifndef WIN32
    apd_WriteRegByMask(LCDC_Control, (unsigned long)LCD_ENABLE, LCD_ENABLEMASK);
#else//WIN32
    lcdemu_LCDEnable();
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDDisable
@@
@@ [Summary]    : Disable LCD controller
@@
@@ [Argument]   : None
@@
@@ [Return]     : None
@@
@@ [Desc]       : Disable LCD controller
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDDisable(void)
{
#ifndef WIN32
    apd_WriteRegByMask(LCDC_Control, (unsigned long)LCD_DISABLE, LCD_ENABLEMASK);
#else//WIN32
    lcdemu_LCDDisable();
#endif//WIN32
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDOn
@@
@@ [Summary]    : Power LCD panel
@@
@@ [Argument]   : None
@@
@@ [Return]     : None
@@
@@ [Desc]       : Signal which controls to supply power to LCD panel is on.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]

******************************************************************************/
void apd_LCDOn(void)
{
#ifndef WIN32
    apd_WriteRegByMask(LCDC_Control, (unsigned long)LCD_POWERON, LCD_POWERMASK);
#endif//WIN32
	apd_PIOSetBit(APD_PIOC,2);	//set "LCD_Ctrl" output

}

/******************************************************************************
@@
@@ [Name]       : apd_LCDOff
@@
@@ [Summary]    : Turn off power to LCD panel
@@
@@ [Argument]   : None
@@
@@ [Return]     : None
@@
@@ [Desc]       : Signal which controls to supply power to LCD panel is off.
@@
@@ [History]    : Date      Modifier    Comment
@@
@@ [END]
******************************************************************************/
void apd_LCDOff(void)
{
    apd_WriteRegByMask(LCDC_Control, (unsigned long)LCD_POWEROFF, LCD_POWERMASK);
    apd_PIOClrBit(APD_PIOC,2);	//clear "LCD_Ctrl" output.
}

/******************************************************************************
@@
@@ [Name]       : apd_LCDIPCEnable
@@
@@ [Summary]    : Enable LCD interface peripheral control
@@
@@ [Argument]   : state : The value to enable output control
@@                        APD_LCD_IPC_SPS
@@                        APD_LCD_IPC_CLS
@@                        APD_LCD_IPC_UBL
@@                        APD_LCD_IPC_DISP
@@                        APD_LCD_IPC_EN0
@@                        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 enable two or more output
@@                        controls.
@@                        Example)
@@                        enable output controls of SPS and CLS
@@                        APD_LCD_IPC_SPS | APD_LCD_IPC_CLS
@@
@@ [Return]     : None
@@
@@ [Desc]       : Enable 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_LCDIPCEnable(APD_LCD_IPC_OUT_TYPE  state)
{
    unsigned long mask;

    mask = state & LCDIPC_ENABLEMASK;
    apd_WriteRegByMask(LCDIPC_Control, state, mask);
}
#endif
*/
/******************************************************************************
@@
@@ [Name]       : apd_LCDIPCDisable
@@
@@ [Summary]    : Disable LCD interface peripheral control
@@
@@ [Argument]   : state : The value to disable output control
@@                        APD_LCD_IPC_SPS
@@                        APD_LCD_IPC_CLS
@@                        APD_LCD_IPC_UBL
@@                        APD_LCD_IPC_DISP
@@                        APD_LCD_IPC_EN0

⌨️ 快捷键说明

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