Documentation Archive Developer
Search

ADC Home > Reference Library > Technical Q&As > Legacy Documents > Hardware & Drivers >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Native Drivers ('ndrv's) and dNeedTime


Q: I'm writing a native driver and I've noticed that, if I set dNeedTime in the dCtlFlags fields of my DCtlEntry, I never receive accRun events and the system crashes when my driver unloads. What's going on?

A: The designers of the native driver model felt that native driver should not access the Device Control Entry (DCE) and would never need system task time. Therefore, they reused a number of fields in the DCE for other purposes. The reused fields include:

  • dCtlCurTicks
  • dCtlStorage
  • dCtlOwner
  • dCtlWindow

For native drivers, these fields are now reserved. Your software must not rely on their value nor modify them, either explicitly or implicitly. Setting dNeedTime causes the system to modify the value of dCtlCurTicks, which causes the system crash when it accesses dCtlCurTicks as it unloads your driver.

If you need system task time in your native driver, you should use the support provided by your driver's I/O family. For example, FireWire drivers can use FWSendSoftwareInterrupt, while drivers that use Open Transport can use OTScheduleSystemTask. If your driver has no I/O family, or its I/O family does not provide support for getting system task time, your only recourse is to use one of the techniques outlined in Technote 1033, "Interrupts in Need of (a Good) Time". For native drivers, the best approach described by that technote is probably Approach #3.

External software can tell whether a driver is native by looking at bit 3 of the dCtlFlags, as described in DTS Q&A DV 27 Device Driver Flags.

The issue that native drivers can't get system task time is being tracked as bug ID 2323538.

[Apr 26 1999]