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
29
Issues
29
List
Board
Labels
Milestones
Merge Requests
5
Merge Requests
5
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
5fc4dfc3
Commit
5fc4dfc3
authored
Feb 23, 2017
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arch/lm32: add a pointer to hdl_testbench structure in crt0.S
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
3ea94d74
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
12 deletions
+52
-12
crt0.S
arch/lm32/crt0.S
+11
-0
crt0.h
arch/lm32/crt0.h
+1
-0
wrc_main_sim.c
wrc_main_sim.c
+40
-12
No files found.
arch/lm32/crt0.S
View file @
5fc4dfc3
...
...
@@ -78,6 +78,7 @@
#include "include/revision.h"
#include "ppsi/proto-ext-whiterabbit/wr-api.h"
#include "arch/lm32/crt0.h"
#include "include/generated/autoconf.h"
/* From include/sys/signal.h */
#define SIGINT 2 /* interrupt */
#define SIGTRAP 5 /* trace trap */
...
...
@@ -135,6 +136,16 @@ version_wrpc:
version_ppsi:
.byte WRS_PPSI_SHMEM_VERSION
/* Pointer to a structure used by testbenches, use only when
* CONFIG_WR_NODE_SIM is set */
.org HDL_TESTBENCH_PADDR
.global hdl_testbench_p
hdl_testbench_p:
#ifdef CONFIG_WR_NODE_SIM
.word hdl_testbench
#else
.word 0
#endif
.extern _irq_entry
.org 0xc0
.global _interrupt_handler
...
...
arch/lm32/crt0.h
View file @
5fc4dfc3
...
...
@@ -18,5 +18,6 @@
#define UPTIME_SEC_ADDR 0xa0
#define VERSION_WRPC_ADDR 0xa4
#define VERSION_PPSI_ADDR 0xa5
#define HDL_TESTBENCH_PADDR 0xbc
#endif
/* __CRT0_H__ */
wrc_main_sim.c
View file @
5fc4dfc3
...
...
@@ -4,6 +4,7 @@
* Copyright (C) 2017 CERN (www.cern.ch)
* Author: Grzegorz Daniluk <grzegorz.daniluk@cern.ch>
* Author: Maciej Lipinski <maciej.lipinski@cern.ch>
* Author: Adam Wujek <adam.wujek@cern.ch>
*
* Released according to the GNU GPL, version 2 or any later version.
*
...
...
@@ -32,23 +33,40 @@
#include "softpll_ng.h"
#include <wrpc.h>
/*needed for htons()*/
int
wrpc_test_1
(
void
);
#define TESTBENCH_MAGIC 0x4d433ebc
#define TESTBENCH_VERSION 1
#define TESTBENCH_RET_OK 1
#define TESTBENCH_RET_ERROR 2
/*
* This is a variable that is meant to be set by testbench through
* This is a structure to pass information from the testbench to lm32's
* software. hdl_testbench structure is meant to be set by testbench through
* memory-manipulation.
*
* To allow this, there are still some elements missing:
* - the test_number variable needs to be at a known address, this is already
* done for other variables (for VLANs?), so the same needs to be done for
* this
* - testbench needs to be modified appropriately
* At the address HDL_TESTBENCH_PADDR is a pointer to hdl_testbench structure.
* hdl_testbench_t structure can be expanded to carry information with any
* size.
*
* The idea behind is that different tests for different testbenches are
* compiled in this file, and the proper test is loaded based on this variable.
* Each testbench sets the proper testbench number at th startup
* compiled in this file, and the proper test is loaded based on variable
* hdl_testbench.test_num.
* Each HDL testbench sets the proper testbench number at the startup.
*/
static
int
test_number
;
struct
hdl_testbench_t
{
uint32_t
magic
;
uint32_t
version
;
uint32_t
test_num
;
uint32_t
return_val
;
};
struct
hdl_testbench_t
hdl_testbench
=
{
.
magic
=
TESTBENCH_MAGIC
,
.
version
=
TESTBENCH_VERSION
,
.
test_num
=
0
,
};
int
wrpc_test_1
(
void
);
/*
* Basic initialization required for simulation
...
...
@@ -123,6 +141,7 @@ int wrpc_test_1(void)
memcpy
(
tx_hdr
.
dstmac
,
"
\x01\x1B\x19\x00\x00\x00
"
,
6
);
tx_hdr
.
ethtype
=
htons
(
0x88f7
);
hdl_testbench
.
return_val
=
TESTBENCH_RET_OK
;
/** main loop, send test frames */
for
(;;)
{
/* seqID */
...
...
@@ -165,11 +184,20 @@ void main(void)
{
wrc_sim_initialize
();
switch
(
test_number
)
{
case
0
:
if
(
hdl_testbench
.
magic
!=
TESTBENCH_MAGIC
||
hdl_testbench
.
magic
!=
TESTBENCH_VERSION
)
{
/* Wrong testbench structure */
hdl_testbench
.
return_val
=
TESTBENCH_RET_ERROR
;
while
(
1
)
;
}
switch
(
hdl_testbench
.
test_num
)
{
case
1
:
wrpc_test_1
();
break
;
default:
/* Wrong test number */
hdl_testbench
.
return_val
=
TESTBENCH_RET_ERROR
;
while
(
1
)
;
}
...
...
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