uint32_tbcm2835_peri_read(volatileuint32_t*paddr)[extern]
Reads 32 bit value from a peripheral address WITH a memory barrier before and after each read. This is
safe, but slow. The MB before protects this read from any in-flight reads that didn't use a MB. The MB
after protects subsequent reads from another peripheral.
Parameterspaddr Physical address to read from. See BCM2835_GPIO_BASE etc.
Returns
the value read from the 32 bit register
Seealso
Physical Addresses
uint32_tbcm2835_peri_read_nb(volatileuint32_t*paddr)[extern]
Reads 32 bit value from a peripheral address WITHOUT the read barriers You should only use this when: o
your code has previously called bcm2835_peri_read() for a register within the same peripheral, and no
read or write to another peripheral has occurred since. o your code has called bcm2835_memory_barrier()
since the last access to ANOTHER peripheral.
Parameterspaddr Physical address to read from. See BCM2835_GPIO_BASE etc.
Returns
the value read from the 32 bit register
Seealso
Physical Addresses
voidbcm2835_peri_set_bits(volatileuint32_t*paddr,uint32_tvalue,uint32_tmask)[extern]
Alters a number of bits in a 32 peripheral regsiter. It reads the current valu and then alters the bits
defines as 1 in mask, according to the bit value in value. All other bits that are 0 in the mask are
unaffected. Use this to alter a subset of the bits in a register. Memory barriers are used. Note that
this is not atomic; an interrupt routine can cause unexpected results.
Parameterspaddr Physical address to read from. See BCM2835_GPIO_BASE etc.
value The 32 bit value to write, masked in by mask.
mask Bitmask that defines the bits that will be altered in the register.
Seealso
Physical Addresses
voidbcm2835_peri_write(volatileuint32_t*paddr,uint32_tvalue)[extern]
Writes 32 bit value from a peripheral address WITH a memory barrier before and after each write This is
safe, but slow. The MB before ensures that any in-flight write to another peripheral completes before
this write is issued. The MB after ensures that subsequent reads and writes to another peripheral will
see the effect of this write.
This is a tricky optimization; if you aren't sure, use the barrier version.
Parameterspaddr Physical address to read from. See BCM2835_GPIO_BASE etc.
value The 32 bit value to write
Seealso
Physical Addresses
voidbcm2835_peri_write_nb(volatileuint32_t*paddr,uint32_tvalue)[extern]
Writes 32 bit value from a peripheral address without the write barrier You should only use this when: o
your code has previously called bcm2835_peri_write() for a register within the same peripheral, and no
other peripheral access has occurred since. o your code has called bcm2835_memory_barrier() since the
last access to ANOTHER peripheral.
This is a tricky optimization; if you aren't sure, use the barrier version.
Parameterspaddr Physical address to read from. See BCM2835_GPIO_BASE etc.
value The 32 bit value to write
Seealso
Physical Addresses
uint32_t*bcm2835_regbase(uint8_tregbase)[extern]
Gets the base of a register
Parametersregbase You can use one of the common values BCM2835_REGBASE_* in bcm2835RegisterBaseReturns
the register base
Seealso
Physical Addresses