clear PCI memory

This commit is contained in:
Markus Fröschle
2016-10-23 14:25:39 +00:00
parent d5394dbaad
commit 6b44cdcf0c
2 changed files with 13 additions and 6 deletions

View File

@@ -35,7 +35,8 @@ APP=pci_test.prg
TEST_APP=$(APP) TEST_APP=$(APP)
CFLAGS=\ CFLAGS=\
-O0\ -O2\
-fomit-frame-pointer \
-g\ -g\
-Wl,-Map,mapfile\ -Wl,-Map,mapfile\
-Wl,--defsym -Wl,__MBAR=0xff000000\ -Wl,--defsym -Wl,__MBAR=0xff000000\
@@ -84,7 +85,7 @@ $(1)_OBJS=$(patsubst %,$(1)/objs/%,$(OBJS))
$(1)/$(APP): $$($(1)_OBJS) $(1)/$(APP): $$($(1)_OBJS)
@echo CC $$@ @echo CC $$@
@$(CC) $$(CFLAGS) -o $$@ $(LIBCMINI)/$(1)/startup.o $$($(1)_OBJS) -L$(LIBCMINI)/$(1) $(LIBS) @$(CC) $$(CFLAGS) -o $$@ $(LIBCMINI)/$(1)/startup.o $$($(1)_OBJS) -L$(LIBCMINI)/$(1) $(LIBS)
@$(STRIP) $$@ #@$(STRIP) $$@
endef endef
$(foreach DIR,$(TRGTDIRS),$(eval $(call CC_TEMPLATE,$(DIR)))) $(foreach DIR,$(TRGTDIRS),$(eval $(call CC_TEMPLATE,$(DIR))))

View File

@@ -12,6 +12,9 @@
#define SYSCLK 132000 #define SYSCLK 132000
#define KB 1024UL
#define MB (KB * KB)
volatile int32_t time, start, end; volatile int32_t time, start, end;
int i; int i;
@@ -166,14 +169,17 @@ void do_tests(struct pci_native_driver_interface *pci)
"", ""); "", "");
printf("\r\n"); 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"); 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); rd = (struct pci_rd *) (((uintptr_t) rd) + (uintptr_t) rd->next);