Subversion Repositories Kolibri OS

Rev

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