On 7 February 2013 21:37, Michael Haberler <[email protected]> wrote:
> Is this about adding a string flavor variant to these operations? > http://www.linuxcnc.org/docs/devel/html/man/man3/hal_param_new.3hal.html I think so, yes. Though I haven't really thought it through properly. Going back to the previous question, the BSPI Hostmot2 driver creates, internally, a set of string-type names for each BSPI channel (for example hm2_5i23.0.bspi.0) A sub-driver such as mesa_7i65.comp is then loaded with loadrt mesa_7i65 bspi_chan=hm2_5i23.0.bspi.0 The .comp file then reads in the modparam, calls a section of code in hostmot2,c which walks the hm2->bspi struct looking for one with a name matching the string, then returns, in effect, a hm2 structure (ie hooks into the correcr FPGA board) and the index into its bspi struct. This is a classic and horrible example of the late-binding limitations you described earlier. I can't even find a way to make the code generic, short of exploring both bspi and uart and.... structs. The names of the bspi channels are only advertised to the outside world in the dmesg output. It would be nice if the HAL config could show the channel names, and nicer still if the sub-drivers could be hooked-up with a param change (setp hm2_7i65.0.chan-name = "hm2_5i23.0.bspi.0". I don't actually see this as a use-case for netting a string pin. The current way this set of components works is very much driven by a combination of the late-binding problem, and what information is available in hal at the time that modules load. I am not _completely_ sure that it would be possible to re-organise the bspi registers on the fly when the channel param changes, I think it might all fall foul of the load-time setup of the TRAM registers (the Hostmot2 register reads and writes are carved in stone at module loading time) but I think it would be OK to set up the registers pre-emptively on the basis of the channels being activated, so this is more of an example than a specific use-case. To be honest, thinking about this, I could probably have assigned each channel an integer index :-) -- atp If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Emc-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-developers
