Xenomai  3.0.8
rtcan_internal.h
1 /*
2  * Copyright (C) 2006 Wolfgang Grandegger <wg@grandegger.com>
3  *
4  * Derived from RTnet project file stack/include/rtnet_internal.h:
5  *
6  * Copyright (C) 1999 Lineo, Inc
7  * 1999, 2002 David A. Schleef <ds@schleef.org>
8  * 2002 Ulrich Marx <marx@kammer.uni-hannover.de>
9  * 2003-2005 Jan Kiszka <jan.kiszka@web.de>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25 
26 #ifndef __RTCAN_INTERNAL_H_
27 #define __RTCAN_INTERNAL_H_
28 
29 #include <linux/module.h>
30 #include <rtdm/driver.h>
31 
32 #ifdef CONFIG_XENO_DRIVERS_CAN_DEBUG
33 #define RTCAN_ASSERT(expr, func) \
34  if (!(expr)) { \
35  rtdm_printk("Assertion failed! %s:%s:%d %s\n", \
36  __FILE__, __FUNCTION__, __LINE__, (#expr)); \
37  func \
38  }
39 #else
40 #define RTCAN_ASSERT(expr, func)
41 #endif /* CONFIG_RTCAN_CHECKED */
42 
43 #ifdef CONFIG_XENO_DRIVERS_CAN_DEBUG
44 # define RTCAN_DBG(fmt,args...) do { printk(fmt ,##args); } while (0)
45 # define RTCAN_RTDM_DBG(fmt,args...) do { rtdm_printk(fmt ,##args); } while (0)
46 #else
47 # define RTCAN_DBG(fmt,args...) do {} while (0)
48 # define RTCAN_RTDM_DBG(fmt,args...) do {} while (0)
49 #endif
50 
51 #define rtcan_priv(dev) (dev)->priv
52 #define rtcandev_dbg(dev, fmt, args...) \
53  printk(KERN_DEBUG "%s: " fmt, (dev)->name, ##args)
54 #define rtcandev_info(dev, fmt, args...) \
55  printk(KERN_INFO "%s: " fmt, (dev)->name, ##args)
56 #define rtcandev_warn(dev, fmt, args...) \
57  printk(KERN_WARNING "%s: " fmt, (dev)->name, ##args)
58 #define rtcandev_err(dev, fmt, args...) \
59  printk(KERN_ERR "%s: " fmt, (dev)->name, ##args)
60 
61 #endif /* __RTCAN_INTERNAL_H_ */
Real-Time Driver Model for Xenomai, driver API header.