Try to set right Peripherals base
This commit is contained in:
parent
5b5a4ee083
commit
a3611e265e
2 changed files with 14 additions and 19 deletions
26
src/dma.cpp
26
src/dma.cpp
|
@ -19,6 +19,7 @@ This program is free software: you can redistribute it and/or modify
|
||||||
#include "dma.h"
|
#include "dma.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include <bcm_host.h>
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -71,27 +72,16 @@ dma::dma(int Channel,uint32_t CBSize,uint32_t UserMemSize) // Fixme! Need to che
|
||||||
|
|
||||||
void dma::GetRpiInfo()
|
void dma::GetRpiInfo()
|
||||||
{
|
{
|
||||||
RASPBERRY_PI_INFO_T info;
|
dram_phys_base= bcm_host_get_sdram_address();
|
||||||
if (getRaspberryPiInformation(&info) > 0)
|
|
||||||
{
|
|
||||||
if(info.peripheralBase==RPI_BROADCOM_2835_PERIPHERAL_BASE)
|
|
||||||
{
|
|
||||||
|
|
||||||
dram_phys_base = 0x40000000;
|
mem_flag = MEM_FLAG_HINT_PERMALOCK|MEM_FLAG_NO_INIT;//0x0c;
|
||||||
mem_flag = MEM_FLAG_L1_NONALLOCATING|MEM_FLAG_HINT_PERMALOCK|MEM_FLAG_NO_INIT;//0x0c;
|
switch(dram_phys_base)
|
||||||
|
{
|
||||||
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
|
||||||
{
|
|
||||||
dbg_printf(1,"Unknown Raspberry architecture\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dma::~dma()
|
dma::~dma()
|
||||||
|
|
|
@ -45,7 +45,12 @@ uint32_t gpio::GetPeripheralBase()
|
||||||
{
|
{
|
||||||
RASPBERRY_PI_INFO_T info;
|
RASPBERRY_PI_INFO_T info;
|
||||||
uint32_t BCM2708_PERI_BASE = bcm_host_get_peripheral_address();
|
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)
|
if (getRaspberryPiInformation(&info) > 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue