diff --git a/src/dma.cpp b/src/dma.cpp index 079ee3c..4b82e4b 100644 --- a/src/dma.cpp +++ b/src/dma.cpp @@ -19,6 +19,7 @@ This program is free software: you can redistribute it and/or modify #include "dma.h" #include "stdio.h" #include "util.h" +#include extern "C" { @@ -71,27 +72,16 @@ dma::dma(int Channel,uint32_t CBSize,uint32_t UserMemSize) // Fixme! Need to che void dma::GetRpiInfo() { - RASPBERRY_PI_INFO_T info; - if (getRaspberryPiInformation(&info) > 0) - { - if(info.peripheralBase==RPI_BROADCOM_2835_PERIPHERAL_BASE) - { - - dram_phys_base = 0x40000000; - mem_flag = MEM_FLAG_L1_NONALLOCATING|MEM_FLAG_HINT_PERMALOCK|MEM_FLAG_NO_INIT;//0x0c; - } + dram_phys_base= bcm_host_get_sdram_address(); - if((info.peripheralBase==RPI_BROADCOM_2836_PERIPHERAL_BASE)||(info.peripheralBase==RPI_BROADCOM_2837_PERIPHERAL_BASE)) - { - - dram_phys_base = 0xc0000000; - mem_flag = MEM_FLAG_DIRECT|MEM_FLAG_HINT_PERMALOCK|MEM_FLAG_NO_INIT;// 0x04; - } - } - else + mem_flag = MEM_FLAG_HINT_PERMALOCK|MEM_FLAG_NO_INIT;//0x0c; + switch(dram_phys_base) { - dbg_printf(1,"Unknown Raspberry architecture\n"); + case 0x40000000 : mem_flag |=MEM_FLAG_L1_NONALLOCATING;break; + case 0xC0000000 : mem_flag |=MEM_FLAG_DIRECT;break; + default: dbg_printf(0,"Unknown Raspberry architecture\n"); } + } dma::~dma() diff --git a/src/gpio.cpp b/src/gpio.cpp index 7156233..67d5a8c 100644 --- a/src/gpio.cpp +++ b/src/gpio.cpp @@ -45,7 +45,12 @@ uint32_t gpio::GetPeripheralBase() { RASPBERRY_PI_INFO_T info; uint32_t BCM2708_PERI_BASE = bcm_host_get_peripheral_address(); - dbg_printf(1,"Peri Base = %x\n",BCM2708_PERI_BASE); + dbg_printf(1,"Peri Base = %x SDRAM %x\n",bcm_host_get_peripheral_address(),bcm_host_get_sdram_address()); + if(BCM2708_PERI_BASE==0) + { + dbg_printf(0,"Unknown peripheral base, swith to PI4 \n"); + BCM2708_PERI_BASE=0xfe000000; + } /* if (getRaspberryPiInformation(&info) > 0) {