Hi:
I’m too new to WinDDK (2 months?), still learning English, and first post
here. All this will be clear in a couple of lines, so why not mention it?
Thanks for continuing:
I have a custom PCI board with read / write registers on BARs 1 to 3. I
would like to access (read/write) those registers from an application
compiled with Qt 4.6.x on Windows.
My final question is about which of the alternatives is best to insist on
(having a ‘working’ KMDF driver):
- Build a user space EXE on Qt (against MinGW), or
- Build a .LIB, or .DLL using WinDDK’s ‘build -cegZ’ command, that exports
‘readRegister’ and ‘writeRegister’ functions, and
Build an user space EXE on Qt (against MinGW) linking to that .LIB to
use exported functions
Or there may be a better way to have it done.
-
-
- What I have done so far, not too necessary to read - - -
-
Purpose: read a single PCI register in memory space of BAR1
O.S.: WinXP, SP3, 32bit
Device Driver type: KMDF
User application: Qt 4.6.x
Starting point: C:\WinDDK\7600.16385.1\src\general\pcidrv
I have modified some files on KMDF part of ‘pcidrv’ example to adjust to my
device and read registers directly (for example, in [NICMapHWResources()]
after BARs are mapped)
Then I have modified TEST part of ‘pcidrv’ and some part of KMDF to read a
register with an offset set on TEST’s window (modifying GetSrcMac - receives
the offset from QueryBuffer, and returns data on register. I modified
‘GetSrcMac’ as I don’t need any Mac Address and the communication between
user space and kernel space is done)
Then I have modified TEST part of ‘pcidrv’ to convert it to a command line
application.
So I have a ‘working’ KMDF device driver for my custom PCI board and a
command line application with which I can read registers. Both of them built
with ‘build -cegZ’ from command line.
And now I was trying to adapt that command-line application on QT
>>> alternative 1 >>>>
I have finally modified the files to built an executable against MinGW, but
crashes on first loop when trying to:
if (! SetupDiGetDeviceInterfaceDetail (
hardwareDeviceInfo,
&deviceInterfaceData,
deviceInterfaceDetailData,
predictedLength,
&requiredLength,
NULL)) {
Maybe because of too many changes.
<<<<<<<<<<<<<<<<<<<<
>>> alternative 2 >>>>
So I tried a workaround just for testing:
I have modified the ‘sources’ in TEST part of ‘pcidrv’ to build a library:
TARGETNAME=libmyping
TARGETTYPE=DRIVER_LIBRARY
and changed the first line of function main to:
int __cdecl ext_main( long offset )
so I have a libmyping.lib file generated.
But I can’t make Qt link a default Qt GUI application with a call to
‘ext_main(long)’
I have the following error message:
g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o
debug\test_libpci.exe debug/main.o debug/test_libpci.o
debug/moc_test_libpci.o -L"c:\Qt\4.6.2\lib" -lmingw32 -lqtmaind
-LC:/WinDDK/7600.16385.1/src/myEclipseTests/pcidrv/test/objchk_wxp_x86/i386
-llibmyping -lQtGuid4 -lQtCored4
debug/test_libpci.o: In function test_libpci': C:\WinDDK\7600.16385.1\src\myEclipseTests\test_libpci/test_libpci.cpp:19: undefined reference to ext_main(long)’
C:\WinDDK\7600.16385.1\src\myEclipseTests\test_libpci/test_libpci.cpp:19:
undefined reference to `ext_main(long)’
collect2: ld returned 1 exit status
The linker finds libmyping.lib file, but can’t find the function inside. I’m
lacking in background about .LIB/.DLL linking
<<<<<<<<<<<<<<<<<<<<
Please, once you made this great effort on reading, could you help me decide
which way is best to continue?
Thanks in advance,
Aitortxo.
A big mess?