Several bugfixes, mostly from Darcy Gong

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5217 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-10-06 14:50:37 +00:00
parent a41bc3c2ff
commit 4d23437df0
5 changed files with 128 additions and 111 deletions
+4
View File
@@ -364,3 +364,7 @@
There are still a LOT of empty, stub Kconfig files. There are still a LOT of empty, stub Kconfig files.
* Kconfig: Fleshed out apps/examples/buttons/Kconfig. There are still a LOT * Kconfig: Fleshed out apps/examples/buttons/Kconfig. There are still a LOT
of empty, stub Kconfig files. of empty, stub Kconfig files.
* apps/netutils/webserver/httpd.c: Fix a bug that I introduced in
recent check-ins (Darcy Gong).
* apps/netutils/webclient/webclient.c: Fix another but that I introduced
when I was trying to add correct handling for loss of connection (Darcy Gong)
+1 -1
View File
@@ -524,7 +524,7 @@ int wget(FAR const char *url, FAR char *buffer, int buflen,
ret = ws.datend; ret = ws.datend;
goto errout_with_errno; goto errout_with_errno;
} }
else if (ret == 0) else if (ws.datend == 0)
{ {
nvdbg("Connection lost\n"); nvdbg("Connection lost\n");
close(sockfd); close(sockfd);
+1 -1
View File
@@ -694,7 +694,7 @@ static inline int httpd_parse(struct httpd_state *pstate)
while (state != STATE_BODY); while (state != STATE_BODY);
#if !defined(CONFIG_NETUTILS_HTTPD_SENDFILE) && !defined(CONFIG_NETUTILS_HTTPD_MMAP) #if !defined(CONFIG_NETUTILS_HTTPD_SENDFILE) && !defined(CONFIG_NETUTILS_HTTPD_MMAP)
if (0 == strcmp(pstate->ht_filename, "/") if (0 == strcmp(pstate->ht_filename, "/"))
{ {
strncpy(pstate->ht_filename, "/" CONFIG_NETUTILS_HTTPD_INDEX, strlen("/" CONFIG_NETUTILS_HTTPD_INDEX)); strncpy(pstate->ht_filename, "/" CONFIG_NETUTILS_HTTPD_INDEX, strlen("/" CONFIG_NETUTILS_HTTPD_INDEX));
} }
+1
View File
@@ -1656,6 +1656,7 @@ static void stm32_receive(FAR struct stm32_ethmac_s *priv)
stm32_freebuffer(priv, dev->d_buf); stm32_freebuffer(priv, dev->d_buf);
dev->d_buf = NULL; dev->d_buf = NULL;
dev->d_len = 0;
} }
} }
} }
+18 -6
View File
@@ -153,8 +153,10 @@ struct ramtron_dev_s
* Supported Part Lists * Supported Part Lists
************************************************************************************/ ************************************************************************************/
// Defines the initial speed compatible with all devices. In case of RAMTRON /* Defines the initial speed compatible with all devices. In case of RAMTRON
// the defined devices within the part list have all the same speed. * the defined devices within the part list have all the same speed.
*/
#define RAMTRON_INIT_CLK_MAX 40000000UL #define RAMTRON_INIT_CLK_MAX 40000000UL
static struct ramtron_parts_s ramtron_parts[] = static struct ramtron_parts_s ramtron_parts[] =
@@ -317,7 +319,11 @@ static inline int ramtron_readid(struct ramtron_dev_s *priv)
/* Send the "Read ID (RDID)" command and read the first three ID bytes */ /* Send the "Read ID (RDID)" command and read the first three ID bytes */
(void)SPI_SEND(priv->dev, RAMTRON_RDID); (void)SPI_SEND(priv->dev, RAMTRON_RDID);
for (i=0; i<6; i++) manufacturer = SPI_SEND(priv->dev, RAMTRON_DUMMY); for (i = 0; i < 6; i++)
{
manufacturer = SPI_SEND(priv->dev, RAMTRON_DUMMY);
}
memory = SPI_SEND(priv->dev, RAMTRON_DUMMY); memory = SPI_SEND(priv->dev, RAMTRON_DUMMY);
capacity = SPI_SEND(priv->dev, RAMTRON_DUMMY); // fram.id1 capacity = SPI_SEND(priv->dev, RAMTRON_DUMMY); // fram.id1
part = SPI_SEND(priv->dev, RAMTRON_DUMMY); // fram.id2 part = SPI_SEND(priv->dev, RAMTRON_DUMMY); // fram.id2
@@ -327,12 +333,14 @@ static inline int ramtron_readid(struct ramtron_dev_s *priv)
SPI_SELECT(priv->dev, SPIDEV_FLASH, false); SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
ramtron_unlock(priv->dev); ramtron_unlock(priv->dev);
// Select part from the part list /* Select part from the part list */
for (priv->part = ramtron_parts; for (priv->part = ramtron_parts;
priv->part->name != NULL && !(priv->part->id1 == capacity && priv->part->id2 == part); priv->part->name != NULL && !(priv->part->id1 == capacity && priv->part->id2 == part);
priv->part++); priv->part++);
if (priv->part->name) { if (priv->part->name)
{
fvdbg("RAMTRON %s of size %d bytes (mf:%02x mem:%02x cap:%02x part:%02x)\n", fvdbg("RAMTRON %s of size %d bytes (mf:%02x mem:%02x cap:%02x part:%02x)\n",
priv->part->name, priv->part->size, manufacturer, memory, capacity, part); priv->part->name, priv->part->size, manufacturer, memory, capacity, part);
@@ -408,7 +416,9 @@ static inline void ramtron_sendaddr(const struct ramtron_dev_s *priv, uint32_t a
DEBUGASSERT(priv->part->addr_len == 3 || priv->part->addr_len == 2); DEBUGASSERT(priv->part->addr_len == 3 || priv->part->addr_len == 2);
if (priv->part->addr_len == 3) if (priv->part->addr_len == 3)
{
(void)SPI_SEND(priv->dev, (addr >> 16) & 0xff); (void)SPI_SEND(priv->dev, (addr >> 16) & 0xff);
}
(void)SPI_SEND(priv->dev, (addr >> 8) & 0xff); (void)SPI_SEND(priv->dev, (addr >> 8) & 0xff);
(void)SPI_SEND(priv->dev, addr & 0xff); (void)SPI_SEND(priv->dev, addr & 0xff);
@@ -489,6 +499,7 @@ static ssize_t ramtron_bread(FAR struct mtd_dev_s *dev, off_t startblock, size_t
{ {
return nbytes >> priv->pageshift; return nbytes >> priv->pageshift;
} }
return (int)nbytes; return (int)nbytes;
} }
@@ -512,8 +523,8 @@ static ssize_t ramtron_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_
ramtron_pagewrite(priv, buffer, startblock); ramtron_pagewrite(priv, buffer, startblock);
startblock++; startblock++;
} }
ramtron_unlock(priv->dev);
ramtron_unlock(priv->dev);
return nblocks; return nblocks;
} }
@@ -662,6 +673,7 @@ FAR struct mtd_dev_s *ramtron_initialize(FAR struct spi_dev_s *dev)
if (ramtron_readid(priv) != OK) if (ramtron_readid(priv) != OK)
{ {
/* Unrecognized! Discard all of that work we just did and return NULL */ /* Unrecognized! Discard all of that work we just did and return NULL */
kfree(priv); kfree(priv);
priv = NULL; priv = NULL;
} }