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

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] paddrPhysical 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] paddrPhysical 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] paddrPhysical address to read from. See BCM2835_GPIO_BASE etc.
[in] valueThe 32 bit value to write, masked in by mask.
[in] maskBitmask 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] paddrPhysical address to read from. See BCM2835_GPIO_BASE etc.
[in] valueThe 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] paddrPhysical address to read from. See BCM2835_GPIO_BASE etc.
[in] valueThe 32 bit value to write
See also:
Physical Addresses
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值