/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool
7.1.6 by Suren A. Chilingaryan
Provide single header for library
1
#ifndef _PCITOOL_PCI_H
2
#define _PCITOOL_PCI_H
3
45 by root
North West Logick DMA implementation
4
#define PCILIB_DMA_TIMEOUT 10000		/**< us */
70 by Suren A. Chilingaryan
Support modifications of DMA engine and allow DMA customizations by Event engine
5
#define PCILIB_DMA_SKIP_TIMEOUT 1000000		/**< us */
7.1.6 by Suren A. Chilingaryan
Provide single header for library
6
#define PCILIB_REGISTER_TIMEOUT 10000		/**< us */
7
8
#include "driver/pciDriver.h"
45 by root
North West Logick DMA implementation
9
#include "pcilib_types.h"
41 by root
A bit of DMA infrastructure
10
7.1.6 by Suren A. Chilingaryan
Provide single header for library
11
#include "pcilib.h"
47 by Suren A. Chilingaryan
Support FIFO reading/writting, code restructurization, few fixes
12
#include "register.h"
45 by root
North West Logick DMA implementation
13
#include "kmem.h"
55 by Suren A. Chilingaryan
IRQ support in NWL DMA engine
14
#include "irq.h"
47 by Suren A. Chilingaryan
Support FIFO reading/writting, code restructurization, few fixes
15
#include "dma.h"
16
#include "event.h"
45 by root
North West Logick DMA implementation
17
18
struct pcilib_s {
19
    int handle;
20
    
21
    uintptr_t page_mask;
22
    pcilib_board_info_t board_info;
23
    pcilib_dma_info_t dma_info;
24
    pcilib_model_t model;
25
    
26
    char *bar_space[PCILIB_MAX_BANKS];
27
28
    int reg_bar_mapped;
29
    pcilib_bar_t reg_bar;
30
//    char *reg_space;
31
32
    int data_bar_mapped;
33
    pcilib_bar_t data_bar;
34
//    char *data_space;
35
//    size_t data_size;
36
    
37
    pcilib_kmem_list_t *kmem_list;
38
54 by Suren A. Chilingaryan
Support dynamic registers, support register offsets and multiregisters (bitmasks), list NWL DMA registers
39
    size_t num_reg, alloc_reg;
40
    pcilib_model_description_t model_info;
45 by root
North West Logick DMA implementation
41
    
42
    pcilib_dma_context_t *dma_ctx;
43
    pcilib_context_t *event_ctx;
44
    
45
#ifdef PCILIB_FILE_IO
46
    int file_io_handle;
47
#endif /* PCILIB_FILE_IO */
48
};
7.1.6 by Suren A. Chilingaryan
Provide single header for library
49
50
#ifdef _PCILIB_PCI_C
15 by Suren A. Chilingaryan
Infrastructure for event API
51
# include "ipecamera/model.h"
43 by root
Enumerate DMA engines
52
# include "dma/nwl.h"
7.1.6 by Suren A. Chilingaryan
Provide single header for library
53
# include "default.h"
54
55
pcilib_model_description_t pcilib_model[3] = {
117 by Suren A. Chilingaryan
new event architecture, first trial
56
    { 4, PCILIB_HOST_ENDIAN, 	NULL, NULL, NULL, NULL, NULL, NULL },
57
    { 4, PCILIB_HOST_ENDIAN, 	NULL, NULL, NULL, NULL, NULL, NULL },
58
    { 4, PCILIB_LITTLE_ENDIAN,	ipecamera_registers, ipecamera_register_banks, ipecamera_register_ranges, ipecamera_events, ipecamera_data_types, &nwl_dma_api, &ipecamera_image_api }
7.1.6 by Suren A. Chilingaryan
Provide single header for library
59
};
60
61
pcilib_protocol_description_t pcilib_protocol[3] = {
62
    { pcilib_default_read, pcilib_default_write },
63
    { ipecamera_read, ipecamera_write },
64
    { NULL, NULL }
65
};
66
#else
54 by Suren A. Chilingaryan
Support dynamic registers, support register offsets and multiregisters (bitmasks), list NWL DMA registers
67
extern pcilib_model_description_t pcilib_model[];
68
7.1.6 by Suren A. Chilingaryan
Provide single header for library
69
extern void (*pcilib_error)(const char *msg, ...);
70
extern void (*pcilib_warning)(const char *msg, ...);
71
72
extern pcilib_protocol_description_t pcilib_protocol[];
73
#endif /* _PCILIB_PCI_C */
74
45 by root
North West Logick DMA implementation
75
const pcilib_board_info_t *pcilib_get_board_info(pcilib_t *ctx);
76
const pcilib_dma_info_t *pcilib_get_dma_info(pcilib_t *ctx);
77
78
int pcilib_map_register_space(pcilib_t *ctx);
79
int pcilib_map_data_space(pcilib_t *ctx, uintptr_t addr);
80
81
7.1.6 by Suren A. Chilingaryan
Provide single header for library
82
#endif /* _PCITOOL_PCI_H */