Thread: Direct memory access?

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    85

    Direct memory access?

    Hi. I need to access what other applications write to the parallel port address (0x378). Newer computers do not have a physical port, so I'm building myself an USB based extension. I have the hardware and driver ready for it, all I need is to find out what other applications write at the port's address.

    This way, my device will behave like a real parallel port, when you will use an application like relais timer to change some pins, the driver will read the change and send it to my hardware.

    I hope I'm clear, I asked in other forums and no one seems to understand what I want so, again, I don't want to read the parallel port's inputs, I want to read what other applications output to the port. The output is located at 0x378 on most motherboards.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That'll be difficult if we consider that the application wouldn't be writing to the parallel port itself, but to the Windows Driver that in turn writes to the port. If you have a gadget of some sort that connects to a parallel port, why not just get a USB-to-Parallel connector?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    85
    Because such a device is seen by the system as a printer. I want to have direct control over the individual bits, for using software such as relais timer, mach 3, etc.

    I already built the hardware (gadget) and corresponding software for it, all I need now is to simply get what other applications are writing to the port. The problem is that, I want to emulate the parallel port, so I can connect other stuff to it - so I'm building the converter. There is no converter as of now, that can be addresed in the same way the parallel port is addressed. And that's my problem - I need to address the converter (gadget, as you call it, but another gadget wil attach to it) from software that normally addresses the parallel port.

    To write to the parallel port, you simply put some data at RAM address 0x378. I think that is under the convetional memory limit. That's it - nothing special happens in software, just that the hardware on the mobo copies that value to the physical port.

    I need a method of reading address 0x378 in windows.

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    I don't know why people can't get it through their heads that Windows doesn't let you talk to hardware directly unless your program is a driver.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by _izua_ View Post
    Because such a device is seen by the system as a printer. I want to have direct control over the individual bits, for using software such as relais timer, mach 3, etc.

    I already built the hardware (gadget) and corresponding software for it, all I need now is to simply get what other applications are writing to the port. The problem is that, I want to emulate the parallel port, so I can connect other stuff to it - so I'm building the converter. There is no converter as of now, that can be addresed in the same way the parallel port is addressed. And that's my problem - I need to address the converter (gadget, as you call it, but another gadget wil attach to it) from software that normally addresses the parallel port.

    To write to the parallel port, you simply put some data at RAM address 0x378. I think that is under the convetional memory limit. That's it - nothing special happens in software, just that the hardware on the mobo copies that value to the physical port.

    I need a method of reading address 0x378 in windows.
    PORT 0x378 [as referring to the parallel port] is not a MEMORY address, it's an IO-port, which is indicated by the processor signaling a different set of bits on the pins to indicate what type of bus cycle it is making. So it's not "data in RAM address 0x378".

    Further, like MacGyver says, you can't just read/write to IO ports in Windows. You need a driver to do that. If you wish to figure out what goes to the parallel port, you'd need a printer-filter-driver for the parallel printer device [a filter driver can see what goes on, and decide if it wants to forward the data or not].

    Study the device driver kit (DDK) that MS has - it's free of charge and can be dowloading directly from MS website.

    However, writing a trivial filter driver is still a fairly complex task, and not something you can do in a couple of days [unless you have done it several times before, and have most of the code ready to just copy'n'paste].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. tools for finding memory leaks
    By stanlvw in forum C++ Programming
    Replies: 4
    Last Post: 04-03-2009, 11:41 AM
  2. Direct memory access?
    By RobotGymnast in forum C++ Programming
    Replies: 37
    Last Post: 01-09-2008, 12:25 PM
  3. Question regarding Memory Leak
    By clegs in forum C++ Programming
    Replies: 29
    Last Post: 12-07-2007, 01:57 AM
  4. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM
  5. Memory Access Error when using Strcpy()
    By fgs3124 in forum C Programming
    Replies: 2
    Last Post: 03-15-2002, 03:07 PM