These functions provide low level register access, and should not generally need to be used.
◆ bcm2835_peri_read()
uint32_t bcm2835_peri_read |
( |
volatile uint32_t * |
paddr | ) |
|
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.
- Parameters
-
[in] | paddr | Physical address to read from. See BCM2835_GPIO_BASE etc. |
- Returns
- the value read from the 32 bit register
- See also
- Physical Addresses
◆ bcm2835_peri_read_nb()
uint32_t bcm2835_peri_read_nb |
( |
volatile uint32_t * |
paddr | ) |
|
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.
- Parameters
-
[in] | paddr | Physical address to read from. See BCM2835_GPIO_BASE etc. |
- Returns
- the value read from the 32 bit register
- See also
- Physical Addresses
◆ bcm2835_peri_set_bits()
void bcm2835_peri_set_bits |
( |
volatile uint32_t * |
paddr, |
|
|
uint32_t |
value, |
|
|
uint32_t |
mask |
|
) |
| |
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.
- Parameters
-
[in] | paddr | Physical address to read from. See BCM2835_GPIO_BASE etc. |
[in] | value | The 32 bit value to write, masked in by mask. |
[in] | mask | Bitmask that defines the bits that will be altered in the register. |
- See also
- Physical Addresses
◆ bcm2835_peri_write()
void bcm2835_peri_write |
( |
volatile uint32_t * |
paddr, |
|
|
uint32_t |
value |
|
) |
| |
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.
- Parameters
-
[in] | paddr | Physical address to read from. See BCM2835_GPIO_BASE etc. |
[in] | value | The 32 bit value to write |
- See also
- Physical Addresses
◆ bcm2835_peri_write_nb()
void bcm2835_peri_write_nb |
( |
volatile uint32_t * |
paddr, |
|
|
uint32_t |
value |
|
) |
| |
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.
- Parameters
-
[in] | paddr | Physical address to read from. See BCM2835_GPIO_BASE etc. |
[in] | value | The 32 bit value to write |
- See also
- Physical Addresses
◆ bcm2835_regbase()
uint32_t* bcm2835_regbase |
( |
uint8_t |
regbase | ) |
|
Gets the base of a register
- Parameters
-
- Returns
- the register base
- See also
- Physical Addresses