From: Rolf K. <rol...@ci...> - 2004-03-03 14:04:06
|
Hello all, I have just uploaded the first release V1.01 of a VI library with associated user space dll and NT device driver to allow access of the Port IO address space on x86 systems. The CVS module name is "portIO". Packaging is not yet done and I would prefer some people with CVS access using this library first on different systems. It has been tested on NT4, 2000, and XP to work as suspected ;-) The way this works is that the user space DLL decides if the system is NT based and opens, and if necessary, installs the device driver on the system. Each function should be able to perform this check but in general it is a good idea to first call once the PORT IO Get Version.vi. For this to work you need to have administrator rights the first time when it is attempting to install the device driver. Then the PORT IO Read and Write functions have basically two modes. A normal mode where they access the device driver to let it read or write the actual value (this is the same as what the current LabVIEW distributed IO library does), and a fast mode where they will directly perform the according IO port access in the user space DLL. (For Windows 9x/ME systems there is no difference between these two modes as no device driver is needed to access Port IO from user space.) In order for the user space library to be able to access the port directly on NT based systems you need however to enable that port or port range first with the PORT IO Enable Range.vi function. Just pass in the base address and the number of consecutive port addresses you want to have access to and you should be able to access these ports in fast mode. ==> Watch out writing randomly to IO ports in your system will most probably result in a crash and eventually damage your hardware and/or software. Save address ranges are usually 0x220-0x22F (unless you use a GPIB card), 0x300-0x33F (prototype range), and 0x378-0x37F (LPT1), but your mileage may vary. Tests on my Pentium 3 Mobile 866 MHz system show that to read 1000 times 8 registers uses around 750 ms in traditional (device driver access) mode whereas it performs the same operation in 20 ms in the fast mode. Depending on time and motivation I may also try to upload the necessary source code and shared library to perform these same operations transparently on Linux systems. Enjoy Rolf Kalbermatter CIT Engineering Nederland BV tel: +31 (070) 415 9190 Treubstraat 7H fax: +31 (070) 415 9191 2288 EG Rijswijk http://www.citengineering.com Netherlands mailto:rol...@ci... |
From: Jim K. <ji...@ji...> - 2004-03-05 17:23:06
|
Very nice work, Rolf. I downloaded and tested on my WinXP laptop, but I couldn't get it to = work. My laptop doesn't have a parallel port, which might be the problem (no hardware at 0x378). When I run the test VI, regardless of what I set = the "write value" to, the "written value" (read value) is always 255. I'll see if I can get some other folks to do some further testing. It = might be nice to do some speed benchmarks in a real-world application. I know someone with a Parallel Port I2C/SPI driver board. The device driver = for the board currently uses NI's PortIO driver. A speed boost would be = really useful for this person's application since chip test folks always want = to do things *faster* :-) =20 Also, I'll volunteer to create an MNU file for this package so that we = can integrate it into the palettes. -Jim > -----Original Message----- > From: ope...@li...=20 > [mailto:ope...@li...]=20 > On Behalf Of Rolf Kalbermatter > Sent: Wednesday, March 03, 2004 6:00 AM > To: ope...@li... > Subject: First release of Port IO library for Windows=20 > 9x/ME/NT/2000/XP/2003 >=20 >=20 > Hello all, >=20 > I have just uploaded the first release V1.01 of a VI library=20 > with associated user space dll and NT device driver to allow=20 > access of the Port IO address space on x86 systems. The CVS=20 > module name is "portIO". >=20 > Packaging is not yet done and I would prefer some people with=20 > CVS access using this library first on different systems. It=20 > has been tested on NT4, 2000, and XP to work as suspected ;-)=20 >=20 > The way this works is that the user space DLL decides if the=20 > system is NT based and opens, and if necessary, installs the=20 > device driver on the system. Each function should be able to=20 > perform this check but in general it is a good idea to first=20 > call once the PORT IO Get Version.vi. For this to work you=20 > need to have administrator rights the first time when it is=20 > attempting to install the device driver. >=20 > Then the PORT IO Read and Write functions have basically two=20 > modes. A normal mode where they access the device driver to=20 > let it read or write the actual value (this is the same as=20 > what the current LabVIEW distributed IO library does), and a=20 > fast mode where they will directly perform the according IO=20 > port access in the user space DLL. (For Windows 9x/ME systems=20 > there is no difference between these two modes as no device=20 > driver is needed to access Port IO from user space.) >=20 > In order for the user space library to be able to access the=20 > port directly on NT based systems you need however to enable=20 > that port or port range first with the PORT IO Enable=20 > Range.vi function. Just pass in the base address and the=20 > number of consecutive port addresses you want to have access=20 > to and you should be able to access these ports in fast mode. >=20 > =3D=3D> Watch out writing randomly to IO ports in your system=20 > will most probably result in a crash and eventually damage=20 > your hardware and/or software. >=20 > Save address ranges are usually 0x220-0x22F (unless you use a=20 > GPIB card), 0x300-0x33F (prototype range), and 0x378-0x37F=20 > (LPT1), but your mileage may vary. >=20 > Tests on my Pentium 3 Mobile 866 MHz system show that to read=20 > 1000 times 8 registers uses around 750 ms in traditional=20 > (device driver access) mode whereas it performs the same=20 > operation in 20 ms in the fast mode. >=20 > Depending on time and motivation I may also try to upload the=20 > necessary source code and shared library to perform these=20 > same operations transparently on Linux systems. >=20 > Enjoy >=20 > Rolf Kalbermatter > CIT Engineering Nederland BV tel: +31 (070) 415 9190 > Treubstraat 7H fax: +31 (070) 415 9191 > 2288 EG Rijswijk http://www.citengineering.com > Netherlands mailto:rol...@ci... > =20 >=20 >=20 |
From: Rolf K. <rol...@ci...> - 2004-03-05 23:01:03
Attachments:
BEEP Test Example.llb
|
Jim Kring [mailto:ji...@ji...] wrote: > I downloaded and tested on my WinXP laptop, but I couldn't=20 > get it to work. > My laptop doesn't have a parallel port, which might be the problem (no > hardware at 0x378). When I run the test VI, regardless of=20 > what I set the > "write value" to, the "written value" (read value) is always 255. Well 255 is the inactive state of the databus as it is terminated with pullup resistors in all modern systems. Not really sure what other addresses would be save. I completely crashed my system the first time I wrote into the first few address at 0x0 by accident ;-) One possibility might be to test the port at 0x42 which should be the counter for the beeper. I included a beeper example which might be useful as test/example utility for people to see that the routines actually work at all ;-) But I'm sure there are soon computers out there which do not have this speaker anymore! The hardware will probably remain as it is nowadays all integrated in the chipsets but the speaker may have to go to save another 5 cent in production costs in some computers. > I'll see if I can get some other folks to do some further testing. > It might be nice to do some speed benchmarks in a real-world=20 > application. I know someone with a Parallel Port I2C/SPI driver > board. The device driver for the board currently uses NI's PortIO > driver. A speed boost would be really useful for this person's > application since chip test folks always want to do things *faster* = :-) =20 Well, I was thinking that with a little change I may squezze out another few ns ;-). No honestly this is about as fast as it gets and it is a real hack as it effectively circumvents all the protection the Windows NT kernel puts up to prevent an application from trashing the system or even possibiliy gaining access to resources usually protected by passwords and such. But hey there are people who want this and I'm not going to prevent other people from shooting in their own foot ;-)=20 On Linux there is also a similar possible hack I have investigated, but to be honest I am reluctant to try to do that there. It just goes around any and all protection built into the kernel by requiring a user to have root privileges to do certain stuff. > Also, I'll volunteer to create an MNU file for this package=20 > so that we can integrate it into the palettes. Well thanks I just looked at teh OpenG installer you sent me. Nice. Rolf Kalbermatter CIT Engineering Nederland BV tel: +31 (070) 415 9190 Treubstraat 7H fax: +31 (070) 415 9191 2288 EG Rijswijk http://www.citengineering.com Netherlands mailto:rol...@ci... =20 |
From: Jim K. <ji...@ji...> - 2004-03-05 23:19:03
|
Rolf Kalbermatter <rol...@ci...> said: [snip] > One possibility might be to test the port at 0x42 which should be > the counter for the beeper. I included a beeper example which might > be useful as test/example utility for people to see that the > routines actually work at all ;-) It beeps beautifully on my WinXP Laptop. It even turned the head of the fellow in the cubicle next to mine :-) [snip] > > Also, I'll volunteer to create an MNU file for this package > > so that we can integrate it into the palettes. > > Well thanks I just looked at teh OpenG installer you sent me. Nice. Thanks, -Jim |