raspberry GPIO 低权限寄存器访问函数简介

bcm2835   1.25
Functions
Low level register access

Functions

uint32_t  bcm2835_peri_read (volatile uint32_t *paddr)
uint32_t  bcm2835_peri_read_nb (volatile uint32_t *paddr)
void  bcm2835_peri_write (volatile uint32_t *paddr, uint32_t value)
void  bcm2835_peri_write_nb (volatile uint32_t *paddr, uint32_t value)
void  bcm2835_peri_set_bits (volatile uint32_t *paddr, uint32_t value, uint32_t mask)

Detailed Description

These functions provide low level register access, and should not generally need to be used

Function Documentation

uint32_t bcm2835_peri_read ( volatile uint32_t *  paddr )  

Reads 32 bit value from a peripheral address The read is done twice, and is therefore always safe in terms of manual section 1.3 Peripheral access precautions for correct memory ordering

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
uint32_t bcm2835_peri_read_nb ( volatile uint32_t *  paddr )  

Reads 32 bit value from a peripheral address without the read barrier You should only use this when your code has previously called bcm2835_peri_read() within the same peripheral, and no other peripheral access has occurred since.

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
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 deines 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. The write is done twice, and is therefore always safe in terms of manual section 1.3 Peripheral access precautions for correct memory ordering

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
void bcm2835_peri_write ( volatile uint32_t *  paddr,
    uint32_t  value 
  )    

Writes 32 bit value from a peripheral address The write is done twice, and is therefore always safe in terms of manual section 1.3 Peripheral access precautions for correct memory ordering

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
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 your code has previously called bcm2835_peri_write() within the same peripheral, and no other peripheral access has occurred since.

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

你可能感兴趣的:(raspberry GPIO 低权限寄存器访问函数简介)