pcilib_types.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _PCILIB_TYPES_H
  2. #define _PCILIB_TYPES_H
  3. #define KMEM_REF_HW 0x80000000 /**< Special reference to indicate hardware access */
  4. #define KMEM_REF_COUNT 0x0FFFFFFF /**< Mask of reference counter (mmap/munmap), couting in mmaped memory pages */
  5. #define KMEM_MODE_REUSABLE 0x80000000 /**< Indicates reusable buffer */
  6. #define KMEM_MODE_EXCLUSIVE 0x40000000 /**< Only a single process is allowed to mmap the buffer */
  7. #define KMEM_MODE_PERSISTENT 0x20000000 /**< Persistent mode instructs kmem_free to preserve buffer in memory */
  8. #define KMEM_MODE_COUNT 0x0FFFFFFF /**< Mask of reuse counter (alloc/free) */
  9. #define PCILIB_KMEM_TYPE_MASK 0xFFFF0000
  10. typedef enum {
  11. PCILIB_KMEM_TYPE_CONSISTENT = 0x00000,
  12. PCILIB_KMEM_TYPE_PAGE = 0x10000,
  13. PCILIB_KMEM_TYPE_DMA_S2C_PAGE = 0x10001,
  14. PCILIB_KMEM_TYPE_DMA_C2S_PAGE = 0x10002,
  15. PCILIB_KMEM_TYPE_REGION = 0x20000,
  16. PCILIB_KMEM_TYPE_REGION_S2C = 0x20001,
  17. PCILIB_KMEM_TYPE_REGION_C2S = 0x20002
  18. } pcilib_kmem_type_t;
  19. typedef enum {
  20. PCILIB_KMEM_USE_STANDARD = 0,
  21. PCILIB_KMEM_USE_DMA_RING = 1,
  22. PCILIB_KMEM_USE_DMA_PAGES = 2,
  23. PCILIB_KMEM_USE_USER = 0x10
  24. } pcilib_kmem_use_t;
  25. typedef enum {
  26. PCILIB_KMEM_SYNC_BIDIRECTIONAL = 0,
  27. PCILIB_KMEM_SYNC_TODEVICE = 1,
  28. PCILIB_KMEM_SYNC_FROMDEVICE = 2
  29. } pcilib_kmem_sync_direction_t;
  30. #define PCILIB_KMEM_USE(type, subtype) (((type) << 16)|(subtype))
  31. //pcilib_alloc_kmem_buffer(pcilib_t *ctx, size_t size, size_t alignment)
  32. #endif /* _PCILIB_TYPES_H */