diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-13 13:30:38 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-07-13 13:30:38 +0000 |
commit | edeffa28c526825510f7ff35024ea242f82252e5 (patch) | |
tree | 6e73fb2151408160fea483c4c143ef6cf95c00ed /nuttx/drivers | |
parent | 286a4141b552e05aa782b1fafa192426af2f42a2 (diff) | |
download | px4-nuttx-edeffa28c526825510f7ff35024ea242f82252e5.tar.gz px4-nuttx-edeffa28c526825510f7ff35024ea242f82252e5.tar.bz2 px4-nuttx-edeffa28c526825510f7ff35024ea242f82252e5.zip |
Re-architect FAT data structures to support long file names
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3780 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers')
-rw-r--r-- | nuttx/drivers/ramdisk.c | 12 | ||||
-rw-r--r-- | nuttx/drivers/serial/serial.c | 17 |
2 files changed, 23 insertions, 6 deletions
diff --git a/nuttx/drivers/ramdisk.c b/nuttx/drivers/ramdisk.c index b3f9916bc..bfa0618d6 100644 --- a/nuttx/drivers/ramdisk.c +++ b/nuttx/drivers/ramdisk.c @@ -148,10 +148,12 @@ static ssize_t rd_read(FAR struct inode *inode, unsigned char *buffer, { struct rd_struct_s *dev; - fvdbg("sector: %d nsectors: %d sectorsize: %d\n"); - DEBUGASSERT(inode && inode->i_private); dev = (struct rd_struct_s *)inode->i_private; + + fvdbg("sector: %d nsectors: %d sectorsize: %d\n", + start_sector, dev->rd_sectsize, nsectors); + if (start_sector < dev->rd_nsectors && start_sector + nsectors <= dev->rd_nsectors) { @@ -180,10 +182,12 @@ static ssize_t rd_write(FAR struct inode *inode, const unsigned char *buffer, { struct rd_struct_s *dev; - fvdbg("sector: %d nsectors: %d sectorsize: %d\n"); - DEBUGASSERT(inode && inode->i_private); dev = (struct rd_struct_s *)inode->i_private; + + fvdbg("sector: %d nsectors: %d sectorsize: %d\n", + start_sector, dev->rd_sectsize, nsectors); + if (!dev->rd_writeenabled) { return -EACCES; diff --git a/nuttx/drivers/serial/serial.c b/nuttx/drivers/serial/serial.c index 983d4ae16..cff810743 100644 --- a/nuttx/drivers/serial/serial.c +++ b/nuttx/drivers/serial/serial.c @@ -163,12 +163,21 @@ static void uart_pollnotify(FAR uart_dev_t *dev, pollevent_t eventset) static void uart_putxmitchar(FAR uart_dev_t *dev, int ch) { - int nexthead = dev->xmit.head + 1; + irqstate_t flags; + int nexthead; + + /* Increment to see what the next head pointer will be. We need to use the "next" + * head pointer to determine when the circular buffer would overrun + */ + + nexthead = dev->xmit.head + 1; if (nexthead >= dev->xmit.size) { nexthead = 0; } + /* Loop until we are able to add the character to the TX buffer */ + for (;;) { if (nexthead != dev->xmit.tail) @@ -179,8 +188,11 @@ static void uart_putxmitchar(FAR uart_dev_t *dev, int ch) } else { - /* Inform the interrupt level logic that we are waiting */ + /* Inform the interrupt level logic that we are waiting. + * This and the following steps must be atomic. + */ + flags = irqsave(); dev->xmitwaiting = true; /* Wait for some characters to be sent from the buffer @@ -192,6 +204,7 @@ static void uart_putxmitchar(FAR uart_dev_t *dev, int ch) uart_enabletxint(dev); uart_takesem(&dev->xmitsem); uart_disabletxint(dev); + irqrestore(flags); } } } |