OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [char/] [drm/] [drm_os_linux.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
#define __NO_VERSION__
2
 
3
#include <linux/interrupt.h>    /* For task queue support */
4
#include <linux/delay.h>
5
 
6
 
7
/* For data going from/to the kernel through the ioctl argument */
8
#define DRM_COPY_FROM_USER_IOCTL(arg1, arg2, arg3)      \
9
        if ( copy_from_user(&arg1, arg2, arg3) )        \
10
                return -EFAULT
11
#define DRM_COPY_TO_USER_IOCTL(arg1, arg2, arg3)        \
12
        if ( copy_to_user(arg1, &arg2, arg3) )          \
13
                return -EFAULT
14
 
15
 
16
#define DRM_GETSAREA()                                                   \
17
do {                                                                     \
18
        drm_map_list_t *entry;                                           \
19
        list_for_each_entry( entry, &dev->maplist->head, head ) {        \
20
                if ( entry->map &&                                       \
21
                     entry->map->type == _DRM_SHM &&                     \
22
                     (entry->map->flags & _DRM_CONTAINS_LOCK) ) {        \
23
                        dev_priv->sarea = entry->map;                    \
24
                        break;                                           \
25
                }                                                        \
26
        }                                                                \
27
} while (0)
28
 
29
#define DRM_WAIT_ON( ret, queue, timeout, condition )   \
30
do {                                                    \
31
        DECLARE_WAITQUEUE(entry, current);              \
32
        unsigned long end = jiffies + (timeout);        \
33
        add_wait_queue(&(queue), &entry);               \
34
                                                        \
35
        for (;;) {                                      \
36
                set_current_state(TASK_INTERRUPTIBLE);  \
37
                if (condition)                          \
38
                        break;                          \
39
                if((signed)(end - jiffies) <= 0) {       \
40
                        ret = -EBUSY;                   \
41
                        break;                          \
42
                }                                       \
43
                schedule_timeout((HZ/100 > 1) ? HZ/100 : 1);    \
44
                if (signal_pending(current)) {          \
45
                        ret = -EINTR;                   \
46
                        break;                          \
47
                }                                       \
48
        }                                               \
49
        set_current_state(TASK_RUNNING);                \
50
        remove_wait_queue(&(queue), &entry);            \
51
} while (0)
52
 
53
 
54
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.