Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: what does IOPCIDevice class represent? PCI card or individual function on the PCI card.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what does IOPCIDevice class represent? PCI card or individual function on the PCI card.



Personally I'd use one class and the probe() routine to rendezvous the 2 functions. Also remember the provider of both of the IOPCIDevices must be the same as they share the same bridge. A probe routine something like this should work.

static com_einfochips_video_capture * listOfCards[16];

IOService * <com_einfochips_video_capture>::probe(IOService *provider, UINt32 *scoreP)
{
IOService *retVal = this;

if (!super::probe(provider, scoreP)
return 0;

IOSerivce *bridge = provider->getProvider();

// Take a global lock - that is an other question though.
for (int i = 0; listOfCards[i]; i++) {
IOService *existing = listOfCards[i];
if (bridge == existing->getProvider()->getProvider()) {
// found a common parent
// nothing more to do just return existing
// This creates a "fan-in" device
retVal = existing;
break;
}
}
// Didn't find a common ancestor thus this must be a new card.
if (!listOfCards[i])
listOfCards[i] = this;

return retVal;
}

This code is slightly simplifed you will have to add some sort of locking on your listOfCards table. But basically it will work fine.

The advantage of this method is that you have a single instance driver with 2 providers which means you can do your cross device synchronisation more easily (with luck anyway).

Remember both of your functions will share an interrupt line so you must implement IOFilterInterruptEventSources.

Godfrey van der Linden

On May 31, , at 18:10, Shawn Erickson wrote:

On May 31, 2004, at 7:03 AM, John Dalgliesh wrote:

The tricky bit is getting the pointer to the instance of your driver class
that is bound to the other function of the card. The way I did this was
traversing the IORegistry hierarchy. Here is the method I wrote to do that
... I used two instances of the same class because I am lazy (thus the
method returns a pointer to the same type as itself):

It may be easier and better to use features of IOService for the notification and finding of other services. So have one or both of your drivers register themselves when ready and the other listen for such notification or search for such registered services using an appropriate match dictionary.

You will want to look at IOService's registerSerivce, getMatchingServices, addNotification, and IONotifier.

-Shawn
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: what does IOPCIDevice class represent? PCI card or individual function on the PCI card. (From: John Dalgliesh <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.