Subversion Repositories Kolibri OS

Rev

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