summaryrefslogtreecommitdiff
path: root/nuttx/drivers
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-09-15 20:55:06 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-09-15 20:55:06 +0000
commit6ea8fe291f358e9c857a1b5f1170e20004ca0532 (patch)
treee9d3424d4dd59a82f618db6f1b50edda0fd2bcac /nuttx/drivers
parentfdc11d13043299e79dcd88c4269a2f56f2e565d9 (diff)
downloadpx4-nuttx-6ea8fe291f358e9c857a1b5f1170e20004ca0532.tar.gz
px4-nuttx-6ea8fe291f358e9c857a1b5f1170e20004ca0532.tar.bz2
px4-nuttx-6ea8fe291f358e9c857a1b5f1170e20004ca0532.zip
Add logic to dump data in and out of pipe
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2059 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers')
-rw-r--r--nuttx/drivers/pipe_common.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/nuttx/drivers/pipe_common.c b/nuttx/drivers/pipe_common.c
index 174778d6d..a0fd00b7a 100644
--- a/nuttx/drivers/pipe_common.c
+++ b/nuttx/drivers/pipe_common.c
@@ -60,9 +60,19 @@
#if CONFIG_DEV_PIPE_SIZE > 0
/****************************************************************************
- * Definitions
+ * Pre-processor Definitions
****************************************************************************/
+/* CONFIG_DEV_PIPEDUMP will dump the contents of each transfer into and out
+ * of the pipe.
+ */
+
+#ifdef CONFIG_DEV_PIPEDUMP
+# define pipe_dumpbuffer(m,a,n) lib_dumpbuffer(m,a,n)
+#else
+# define pipe_dumpbuffer(m,a,n)
+#endif
+
/****************************************************************************
* Private Types
****************************************************************************/
@@ -319,6 +329,9 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
{
struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private;
+#ifdef CONFIG_DEV_PIPEDUMP
+ FAR ubyte *start = (ubyte*)buffer;
+#endif
ssize_t nread = 0;
int sval;
int ret;
@@ -396,6 +409,7 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
pipecommon_pollnotify(dev, POLLOUT);
sem_post(&dev->d_bfsem);
+ pipe_dumpbuffer("From PIPE:", start, nread);
return nread;
}
@@ -413,12 +427,14 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t
int sval;
/* Some sanity checking */
+
#if CONFIG_DEBUG
if (!dev)
{
return -ENODEV;
}
#endif
+ pipe_dumpbuffer("To PIPE:", (ubyte*)buffer, len);
/* At present, this method cannot be called from interrupt handlers. That is
* because it calls sem_wait (via pipecommon_semtake below) and sem_wait cannot