summaryrefslogtreecommitdiff
path: root/nuttx/drivers
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-21 15:50:06 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-12-21 15:50:06 +0000
commit9f331c4e5b05657516a1d634da9e38758d82c601 (patch)
tree43cc8ae1e277c334fbbbb8430ec0aa41903f08ea /nuttx/drivers
parent3f6973a6104b7ea2f4daf52cf2d06b694a7711e7 (diff)
downloadpx4-nuttx-9f331c4e5b05657516a1d634da9e38758d82c601.tar.gz
px4-nuttx-9f331c4e5b05657516a1d634da9e38758d82c601.tar.bz2
px4-nuttx-9f331c4e5b05657516a1d634da9e38758d82c601.zip
Add the beginning of an STM32 CAN driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4209 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/drivers')
-rw-r--r--nuttx/drivers/Makefile7
-rw-r--r--nuttx/drivers/can.c29
2 files changed, 27 insertions, 9 deletions
diff --git a/nuttx/drivers/Makefile b/nuttx/drivers/Makefile
index b76a04a8c..a6fcbe1f0 100644
--- a/nuttx/drivers/Makefile
+++ b/nuttx/drivers/Makefile
@@ -2,7 +2,7 @@
# drivers/Makefile
#
# Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
-# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -64,10 +64,13 @@ include usbhost/Make.defs
include wireless/Make.defs
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
- CSRCS += dev_null.c dev_zero.c loop.c can.c
+ CSRCS += dev_null.c dev_zero.c loop.c
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
CSRCS += ramdisk.c rwbuffer.c
endif
+ifneq ($(CONFIG_CAN),y)
+ CSRCS += can.c
+endif
ifeq ($(CONFIG_PWM),y)
CSRCS += pwm.c
endif
diff --git a/nuttx/drivers/can.c b/nuttx/drivers/can.c
index fc70678a7..532eef592 100644
--- a/nuttx/drivers/can.c
+++ b/nuttx/drivers/can.c
@@ -1,8 +1,8 @@
/****************************************************************************
* drivers/can.c
*
- * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,10 +34,6 @@
****************************************************************************/
/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
* Included Files
****************************************************************************/
@@ -60,9 +56,27 @@
#include <arch/irq.h>
+#ifdef CONFIG_CAN
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
+/* Debug ********************************************************************/
+/* Non-standard debug that may be enabled just for testing CAN */
+
+#ifdef CONFIG_DEBUG_CAN
+# define candbg dbg
+# define canvdbg vdbg
+# define canlldbg lldbg
+# define canllvdbg llvdbg
+#else
+# define candbg(x...)
+# define canvdbg(x...)
+# define canlldbg(x...)
+# define canllvdbg(x...)
+#endif
+
+/* Timing Definitions *******************************************************/
#define HALF_SECOND_MSEC 500
#define HALF_SECOND_USEC 500000L
@@ -619,7 +633,7 @@ int can_register(FAR const char *path, FAR struct can_dev_s *dev)
/* Register the CAN device */
- dbg("Registering %s\n", path);
+ canvdbg("Registering %s\n", path);
return register_driver(path, &g_canops, 0666, dev);
}
@@ -768,3 +782,4 @@ int can_txdone(FAR struct can_dev_s *dev)
return ret;
}
+#endif /* CONFIG_CAN */