/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool
227 by Suren A. Chilingaryan
Initial implementation of IPEDMA, dummy driver for KAPTURE, start of API changes
1
#ifndef _PCILIB_DMA_NWL_PRIVATE_H
2
#define _PCILIB_DMA_NWL_PRIVATE_H
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
3
64 by Suren A. Chilingaryan
Another reorganization of NWL sources
4
typedef struct nwl_dma_s nwl_dma_t;
236 by Suren A. Chilingaryan
Big redign of model structures
5
typedef struct pcilib_nwl_engine_context_s pcilib_nwl_engine_context_t;
64 by Suren A. Chilingaryan
Another reorganization of NWL sources
6
7
#define NWL_DMA_IRQ_SOURCE 0
8
9
#define NWL_XAUI_ENGINE 0
10
#define NWL_XRAWDATA_ENGINE 1
109 by Suren A. Chilingaryan
Improvements of DMA engine
11
#define NWL_MAX_PACKET_SIZE 4096 //16384
64 by Suren A. Chilingaryan
Another reorganization of NWL sources
12
//#define NWL_GENERATE_DMA_IRQ
13
14
#define PCILIB_NWL_ALIGNMENT 			64  // in bytes
15
#define PCILIB_NWL_DMA_DESCRIPTOR_SIZE		64  // in bytes
179 by Suren A. Chilingaryan
Decrease size of DMA buffer (bigger sizes limit DMA bandwidth)
16
#define PCILIB_NWL_DMA_PAGES			256 // 1024
64 by Suren A. Chilingaryan
Another reorganization of NWL sources
17
241 by Suren A. Chilingaryan
Further adjustments to get ready for independent event plugins
18
#define PCILIB_NWL_REGISTER_TIMEOUT 10000	/**< us */
19
330 by Suren A. Chilingaryan
Support for 64-bit registes
20
#include "datacpy.h"
21
227 by Suren A. Chilingaryan
Initial implementation of IPEDMA, dummy driver for KAPTURE, start of API changes
22
#include "nwl.h"
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
23
#include "nwl_irq.h"
64 by Suren A. Chilingaryan
Another reorganization of NWL sources
24
#include "nwl_engine.h"
65 by Suren A. Chilingaryan
Separate NWL loopback code, provide DMA start/stop interfaces
25
#include "nwl_loopback.h"
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
26
27
#define nwl_read_register(var, ctx, base, reg) pcilib_datacpy(&var, base + reg, 4, 1, ctx->dma_bank->raw_endianess)
28
#define nwl_write_register(var, ctx, base, reg) pcilib_datacpy(base + reg, &var, 4, 1, ctx->dma_bank->raw_endianess)
29
236 by Suren A. Chilingaryan
Big redign of model structures
30
31
struct pcilib_nwl_engine_context_s {
32
    const pcilib_dma_engine_description_t *desc;
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
33
    char *base_addr;
236 by Suren A. Chilingaryan
Big redign of model structures
34
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
35
    size_t ring_size, page_size;
36
    size_t head, tail;
37
    pcilib_kmem_handle_t *ring;
38
    pcilib_kmem_handle_t *pages;
39
    
62 by Suren A. Chilingaryan
Suppport DMA modes in console application (not functional yet)
40
    int started;			/**< indicates that DMA buffers are initialized and reading is allowed */
41
    int writting;			/**< indicates that we are in middle of writting packet */
74 by Suren A. Chilingaryan
Implement DMA access synchronization for NWL implementation
42
    int reused;				/**< indicates that DMA was found intialized, buffers were reused, and no additional initialization is needed */
62 by Suren A. Chilingaryan
Suppport DMA modes in console application (not functional yet)
43
    int preserve;			/**< indicates that DMA should not be stopped during clean-up */
64 by Suren A. Chilingaryan
Another reorganization of NWL sources
44
};
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
45
236 by Suren A. Chilingaryan
Big redign of model structures
46
typedef enum {
47
    NWL_MODIFICATION_DEFAULT,
48
    NWL_MODIFICATION_IPECAMERA
49
} nwl_modification_t;
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
50
51
struct nwl_dma_s {
236 by Suren A. Chilingaryan
Big redign of model structures
52
    pcilib_dma_context_t dmactx;
53
54
    nwl_modification_t type;
55
    int ignore_eop;			/**< always set end-of-packet */
56
57
    const pcilib_register_bank_description_t *dma_bank;
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
58
    char *base_addr;
63 by Suren A. Chilingaryan
Provide IRQ enable/disable call
59
62 by Suren A. Chilingaryan
Suppport DMA modes in console application (not functional yet)
60
    pcilib_irq_type_t irq_enabled;	/**< indicates that IRQs are enabled */
63 by Suren A. Chilingaryan
Provide IRQ enable/disable call
61
    pcilib_irq_type_t irq_preserve;	/**< indicates that IRQs should not be disabled during clean-up */
62 by Suren A. Chilingaryan
Suppport DMA modes in console application (not functional yet)
62
    int started;			/**< indicates that DMA subsystem is initialized and DMA engine can start */
65 by Suren A. Chilingaryan
Separate NWL loopback code, provide DMA start/stop interfaces
63
    int irq_started;			/**< indicates that IRQ subsystem is initialized (detecting which types should be preserverd) */    
64
    int loopback_started;		/**< indicates that benchmarking subsystem is initialized */
65
236 by Suren A. Chilingaryan
Big redign of model structures
66
//    pcilib_dma_engine_t n_engines;
67
    pcilib_nwl_engine_context_t engines[PCILIB_MAX_DMA_ENGINES + 1];
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
68
};
69
236 by Suren A. Chilingaryan
Big redign of model structures
70
int nwl_add_registers(nwl_dma_t *ctx);
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
71
227 by Suren A. Chilingaryan
Initial implementation of IPEDMA, dummy driver for KAPTURE, start of API changes
72
#endif /* _PCILIB_DMA_NWL_PRIVATE_H */