Subversion Repositories Kolibri OS

Rev

Rev 2967 | Rev 3120 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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