memalloc.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. --
  16. -- Abstract :
  17. --
  18. ------------------------------------------------------------------------------*/
  19. #ifndef _HMP4ENC_H_
  20. #define _HMP4ENC_H_
  21. #include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */
  22. /*
  23. * Macros to help debugging
  24. */
  25. #undef PDEBUG /* undef it, just in case */
  26. #ifdef MEMALLOC_DEBUG
  27. # ifdef __KERNEL__
  28. /* This one if debugging is on, and kernel space */
  29. # define PDEBUG(fmt, args...) printk( KERN_INFO "memalloc: " fmt, ## args)
  30. # else
  31. /* This one for user space */
  32. # define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
  33. # endif
  34. #else
  35. # define PDEBUG(fmt, args...) /* not debugging: nothing */
  36. #endif
  37. /*
  38. * Ioctl definitions
  39. */
  40. /* Use 'k' as magic number */
  41. #define MEMALLOC_IOC_MAGIC 'k'
  42. /*
  43. * S means "Set" through a ptr,
  44. * T means "Tell" directly with the argument value
  45. * G means "Get": reply by setting through a pointer
  46. * Q means "Query": response is on the return value
  47. * X means "eXchange": G and S atomically
  48. * H means "sHift": T and Q atomically
  49. */
  50. #define MEMALLOC_IOCXGETBUFFER _IOWR(MEMALLOC_IOC_MAGIC, 1, unsigned long)
  51. #define MEMALLOC_IOCSFREEBUFFER _IOW(MEMALLOC_IOC_MAGIC, 2, unsigned long)
  52. /* ... more to come */
  53. #define MEMALLOC_IOCHARDRESET _IO(MEMALLOC_IOC_MAGIC, 15) /* debugging tool */
  54. #define MEMALLOC_IOC_MAXNR 15
  55. typedef struct
  56. {
  57. unsigned busAddress;
  58. unsigned size;
  59. } MemallocParams;
  60. #endif /* _HMP4ENC_H_ */