From fa11d6cc122c7d86145408e12606260a43fde152 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 7 Jun 2015 21:26:12 +0700 Subject: [PATCH] Pi 2 Ready TODO: Fix "Failed to reverse map phys addr 00000000", sometime 0x5a004a20 --- src/Makefile | 4 ++-- src/pi_fm_rds.c | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Makefile b/src/Makefile index 76cb079..6bbfd97 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,8 +4,8 @@ STD_CFLAGS = -Wall -std=gnu99 -c -g -O3 # Enable ARM-specific options only on ARM, and compilation of the app only on ARM UNAME := $(shell uname -m) -ifeq ($(UNAME), armv6l) - CFLAGS = $(STD_CFLAGS) -march=armv6 -mtune=arm1176jzf-s -mfloat-abi=hard -mfpu=vfp -ffast-math +ifeq ($(UNAME), armv7l) + CFLAGS = $(STD_CFLAGS) -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -ffast-math app: rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o $(CC) -o pi_fm_rds rds.o waveforms.o pi_fm_rds.o fm_mpx.o control_pipe.o -lm -lsndfile diff --git a/src/pi_fm_rds.c b/src/pi_fm_rds.c index 4a414a3..a7fb744 100644 --- a/src/pi_fm_rds.c +++ b/src/pi_fm_rds.c @@ -119,13 +119,13 @@ #define DMA_CONBLK_AD (0x04/4) #define DMA_DEBUG (0x20/4) -#define DMA_BASE 0x20007000 +#define DMA_BASE 0x3F007000 // Pi 2 Ready #define DMA_LEN 0x24 -#define PWM_BASE 0x2020C000 +#define PWM_BASE 0x3F20C000 // Pi 2 Ready #define PWM_LEN 0x28 -#define CLK_BASE 0x20101000 +#define CLK_BASE 0x3F101000 // Pi 2 Ready #define CLK_LEN 0xA8 -#define GPIO_BASE 0x20200000 +#define GPIO_BASE 0x3F200000 // Pi 2 Ready #define GPIO_LEN 0xB4 @@ -245,7 +245,7 @@ mem_phys_to_virt(uint32_t phys) } } fatal("Failed to reverse map phys addr %08x\n", phys); - + // FIXME!!! Failed with code 0x5a004a20 and 0x00000000 sometime return 0; } @@ -257,7 +257,8 @@ map_peripheral(uint32_t base, uint32_t len) if (fd < 0) fatal("Failed to open /dev/mem: %m\n"); - vaddr = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, base); + //vaddr = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, base); + vaddr = mmap(NULL, 0x002FFFFF, PROT_READ|PROT_WRITE, MAP_SHARED, fd, base); if (vaddr == MAP_FAILED) fatal("Failed to map peripheral at 0x%08x: %m\n", base); close(fd);