static int MLSearchNxt ( pML pml, pMLNODE pmlnode, int search_cmd, int skip )

Find the next node in the tree. pmlnode holds result unless negative return value. Return of zero indicates this is the last node. Source: ../mld.c.html#MLSearchNxt

Documentation

The underlying problem with this whole mess is that each MLWrite() implies one or more select() calls, and that takes until the next 10ms tick (with the Linux I'm using as I write this). If we did it one bit at a time it would take 10ms for the reset, 8 * 10ms for the search command, and (64 * 3) * 10ms for the search, a little over two seconds. Since exploring a complex tree means finding all the switches and doing a complete rom search each time a new leaf is turned on, I wanted to get this time down. With the methods I used here I got it down to typically 300ms, which works great for what I need. It would be easy enough to move a lot of this down into the serial driver and get some dramatic gains through improved sychronization, but I don't need to, and keeping it in user code has at least a fighting chance of being ported over to other environments.

The main thing is to do as may bits as possible together in each MLWrite().

The biggest win is the hail mary, which exploits the little endian, sequentially assigned aspect of the DS device IDs.

Each device has an eight bit device code and forty eight bits of address, except that I've never seen one with more than five nybles of address, call it six, plus two nybles device code equals thirty two bits, the rest should be zeros followed by the CRC. So at the point where thirty two bits of deice ID have been resolved, send the last (32 * 3) search slots as one big MLWrite() and then analyze what was read back to see if the hail mary was succussful (which it always is). If that don't work, search the last twenty four bits of ID and then hail mary the CRC, which should never have to be searched, hence two retries could be needed at this level.

alphabetic index hierarchy of classes


XIDAR TECHNICS, 3388 STATE RT 370, CATO NY 13033-9716
Copyright © 1996 Eliot W. Dudley All rights reserved.
edudley@servtech.com

Dallas Semiconductor Home Page 1-Wire, DS, DS1820, DS2405, DS2407, DS9097, and MicroLan are trademarks and/or registered trademarks of Dallas Semiconductor

generated by doc++