Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
SDB - Self-describing Bus
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
SDB - Self-describing Bus
Commits
c4933f3b
Commit
c4933f3b
authored
Oct 08, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sdbfs/lib: new functions, to find FPGA cores by name or ID
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
ed
parent
3c5fc657
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
glue.c
sdbfs/lib/glue.c
+28
-0
libsdbfs.h
sdbfs/lib/libsdbfs.h
+2
-0
No files found.
sdbfs/lib/glue.c
View file @
c4933f3b
...
...
@@ -232,3 +232,31 @@ int sdbfs_close(struct sdbfs *fs)
return
0
;
}
/* to "find" a device, open it, get the current offset, then close */
unsigned
long
sdbfs_find_name
(
struct
sdbfs
*
fs
,
const
char
*
name
)
{
unsigned
long
offset
;
int
ret
;
ret
=
sdbfs_open_name
(
fs
,
name
);
if
(
ret
<
0
)
return
(
unsigned
long
)
ret
;
offset
=
fs
->
f_offset
;
sdbfs_close
(
fs
);
return
offset
;
}
unsigned
long
sdbfs_find_id
(
struct
sdbfs
*
fs
,
uint64_t
vid
,
uint32_t
did
)
{
unsigned
long
offset
;
int
ret
;
ret
=
sdbfs_open_id
(
fs
,
vid
,
did
);
if
(
ret
<
0
)
return
(
unsigned
long
)
ret
;
offset
=
fs
->
f_offset
;
sdbfs_close
(
fs
);
return
offset
;
}
sdbfs/lib/libsdbfs.h
View file @
c4933f3b
...
...
@@ -58,6 +58,8 @@ struct sdbfs {
int
sdbfs_dev_create
(
struct
sdbfs
*
fs
,
int
verbose
);
int
sdbfs_dev_destroy
(
struct
sdbfs
*
fs
);
struct
sdbfs
*
sdbfs_dev_find
(
const
char
*
name
);
unsigned
long
sdbfs_find_name
(
struct
sdbfs
*
fs
,
const
char
*
name
);
unsigned
long
sdbfs_find_id
(
struct
sdbfs
*
fs
,
uint64_t
vid
,
uint32_t
did
);
int
sdbfs_open_name
(
struct
sdbfs
*
fs
,
const
char
*
name
);
int
sdbfs_open_id
(
struct
sdbfs
*
fs
,
uint64_t
vid
,
uint32_t
did
);
int
sdbfs_close
(
struct
sdbfs
*
fs
);
...
...
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