2010-09-13 22:07:22 +02:00
|
|
|
|
2010-09-29 13:59:24 +02:00
|
|
|
|
2010-09-13 22:07:22 +02:00
|
|
|
#ifndef __DDK_H__
|
|
|
|
#define __DDK_H__
|
|
|
|
|
|
|
|
#include <kernel.h>
|
2012-11-12 22:22:52 +01:00
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/spinlock.h>
|
2010-09-29 13:59:24 +02:00
|
|
|
#include <mutex.h>
|
2012-11-12 22:22:52 +01:00
|
|
|
#include <linux/pci.h>
|
2010-09-29 13:59:24 +02:00
|
|
|
|
2010-09-13 22:07:22 +02:00
|
|
|
|
|
|
|
#define OS_BASE 0x80000000
|
|
|
|
|
|
|
|
#define PG_SW 0x003
|
2012-09-04 23:42:08 +02:00
|
|
|
#define PG_NOCACHE 0x010
|
2010-09-13 22:07:22 +02:00
|
|
|
|
|
|
|
#define MANUAL_DESTROY 0x80000000
|
|
|
|
|
2010-09-27 00:57:18 +02:00
|
|
|
#define ENTER() dbgprintf("enter %s\n",__FUNCTION__)
|
|
|
|
#define LEAVE() dbgprintf("leave %s\n",__FUNCTION__)
|
|
|
|
|
2010-09-13 22:07:22 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u32_t code;
|
|
|
|
u32_t data[5];
|
|
|
|
}kevent_t;
|
|
|
|
|
|
|
|
typedef union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
u32_t handle;
|
|
|
|
u32_t euid;
|
|
|
|
};
|
|
|
|
u64_t raw;
|
|
|
|
}evhandle_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
u32_t handle;
|
|
|
|
u32_t io_code;
|
|
|
|
void *input;
|
|
|
|
int inp_size;
|
|
|
|
void *output;
|
|
|
|
int out_size;
|
|
|
|
}ioctl_t;
|
|
|
|
|
|
|
|
typedef int (__stdcall *srv_proc_t)(ioctl_t *);
|
|
|
|
|
|
|
|
#define ERR_OK 0
|
|
|
|
#define ERR_PARAM -1
|
|
|
|
|
|
|
|
|
|
|
|
struct ddk_params;
|
|
|
|
|
|
|
|
int ddk_init(struct ddk_params *params);
|
|
|
|
|
|
|
|
u32_t drvEntry(int, char *)__asm__("_drvEntry");
|
|
|
|
|
|
|
|
|
2012-11-12 22:22:52 +01:00
|
|
|
#define __WARN() dbgprintf(__FILE__, __LINE__)
|
2010-09-13 22:07:22 +02:00
|
|
|
|
2012-11-12 22:22:52 +01:00
|
|
|
#ifndef WARN_ON
|
|
|
|
#define WARN_ON(condition) ({ \
|
|
|
|
int __ret_warn_on = !!(condition); \
|
|
|
|
if (unlikely(__ret_warn_on)) \
|
|
|
|
__WARN(); \
|
|
|
|
unlikely(__ret_warn_on); \
|
|
|
|
})
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
static inline void *kmalloc_array(size_t n, size_t size, gfp_t flags)
|
|
|
|
{
|
|
|
|
// if (size != 0 && n > SIZE_MAX / size)
|
|
|
|
// return NULL;
|
|
|
|
return kmalloc(n * size, flags);
|
|
|
|
}
|
2010-09-13 22:07:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* DDK_H */
|