Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Trigger Distribution
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
White Rabbit Trigger Distribution
Commits
14ed66ea
Commit
14ed66ea
authored
Dec 13, 2018
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrtd-boot: display list of MT, display needed firmwares.
parent
f99f8986
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
22 deletions
+76
-22
libwrtd-base.c
software/lib/libwrtd-base.c
+39
-15
libwrtd-devices.c
software/lib/libwrtd-devices.c
+3
-1
libwrtd-private.h
software/lib/libwrtd-private.h
+6
-0
wrtd-boot.c
software/tools/wrtd-boot.c
+28
-6
No files found.
software/lib/libwrtd-base.c
View file @
14ed66ea
...
...
@@ -43,6 +43,8 @@ enum wrtd_status wrtd_init(const char *resource_name,
const
char
*
options_str
,
struct
wrtd_dev
**
dev
)
{
struct
trtl_dev
*
trtl
;
/* In case of error... */
*
dev
=
NULL
;
...
...
@@ -51,18 +53,24 @@ enum wrtd_status wrtd_init(const char *resource_name,
init
();
/* Resource is MTxxx where xxx is the mock-turtle device id. */
if
(
resource_name
[
0
]
!=
'M'
||
resource_name
[
1
]
!=
'T'
)
return
WRTD_ERROR_RESOURCE_UNKNOWN
;
unsigned
long
dev_id
;
char
*
eptr
;
dev_id
=
strtoul
(
resource_name
+
2
,
&
eptr
,
0
);
if
(
*
eptr
!=
0
)
{
/* Invalid characters. */
if
(
resource_name
[
0
]
==
'M'
&&
resource_name
[
1
]
==
'T'
)
{
unsigned
long
dev_id
;
char
*
eptr
;
dev_id
=
strtoul
(
resource_name
+
2
,
&
eptr
,
0
);
if
(
*
eptr
!=
0
)
{
/* Invalid characters. */
return
WRTD_ERROR_RESOURCE_UNKNOWN
;
}
trtl
=
trtl_open_by_id
(
dev_id
);
}
else
if
(
strncmp
(
resource_name
,
"trtl-"
,
5
)
==
0
)
{
trtl
=
trtl_open
(
resource_name
);
}
else
{
return
WRTD_ERROR_RESOURCE_UNKNOWN
;
}
if
(
trtl
==
NULL
)
return
WRTD_ERROR_RESOURCE_UNKNOWN
;
struct
wrtd_dev
*
res
;
...
...
@@ -71,11 +79,7 @@ enum wrtd_status wrtd_init(const char *resource_name,
return
WRTD_ERROR_OUT_OF_MEMORY
;
memset
(
res
,
0
,
sizeof
(
*
res
));
res
->
trtl
=
trtl_open_by_id
(
dev_id
);
if
(
!
res
->
trtl
)
{
free
(
res
);
return
WRTD_ERROR_RESOURCE_UNKNOWN
;
}
res
->
trtl
=
trtl
;
*
dev
=
res
;
return
WRTD_SUCCESS
;
...
...
@@ -98,6 +102,26 @@ enum wrtd_status wrtd_reset(struct wrtd_dev *dev)
}
enum
wrtd_status
wrtd_get_firmware_id
(
struct
wrtd_dev
*
dev
,
unsigned
*
nbr_ids
,
uint32_t
*
ids
)
{
const
struct
wrtd_mt_config
*
cfg
;
enum
wrtd_status
status
;
int
i
;
/* Find config. */
status
=
wrtd_find_config
(
dev
,
&
cfg
);
WRTD_RETURN_IF_ERROR
(
status
);
/* Find firmwares. */
*
nbr_ids
=
cfg
->
nbr_cpus
;
for
(
i
=
0
;
i
<
cfg
->
nbr_cpus
;
i
++
)
{
ids
[
i
]
=
cfg
->
cpus
[
i
].
fw_id
;
}
return
WRTD_SUCCESS
;
}
enum
wrtd_status
wrtd_load_firmware
(
struct
wrtd_dev
*
dev
,
unsigned
verbose
,
unsigned
int
nbr_firmwares
,
struct
wrtd_firmware
*
fw
)
...
...
software/lib/libwrtd-devices.c
View file @
14ed66ea
...
...
@@ -7,7 +7,9 @@
#include "libwrtd.h"
#include "libwrtd-private.h"
#include "hw/fmctdc-direct.h"
#include "wrtd-rt-tdc.h"
/* FIXME: duplicated macro. */
#define BASE_DP_TDC_DIRECT 0x8000
static
enum
wrtd_status
wrtd_none_configure
(
struct
wrtd_dev
*
wrtd
,
unsigned
cpu
,
unsigned
dev
,
...
...
software/lib/libwrtd-private.h
View file @
14ed66ea
...
...
@@ -78,6 +78,12 @@ extern enum wrtd_status wrtd_return_error(struct wrtd_dev *dev,
/* Get current error message. Simpler than the official API. */
extern
const
char
*
wrtd_get_error_msg
(
struct
wrtd_dev
*
dev
);
/* Get the list of firmware expected by cpus.
IDS must be at least WRTD_MAX_CPUS long. */
extern
enum
wrtd_status
wrtd_get_firmware_id
(
struct
wrtd_dev
*
dev
,
unsigned
*
nbr_ids
,
uint32_t
*
ids
);
/* For wrtd_load_firmware. */
struct
wrtd_firmware
{
const
char
*
path
;
...
...
software/tools/wrtd-boot.c
View file @
14ed66ea
...
...
@@ -184,14 +184,17 @@ int main(int argc, char *argv[])
}
if
(
dev_name
==
NULL
)
{
fprintf
(
stderr
,
"missing trtl device
\n
"
);
char
**
list
;
int
i
;
fprintf
(
stderr
,
"missing trtl device, use -D DEVICE
\n
"
);
list
=
trtl_list
();
printf
(
"List of mock turtle devices:
\n
"
);
for
(
i
=
0
;
list
[
i
];
i
++
)
printf
(
" %s
\n
"
,
list
[
i
]);
exit
(
1
);
}
if
(
optind
==
argc
)
{
fprintf
(
stderr
,
"no firmware
\n
"
);
exit
(
1
);
}
if
((
argc
-
optind
)
%
2
!=
0
)
{
fprintf
(
stderr
,
"badly built ID FW
\n
"
);
exit
(
1
);
...
...
@@ -218,10 +221,29 @@ int main(int argc, char *argv[])
res
=
wrtd_init
(
dev_name
,
false
,
NULL
,
&
wrtd
);
if
(
res
!=
WRTD_SUCCESS
)
{
fprintf
(
stderr
,
"Cannot open WRTD
\n
"
);
fprintf
(
stderr
,
"Cannot open WRTD %s (errno=%s)
\n
"
,
dev_name
,
strerror
(
errno
));
exit
(
1
);
}
if
(
nbr_fw
==
0
)
{
uint32_t
ids
[
WRTD_MAX_CPUS
];
unsigned
nids
;
fprintf
(
stderr
,
"no firmware on the command line
\n
"
);
res
=
wrtd_get_firmware_id
(
wrtd
,
&
nids
,
ids
);
if
(
res
!=
WRTD_SUCCESS
)
{
fprintf
(
stderr
,
"cannot get list of firmwares: %s
\n
"
,
wrtd_get_error_msg
(
wrtd
));
}
else
{
int
i
;
printf
(
"list of expected firmwares:
\n
"
);
for
(
i
=
0
;
i
<
nids
;
i
++
)
printf
(
" cpu %d: 0x%04x
\n
"
,
i
,
ids
[
i
]);
}
exit
(
1
);
}
res
=
wrtd_load_firmware
(
wrtd
,
1
,
nbr_fw
,
map
);
if
(
res
!=
WRTD_SUCCESS
)
{
fprintf
(
stderr
,
"error loading firmware: %s
\n
"
,
...
...
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