#include <netinet/in.h>
#include "vme_io.h"
Go to the source code of this file.
|
struct vme_handle * | vme_open (unsigned long vme_addr, struct vme_mapping_ctrl mapping, int size, int fifo_block_size=0) |
|
void | vme_close (struct vme_handle *handle) |
|
int | vme_dma_read (struct vme_handle *handle, unsigned long vme_addr, unsigned char *buffer, int size) |
|
int | vme_dma_write (struct vme_handle *handle, unsigned long vme_addr, unsigned char *buffer, int size) |
|
unsigned long | vme_read_d32 (struct vme_handle *handle, unsigned long vme_addr) |
|
unsigned short | vme_read_d16 (struct vme_handle *handle, unsigned long vme_addr) |
|
unsigned char | vme_read_d8 (struct vme_handle *handle, unsigned long vme_addr) |
|
void | vme_write_d32 (struct vme_handle *handle, unsigned long vme_addr, unsigned long value) |
|
void | vme_write_d16 (struct vme_handle *handle, unsigned long vme_addr, unsigned short value) |
|
void | vme_write_d8 (struct vme_handle *handle, unsigned long vme_addr, unsigned char value) |
|
unsigned long | vme_read_d32_checked (struct vme_handle *handle, unsigned long vme_addr, int *status=NULL) |
|
unsigned short | vme_read_d16_checked (struct vme_handle *handle, unsigned long vme_addr, int *status=NULL) |
|
unsigned char | vme_read_d8_checked (struct vme_handle *handle, unsigned long vme_addr, int *status=NULL) |
|
int | vme_write_d32_checked (struct vme_handle *handle, unsigned long vme_addr, unsigned long value) |
|
int | vme_write_d16_checked (struct vme_handle *handle, unsigned long vme_addr, unsigned short value) |
|
int | vme_write_d8_checked (struct vme_handle *handle, unsigned long vme_addr, unsigned char value) |
|
Definition at line 162 of file vme_universe.cpp.
169 perror(
"Error unmapping VME:");
171 status = close(handle->
fd);
173 perror(
"Error closing VME:");
175 handle->
used =
false;
int vme_dma_read |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
unsigned char * |
buffer, |
|
|
int |
size |
|
) |
| |
Definition at line 179 of file vme_universe.cpp.
187 dma_req.buf = buffer;
188 dma_req.count =
size;
202 while(bytes_read <
size) {
206 int status = pread(handle->
fd, buffer + bytes_read, size_this_time,
213 if(status < size_this_time) {
int vme_dma_write |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
unsigned char * |
buffer, |
|
|
int |
size |
|
) |
| |
Definition at line 223 of file vme_universe.cpp.
231 dma_req.buf = buffer;
232 dma_req.count =
size;
237 return bytes_written;
244 int bytes_written = 0;
246 while(bytes_written <
size) {
250 int status = pwrite(handle->
fd, buffer + bytes_written, size_this_time,
257 if(status < size_this_time) {
262 return bytes_written;
Definition at line 51 of file vme_universe.cpp.
57 unsigned long new_vme_base = 0;
58 unsigned long new_vme_size = 0;
74 unsigned long new_vme_addr_end =
76 new_vme_size = new_vme_addr_end - new_vme_base;
87 new_vme_base = vme_addr;
88 new_vme_size = vme_addr_end - vme_addr;
101 for(
int i = 0;
i < 8;
i++) {
103 sprintf(filename,
"/dev/vme_a32_%d",
i);
104 handle->
fd = open(filename, O_RDWR);
105 if(handle->
fd >= 0) {
112 diag_print(0,
"Unable to open a VME device file\n");
118 munmap((
void *) handle->
base, handle->
size);
123 perror(
"ioctl VMEIMG_SETMAPPING");
129 perror(
"ioctl VMEIMG_SETVMEADDR");
135 perror(
"ioctl VMEIMG_GETVMEADDR");
140 handle->
base = (
volatile unsigned char *)
141 mmap(NULL, new_vme_size, PROT_WRITE | PROT_READ, MAP_SHARED, handle->
fd, 0);
142 if(handle->
base == (
volatile unsigned char *) -1) {
143 perror(
"mmap VME address space");
154 handle->
size = new_vme_size;
unsigned short vme_read_d16 |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr |
|
) |
| |
|
inline |
unsigned short vme_read_d16_checked |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
int * |
status = NULL |
|
) |
| |
|
inline |
Definition at line 105 of file vme_universe.h.
References status, and vme_dma_read().
109 unsigned short result;
111 int status1 =
vme_dma_read(handle, vme_addr, (
unsigned char *) &result,
112 sizeof(
unsigned short));
115 if(status1 ==
sizeof(
unsigned short)) {
122 return ntohs(result);
unsigned long vme_read_d32 |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr |
|
) |
| |
|
inline |
unsigned long vme_read_d32_checked |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
int * |
status = NULL |
|
) |
| |
|
inline |
Definition at line 85 of file vme_universe.h.
References status, and vme_dma_read().
91 int status1 =
vme_dma_read(handle, vme_addr, (
unsigned char *) &result,
92 sizeof(
unsigned long));
95 if(status1 ==
sizeof(
unsigned long)) {
102 return ntohl(result);
unsigned char vme_read_d8 |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr |
|
) |
| |
|
inline |
unsigned char vme_read_d8_checked |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
int * |
status = NULL |
|
) |
| |
|
inline |
Definition at line 125 of file vme_universe.h.
References status, and vme_dma_read().
129 unsigned short result;
131 int status1 =
vme_dma_read(handle, vme_addr, (
unsigned char *) &result,
132 sizeof(
unsigned char));
135 if(status1 ==
sizeof(
unsigned char)) {
void vme_write_d16 |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
unsigned short |
value |
|
) |
| |
|
inline |
int vme_write_d16_checked |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
unsigned short |
value |
|
) |
| |
|
inline |
void vme_write_d32 |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
unsigned long |
value |
|
) |
| |
|
inline |
int vme_write_d32_checked |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
unsigned long |
value |
|
) |
| |
|
inline |
void vme_write_d8 |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
unsigned char |
value |
|
) |
| |
|
inline |
int vme_write_d8_checked |
( |
struct vme_handle * |
handle, |
|
|
unsigned long |
vme_addr, |
|
|
unsigned char |
value |
|
) |
| |
|
inline |