CRpi
A library for rpi with intefaces to: gpio, pwm, dma
addressing.h
Go to the documentation of this file.
1 #ifndef ADDRESSING_H
2 #define ADDRESSING_H
3 
4 #include <stdint.h>
5 
35 #define PERIPHERAL_BASE_ADDR_PHYS_RPI2 0x3f000000
37 #define PERIPHERAL_BASE_ADDR_PHYS_RPI1 0x20000000
39 #define PERIPHERAL_BASE_ADDR_BUS 0x7e000000
41 
42 extern uintptr_t peripheralsBaseAddressPhys;//defined in addressing.c
43 
44 int addrVirtToPhys(void* virtAddr, uintptr_t* physAddrRet);
45 
46 
50 #define TO_PHYS_MEM(addr) (addr & ~0xc0000000)
51 
55 #define PERIPHERAL_PHYS_TO_BUS_ADDR(addr) (addr - PERIPHERAL_BASE_ADDR_PHYS_RPI2 + PERIPHERAL_BASE_ADDR_BUS)
56 
57 
58 
59 #endif
int addrVirtToPhys(void *virtAddr, uintptr_t *physAddrRet)
Gets the physical address corresponding to the provided virtual address.
Definition: addressing.cpp:29
uintptr_t peripheralsBaseAddressPhys
Physical base address of the peripherals memory area.
Definition: addressing.cpp:19