/home/hillier_g/checkout/most4linux/most-kernel/most-common-rt.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright(c) Siemens AG, Muenchen, Germany, 2005, 2006, 2007
00003  *                           Bernhard Walle <bernhard.walle@gmx.de>
00004  *                           Gernot Hillier <gernot.hillier@siemens.com>
00005  *
00006  * ----------------------------------------------------------------------------
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License version 2 as 
00009  * published by the Free Software Foundation;
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  * ----------------------------------------------------------------------------
00020  */
00021 #ifndef MOST_COMMON_RT_H
00022 #define MOST_COMMON_RT_H
00023 
00031 #ifdef HAVE_CONFIG_H
00032 #include "config/config.h"
00033 #endif
00034 #include <linux/spinlock.h>
00035 #include <linux/rwsem.h>
00036 #include <linux/list.h>
00037 
00038 #ifndef RT_RTDM
00039 #   warning "This file is only usable with RTDM driver."
00040 #endif
00041 
00048 struct rt_spin_locked_list {
00049     struct list_head    list;           
00050     rtdm_lock_t         lock;           
00051 };
00052 
00053 
00060 #define RT_SPIN_LOCKED_LIST(name)                                                   \
00061     struct rt_spin_locked_list name = {                                             \
00062         .list       = LIST_HEAD_INIT(name.list),                                    \
00063         .lock       = RTDM_LOCK_UNLOCKED                                            \
00064     }
00065 
00066 
00081 #define copy_from_user_or_kernel(err, user_info, dst, src, size)    \
00082     do {                                                            \
00083         if (user_info) {                                            \
00084             err = rtdm_copy_from_user(user_info, dst, src, size);   \
00085         } else {                                                    \
00086             memcpy(dst, src, size);                                 \
00087             err = 0;                                                \
00088         }                                                           \
00089     } while (0)
00090 
00091 #endif /* MOST_COMMON_RT_H */
00092 
00093 
00094 /* vim: set ts=4 et sw=4: */

Generated on Fri Mar 9 14:48:57 2007 for MOST Linux Drivers (Linux and RTAI) by  doxygen 1.5.0