diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-12-22 18:28:13 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-12-22 18:28:13 +0000 |
commit | a8ab2aef243697e99a0c9eba0b9d9fba98444b27 (patch) | |
tree | bc86e807c879b917272e3a9d87faa792edaa6d6c /nuttx/drivers | |
parent | 5b038d28629472894c07f4efc604c992c9d8264d (diff) | |
download | px4-nuttx-a8ab2aef243697e99a0c9eba0b9d9fba98444b27.tar.gz px4-nuttx-a8ab2aef243697e99a0c9eba0b9d9fba98444b27.tar.bz2 px4-nuttx-a8ab2aef243697e99a0c9eba0b9d9fba98444b27.zip |
STM32 CAN debug fixes
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4214 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers')
-rw-r--r-- | nuttx/drivers/can.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/nuttx/drivers/can.c b/nuttx/drivers/can.c index 532eef592..8c9f8ea13 100644 --- a/nuttx/drivers/can.c +++ b/nuttx/drivers/can.c @@ -133,6 +133,8 @@ static int can_open(FAR struct file *filep) uint8_t tmp; int ret = OK; + canvdbg("ocount: %d\n", dev->cd_ocount); + /* If the port is the middle of closing, wait until the close is finished */ if (sem_wait(&dev->cd_closesem) != OK) @@ -204,6 +206,8 @@ static int can_close(FAR struct file *filep) irqstate_t flags; int ret = OK; + canvdbg("ocount: %d\n", dev->cd_ocount); + if (sem_wait(&dev->cd_closesem) != OK) { ret = -errno; @@ -279,6 +283,8 @@ static ssize_t can_read(FAR struct file *filep, FAR char *buffer, size_t buflen) irqstate_t flags; int ret = 0; + canvdbg("buflen: %d\n", buflen); + /* The caller must provide enough memory to catch the smallest possible message * This is not a system error condition, but we won't permit it, Hence we return 0. */ @@ -367,6 +373,8 @@ static int can_xmit(FAR struct can_dev_s *dev) bool enable = false; int ret = OK; + canllvdbg("xmit head: %d tail: %d\n", dev->cd_xmit.cf_head, dev->cd_xmit.cf_tail); + /* Check if the xmit FIFO is empty */ if (dev->cd_xmit.cf_head != dev->cd_xmit.cf_tail) @@ -400,6 +408,8 @@ static ssize_t can_write(FAR struct file *filep, FAR const char *buffer, size_t int msglen; int ret = 0; + canvdbg("buflen: %d\n", buflen); + /* Interrupts must disabled throughout the following */ flags = irqsave(); @@ -573,6 +583,8 @@ static int can_ioctl(FAR struct file *filep, int cmd, unsigned long arg) FAR struct can_dev_s *dev = inode->i_private; int ret = OK; + canvdbg("cmd: %d arg: %ld\n", cmd, arg); + /* Handle built-in ioctl commands */ switch (cmd) @@ -661,6 +673,8 @@ int can_receive(FAR struct can_dev_s *dev, uint16_t hdr, FAR uint8_t *data) int err = -ENOMEM; int i; + canllvdbg("ID: %d DLC: %d\n", CAN_ID(hdr), CAN_DLC(hdr)); + /* Check if adding this new message would over-run the drivers ability to enqueue * read data. */ @@ -742,7 +756,7 @@ int can_receive(FAR struct can_dev_s *dev, uint16_t hdr, FAR uint8_t *data) * Called from the CAN interrupt handler at the completion of a send operation. * * Parameters: - * dev - The specifi CAN device + * dev - The specific CAN device * hdr - The 16-bit CAN header * data - An array contain the CAN data. * @@ -755,6 +769,8 @@ int can_txdone(FAR struct can_dev_s *dev) { int ret = -ENOENT; + canllvdbg("xmit head: %d tail: %d\n", dev->cd_xmit.cf_head, dev->cd_xmit.cf_tail); + /* Verify that the xmit FIFO is not empty */ if (dev->cd_xmit.cf_head != dev->cd_xmit.cf_tail) |