Schol-R-LEA wrote:
Fair enough, I'll fix it now (assuming that no one has done it already).
EDIT:
The code I propose using, in order to minimize changes to the rest of the code, goes:
I believe the purpose of the switch is to detect the board in run-time. So either forget about the detection and "int raspi" on this page entirely, and just link to the page talking about the run-time board detection; or keep "int raspi" and the switch and use a static variable and bunch of defines like
Code:
static uint32_t MMIO_BASE;
#define GPFSEL0 ((volatile uint32_t*)(MMIO_BASE+0x00200000))
#define GPFSEL1 ((volatile uint32_t*)(MMIO_BASE+0x00200004))
instead of an enum.
Schol-R-LEA wrote:
I still haven't been able to get the print-out to work in emulation. Does anyone else have a working version of this?
Sadly no, not of this. But you should try my raspi3-tutorials, there's two Hello World tutorial in them, one for mini AUX (uart1), and one for the PL011 (uart0). But I can tell you I pissed blood when I was working on those because it is not documented that on later models (around late RPi2 and early RPi3) the uart clock frequency is not fixed, so in order to use a baud divisor, first you must fixate the uart freq with a mailbox call. (For older models, the mini AUX was CPU clock dependent and PL011 wasn't, for newer models it's the other way around, mini AUX is fixed and PL011 isn't. Took me days of trial-and-error to figure this out.) You could use my tutorials as a base, but they are for RPi3 AArch64 only.
(I got "time out" error for the wiki, is something wrong with the server? Had to wait a lot until forum loaded too)
EDIT: I've modified the code, moved MMIO_BASE from the enum into a variable and mmio_read() and mmio_write(). Please give it a try.
Cheers,
bzt