Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV

Before Posting...

Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Do I need Synchronization ? Please help!

OSR_Community_UserOSR_Community_User Member Posts: 110,217
Hello,

I am writing a Win2K Bus Driver to simulate a novel high-performance
hardware device.

This Bus Driver will be used to develop the actual Device Drivers for
the device until the real hardware is available. The aim of the Bus
Driver is to take control of one of the CPUs (on an MP system), and
behave as the novel device(s).

What the Bus Driver does:
-Simulates the Register Space of the device and communicates the Base
Address of the Register Space to the Function (Device) Driver for the
device.
-Creates a thread:
-sets thread affinity to a particular CPU
-sets thread priority to HIGH_PRIORITY
-this thread continuously monitors the Register Space of device
for any changes and takes appropriate action.

My questions:

1. Can I run this thread continuously or do I need some way for it
to block ? (since this is a HIGH_PRIORITY real-time thread ?)

Please remember that this Bus Driver is not for production and
will only be used to develope the actual Funtion Driver]

2. Type of synchronization mechanism ?
-I create the thread in my AddDevice() for the Bus Driver
-In ThreadMain() I need to monitor the Register Spaces of the
simulated devices (but the simulated devices don't come into
existence until the PDOs are created).
-I store a "list of PDOs created" and "# PDOs currently
enumerated" in my Bus FDO DevExtn.

So I am thinking that I could block the thread while #PDOs = 0
From my understanding, I can use a Notification Event or Binary
Semaphore for this purpose. But I am not sure which one to use
and how ?

Please help!

Thanks much.
Puja


____________________________________________________________________
Get free email and a permanent address at http://www.amexmail.com/?A=1

Comments

  • OSR_Community_UserOSR_Community_User Member Posts: 110,217
    I have a problem with kernel-mode driver for serial port. I'm unable to make
    a interrupt connection for COM2 port with IoConnectInterrupt function. It
    returns invalid parameters error. Parameters that I get from
    HalGetInterruptVector I send to IoConnectInterrupt.
    Parameters that I send to HalGetInterruptVector I take according my
    knowledge of the system platform x86. In parameters are:
    BusType = Isa,
    BusNumber= 0 (as it is the only Isa bus),
    BusRelativeVector = ? ,
    BusRelativeLevel = ?,

    are unknown to me. I can't get this information from registry (I'm trying to
    find them out but I have problems with the key) and I supposed that these
    are Port interrupt Vector and port Interrupt level.
    Am I right about these assumptions?

    Regards,
    Neno
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 January 2023 Live, Online
Developing Minifilters 20 March 2023 Live, Online
Internals & Software Drivers 17 April 2023 Live, Online
Writing WDF Drivers 22 May 2023 Live, Online