Commit a7140df1 authored by Adam Wujek's avatar Adam Wujek 💬

arch/lm32: use defines for addresses of structures for wrpc-dump

Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 6849a1aa
......@@ -77,6 +77,7 @@
#define __ASSEMBLY__
#include "include/revision.h"
#include "ppsi/proto-ext-whiterabbit/wr-api.h"
#include "arch/lm32/crt0.h"
/* From include/sys/signal.h */
#define SIGINT 2 /* interrupt */
#define SIGTRAP 5 /* trace trap */
......@@ -104,24 +105,32 @@ _reset_handler:
nop
.size _reset_handler, .-_reset_handler
.org 0x80
.org WRPC_MARK
/* Used by the dumping tool to identify byte ordering */
.ascii "WRPC----"
.int 0x01234567
.short 0x89ab, 0xcdef
/* Pointer to structures, for the dumping tool */
.word softpll, fifo_log, ppi_static, stats
.org SOFTPLL_PADDR
.word softpll
.org FIFO_LOG_PADDR
.word fifo_log
.org PPI_STATIC_PADDR
.word ppi_static
.org STATS_PADDR
.word stats
.org 0xa0
.org UPTIME_SEC_ADDR
.global uptime_sec
uptime_sec:
.word 0
.org 0xa4
.org VERSION_WRPC_ADDR
.global version_wrpc
version_wrpc:
.byte WRPC_SHMEM_VERSION
.org VERSION_PPSI_ADDR
.global version_ppsi
version_ppsi:
.byte WRS_PPSI_SHMEM_VERSION
......
/*
* This work is part of the White Rabbit project
*
* Copyright (C) 2017 CERN (www.cern.ch)
* Author: Adam Wujek <adam.wujek@cern.ch>
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#ifndef __CRT0_H__
#define __CRT0_H__
/* offsets for crt0.s */
#define WRPC_MARK 0x80
#define SOFTPLL_PADDR 0x90
#define FIFO_LOG_PADDR 0x94
#define PPI_STATIC_PADDR 0x98
#define STATS_PADDR 0x9c
#define UPTIME_SEC_ADDR 0xa0
#define VERSION_WRPC_ADDR 0xa4
#define VERSION_PPSI_ADDR 0xa5
#endif /* __CRT0_H__ */
......@@ -43,7 +43,7 @@ sdb-wrpc.bin: sdbfs
$(SDBFS)/gensdbfs $< $@
wrpc-dump: wrpc-dump.c dump-info-host.o
$(CC) $(CFLAGS) -I../ppsi/include -I../ppsi/arch-wrpc/include \
$(CC) $(CFLAGS) -I../ppsi/include -I../ppsi/arch-wrpc/include -I.. \
-I ../softpll \
$^ -o $@ \
-D__GIT_VER__="\"$(GIT_VER)\"" -D__GIT_USR__="\"$(GIT_USR)\""
......
......@@ -13,6 +13,8 @@
#include <ppsi/ppsi.h>
#include <softpll_ng.h>
#include <revision.h>
#include <arch/lm32/crt0.h>
#include <dump-info.h>
/* We have a problem: ppsi is built for wrpc, so it has ntoh[sl] wrong */
......@@ -281,7 +283,7 @@ int main(int argc, char **argv)
}
/* In case we have a "new" binary file, use such information */
if (!strncmp(mapaddr + 0x80, "CPRW", 4))
if (!strncmp(mapaddr + WRPC_MARK, "CPRW", 4))
setenv("WRPC_SPEC", "yes", 1);
/* If the dump file needs "spec" byte order, fix it all */
......@@ -298,12 +300,12 @@ int main(int argc, char **argv)
/* If we have a new binary file, pick the pointers
* Magic numbers are taken from crt0.S or disassembly of wrc.bin */
if (!strncmp(mapaddr + 0x80, "WRPC----", 8)) {
if (!strncmp(mapaddr + WRPC_MARK, "WRPC----", 8)) {
spll_off = wrpc_get_l32(mapaddr + 0x90);
fifo_off = wrpc_get_l32(mapaddr + 0x94);
ppi_off = wrpc_get_l32(mapaddr + 0x98);
stats_off = wrpc_get_l32(mapaddr + 0x9c);
spll_off = wrpc_get_l32(mapaddr + SOFTPLL_PADDR);
fifo_off = wrpc_get_l32(mapaddr + FIFO_LOG_PADDR);
ppi_off = wrpc_get_l32(mapaddr + PPI_STATIC_PADDR);
stats_off = wrpc_get_l32(mapaddr + STATS_PADDR);
if (ppi_off) { /* This is 0 for wrs */
ppg_off = wrpc_get_pointer(mapaddr + ppi_off,
"pp_instance", "glbs");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment