1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#ifndef _PCITOOL_PCI_H
#define _PCITOOL_PCI_H
#define PCILIB_DEFAULT_CPU_COUNT 2
#define PCILIB_EVENT_TIMEOUT 1000000 /**< us */
#define PCILIB_TRIGGER_TIMEOUT 100000 /**< us */
#define PCILIB_DMA_TIMEOUT 10000 /**< us */
#define PCILIB_DMA_SKIP_TIMEOUT 1000000 /**< us */
#define PCILIB_REGISTER_TIMEOUT 10000 /**< us */
#include "driver/pciDriver.h"
#include "pcilib_types.h"
#include "pcilib.h"
#include "register.h"
#include "kmem.h"
#include "irq.h"
#include "dma.h"
#include "event.h"
struct pcilib_s {
int handle;
uintptr_t page_mask;
pcilib_board_info_t board_info;
pcilib_dma_info_t dma_info;
pcilib_model_t model;
char *bar_space[PCILIB_MAX_BANKS];
int reg_bar_mapped;
pcilib_bar_t reg_bar;
// char *reg_space;
int data_bar_mapped;
pcilib_bar_t data_bar;
// char *data_space;
// size_t data_size;
pcilib_kmem_list_t *kmem_list;
size_t num_reg, alloc_reg;
pcilib_model_description_t model_info;
pcilib_dma_context_t *dma_ctx;
pcilib_context_t *event_ctx;
#ifdef PCILIB_FILE_IO
int file_io_handle;
#endif /* PCILIB_FILE_IO */
};
#ifdef _PCILIB_PCI_C
# include "ipecamera/model.h"
# include "kapture/model.h"
# include "dma/nwl.h"
# include "dma/ipe.h"
# include "default.h"
pcilib_model_description_t pcilib_model[4] = {
{ 4, PCILIB_HOST_ENDIAN, NULL, NULL, NULL, NULL, NULL, NULL },
{ 4, PCILIB_HOST_ENDIAN, NULL, NULL, NULL, NULL, NULL, NULL },
{ 4, PCILIB_LITTLE_ENDIAN, ipecamera_registers, ipecamera_register_banks, ipecamera_register_ranges, ipecamera_events, ipecamera_data_types, &ipe_dma_api, &ipecamera_image_api },
{ 4, PCILIB_LITTLE_ENDIAN, kapture_registers, kapture_register_banks, kapture_register_ranges, kapture_events, kapture_data_types, &ipe_dma_api, &kapture_api },
};
pcilib_protocol_description_t pcilib_protocol[3] = {
{ pcilib_default_read, pcilib_default_write },
{ ipecamera_read, ipecamera_write },
{ NULL, NULL }
};
#else
extern pcilib_model_description_t pcilib_model[];
extern pcilib_protocol_description_t pcilib_protocol[];
#endif /* _PCILIB_PCI_C */
const pcilib_board_info_t *pcilib_get_board_info(pcilib_t *ctx);
const pcilib_dma_info_t *pcilib_get_dma_info(pcilib_t *ctx);
int pcilib_map_register_space(pcilib_t *ctx);
int pcilib_map_data_space(pcilib_t *ctx, uintptr_t addr);
int pcilib_detect_address(pcilib_t *ctx, pcilib_bar_t *bar, uintptr_t *addr, size_t size);
#endif /* _PCITOOL_PCI_H */
|