Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
meta-soleil-fofb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DG
FOFB
meta-soleil-fofb
Commits
3b402e79
Commit
3b402e79
authored
1 year ago
by
BRONES Romain
Browse files
Options
Downloads
Patches
Plain Diff
feat(archiver): test application archiver
parent
e49b2cda
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
recipes-app/simple-test/files/archiver.c
+77
-0
77 additions, 0 deletions
recipes-app/simple-test/files/archiver.c
recipes-app/simple-test/simple-test_0.1.bb
+4
-4
4 additions, 4 deletions
recipes-app/simple-test/simple-test_0.1.bb
with
81 additions
and
4 deletions
recipes-app/simple-test/files/archiver.c
0 → 100644
+
77
−
0
View file @
3b402e79
#include
<stdio.h>
#include
<unistd.h>
#include
<poll.h>
#include
<sys/mman.h>
#include
<stdint.h>
#include
<fcntl.h>
int
main
(){
int
fd_ddr
,
fd_ddr_ro
;
// File descriptors for DDR4
int
fd_dst
;
// File descriptor for destination
unsigned
int
fcnt
=
0
;
// Binary file counter
int
rp
;
ssize_t
s_wr
;
const
uint32_t
unmask
=
1
;
uint32_t
info
;
char
fname
[
128
];
char
*
src
;
struct
pollfd
pfd
;
// Open file descriptor for DDR4
fd_ddr
=
open
(
"/dev/ddr4"
,
O_RDWR
);
fd_ddr_ro
=
open
(
"/dev/ddr4"
,
O_RDONLY
);
if
(
fd_ddr
<=
0
||
fd_ddr_ro
<=
0
)
{
fprintf
(
stderr
,
"Failed to open UIO device.
\n
"
);
return
-
1
;
};
pfd
.
fd
=
fd_ddr
;
pfd
.
events
=
POLLIN
;
// Open MMAP for DDR4
src
=
mmap
(
NULL
,
0x20000000
,
PROT_READ
,
MAP_SHARED
,
fd_ddr_ro
,
0
);
// Open destination file
snprintf
(
fname
,
128
,
"/mnt/data/archiver/file_%08d.bin"
,
fcnt
);
fd_dst
=
creat
(
fname
,
0
);
if
(
fd_dst
<=
0
)
{
fprintf
(
stderr
,
"Failed to open destination file '%s'.
\n
"
,
fname
);
return
-
2
;
};
// Unmask interrupt
s_wr
=
write
(
fd_ddr
,
&
unmask
,
sizeof
(
unmask
));
if
(
s_wr
!=
(
ssize_t
)
sizeof
(
unmask
))
{
fprintf
(
stderr
,
"Error when unmasking interrupt !
\n
"
);
return
-
3
;
};
// Wait for interrupt
fprintf
(
stdout
,
"Waiting for interrupt..."
);
rp
=
poll
(
&
pfd
,
1
,
-
1
);
// Timeout = -1, infinite wait
if
(
rp
>=
1
)
{
read
(
fd_ddr
,
&
info
,
sizeof
(
info
));
fprintf
(
stdout
,
"Read %d interrupts
\n
"
,
info
);
}
else
if
(
rp
==
0
)
{
fprintf
(
stderr
,
"Wait for IRQ interrupted, timeout or signal.
\n
"
);
return
-
4
;
}
else
{
fprintf
(
stderr
,
"Failed poll.
\n
"
);
return
-
5
;
//fprintf(stderr, "Failed poll. Relaunch for next iteration.\n");
//continue;
};
// Copy data
s_wr
=
write
(
fd_dst
,
&
src
,
0x1000
);
if
(
s_wr
<
0x1000
)
{
fprintf
(
stderr
,
"Error while writing to file '%s'.
\n
"
,
fname
);
}
close
(
fd_dst
);
return
0
;
}
This diff is collapsed.
Click to expand it.
recipes-app/simple-test/simple-test_0.1.bb
+
4
−
4
View file @
3b402e79
...
...
@@ -5,19 +5,19 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda
inherit pkgconfig
SRC_URI = "file://
testread.cpp
"
SRC_URI = "file://
archiver.c
"
S = "${WORKDIR}"
DEPENDS = "
deviceaccess
"
DEPENDS = ""
do_compile() {
${C
XX} `pkg-config ChimeraTK-DeviceAccess --cflags --libs` testread.cpp -o testread
${C
C} -O archiver.c -o archiver
}
do_install() {
install -d ${D}/${bindir}/
install -m 0755
testread
${D}/${bindir}
install -m 0755
archiver
${D}/${bindir}
}
INSANE_SKIP_${PN} = "ldflags"
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment