owq is filled by the "read" command -- i.e. a filesystem read has size and
offset as part of the call. Buffer (for the result) is allocated as well.
You don't need to worry about how it's filled in, that comes from the
OW_read routines (or OW_write).
Those MACROs: OWQ_buffer, OWQ_size, OWQ_offset call the relevant fields from
the structure.
OW_r_mem, in this case, takes those parameters, and knows what 1-wire
commands to send to the device to read the memory.
In the case of BAE, as I recall, there was the added "complexity" that the
chip and memory read is designed as a long linear address space, while the
various fields exposed (EEPROM, user mem, variables) are subsets of that
space. We remap the start to correspond to the correct chip address space
while keeping the bounds checking correct.
All this is a thin object-oriented layer written in C. owq stands for
one-wire-query, and hold the field's size, offset, data buffer, and all the
flags and parsed path information. This way we use a similar data structure
independent of the data type (float, integer, boolean, data, memory).
Paul Alfille
On Thu, Jul 7, 2011 at 3:15 PM, Eloy Paris <pe...@chapus.net> wrote:
> Hi list,
>
> I am working on a micro-controller-based 1-Wire device and am looking at
> ow_bae.c as a guide in implementing OWFS support for my device. OWFS BAE
> support has the capability to read micro-controller memory by accessing
> generic/memory and I'd like to implement that capability for my device.
>
> There is something I don't understand, though -- the FS_r_mem() function
> does this:
>
> OW_r_mem( (BYTE *) OWQ_buffer(owq), OWQ_size(owq), OWQ_offset(owq),
> PN(owq))
>
> owq is a struct one_wire_query pointer.
>
> What has me puzzled is: how does one put into owq the size and offset of
> the memory block to be read? In other words, it is not clear to me how
> one would access generic/memory to read a certain number of bytes
> starting at some arbitrary offset.
>
> Writing the micro-controller code to handle the memory read (and
> subsequent 1-Wire transfer from micro-controller to bus master) is easy
> but I am struggling with the OWFS side of things.
>
> Thanks in advance for any hints.
>
> Cheers,
>
> Eloy Paris.-
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers