Previous Thread
Next Thread
Print Thread
#124516 05/22/25 12:52 PM
Joined: Mar 2001
Posts: 17,294
Likes: 272
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,294
Likes: 272
I'm trying to add DMA to NuBus and friends. I have the DMA itself working, but there's a hitch. Some of the cards use a dp83932 device, which needs a device name and a space number to feed to an address space finder, ideally at mconfig time.

The way the card can know that is that the root bus calls set_nubus_tag() on each card_interface at device_resolve_objects time. I thought I could fix that by having the card implement its own device_config_complete and set the tag when it's valid, but if I throw device_missing_dependencies there the core gets angry and if I don't throw anything it proceeds to try and resolve the object finders without my being able to set the tag.

How do I make this work short of hardcoding device tags in the card?

Joined: Nov 1999
Posts: 716
Likes: 9
B
Senior Member
Senior Member
B Offline
Joined: Nov 1999
Posts: 716
Likes: 9
Maybe this? (not 100% sure)

Code
/// \brief Start order dependencies not satisfied exception
///
/// May be thrown from the start member functions of #device_t and
/// #device_interface implementations if start order dependencies have
/// not been satisfied.  MAME will start additional devices before
/// reattempting to start the device that threw the exception.
/// \sa device_t::device_start device_interface::interface_pre_start
class device_missing_dependencies : public emu_exception { };

Joined: Mar 2001
Posts: 17,294
Likes: 272
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,294
Likes: 272
As I said in the OP, I tried that. The problem is the init callbacks aren't fine-grained enough to make that work. I need a "call this after the parent object is completely initialized but child objects haven't been".

Joined: Feb 2004
Posts: 2,641
Likes: 351
Very Senior Member
Very Senior Member
Joined: Feb 2004
Posts: 2,641
Likes: 351
The only callback you get before object finders are resolved is config complete. You need to be kind of careful with config complete because there’s some weirdness with what happens with how slot cards are instantiated and added. The resolve objects callback happens after object finders are resolved.

You obviously can’t throw device_missing_dependencies from anywhere except device_start because MAME assumes all the other callbacks can be called in tree walk order without having to worry about backtracking to deal with stragglers.

Anyway, I don’t know if there’s a nice way to do this with an object finder. In most cases, when there are situations where cards need to know about some resource (a bus, address space or something), they’re supplied with a pointer to the object itself at resolve objects or start time, not information for setting up an object finder.

The only thing I can think of at the moment that might work is:
  • In device_config_complete for the bus, tell the slots what the space finder’s details are.
  • In device_config_complete for the cards, ask the slot what the space finder’s details are and pass that on to the DP83932 .


The slots will definitely be present when device_config_complete is called for the bus. When device_config_complete is called for a card, its host slot will definitely be present (it’s the parent device).

Just remember the card needs to survive device_config_complete without a slot for -valid, -listxml, etc. It doesn’t have to do anything useful, but it needs to not crash if its parent isn’t a slot.

Joined: Mar 2001
Posts: 17,294
Likes: 272
R
Very Senior Member
Very Senior Member
R Offline
Joined: Mar 2001
Posts: 17,294
Likes: 272
Thanks, I'll give that a try.


Link Copied to Clipboard
Who's Online Now
2 members (Praxis, 1 invisible), 177 guests, and 2 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,381
Posts122,711
Members5,085
Most Online1,529
Jun 7th, 2025
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Powered by UBB.threads™ PHP Forum Software 8.0.0