-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibvmemap.h
100 lines (83 loc) · 2.5 KB
/
libvmemap.h
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
Moscow, ITEP, I. Alekseev, D. Kalinkin, D. Svirida
Support for vme_user driver.
*/
#ifndef LIBVMEMAP_H
#define LIBVMEMAP_H
#include "vme_user.h"
struct vmemap_struct {
int fd; // file descriptor
unsigned int *ptr; // pointer returned
unsigned int *rptr; // real pointer
unsigned long long size; // size
};
#ifdef __cplusplus
extern "C" {
#endif
/* Open VME and map particular window.
Return pointer to mapped region. NULL on error */
unsigned *vmemap_open(
unsigned int unit, // Tundra master window.
unsigned long long vme_addr, // VME address
unsigned long long size, // size of mapped region
unsigned int aspace, // VME address space
unsigned int cycle, // VME cycle type
unsigned int dwidth // VME data width
);
/* Unmap the region and close driver */
void vmemap_close(
unsigned int *ptr // Pointer returned by vmemap
);
/* Open DMA channel. Return file descriptor */
int vmedma_open(void);
/* Close dma channel. */
void vmedma_close(int fd);
/* Read A64D32. Return the value if OK, -1 on error */
int vmemap_a64_read(
unsigned int unit, // Tundra master window.
unsigned long long vme_addr // VME address
);
/* Write A64D32. Return 0 if OK, negative number on error */
int vmemap_a64_write(
unsigned int unit, // Tundra master window.
unsigned long long vme_addr, // VME address
int data // the data
);
/* Read block A64D32. Return 0 if OK, -1 on error */
int vmemap_a64_blkread(
unsigned int unit, // Tundra master window.
unsigned long long vme_addr, // VME address
unsigned int *data, // buffer for data
int len // length in bytes
);
/* Write block A64D32. Return 0 if OK, negative number on error */
int vmemap_a64_blkwrite(
unsigned int unit, // Tundra master window.
unsigned long long vme_addr, // VME address
unsigned int *data, // the data
int len // length in bytes
);
/* Read/write block A64D32 using DMA. Return 0 if OK, -1 on error */
int vmemap_a64_dma(
int fd, // DMA file
unsigned long long vme_addr, // VME address
unsigned int *data, // buffer for data
int len, // length in bytes
int rw // rw = 0 - read, rw = 1 - write
);
/* Read/write block A32D32 using DMA & BLT. Return 0 if OK, -1 on error */
int vmemap_a32_dma(
int fd, // DMA file
unsigned long vme_addr, // VME address
unsigned int *data, // buffer for data
int len, // length in bytes
int rw // rw = 0 - read, rw = 1 - write
);
/* Sleep number of usec using nanosleep */
void vmemap_usleep(
int usec
);
#ifdef __cplusplus
}
#endif
#endif /* LIBVMEMAP_H */