-
Notifications
You must be signed in to change notification settings - Fork 1
peripherals.h
Jaslo edited this page Mar 20, 2019
·
2 revisions
This is the core header of the library which can be used to map and unmap peripherlas directly with the struct peripheral.
-
uint32_t *peripheral_map(uint32_t addr, uint32_t size): This function takes a address and the size of the peripheral. On success it returns the pointer to the base of the mapped address. When an error accurs the function returnsNULL. -
void peripheral_unmap(void* map, uint32_t size): This functions also takes the returned pointer from map and the size and unmapps it.
gpio_base_ptr = (volatile uint32_t *)peripheral_map(PERIPHERAL_BASE + GPIO_OFFSET, GPIO_SIZE);
return gpio_base_ptr;
peripheral_unmap((void *)gpio_base_ptr, GPIO_SIZE);
- bcm2835_peripherals.h and bcm2835_peripherals.c are highly inspired by Pieter Jan's "Low Level Programming of the Raspberry Pi in C".
- BCM2835 ARM Peripherals Datasheet
- There are many errors in the BCM2835 ARM Peripherals Datasheet so the BCM2835 datasheet errata by elinux.org is very useful and important.
- Because the BCM2835 ARM Peripherals Datasheet for some reason does not feature the PWM and PCM clocks, there is this very useful datasheet snippet: BCM2835 Audio clocks