Answered by:
S3C6410 GPIO port access through VC++ Application

Question
-
Dear all,
I am new to WINCE/VC++ development environment, I m using samsung S3C6410 development board, I tried to access the GPIO's through VC++ application , i got failed, I tried to access from Driver it is working fine.
Based on my search i found , Need to do Virtual mapping for GPIO's to Access those from application.
volatile S3C6410_GPIO_REG * g_pGPIOReg ; BOOL bRet = TRUE; g_pGPIOReg = (S3C6410_GPIO_REG *)DrvLib_MapIoSpace(S3C6410_BASE_REG_PA_GPIO, sizeof(S3C6410_GPIO_REG), FALSE); if (g_pGPIOReg == NULL) { //TSPERR((_T("[TSP:ERR] TSP_VirtualAlloc() : g_pGPIOReg Allocation Fail\r\n"))); bRet = FALSE; goto CleanUp; }
CleanUp: if (bRet == FALSE) { // TSPERR((_T("[TSP:ERR] TSP_VirtualAlloc() : Failed\r\n"))); TSP_VirtualFree(); }I included Drvlib.h also from S3C6410 SDK..
#ifndef __S3C6410_DEVICE_DRIVER_LIB_H__ #define __S3C6410_DEVICE_DRIVER_LIB_H__ //extern g_oalAddressTable [index][2]; #if __cplusplus extern "C" { #endif void *DrvLib_MapIoSpace(UINT32 PhysicalAddress, UINT32 NumberOfBytes, BOOL CacheEnable); void DrvLib_UnmapIoSpace(void *MappedAddress);
But i am getting Error from compilation:
error LNK2019: unresolved external symbol DrvLib_MapIoSpace referenced in function "public: void __cdecl CbuttonDlg::OnBnClickedButton1(void)" (?OnBnClickedButton1@CbuttonDlg@@QAAXXZ)
1>buttonDlg.obj : error LNK2019: unresolved external symbol DrvLib_UnmapIoSpace referenced in function "void __cdecl TSP_VirtualFree(void)" (?TSP_VirtualFree@@YAXXZ)
1>Idea6410_SDK (ARMV4I)\Debug\button.exe : fatal error LNK1120: 2 unresolved external
How to solve this problem, Please suggest me..
Thanks,
sri
Tuesday, November 30, 2010 6:51 AM
Answers
-
Hi,
The best solution is to implement a stream driver to access the GPIO functionality for S3C6410 development board in WinCE BSP.
Accessing the GPIO port from the application is not a good method.
Thanks & best regards, Prasad K R S V- Proposed as answer by Michael Koster Tuesday, November 30, 2010 7:44 PM
- Marked as answer by Srini_vasan Thursday, December 2, 2010 7:41 AM
Tuesday, November 30, 2010 9:48 AM -
Hi,
to read about the Stream Driver Interface concept for Windows CE 6.0 start here.
http://msdn.microsoft.com/en-US/library/ee484885.aspx
Basically a stream interfcae driver is a dll running in kernel mode that exposes a set of functions that can be accessed through the File I/O API, e.g. CreateFile, Read/WriteFile and DeviceIoControl.
Some good examples and very comprehensive articles can be found on Bruce Eitmans' BLOG.
http://geekswithblogs.net/BruceEitman/archive/2008/06/09/windows-ce-a-stream-interface-shell.aspx
We had similar requirements for our project but instead of writing a driver that allows us to manipulate the GPIO pins of our board, we decided to use the NLED Driver API (http://msdn.microsoft.com/en-US/library/ee481282.aspx)
Basic idea is:
- clone the NLED Driver into your BSP.
- add GPIO handling code to the PDD part of the driver
- use the registry to store information on which GPIOs to use
HTH,
Bjoern
- Marked as answer by Srini_vasan Thursday, December 2, 2010 2:16 AM
Wednesday, December 1, 2010 10:34 AM
All replies
-
Hi Sri,
I guess that you have to include the libraries which are installed as part of SDK in IDE as dependencies.
If you have already included the libraries in the IDE settings, still you are seeing the error means that the libraries doesn't have the definition for those functions.
Thank You & Regards,
GSR
Tuesday, November 30, 2010 7:17 AM -
Hi sudir,
Thanks for your reply, In SMDK 6410, Touch screen driver they used this DrvLib_MapIoSpace , compiled success no problem, this application i m compiling in VS2005 with that SDK,
That fuction definition , i tried all files i m not able to find.. still searching.
Thanks,
Sri
SriTuesday, November 30, 2010 8:46 AM -
Hi,
The best solution is to implement a stream driver to access the GPIO functionality for S3C6410 development board in WinCE BSP.
Accessing the GPIO port from the application is not a good method.
Thanks & best regards, Prasad K R S V- Proposed as answer by Michael Koster Tuesday, November 30, 2010 7:44 PM
- Marked as answer by Srini_vasan Thursday, December 2, 2010 7:41 AM
Tuesday, November 30, 2010 9:48 AM -
Hi Prasad,
Thanks for your reply, Using DrvLib_MapIoSpace (for Virtual IO Mapping) is not possible from my Application i think, From the Drivers functionalities i can access any ports,
Means , i have configured some GPIO PORTS in touch screen drivers, After touch Enable buzzer port. i got Success.
I want to Enable some siren, Lights On/OFF, Though Application Buttons via GPIO outputs.
I dont have Clear idea about Stream driver.. Can u give bit idea? or any samples. it would be helpful for me.
Thanks,
Sri
SriWednesday, December 1, 2010 3:57 AM -
Hi,
to read about the Stream Driver Interface concept for Windows CE 6.0 start here.
http://msdn.microsoft.com/en-US/library/ee484885.aspx
Basically a stream interfcae driver is a dll running in kernel mode that exposes a set of functions that can be accessed through the File I/O API, e.g. CreateFile, Read/WriteFile and DeviceIoControl.
Some good examples and very comprehensive articles can be found on Bruce Eitmans' BLOG.
http://geekswithblogs.net/BruceEitman/archive/2008/06/09/windows-ce-a-stream-interface-shell.aspx
We had similar requirements for our project but instead of writing a driver that allows us to manipulate the GPIO pins of our board, we decided to use the NLED Driver API (http://msdn.microsoft.com/en-US/library/ee481282.aspx)
Basic idea is:
- clone the NLED Driver into your BSP.
- add GPIO handling code to the PDD part of the driver
- use the registry to store information on which GPIOs to use
HTH,
Bjoern
- Marked as answer by Srini_vasan Thursday, December 2, 2010 2:16 AM
Wednesday, December 1, 2010 10:34 AM -
Hi,
to read about the Stream Driver Interface concept for Windows CE 6.0 start here.
http://msdn.microsoft.com/en-US/library/ee484885.aspx
Basically a stream interfcae driver is a dll running in kernel mode that exposes a set of functions that can be accessed through the File I/O API, e.g. CreateFile, Read/WriteFile and DeviceIoControl.
Some good examples and very comprehensive articles can be found on Bruce Eitmans' BLOG.
http://geekswithblogs.net/BruceEitman/archive/2008/06/09/windows-ce-a-stream-interface-shell.aspx
We had similar requirements for our project but instead of writing a driver that allows us to manipulate the GPIO pins of our board, we decided to use the NLED Driver API (http://msdn.microsoft.com/en-US/library/ee481282.aspx)
Basic idea is:
- clone the NLED Driver into your BSP.
- add GPIO handling code to the PDD part of the driver
- use the registry to store information on which GPIOs to use
HTH,
Bjoern
Thanks to all of your guidance and support ..
SriThursday, December 2, 2010 2:18 AM