/home/hillier_g/checkout/most4linux/most-kernel/usp-test.h

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 USP_TEST_H
00022 #define USP_TEST_H
00023 
00024 #ifdef HAVE_CONFIG_H
00025 #include "config/config.h"
00026 #endif
00027 #include <stdio.h>
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <stdbool.h>
00031 #include <errno.h>
00032 
00033 /* no user memory */
00034 #define __user
00035 
00036 /* define some struct members as int */
00037 #define rwlock_t                int
00038 #define wait_queue_head_t       int
00039 
00040 /* use printf for debugging */
00041 #define pr_debugm               printf
00042 #define most_printk             printf
00043 #define pr_err                  printf
00044 #define pr_warning              printf
00045 #define pr_crit                 printf
00046 #define pr_alert                printf
00047 #define pr_emerg                printf
00048 #define pr_rxbuf_debug          printf
00049 #define pr_txbuf_debug          printf
00050 
00051 /* suppress compiler warnings */
00052 #define do_nothing              do{} while (0);
00053 
00054 /* memory allocation functions */
00055 #define kfree(m)                free(m)
00056 #define ker_malloc(m)           malloc(m)
00057 #define vmalloc(m)              malloc(m)
00058 #define vfree(m)                free(m)
00059 
00060 /* memory copying */
00061 static inline int my_memcpy(void *dst, void *src, int size)
00062 {
00063     memcpy(dst, src, size);
00064     return 0;
00065 }
00066 #define copy_from_user(a, b, c) \
00067     my_memcpy(a, b, c)
00068 
00069 #define copy_to_user(a, b, c)   \
00070     my_memcpy(a, b, c)
00071 
00072 /* some algorithms */
00073 #define min(a,b)                (((a) < (b)) ? (a) : (b))
00074 #define max(a,b)                (((a) > (b)) ? (a) : (b))
00075 
00076 /* no locking in userspace */
00077 #define read_lock_irqsave(a,b)          do_nothing
00078 #define read_unlock_irqrestore(a,b)     do_nothing
00079 #define write_lock_irqsave(a,b)         do_nothing
00080 #define write_unlock_irqrestore(a,b)    do_nothing
00081 
00082 /* no initialization for locking function */
00083 #define rwlock_init(a)                  do_nothing
00084 #define init_waitqueue_head(a)          do_nothing
00085 
00086 /* no wakeup */
00087 #define wake_up(a)                      do_nothing
00088 
00089 /* compile specific */
00090 #define unlikely(x)  __builtin_expect(!!(x), 0)
00091 
00092 #endif /* USP_TEST_H */

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