具体情况如下,我在显示驱动代码实现中调用背光驱动,显示驱动代码中导入了背光驱动的H文件,后面具体调用过程省略。
#include "VGAoutpch.h"
#include "CH702X.h"
#include "bsp_backlight.h"
//#pragma comment(lib,"backlight.lib")
//#pragma comment(lib,"backlight_lib.lib")
。。。。。。。。
//代码段中调用了背光驱动中的BLHwPowerOff和BLHwInit两个函数
void CSetupDialog::SetupCmdProc(WORD wCmd)
{
TCHAR wzInvalid[] = _T(";<>*+=|? \t\"");
TCHAR multiSz[] = _T("AR6K_SD1");
switch (wCmd)
{
case IDOK:
CH702X_Close();
EndDialog(m_hDlg, FALSE);
break;
case IDCANCEL:
CH702X_Close();
EndDialog(m_hDlg, FALSE);
break;
case IDC_ON:
//CH702X_Init(NTSC_M);
BLHwPowerOff();
CH702X_Init(VGA_SCALER);
InitSliderStatus();
break;
case IDC_OFF:
BLHwInit();
TCHAR szOut[16];
CH702X_PowerOff();
SendMessage(m_hSliderContrast,TBM_SETPOS,TRUE,0);
SendMessage(m_hSliderBrightness,TBM_SETPOS,TRUE,0);
SendMessage(m_hSliderSharpness,TBM_SETPOS,TRUE,0);
wsprintf(szOut,_T("%d"),0);
SendMessage(m_hTextContrast,WM_SETTEXT,0,(LPARAM)szOut);
wsprintf(szOut,_T("%d"),0);
SendMessage(m_hTextBrightness,WM_SETTEXT,0,(LPARAM)szOut);
wsprintf(szOut,_T("%d"),0);
SendMessage(m_hTextSharpness,WM_SETTEXT,0,(LPARAM)szOut);
break;
}
}
。。。。。。。。
还编辑了sources文件的内容如下:
!IF "$(BSP_VGAOUT)" == "1"
!ELSE
SKIPBUILD=1
!ENDIF
TARGETNAME=VGAoutpnl
RELEASETYPE=PLATFORM
WINCEOEM=1
CPL=1
DLLENTRY=DllEntry
TARGETTYPE=DYNLINK
TARGETLIBS= \
$(_COMMONSDKROOT)\lib\$(_CPUINDPATH)\coredll.lib \
$(_COMMONSDKROOT)\lib\$(_CPUINDPATH)\Commctrl.lib \
$(_COMMONSDKROOT)\lib\$(_CPUINDPATH)\ceddk.lib \
$(_TARGETPLATROOT)\lib\$(_CPUINDPATH)\drvbaselib.lib \
$(_TARGETPLATROOT)\lib\$(_CPUINDPATH)\backlight.lib \
$(_TARGETPLATROOT)\lib\$(_CPUINDPATH)\backlight_lib.lib \
_ISVINCPATH=$(_WINCEROOT)\public\ie\sdk\inc;$(_WINCEROOT)\public\shellsdk\sdk\inc;$(_WINCEROOT)\public\common\sdk\inc;$(_WINCEROOT)\public\common\oak\inc;$(_WINCEROOT)\public\gdiex\sdk\inc;
_OEMINCPATH=$(_WINCEROOT)\public\ie\sdk\inc;$(_WINCEROOT)\public\shellsdk\sdk\inc;$(_WINCEROOT)\public\wceshellfe\oak\inc;$(_WINCEROOT)\public\common\sdk\inc;$(_WINCEROOT)\public\common\oak\inc;$(_WINCEROOT)\public\gdiex\sdk\inc;
INCLUDES= \
$(INCLUDES);$(_TARGETPLATROOT)\SRC\BSP_CONFIG\8801_EPC_V2;$(_TARGETPLATROOT)\SRC\AK_PRIVATE\DRIVERS\BACKLIGHT;$(_TARGETPLATROOT)\SRC\DRIVERS\BACKLIGHT;$(_TARGETPLATROOT)\SRC\AK_PRIVATE\DRIVERS\I2C\INC;$(_TARGETPLATROOT)\SRC\DRIVERS\I2C;$(_WINCEROOT)\\PUBLIC\COMMON\DDK\INC \
SOURCES= \
VGAoutpnl.rc \
CH702X.cpp \
VGAoutpnl.cpp \
最后编译BSP代码,但是生成nb0文件时失败,提示出现如下错误:
BUILD: [01:0000001162:ERRORE] VGAoutpnl.obj : error LNK2019: unresolved external symbol BLHwPowerOff referenced in function "public: void __cdecl CSetupDialog::SetupCmdProc(unsigned short)" (?SetupCmdProc@CSetupDialog@@QAAXG@Z)
BUILD: [01:0000001163:ERRORE] VGAoutpnl.obj : error LNK2019: unresolved external symbol BLHwInit referenced in function "public: void __cdecl CSetupDialog::SetupCmdProc(unsigned short)" (?SetupCmdProc@CSetupDialog@@QAAXG@Z)
BUILD: [01:0000001164:ERRORE] C:\WINCE600\platform\AK780X\target\ARMV4I\retail\VGAoutpnl.dll : fatal error LNK1120: 2 unresolved externals
补充:背光驱动代码主要分2部分:
第一个文件:
bsp_backlight_stub.c文件实现:
#include "bsp_backlight.c"(路径C:\WINCE600\PLATFORM\AK780X\SRC\DRIVERS\BACKLIGHT)
第二个文件:
bsp_backlight.c文件实现:(路径C:\WINCE600\PLATFORM\AK780X\SRC\BSP_CONFIG\8801_EPC_V2)
#include
#include
#include "bsp_backlight.h"
#ifdef DGPIO
#undef DGPIO
#endif
#ifdef GPIO
#undef GPIO
#endif
#define DGPIO TRUE
#define GPIO FALSE
void BLHwInit()
{
BYTE bBrightness = 8;
BacklightBrightnessControl(&bBrightness);
}
void BLHwPowerOn(void)
{
AKPIN_ID pin;
AKGPIO_HANDLE hIoPin = NULL;
AKSPIN_HANDLE hPin = NULL;
AKGPIO_CreatePinID(9, GPIO, &pin);
if (AKRSLT_FAILD(AKSPIN_Init(&pin, PINSHARE_EXCLUSIVE, &hPin))
|| AKRSLT_FAILD(AKSPIN_Lock(hPin))
|| AKRSLT_FAILD(AKGPIO_Alloc(&pin, &hIoPin)) // get IO object
|| AKRSLT_FAILD(AKGPIO_SetDirection(hIoPin, FALSE)) // set dir in
)
{
RETAILMSG(1, (TEXT("can't get BACKLIGHT IO resource\r\n")));
if(hPin)
{
AKSPIN_Deinit(hPin);
}
if (hIoPin)
{
AKGPIO_Free(hIoPin);
}
return;
}
AKGPIO_SetVal(hIoPin, 0xffffffff);
AKSPIN_Deinit(hPin);
AKGPIO_Free(hIoPin);
}
void BLHwPowerOff(void)
{
AKPIN_ID pin;
AKGPIO_HANDLE hIoPin = NULL;
AKSPIN_HANDLE hPin = NULL;
AKGPIO_CreatePinID(9, GPIO, &pin);
if (AKRSLT_FAILD(AKSPIN_Init(&pin, PINSHARE_EXCLUSIVE, &hPin))
|| AKRSLT_FAILD(AKSPIN_Lock(hPin))
|| AKRSLT_FAILD(AKGPIO_Alloc(&pin, &hIoPin)) // get IO object
|| AKRSLT_FAILD(AKGPIO_SetDirection(hIoPin, FALSE)) // set dir in
)
{
RETAILMSG(1, (TEXT("can't get BACKLIGHT IO resource\r\n")));
if(hPin)
{
AKSPIN_Deinit(hPin);
}
if (hIoPin)
{
AKGPIO_Free(hIoPin);
}
return;
}
AKGPIO_SetVal(hIoPin, 0);
AKSPIN_Deinit(hPin);
AKGPIO_Free(hIoPin);
}
void BacklightBrightnessControl(LPBYTE pBrightness )
{
BYTE bBrightness;
BYTE i;
BYTE nDelay;
RETAILMSG(1, (TEXT("Set backlight:%d\r\n"), *pBrightness));
bBrightness = *pBrightness; //0: backlight off;
BLHwPowerOff();
if(bBrightness != 0)
{
for (i=0; i < bBrightness; i++)// on epc using pulse to control Backlight Brightness 16 register
{
BLHwPowerOff();
BLHwPowerOn();
}
}
else
{
BLHwPowerOff();
}
}
有没有哪位高手指点一下小弟,为什么背光驱动文件中的函数无法引用?万分感谢!