Hi Matt,

2011/5/5 mattschinkel <[email protected]>

> > Here's an idea for you -- add 4 mode routines, and then inline each
> > one -- will save code space and run faster.
>
> Seb, what do you think?
>

This seems an interesting idea to dig. Is setting mode the same, again and
again within the same program, is something quite usual in SPI world, as in
your SD card lib ? If so, then it could do the trick, as I have some doubts
about inlining set_mode(), it consumes much more resources than w/o...
except when -const-detect (or pragma const detect IIRC) is used ! This
const-detect really can sometime makes the difference, I'm wondering it
should be added as default on some libs where it makes sense.

I tried very quickly: created 4 more inlined procedures, keep set_mode() w/o
inline, and use these 4 procs, it saves few more bytes.

Since we're talking about potential improvement, fwiw,
inlining spi_master_hw_exchange() + const-detect consumes "only" 6 more
bytes but saves one stack level. Is this function an internal one ? Or is it
used elsewhere (outside jallib repos) directly ? In other words, are
pseudo-var spi_master_hw get/put are the unique entry point to read/write
data ?

But, anyway, we first to have William's answers on the many questions I
asked today, before going further. Because current issue really isn't a
technical issue, beyond this init procedure, my main concern is about not
being able to change code because of some highly arguable reason: "some code
is running out there, don't change anything". The following scenario makes
sense: what if someone wants to use MCP2515 device, using can_mcp2515.jal
library, on MSSP2 module, or on SPI software ? Current implementation
directly use spi_master_hw pseudo-var, and would require usage of
intermediate aliases (eg. alias spi_master is spi_master_hw). Will we be
able to modify this ? Another question I'm asking...


Cheers,
Seb

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to