From 6b44cdcf0c7042fda944f6bb44fbb8dd7e165931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Sun, 23 Oct 2016 14:25:39 +0000 Subject: [PATCH] clear PCI memory --- BaS_gcc/tos/pci_test/Makefile | 5 +++-- BaS_gcc/tos/pci_test/sources/pci_test.c | 14 ++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/BaS_gcc/tos/pci_test/Makefile b/BaS_gcc/tos/pci_test/Makefile index cb281ad..fb8b857 100755 --- a/BaS_gcc/tos/pci_test/Makefile +++ b/BaS_gcc/tos/pci_test/Makefile @@ -35,7 +35,8 @@ APP=pci_test.prg TEST_APP=$(APP) CFLAGS=\ - -O0\ + -O2\ + -fomit-frame-pointer \ -g\ -Wl,-Map,mapfile\ -Wl,--defsym -Wl,__MBAR=0xff000000\ @@ -84,7 +85,7 @@ $(1)_OBJS=$(patsubst %,$(1)/objs/%,$(OBJS)) $(1)/$(APP): $$($(1)_OBJS) @echo CC $$@ @$(CC) $$(CFLAGS) -o $$@ $(LIBCMINI)/$(1)/startup.o $$($(1)_OBJS) -L$(LIBCMINI)/$(1) $(LIBS) - @$(STRIP) $$@ + #@$(STRIP) $$@ endef $(foreach DIR,$(TRGTDIRS),$(eval $(call CC_TEMPLATE,$(DIR)))) diff --git a/BaS_gcc/tos/pci_test/sources/pci_test.c b/BaS_gcc/tos/pci_test/sources/pci_test.c index f0d2fd9..8be6826 100644 --- a/BaS_gcc/tos/pci_test/sources/pci_test.c +++ b/BaS_gcc/tos/pci_test/sources/pci_test.c @@ -12,6 +12,9 @@ #define SYSCLK 132000 +#define KB 1024UL +#define MB (KB * KB) + volatile int32_t time, start, end; int i; @@ -166,14 +169,17 @@ void do_tests(struct pci_native_driver_interface *pci) "", ""); printf("\r\n"); - if (rd->start != 0L) + if (rd->start != 0L && rd->start == 0x80000000) { - hexdump((uint8_t *) rd->start + rd->offset, 128); + hexdump((uint8_t *) rd->start + rd->offset, 64); - memset((uint8_t *) rd-> start + rd->offset, 0, 128); + memset((uint8_t *) rd-> start + rd->offset, 0, 128 * MB); printf("memory cleared\r\n"); - hexdump((uint8_t *) rd->start + rd->offset, 128); + hexdump((uint8_t *) rd->start + rd->offset, 64); + + memset((uint8_t *) rd->start + rd->offset, 0xaa, 128 * MB); + hexdump((uint8_t *) rd->start + rd->offset, 64); } rd = (struct pci_rd *) (((uintptr_t) rd) + (uintptr_t) rd->next);