Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple VME FMC Carrier SVEC - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Simple VME FMC Carrier SVEC - Software
Commits
2e8a0749
Commit
2e8a0749
authored
Nov 26, 2012
by
Juan David González Cobas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: add a simple vme access tool
parent
84722c3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
0 deletions
+85
-0
Makefile
tools/Makefile
+9
-0
vme.c
tools/vme.c
+76
-0
No files found.
tools/Makefile
0 → 100644
View file @
2e8a0749
CFLAGS
+=
-I
/acc/src/dsc/drivers/coht/vmebridge/include/
LDFLAGS
+=
-L
/acc/local/L865/lib
LDLIBS
+=
-lvmebus
all
:
vme
vme
:
vme.o
clean
:
rm
-f
*
.o vme
tools/vme.c
0 → 100644
View file @
2e8a0749
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <libvmebus.h>
static
char
usage_string
[]
=
"usage: %s [-v vme_address] "
"[-d data_width] [-a address_modifier] [-n word_count]
\n
"
;
void
usage
(
char
*
prog
)
{
fprintf
(
stderr
,
usage_string
,
prog
);
exit
(
1
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
struct
vme_mapping
map
;
struct
vme_mapping
*
mapp
=
&
map
;
volatile
void
*
ptr
;
unsigned
long
vmebase
,
am
,
data_width
;
int
i
,
count
;
int
c
;
/* vme defaults */
count
=
1
;
am
=
VME_A32_USER_DATA_SCT
;
data_width
=
VME_D32
;
while
((
c
=
getopt
(
argc
,
argv
,
"v:d:a:n:"
))
!=
-
1
)
{
switch
(
c
)
{
case
'v'
:
vmebase
=
strtoul
(
optarg
,
NULL
,
0
);
break
;
case
'd'
:
data_width
=
strtoul
(
optarg
,
NULL
,
0
);
break
;
case
'a'
:
am
=
VME_A32_USER_DATA_SCT
;
break
;
case
'n'
:
count
=
strtoul
(
optarg
,
NULL
,
0
);
break
;
case
'?'
:
case
'h'
:
usage
(
argv
[
0
]);
break
;
default:
break
;
}
}
memset
(
mapp
,
0
,
sizeof
(
*
mapp
));
mapp
->
am
=
VME_A32_USER_DATA_SCT
;
mapp
->
data_width
=
VME_D32
;
mapp
->
sizel
=
0x80000
;
mapp
->
vme_addrl
=
vmebase
;
if
((
ptr
=
vme_map
(
mapp
,
1
))
==
(
void
*
)
-
1
)
{
printf
(
"could not map at 0x%08x
\n
"
,
vmebase
);
exit
(
1
);
}
printf
(
"vme 0x%08x kernel 0x%08x user 0x%08x
\n
"
,
vmebase
,
mapp
->
kernel_va
,
mapp
->
user_va
);
for
(
i
=
0
;
i
<
count
;
i
++
,
ptr
+=
4
)
{
printf
(
"%08x: %08x
\n
"
,
ptr
,
ntohl
(
*
(
uint32_t
*
)
ptr
));
}
vme_unmap
(
mapp
,
1
);
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment