Subversion Repositories Kolibri OS

Rev

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