<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2010-06-22)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>ccj</strong></font>
<font color='#225522'><em>(on branch rtems-4-10-branch)</em></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-06-22 Chris Johns <chrisj@rtems.org>
* startup/m68k-stub.c: PR 1539. Fix buffer overrun.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/m68k/ods68302/ChangeLog.diff?r1=text&tr1=1.126&r2=text&tr2=1.126.2.1&diff_format=h">M</a></td><td width='1%'>1.126.2.1</td><td width='100%'>c/src/lib/libbsp/m68k/ods68302/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c.diff?r1=text&tr1=1.11&r2=text&tr2=1.11.2.1&diff_format=h">M</a></td><td width='1%'>1.11.2.1</td><td width='100%'>c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/m68k/ods68302/ChangeLog:1.126 rtems/c/src/lib/libbsp/m68k/ods68302/ChangeLog:1.126.2.1
--- rtems/c/src/lib/libbsp/m68k/ods68302/ChangeLog:1.126 Fri Apr 30 11:44:16 2010
+++ rtems/c/src/lib/libbsp/m68k/ods68302/ChangeLog Tue Jun 22 06:23:22 2010
</font><font color='#997700'>@@ -1,3 +1,7 @@
</font><font color='#000088'>+2010-06-22 Chris Johns <chrisj@rtems.org>
+
+ * startup/m68k-stub.c: PR 1539. Fix buffer overrun.
+
</font> 2010-04-30 Joel Sherrill <joel.sherrilL@OARcorp.com>
* include/bsp.h: Add BSP_SMALL_MEMORY.
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c:1.11 rtems/c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c:1.11.2.1
--- rtems/c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c:1.11 Wed Apr 28 14:43:37 2010
+++ rtems/c/src/lib/libbsp/m68k/ods68302/startup/m68k-stub.c Tue Jun 22 06:23:22 2010
</font><font color='#997700'>@@ -601,7 +601,7 @@
</font> count = 0;
/* now, read until a # or end of buffer is found */
<font color='#880000'>- while (count < BUFMAX) {
</font><font color='#000088'>+ while (count < (BUFMAX - 1)) {
</font> ch = getDebugChar() & 0x7f;
if (ch == '#') break;
checksum = checksum + ch;
</pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-06-22 Arnout Vandecappelle <arnout@mind.be>
PR 1580/misc
* libchip/i2c/spi-sd-card.c: Use bigger chunks and yield processor
while waiting for read data.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/ChangeLog.diff?r1=text&tr1=1.526&r2=text&tr2=1.527&diff_format=h">M</a></td><td width='1%'>1.527</td><td width='100%'>c/src/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/libchip/i2c/spi-sd-card.c.diff?r1=text&tr1=1.21&r2=text&tr2=1.22&diff_format=h">M</a></td><td width='1%'>1.22</td><td width='100%'>c/src/libchip/i2c/spi-sd-card.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/ChangeLog:1.526 rtems/c/src/ChangeLog:1.527
--- rtems/c/src/ChangeLog:1.526 Tue Jun 22 03:41:08 2010
+++ rtems/c/src/ChangeLog Tue Jun 22 06:36:13 2010
</font><font color='#997700'>@@ -1,5 +1,11 @@
</font> 2010-06-22 Arnout Vandecappelle <arnout@mind.be>
<font color='#000088'>+ PR 1580/misc
+ * libchip/i2c/spi-sd-card.c: Use bigger chunks and yield processor
+ while waiting for read data.
+
+2010-06-22 Arnout Vandecappelle <arnout@mind.be>
+
</font> PR 1579/misc
* libchip/i2c/spi-sd-card.c: Gradually increasing sleep times when
waiting for write to finish.
<font color='#006600'>diff -u rtems/c/src/libchip/i2c/spi-sd-card.c:1.21 rtems/c/src/libchip/i2c/spi-sd-card.c:1.22
--- rtems/c/src/libchip/i2c/spi-sd-card.c:1.21 Tue Jun 22 03:41:08 2010
+++ rtems/c/src/libchip/i2c/spi-sd-card.c Tue Jun 22 06:36:14 2010
</font><font color='#997700'>@@ -374,7 +374,7 @@
</font> FIXME should actually look at R2W_FACTOR for non-HC cards. */
int retries = e->n_ac_max * 25 / 10;
/* n_ac_max/100 is supposed to be the average waiting time. To
<font color='#880000'>- approximate this, we start with waiting n_ac_max/250 and
</font><font color='#000088'>+ approximate this, we start with waiting n_ac_max/150 and
</font> gradually increase the waiting time. */
int wait_time_bytes = (retries + 149) / 150;
while (e->busy) {
<font color='#997700'>@@ -530,57 +530,65 @@
</font> {
int rv = 0;
<font color='#880000'>- /* Access time idle tokens */
- uint32_t n_ac = 1;
-
</font> /* Discard command response */
int r = e->response_index + 1;
<font color='#880000'>- /* Minimum token number before data start */
- int next_response_size = 2;
-
</font> /* Standard response size */
int response_size = SD_CARD_COMMAND_SIZE;
<font color='#000088'>+ /* Where the response is stored */
+ uint8_t *response = e->response;
+
</font> /* Data input index */
int i = 0;
/* CRC check of data */
uint16_t crc16;
<font color='#000088'>+ /* Maximum number of tokens to read. */
+ int retries = e->n_ac_max;
+
</font> SD_CARD_INVALIDATE_RESPONSE_INDEX( e);
while (true) {
RTEMS_DEBUG_PRINT( "Search from %u to %u\n", r, response_size - 1);
/* Search the data start token in in current response buffer */
<font color='#000088'>+ retries -= (response_size - r);
</font> while (r < response_size) {
<font color='#880000'>- RTEMS_DEBUG_PRINT( "Token [%02u]: 0x%02x\n", r, e->response [r]);
- if (n_ac > e->n_ac_max) {
- RTEMS_SYSLOG_ERROR( "Timeout\n");
- return -RTEMS_IO_ERROR;
- } else if (e->response [r] == start_token) {
</font><font color='#000088'>+ RTEMS_DEBUG_PRINT( "Token [%02u]: 0x%02x\n", r, response [r]);
+ if (response [r] == start_token) {
</font> /* Discard data start token */
++r;
goto sd_card_read_start;
<font color='#880000'>- } else if (SD_CARD_IS_DATA_ERROR( e->response [r])) {
- RTEMS_SYSLOG_ERROR( "Data error token [%02i]: 0x%02" PRIx8 "\n", r, e->response [r]);
</font><font color='#000088'>+ } else if (SD_CARD_IS_DATA_ERROR( response [r])) {
+ RTEMS_SYSLOG_ERROR( "Data error token [%02i]: 0x%02" PRIx8 "\n", r, response [r]);
</font> return -RTEMS_IO_ERROR;
<font color='#880000'>- } else if (e->response [r] != SD_CARD_IDLE_TOKEN) {
- RTEMS_SYSLOG_ERROR( "Unexpected token [%02i]: 0x%02" PRIx8 "\n", r, e->response [r]);
</font><font color='#000088'>+ } else if (response [r] != SD_CARD_IDLE_TOKEN) {
+ RTEMS_SYSLOG_ERROR( "Unexpected token [%02i]: 0x%02" PRIx8 "\n", r, response [r]);
</font> return -RTEMS_IO_ERROR;
}
<font color='#880000'>- ++n_ac;
</font> ++r;
}
<font color='#880000'>- /* Query more */
- rv = sd_card_query( e, e->response, next_response_size);
- RTEMS_CHECK_RV( rv, "Query data start token");
</font><font color='#000088'>+ if (retries <= 0) {
+ RTEMS_SYSLOG_ERROR( "Timeout\n");
+ return -RTEMS_IO_ERROR;
+ }
</font>
<font color='#880000'>- /* Set standard query size */
- response_size = next_response_size;
- next_response_size = SD_CARD_COMMAND_SIZE;
</font><font color='#000088'>+ if (e->schedule_if_busy)
+ rtems_task_wake_after( RTEMS_YIELD_PROCESSOR);
+
+ /* Query more. We typically have to wait between 10 and 100
+ bytes. To reduce overhead, read the response in chunks of
+ 50 bytes - this doesn't introduce too much copy overhead
+ but does allow SPI DMA transfers to work efficiently. */
+ response = in;
+ response_size = 50;
+ if (response_size > n)
+ response_size = n;
+ rv = sd_card_query( e, response, response_size);
+ RTEMS_CHECK_RV( rv, "Query data start token");
</font>
/* Reset start position */
r = 0;
<font color='#997700'>@@ -590,7 +598,7 @@
</font>
/* Read data */
while (r < response_size && i < n) {
<font color='#880000'>- in [i++] = e->response [r++];
</font><font color='#000088'>+ in [i++] = response [r++];
</font> }
/* Read more data? */
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>