My Project
 All Classes
MWDMAMem.h
1 // CONFIDENTIAL and PROPRIETARY software of Magewell Electronics Co., Ltd.
3 // Copyright (c) 2011-2014 Magewell Electronics Co., Ltd. (Nanjing)
4 // All rights reserved.
5 // This copyright notice MUST be reproduced on all authorized copies.
7 #ifndef __MW_DMA_MEM_H__
8 #define __MW_DMA_MEM_H__
9 
10 #pragma pack(push)
11 #pragma pack(1)
12 
13 #include "MWSg.h"
14 
15 enum mw_dma_data_direction{
16  MW_DMA_BIDIRECTIONAL = 0,
17  MW_DMA_TO_DEVICE = 1,
18  MW_DMA_FROM_DEVICE = 2,
19  MW_DMA_NONE = 3,
20 };
21 
22 static inline int mw_valid_dma_direction(int direction)
23 {
24  return ((direction == MW_DMA_BIDIRECTIONAL) ||
25  (direction == MW_DMA_TO_DEVICE) ||
26  (direction == MW_DMA_FROM_DEVICE));
27 }
28 
29 #define MW_DMA_MEMORY_MAX_CLIENT (16)
30 
31 #define MWCAP_VIDEO_MEMORY_TYPE_USER (3)
32 #define MWCAP_VIDEO_MEMORY_TYPE_PHYSICAL (4)
33 #define MWCAP_VIDEO_MEMORY_TYPE_NVRDMA (5) /* need NvRdmaForProCapture module */
34 #define MWCAP_VIDEO_MEMORY_TYPE_PRIV_BASE (6)
35 
36 
38 
39 struct mw_dma_desc {
40  mw_scatterlist_t *mwsg_list;
41  int sglen;
42 
43  /* for internal use */
44  struct mw_dma_memory_client *client;
45 };
46 
48  int mem_type;
49 
50  int (*create_dma_desc)(struct mw_dma_desc **dma_desc,
51  unsigned long addr, size_t size,
52  int direction,
53  void *private_data);
54  int (*sync_for_cpu)(struct mw_dma_desc *dma_desc);
55  int (*sync_for_device)(struct mw_dma_desc *dma_desc);
56  void (*destroy_dma_desc)(struct mw_dma_desc *dma_desc);
57 };
58 
59 int mw_register_dma_memory_client(struct mw_dma_memory_client *client);
60 
61 int mw_unregister_dma_memory_client(struct mw_dma_memory_client *client);
62 
63 #pragma pack(pop)
64 
65 #endif /* __MW_DMA_MEM_H__ */
Definition: MWDMAMem.h:39
Definition: MWDMAMem.h:47
Definition: MWSg.h:15