<div class="gmail_quote">A couple quick comments in-line below...</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Mon, Jun 27, 2011 at 8:33 PM, Stefan Tauner <span dir="ltr"><<a href="mailto:stefan.tauner@student.tuwien.ac.at">stefan.tauner@student.tuwien.ac.at</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
+ static void ich_read_data(uint8_t *data, uint8_t len, int reg0_off)<br>
+ {<br>
+       int a;<br>
+       uint32_t temp32 = 0;<br>
+<br>
+       if (len > spi_programmer->max_data_read)<br>
+               len = spi_programmer->max_data_read;<br>
+<br>
+       for (a = 0; a < len; a++) {<br>
+               if ((a % 4) == 0)<br>
+                       temp32 = REGREAD32(reg0_off + (a));<br>
+<br>
+               data[a] = (temp32 & (((uint32_t) 0xff) << ((a % 4) * 8)))<br>
+                         >> ((a % 4) * 8);<br></blockquote><div><br></div><div>How about "data[a] = (temp32 >> ((a % 4) * 8)) & 0xff" instead? That is clearer IMHO, and you won't even need to break the line. (80 columns really *is* enough :-P)</div>

<div><br></div><div>On Mon, Jun 27, 2011 at 8:33 PM, Stefan Tauner <span dir="ltr"><<a href="mailto:stefan.tauner@student.tuwien.ac.at">stefan.tauner@student.tuwien.ac.at</a>></span> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

+static uint8_t ich_fill_data(const uint8_t *data, uint8_t len, int reg0_off)</blockquote><div><br></div><div>As mentioned on IRC, the caller tends to pass in a "len" value > 255, e.g. 1 block of 4096 bytes or more. Since len is handled as an int in the caller, it should probably get passed in as an int here.</div>

<div><br></div></div>-- <br>David Hendricks (dhendrix)<br>Systems Software Engineer, Google Inc.<br>