/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to kmem.h

  • Committer: Suren A. Chilingaryan
  • Date: 2015-04-20 20:01:04 UTC
  • Revision ID: csa@suren.me-20150420200104-b5xny65io8lvoz3w
Big redign of model structures

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#ifndef _PCILIB_KMEM_H
2
2
#define _PCILIB_KMEM_H
3
3
 
4
 
#include "pcilib.h"
5
 
 
 
4
typedef struct pcilib_s pcilib_t;
6
5
typedef struct pcilib_kmem_list_s pcilib_kmem_list_t;
7
6
 
8
 
#include "tools.h"
9
 
 
10
 
typedef enum {
11
 
    PCILIB_KMEM_FLAG_REUSE = KMEM_FLAG_REUSE,
12
 
    PCILIB_KMEM_FLAG_EXCLUSIVE = KMEM_FLAG_EXCLUSIVE,
13
 
    PCILIB_KMEM_FLAG_PERSISTENT = KMEM_FLAG_PERSISTENT,
14
 
    PCILIB_KMEM_FLAG_HARDWARE = KMEM_FLAG_HW,
15
 
    PCILIB_KMEM_FLAG_FORCE = KMEM_FLAG_FORCE,
16
 
    PCILIB_KMEM_FLAG_TRY =  KMEM_FLAG_TRY
 
7
typedef enum {
 
8
    PCILIB_TRISTATE_NO = 0,
 
9
    PCILIB_TRISTATE_PARTIAL = 1,
 
10
    PCILIB_TRISTATE_YES = 2
 
11
} pcilib_tristate_t;
 
12
 
 
13
#define PCILIB_KMEM_TYPE_MASK   0xFFFF0000
 
14
#define PCILIB_KMEM_USE(type, subtype) (((type) << 16)|(subtype))
 
15
 
 
16
typedef enum {
 
17
    PCILIB_KMEM_TYPE_CONSISTENT = 0x00000,
 
18
    PCILIB_KMEM_TYPE_PAGE = 0x10000,
 
19
    PCILIB_KMEM_TYPE_DMA_S2C_PAGE = 0x10001,
 
20
    PCILIB_KMEM_TYPE_DMA_C2S_PAGE = 0x10002,
 
21
    PCILIB_KMEM_TYPE_REGION = 0x20000,
 
22
    PCILIB_KMEM_TYPE_REGION_S2C = 0x20001,
 
23
    PCILIB_KMEM_TYPE_REGION_C2S = 0x20002
 
24
} pcilib_kmem_type_t;
 
25
 
 
26
typedef enum {
 
27
    PCILIB_KMEM_USE_STANDARD = 0,
 
28
    PCILIB_KMEM_USE_DMA_RING = 1,
 
29
    PCILIB_KMEM_USE_DMA_PAGES = 2,
 
30
    PCILIB_KMEM_USE_USER = 0x10
 
31
} pcilib_kmem_use_t;
 
32
 
 
33
typedef enum {
 
34
    PCILIB_KMEM_SYNC_BIDIRECTIONAL = 0,
 
35
    PCILIB_KMEM_SYNC_TODEVICE = 1,
 
36
    PCILIB_KMEM_SYNC_FROMDEVICE = 2
 
37
} pcilib_kmem_sync_direction_t;
 
38
 
 
39
typedef enum {
 
40
    PCILIB_KMEM_FLAG_REUSE = 1,                         /**< Try to reuse existing buffer with the same use & item */
 
41
    PCILIB_KMEM_FLAG_EXCLUSIVE = 2,                     /**< Allow only a single application accessing a specified use & item */
 
42
    PCILIB_KMEM_FLAG_PERSISTENT = 4,                    /**< Sets persistent mode */
 
43
    PCILIB_KMEM_FLAG_HARDWARE = 8,                      /**< The buffer may be accessed by hardware, the hardware access will not occur any more if passed to _free function */
 
44
    PCILIB_KMEM_FLAG_FORCE = 16,                        /**< Force memory cleanup even if references are present */
 
45
    PCILIB_KMEM_FLAG_MASS = 32,                         /**< Apply to all buffers of selected use */
 
46
    PCILIB_KMEM_FLAG_TRY =  64                          /**< Do not allocate buffers, try to reuse and fail if not possible */
17
47
} pcilib_kmem_flags_t;
18
48
 
19
49