Sebastian Kuzminsky wrote: >Stephen Wille Padnos wrote: > > >>Sebastian Kuzminsky wrote: >> >> >>>It should be something like this: >>> >>> loadrt hm2_5i20 config="firmware=SVST8_4.BIT num_stepgens=2" >>> >>> >>Hmmm. >> >>These variables really should be split out into separate parameters, >>using arrays where practical. It's kind of silly to do your own string >>parsing when there are facilities to do it for you already. The >>firmware option still needs to be a string of course, but anything else >>that's an int of some sort should be done with the existing parameter >>parsing mechanism. >> >>Doing this will change the module loading syntax, but if you have no >>objection, I'll make those changes and commit them in the next few days >>(along with changes to any sample configs). >> >>I think it would end up something like this: >>loadrt hm2_5i20 firmware="unchanged" num_stepgens=0,2 num_pwmgens=4 ... >> >>In that example, there are two boards, the first gets 0 stepgens and 4 >>pwmgens. The second gets 2 stepgens and 0 pwmgens. All other settings >>are left at default. >> >> > >I agree what's there now is a bit silly... I considered doing it like >you suggest, but decided against it. The reason why is that the config >info get told to the llio drivers but handled (exclusively) by the >generic hostmot2 driver. These things get passed to hm2_register() by >the llio init functions. Having a single argument seems simpler and >more flexible than having five (currently) different ones, and changing >all the llios whenever the set of config parameters changes. The llios >dont know and they dont care, and i like that. > > It's the individual board drivers that have to validate that data anyway (right?). Even if it isn't, it's a heck of a lot easier to copy an array of ints than it is to scan for strings, do proper error checking (which it isn't doing right now - what happens if you have "num_stepgens=z2"?), and then put the numbers in the master structure anyway. Might as well just copy numbers from several arrays of ints into an array of structs.
>My plan is to eventually add a field to the config parameter like >"stepgen=on,off,on:width=2", which would mean: enable stepgen.00, >disable stepgen.01, and enable stepgen.02 and make it just 2 bits wide >(instead of the default 6). Similar for pwmgen and encoder. > That could work, but you could also have an array of stepgen_width=-1,-1,2 (or possibly ,,2 - I don't know if you can leave out the ones you don't want to explicitly change). - Steve ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Emc-developers mailing list Emc-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-developers