Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the bcm_host helper functions #158

Closed
P33M opened this issue Feb 5, 2015 · 7 comments
Closed

Document the bcm_host helper functions #158

P33M opened this issue Feb 5, 2015 · 7 comments
Assignees

Comments

@P33M
Copy link
Contributor

P33M commented Feb 5, 2015

For programs wanting to poke peripheral addresses directly (for lack of a better interface), they need to know where in the virtual memory map the peripheral bus segment has been placed. This used to be tied to the platform (or rather had the same address since day 0), now is variable between Pi1 and Pi2.

Perhaps we need a one-pager in the hardware section detailing how to use this api:

https://github.com/raspberrypi/firmware/blob/master/opt/vc/include/bcm_host.h

@ghollingworth
Copy link
Contributor

:)

@ebenupton ebenupton assigned P33M and unassigned popcornmix Mar 4, 2015
@ebenupton
Copy link
Contributor

Jonathan - can you propose some text, and where you think it should be located in the documentation?

@JamesH65
Copy link
Contributor

JamesH65 commented Mar 2, 2017

Hi @P33M, any news on this?

@JamesH65
Copy link
Contributor

@P33M @popcornmix If either of you guys can give me a leg up on how this stuff works and why it's needed, I'm happy to write the documentation for it. Would be nice to get this 2 year old issue out of the way!

@popcornmix
Copy link
Contributor

The code is here:
https://github.com/raspberrypi/userland/blob/master/host_applications/linux/libs/bcm_host/bcm_host.c#L150-L166
They just read from device-tree (falling back to hard-coded Pi1 addresses if not available) the addresses needed for accessing sdram or peripherals from arm.

bcm_host_get_peripheral_address
Gets the arm side physical address of where peripherals are mapped.
Will be 0x20000000 on Pi1 and 0x3f000000 on Pi2

bcm_host_get_peripheral_size
Gets the size of peripherals space
Will always be 0x01000000

bcm_host_get_sdram_address
Gets the bus address of usual alias of sdram.
Will be 0x40000000 on Pi1 (GPU L2 cached) and 0xC0000000 on Pi2 (uncached).

These are of interest to very few users - i.e. those who want to mmap peripherals to access without using a kernel driver.

@JamesH65
Copy link
Contributor

@popcornmix Does this read OK for the bcm stuff? Which library do you need to build in to get this library, just bcmhost?

@JamesH65
Copy link
Contributor

Sorry, I should have linked to the PR. #623

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants