Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
31
Issues
31
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
Software for White Rabbit PTP Core
Commits
a74e0f3e
Commit
a74e0f3e
authored
Jan 18, 2012
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrcore_v2: little cosmetic changes in lm32-loader
parent
cd91f910
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
68 deletions
+70
-68
Makefile
tools/Makefile
+2
-2
lm32-loader.c
tools/lm32-loader.c
+67
-65
Makefile
tools/mini_bone/Makefile
+1
-1
No files found.
tools/Makefile
View file @
a74e0f3e
...
...
@@ -15,7 +15,7 @@ all: lm32-loader genraminit vuart_console
OBJS_LOADER
=
lm32-loader.o rr_io.o mini_bone/ptpd_netif.o mini_bone/minibone_lib.o
lm32-loader
:
$(OBJS_LOADER)
#
make -C mini_bone
make
-C
mini_bone
${
CC
}
-o
lm32-loader
$(OBJS_LOADER)
genraminit
:
genraminit.o
...
...
@@ -28,4 +28,4 @@ vuart_console: vuart_console.o rr_io.o
${
CC
}
-c
$^
$(CFLAGS)
-O0
clean
:
rm
-f
$(ALL)
*
.o
*
~
rm
-f
$(ALL)
*
.o
*
~
mini_bone/
*
.o mini_bone/
*
~
tools/lm32-loader.c
View file @
a74e0f3e
...
...
@@ -36,23 +36,21 @@ static void *mb_handle = NULL;
static
void
spec_writel
(
uint32_t
value
,
uint32_t
addr
)
{
if
(
mb_handle
)
mbn_writel
(
mb_handle
,
value
,
(
BASE_MBONE
+
addr
)
>>
2
);
else
rr_writel
(
value
,
BASE_PCIE
+
addr
);
if
(
mb_handle
)
mbn_writel
(
mb_handle
,
value
,
(
BASE_MBONE
+
addr
)
>>
2
);
else
rr_writel
(
value
,
BASE_PCIE
+
addr
);
}
static
uint32_t
spec_readl
(
uint32_t
addr
)
{
uint32_t
rval
;
if
(
mb_handle
)
rval
=
mbn_readl
(
mb_handle
,
(
BASE_MBONE
+
addr
)
>>
2
);
else
rval
=
rr_readl
(
BASE_PCIE
+
addr
);
uint32_t
rval
;
if
(
mb_handle
)
rval
=
mbn_readl
(
mb_handle
,
(
BASE_MBONE
+
addr
)
>>
2
);
else
rval
=
rr_readl
(
BASE_PCIE
+
addr
);
// printf("readl: value %x addr %x\n", addr, rval);
return
rval
;
return
rval
;
}
...
...
@@ -73,35 +71,35 @@ void copy_lm32(uint32_t *buf, int buf_nwords, uint32_t base_addr)
for
(
i
=
0
;
i
<
buf_nwords
;
i
++
)
{
spec_writel
(
conv_endian
(
buf
[
i
]),
base_addr
+
i
*
4
);
if
(
!
(
i
&
0xfff
))
{
printf
(
"."
);
fflush
(
stdout
);
}
spec_writel
(
conv_endian
(
buf
[
i
]),
base_addr
+
i
*
4
);
if
(
!
(
i
&
0xfff
))
{
printf
(
"."
);
fflush
(
stdout
);
}
}
printf
(
"
\n
Verifing memory: "
);
for
(
i
=
0
;
i
<
buf_nwords
;
i
++
)
{
uint32_t
x
=
spec_readl
(
base_addr
+
i
*
4
);
if
(
conv_endian
(
buf
[
i
])
!=
x
)
{
printf
(
"Verify failed (%x vs %x)
\n
"
,
conv_endian
(
buf
[
i
]),
x
);
return
;
}
if
(
!
(
i
&
0xfff
))
{
printf
(
"."
);
fflush
(
stdout
);
}
uint32_t
x
=
spec_readl
(
base_addr
+
i
*
4
);
if
(
conv_endian
(
buf
[
i
])
!=
x
)
{
printf
(
"Verify failed (%x vs %x)
\n
"
,
conv_endian
(
buf
[
i
]),
x
);
return
;
}
if
(
!
(
i
&
0xfff
))
{
printf
(
"."
);
fflush
(
stdout
);
}
}
printf
(
"OK.
\n
"
);
printf
(
"OK.
\n
"
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
num_words
;
uint32_t
*
buf
;
uint8_t
target_mac
[
6
];
FILE
*
f
;
char
if_name
[
16
];
int
num_words
;
uint32_t
*
buf
;
uint8_t
target_mac
[
6
];
FILE
*
f
;
char
if_name
[
16
];
if
(
argc
<
2
)
{
fprintf
(
stderr
,
"No parameters specified !
\n
"
);
...
...
@@ -113,45 +111,49 @@ int main(int argc, char **argv)
if
(
argc
>=
4
&&
!
strcmp
(
argv
[
2
],
"-m"
))
{
sscanf
(
argv
[
3
],
"%s"
,
if_name
);
sscanf
(
argv
[
4
],
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
,
&
target_mac
[
0
],
&
target_mac
[
1
],
&
target_mac
[
2
],
&
target_mac
[
3
],
&
target_mac
[
4
],
&
target_mac
[
5
]);
mb_handle
=
mbn_open
(
if_name
,
target_mac
);
if
(
!
mb_handle
)
{
fprintf
(
stderr
,
"Connection failed....
\n
"
);
return
-
1
;
}
sscanf
(
argv
[
3
],
"%s"
,
if_name
);
sscanf
(
argv
[
4
],
"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx"
,
&
target_mac
[
0
],
&
target_mac
[
1
],
&
target_mac
[
2
],
&
target_mac
[
3
],
&
target_mac
[
4
],
&
target_mac
[
5
]);
mb_handle
=
mbn_open
(
if_name
,
target_mac
);
if
(
!
mb_handle
)
{
fprintf
(
stderr
,
"Connection failed....
\n
"
);
return
-
1
;
}
}
else
if
(
rr_init
()
<
0
)
{
fprintf
(
stderr
,
"Can't initialize rawrabbit :(
\n
"
);
return
-
1
;
fprintf
(
stderr
,
"Can't initialize rawrabbit :(
\n
"
);
return
-
1
;
}
f
=
fopen
(
argv
[
1
],
"rb"
);
if
(
!
f
)
{
fprintf
(
stderr
,
"Input file not found.
\n
"
);
return
-
1
;
}
fseek
(
f
,
0
,
SEEK_END
);
int
size
=
ftell
(
f
);
rewind
(
f
);
buf
=
malloc
(
size
+
4
);
fread
(
buf
,
1
,
size
,
f
);
fclose
(
f
);
rst_lm32
(
1
);
rst_lm32
(
1
);
rst_lm32
(
1
);
rst_lm32
(
1
);
copy_lm32
(
buf
,
(
size
+
3
)
/
4
,
0
);
rst_lm32
(
0
);
if
(
mb_handle
)
{
mbn_stats
(
mb_handle
);
mbn_close
(
mb_handle
);
}
f
=
fopen
(
argv
[
1
],
"rb"
);
if
(
!
f
)
{
fprintf
(
stderr
,
"Input file not found.
\n
"
);
return
-
1
;
}
fseek
(
f
,
0
,
SEEK_END
);
int
size
=
ftell
(
f
);
rewind
(
f
);
buf
=
malloc
(
size
+
4
);
fread
(
buf
,
1
,
size
,
f
);
fclose
(
f
);
rst_lm32
(
1
);
rst_lm32
(
1
);
rst_lm32
(
1
);
rst_lm32
(
1
);
copy_lm32
(
buf
,
(
size
+
3
)
/
4
,
0
);
rst_lm32
(
0
);
// mbn_stats(mb_handle);
return
0
;
}
tools/mini_bone/Makefile
View file @
a74e0f3e
OBJS
=
minibone_lib.o ptpd_netif.o
all
:
$(OBJS)
gcc
-o
m
$(OBJS)
\ No newline at end of file
gcc
-c
-o
m
$(OBJS)
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