Subversion Repositories Kolibri OS

Rev

Rev 3031 | Rev 3262 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3031 Rev 3120
1
#ifndef __DDK_H__
1
#ifndef __DDK_H__
2
#define __DDK_H__
2
#define __DDK_H__
3
 
3
 
4
#include 
4
#include 
5
#include 
5
#include 
6
#include 
6
#include 
7
#include 
7
#include 
8
#include 
8
#include 
9
 
9
 
10
 
10
 
11
#define OS_BASE             0x80000000
11
#define OS_BASE             0x80000000
12
 
12
 
13
#define PG_SW               0x003
13
#define PG_SW               0x003
14
#define PG_NOCACHE          0x010
14
#define PG_NOCACHE          0x010
15
 
15
 
16
#define MANUAL_DESTROY      0x80000000
16
#define MANUAL_DESTROY      0x80000000
17
 
17
 
18
#define ENTER()   dbgprintf("enter %s\n",__FUNCTION__)
18
#define ENTER()   dbgprintf("enter %s\n",__FUNCTION__)
19
#define LEAVE()   dbgprintf("leave %s\n",__FUNCTION__)
19
#define LEAVE()   dbgprintf("leave %s\n",__FUNCTION__)
20
 
20
#define FAIL()    dbgprintf("fail %s\n",__FUNCTION__)
21
typedef struct
21
 
-
 
22
typedef struct
22
{
23
{
23
    u32_t  code;
24
    u32_t  code;
24
    u32_t  data[5];
25
    u32_t  data[5];
25
}kevent_t;
26
}kevent_t;
26
 
27
 
27
typedef union
28
typedef union
28
{
29
{
29
    struct
30
    struct
30
    {
31
    {
31
        u32_t handle;
32
        u32_t handle;
32
        u32_t euid;
33
        u32_t euid;
33
    };
34
    };
34
    u64_t raw;
35
    u64_t raw;
35
}evhandle_t;
36
}evhandle_t;
36
 
37
 
37
typedef struct
38
typedef struct
38
{
39
{
39
  u32_t      handle;
40
  u32_t      handle;
40
  u32_t      io_code;
41
  u32_t      io_code;
41
  void       *input;
42
  void       *input;
42
  int        inp_size;
43
  int        inp_size;
43
  void       *output;
44
  void       *output;
44
  int        out_size;
45
  int        out_size;
45
}ioctl_t;
46
}ioctl_t;
46
 
47
 
47
typedef int (__stdcall *srv_proc_t)(ioctl_t *);
48
typedef int (__stdcall *srv_proc_t)(ioctl_t *);
48
 
49
 
49
#define ERR_OK       0
50
#define ERR_OK       0
50
#define ERR_PARAM   -1
51
#define ERR_PARAM   -1
51
 
52
 
52
 
53
 
53
struct ddk_params;
54
struct ddk_params;
54
 
55
 
55
int   ddk_init(struct ddk_params *params);
56
int   ddk_init(struct ddk_params *params);
56
 
57
 
57
u32_t drvEntry(int, char *)__asm__("_drvEntry");
58
u32_t drvEntry(int, char *)__asm__("_drvEntry");
58
 
59
 
59
 
60
 
60
#define __WARN()      dbgprintf(__FILE__, __LINE__)
61
#define __WARN()      dbgprintf(__FILE__, __LINE__)
61
 
62
 
62
#ifndef WARN_ON
63
#ifndef WARN_ON
63
#define WARN_ON(condition) ({                                           \
64
#define WARN_ON(condition) ({                                           \
64
        int __ret_warn_on = !!(condition);                              \
65
        int __ret_warn_on = !!(condition);                              \
65
        if (unlikely(__ret_warn_on))                                    \
66
        if (unlikely(__ret_warn_on))                                    \
66
                __WARN();                                               \
67
                __WARN();                                               \
67
        unlikely(__ret_warn_on);                                        \
68
        unlikely(__ret_warn_on);                                        \
68
})
69
})
69
#endif
70
#endif
70
 
71
 
71
 
72
 
72
static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
73
static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
73
{
74
{
74
//    if (size != 0 && n > SIZE_MAX / size)
75
//    if (size != 0 && n > SIZE_MAX / size)
75
//        return NULL;
76
//        return NULL;
76
    return kmalloc(n * size, flags);
77
    return kmalloc(n * size, flags);
77
}
78
}
78
 
79
 
79
 
80
 
80
#endif      /*    DDK_H    */
81
#endif      /*    DDK_H    */