+
Macros | Enumerations | Variables
bcm2835: Constants for passing to and from library functions
bcm2835 1.62
Main Page
Modules
Files
Examples
用于向库函数传递和从库函数传递的
常量
宏
#define HIGH 0x1
#define LOW 0x0
#define MIN(a, b) (a < b ? a : b)
#define BCM2835_CORE_CLK_HZ 250000000
#define BMC2835_RPI2_DT_FILENAME "/proc/device-tree/soc/ranges"
#define BCM2835_PERI_BASE 0x20000000
#define BCM2835_PERI_SIZE 0x01000000
#define BCM2835_RPI2_PERI_BASE 0x3F000000
#define BCM2835_RPI4_PERI_BASE 0xFE000000
#define BCM2835_RPI4_PERI_SIZE 0x01800000
#define BCM2835_ST_BASE 0x3000
#define BCM2835_GPIO_PADS 0x100000
#define BCM2835_CLOCK_BASE 0x101000
#define BCM2835_GPIO_BASE 0x200000
#define BCM2835_SPI0_BASE 0x204000
#define BCM2835_BSC0_BASE 0x205000
#define BCM2835_GPIO_PWM 0x20C000
#define BCM2835_AUX_BASE 0x215000
#define BCM2835_SPI1_BASE 0x215080
#define BCM2835_SPI2_BASE 0x2150C0
#define BCM2835_BSC1_BASE 0x804000
#define BCM2835_PAGE_SIZE (4*1024)
#define BCM2835_BLOCK_SIZE (4*1024)
#define BCM2835_GPFSEL0 0x0000
#define BCM2835_GPFSEL1 0x0004
#define BCM2835_GPFSEL2 0x0008
http://www.airspayce.com/mikem/bcm2835/group__constants.html[2020/1/28 11:01:35]
bcm2835: Constants for passing to and from library functions
#define BCM2835_GPFSEL3 0x000c
#define BCM2835_GPFSEL4 0x0010
#define BCM2835_GPFSEL5 0x0014
#define BCM2835_GPSET0 0x001c
#define BCM2835_GPSET1 0x0020
#define BCM2835_GPCLR0 0x0028
#define BCM2835_GPCLR1 0x002c
#define BCM2835_GPLEV0 0x0034
#define BCM2835_GPLEV1 0x0038
#define BCM2835_GPEDS0 0x0040
#define BCM2835_GPEDS1 0x0044
#define BCM2835_GPREN0 0x004c
#define BCM2835_GPREN1 0x0050
#define BCM2835_GPFEN0 0x0058
#define BCM2835_GPFEN1 0x005c
#define BCM2835_GPHEN0 0x0064
#define BCM2835_GPHEN1 0x0068
#define BCM2835_GPLEN0 0x0070
#define BCM2835_GPLEN1 0x0074
#define BCM2835_GPAREN0 0x007c
#define BCM2835_GPAREN1 0x0080
#define BCM2835_GPAFEN0 0x0088
#define BCM2835_GPAFEN1 0x008c
#define BCM2835_GPPUD 0x0094
#define BCM2835_GPPUDCLK0 0x0098
#define BCM2835_GPPUDCLK1 0x009c
#define BCM2835_GPPUPPDN0 0x00e4 /* Pin pull-up/down for pins 15:0 */
#define BCM2835_GPPUPPDN1 0x00e8 /* Pin pull-up/down for pins 31:16 */
#define BCM2835_GPPUPPDN2 0x00ec /* Pin pull-up/down for pins 47:32 */
#define BCM2835_GPPUPPDN3 0x00f0 /* Pin pull-up/down for pins 57:48 */
#define BCM2835_GPIO_PUD_ERROR 0x08
#define BCM2835_PADS_GPIO_0_27 0x002c
#define BCM2835_PADS_GPIO_28_45 0x0030
#define BCM2835_PADS_GPIO_46_53 0x0034
#define BCM2835_PAD_PASSWRD (0x5A << 24)
#define BCM2835_PAD_SLEW_RATE_UNLIMITED 0x10
#define BCM2835_PAD_HYSTERESIS_ENABLED 0x08
#define BCM2835_PAD_DRIVE_2mA 0x00
#define BCM2835_PAD_DRIVE_4mA 0x01
#define BCM2835_PAD_DRIVE_6mA 0x02
#define BCM2835_PAD_DRIVE_8mA 0x03
http://www.airspayce.com/mikem/bcm2835/group__constants.html[2020/1/28 11:01:35]
bcm2835: Constants for passing to and from library functions
#define BCM2835_PAD_DRIVE_10mA 0x04
#define BCM2835_PAD_DRIVE_12mA 0x05
#define BCM2835_PAD_DRIVE_14mA 0x06
#define BCM2835_PAD_DRIVE_16mA 0x07
#define BCM2835_AUX_IRQ 0x0000
#define BCM2835_AUX_ENABLE 0x0004
#define BCM2835_AUX_ENABLE_UART1 0x01
#define BCM2835_AUX_ENABLE_SPI0 0x02
#define BCM2835_AUX_ENABLE_SPI1 0x04
#define BCM2835_AUX_SPI_CNTL0 0x0000
#define BCM2835_AUX_SPI_CNTL1 0x0004
#define BCM2835_AUX_SPI_STAT 0x0008
#define BCM2835_AUX_SPI_PEEK 0x000C
#define BCM2835_AUX_SPI_IO 0x0020
#define BCM2835_AUX_SPI_TXHOLD 0x0030
#define BCM2835_AUX_SPI_CLOCK_MIN 30500
#define BCM2835_AUX_SPI_CLOCK_MAX 125000000
#define BCM2835_AUX_SPI_CNTL0_SPEED 0xFFF00000
#define BCM2835_AUX_SPI_CNTL0_SPEED_MAX 0xFFF
#define BCM2835_AUX_SPI_CNTL0_SPEED_SHIFT 20
#define BCM2835_AUX_SPI_CNTL0_CS0_N 0x000C0000
#define BCM2835_AUX_SPI_CNTL0_CS1_N 0x000A0000
#define BCM2835_AUX_SPI_CNTL0_CS2_N 0x00060000
#define BCM2835_AUX_SPI_CNTL0_POSTINPUT 0x00010000
#define BCM2835_AUX_SPI_CNTL0_VAR_CS 0x00008000
#define BCM2835_AUX_SPI_CNTL0_VAR_WIDTH 0x00004000
#define BCM2835_AUX_SPI_CNTL0_DOUTHOLD 0x00003000
#define BCM2835_AUX_SPI_CNTL0_ENABLE 0x00000800
#define BCM2835_AUX_SPI_CNTL0_CPHA_IN 0x00000400
#define BCM2835_AUX_SPI_CNTL0_CLEARFIFO 0x00000200
#define BCM2835_AUX_SPI_CNTL0_CPHA_OUT 0x00000100
#define BCM2835_AUX_SPI_CNTL0_CPOL 0x00000080
#define BCM2835_AUX_SPI_CNTL0_MSBF_OUT 0x00000040
#define BCM2835_AUX_SPI_CNTL0_SHIFTLEN 0x0000003F
#define BCM2835_AUX_SPI_CNTL1_CSHIGH 0x00000700
#define BCM2835_AUX_SPI_CNTL1_IDLE 0x00000080
#define BCM2835_AUX_SPI_CNTL1_TXEMPTY 0x00000040
#define BCM2835_AUX_SPI_CNTL1_MSBF_IN 0x00000002
#define BCM2835_AUX_SPI_CNTL1_KEEP_IN 0x00000001
#define BCM2835_AUX_SPI_STAT_TX_LVL 0xFF000000
#define BCM2835_AUX_SPI_STAT_RX_LVL 0x00FF0000
http://www.airspayce.com/mikem/bcm2835/group__constants.html[2020/1/28 11:01:35]
bcm2835: Constants for passing to and from library functions
#define BCM2835_AUX_SPI_STAT_TX_FULL 0x00000400
#define BCM2835_AUX_SPI_STAT_TX_EMPTY 0x00000200
#define BCM2835_AUX_SPI_STAT_RX_FULL 0x00000100
#define BCM2835_AUX_SPI_STAT_RX_EMPTY 0x00000080
#define BCM2835_AUX_SPI_STAT_BUSY 0x00000040
#define BCM2835_AUX_SPI_STAT_BITCOUNT 0x0000003F
#define BCM2835_SPI0_CS 0x0000
#define BCM2835_SPI0_FIFO 0x0004
#define BCM2835_SPI0_CLK 0x0008
#define BCM2835_SPI0_DLEN 0x000c
#define BCM2835_SPI0_LTOH 0x0010
#define BCM2835_SPI0_DC 0x0014
#define BCM2835_SPI0_CS_LEN_LONG 0x02000000
#define BCM2835_SPI0_CS_DMA_LEN 0x01000000
#define BCM2835_SPI0_CS_CSPOL2 0x00800000
#define BCM2835_SPI0_CS_CSPOL1 0x00400000
#define BCM2835_SPI0_CS_CSPOL0 0x00200000
#define BCM2835_SPI0_CS_RXF 0x00100000
#define BCM2835_SPI0_CS_RXR 0x00080000
#define BCM2835_SPI0_CS_TXD 0x00040000
#define BCM2835_SPI0_CS_RXD 0x00020000
#define BCM2835_SPI0_CS_DONE 0x00010000
#define BCM2835_SPI0_CS_TE_EN 0x00008000
#define BCM2835_SPI0_CS_LMONO 0x00004000
#define BCM2835_SPI0_CS_LEN 0x00002000
#define BCM2835_SPI0_CS_REN 0x00001000
#define BCM2835_SPI0_CS_ADCS 0x00000800
#define BCM2835_SPI0_CS_INTR 0x00000400
#define BCM2835_SPI0_CS_INTD 0x00000200
#define BCM2835_SPI0_CS_DMAEN 0x00000100
#define BCM2835_SPI0_CS_TA 0x00000080
#define BCM2835_SPI0_CS_CSPOL 0x00000040
#define BCM2835_SPI0_CS_CLEAR 0x00000030
#define BCM2835_SPI0_CS_CLEAR_RX 0x00000020
#define BCM2835_SPI0_CS_CLEAR_TX 0x00000010
#define BCM2835_SPI0_CS_CPOL 0x00000008
#define BCM2835_SPI0_CS_CPHA 0x00000004
#define BCM2835_SPI0_CS_CS 0x00000003
#define BCM2835_BSC_C 0x0000
#define BCM2835_BSC_S 0x0004
#define BCM2835_BSC_DLEN 0x0008
http://www.airspayce.com/mikem/bcm2835/group__constants.html[2020/1/28 11:01:35]
bcm2835: Constants for passing to and from library functions
#define BCM2835_BSC_A 0x000c
#define BCM2835_BSC_FIFO 0x0010
#define BCM2835_BSC_DIV 0x0014
#define BCM2835_BSC_DEL 0x0018
#define BCM2835_BSC_CLKT 0x001c
#define BCM2835_BSC_C_I2CEN 0x00008000
#define BCM2835_BSC_C_INTR 0x00000400
#define BCM2835_BSC_C_INTT 0x00000200
#define BCM2835_BSC_C_INTD 0x00000100
#define BCM2835_BSC_C_ST 0x00000080
#define BCM2835_BSC_C_CLEAR_1 0x00000020
#define BCM2835_BSC_C_CLEAR_2 0x00000010
#define BCM2835_BSC_C_READ 0x00000001
#define BCM2835_BSC_S_CLKT 0x00000200
#define BCM2835_BSC_S_ERR 0x00000100
#define BCM2835_BSC_S_RXF 0x00000080
#define BCM2835_BSC_S_TXE 0x00000040
#define BCM2835_BSC_S_RXD 0x00000020
#define BCM2835_BSC_S_TXD 0x00000010
#define BCM2835_BSC_S_RXR 0x00000008
#define BCM2835_BSC_S_TXW 0x00000004
#define BCM2835_BSC_S_DONE 0x00000002
#define BCM2835_BSC_S_TA 0x00000001
#define BCM2835_BSC_FIFO_SIZE 16
#define BCM2835_ST_CS 0x0000
#define BCM2835_ST_CLO 0x0004
#define BCM2835_ST_CHI 0x0008
列举
enum bcm2835RegisterBase {
BCM2835_REGBASE_ST = 1, BCM2835_REGBASE_GPIO = 2, BCM2835_REGBASE_PWM = 3,
BCM2835_REGBASE_CLK = 4,
BCM2835_REGBASE_PADS = 5, BCM2835_REGBASE_SPI0 = 6, BCM2835_REGBASE_BSC0 = 7,
BCM2835_REGBASE_BSC1 = 8,
BCM2835_REGBASE_AUX = 9, BCM2835_REGBASE_SPI1 = 10
}
bcm2835RegisterBase Register bases for bcm2835_regbase() More...
enum bcm2835FunctionSelect {
BCM2835_GPIO_FSEL_INPT = 0x00, BCM2835_GPIO_FSEL_OUTP = 0x01,
BCM2835_GPIO_FSEL_ALT0 = 0x04, BCM2835_GPIO_FSEL_ALT1 = 0x05,
BCM2835_GPIO_FSEL_ALT2 = 0x06, BCM2835_GPIO_FSEL_ALT3 = 0x07,
BCM2835_GPIO_FSEL_ALT4 = 0x03, BCM2835_GPIO_FSEL_ALT5 = 0x02,
BCM2835_GPIO_FSEL_MASK = 0x07
http://www.airspayce.com/mikem/bcm2835/group__constants.html[2020/1/28 11:01:35]
bcm2835: Constants for passing to and from library functions
}
bcm2835PortFunction Port function select modes for bcm2835_gpio_fsel() More...
enum bcm2835PUDControl { BCM2835_GPIO_PUD_OFF = 0x00, BCM2835_GPIO_PUD_DOWN = 0x01,
BCM2835_GPIO_PUD_UP = 0x02 }
bcm2835PUDControl Pullup/Pulldown defines for bcm2835_gpio_pud() More...
enum bcm2835PadGroup { BCM2835_PAD_GROUP_GPIO_0_27 = 0, BCM2835_PAD_GROUP_GPIO_28_45 =
1, BCM2835_PAD_GROUP_GPIO_46_53 = 2 }
bcm2835PadGroup Pad group specification for bcm2835_gpio_pad() More...
enum RPiGPIOPin {
RPI_GPIO_P1_03 = 0, RPI_GPIO_P1_05 = 1, RPI_GPIO_P1_07 = 4, RPI_GPIO_P1_08 = 14,
RPI_GPIO_P1_10 = 15, RPI_GPIO_P1_11 = 17, RPI_GPIO_P1_12 = 18, RPI_GPIO_P1_13 = 21,
RPI_GPIO_P1_15 = 22, RPI_GPIO_P1_16 = 23, RPI_GPIO_P1_18 = 24, RPI_GPIO_P1_19 = 10,
RPI_GPIO_P1_21 = 9, RPI_GPIO_P1_22 = 25, RPI_GPIO_P1_23 = 11, RPI_GPIO_P1_24 = 8,
RPI_GPIO_P1_26 = 7, RPI_V2_GPIO_P1_03 = 2, RPI_V2_GPIO_P1_05 = 3, RPI_V2_GPIO_P1_07 = 4,
RPI_V2_GPIO_P1_08 = 14, RPI_V2_GPIO_P1_10 = 15, RPI_V2_GPIO_P1_11 = 17, RPI_V2_GPIO_P1_12
= 18,
RPI_V2_GPIO_P1_13 = 27, RPI_V2_GPIO_P1_15 = 22, RPI_V2_GPIO_P1_16 = 23, RPI_V2_GPIO_P1_18
= 24,
RPI_V2_GPIO_P1_19 = 10, RPI_V2_GPIO_P1_21 = 9, RPI_V2_GPIO_P1_22 = 25, RPI_V2_GPIO_P1_23
= 11,
RPI_V2_GPIO_P1_24 = 8, RPI_V2_GPIO_P1_26 = 7, RPI_V2_GPIO_P1_29 = 5, RPI_V2_GPIO_P1_31 =
6,
RPI_V2_GPIO_P1_32 = 12, RPI_V2_GPIO_P1_33 = 13, RPI_V2_GPIO_P1_35 = 19, RPI_V2_GPIO_P1_36
= 16,
RPI_V2_GPIO_P1_37 = 26, RPI_V2_GPIO_P1_38 = 20, RPI_V2_GPIO_P1_40 = 21, RPI_V2_GPIO_P5_03
= 28,
RPI_V2_GPIO_P5_04 = 29, RPI_V2_GPIO_P5_05 = 30, RPI_V2_GPIO_P5_06 = 31,
RPI_BPLUS_GPIO_J8_03 = 2,
RPI_BPLUS_GPIO_J8_05 = 3, RPI_BPLUS_GPIO_J8_07 = 4, RPI_BPLUS_GPIO_J8_08 = 14,
RPI_BPLUS_GPIO_J8_10 = 15,
RPI_BPLUS_GPIO_J8_11 = 17, RPI_BPLUS_GPIO_J8_12 = 18, RPI_BPLUS_GPIO_J8_13 = 27,
RPI_BPLUS_GPIO_J8_15 = 22,
RPI_BPLUS_GPIO_J8_16 = 23, RPI_BPLUS_GPIO_J8_18 = 24, RPI_BPLUS_GPIO_J8_19 = 10,
RPI_BPLUS_GPIO_J8_21 = 9,
RPI_BPLUS_GPIO_J8_22 = 25, RPI_BPLUS_GPIO_J8_23 = 11, RPI_BPLUS_GPIO_J8_24 = 8,
RPI_BPLUS_GPIO_J8_26 = 7,
RPI_BPLUS_GPIO_J8_29 = 5, RPI_BPLUS_GPIO_J8_31 = 6, RPI_BPLUS_GPIO_J8_32 = 12,
RPI_BPLUS_GPIO_J8_33 = 13,
RPI_BPLUS_GPIO_J8_35 = 19, RPI_BPLUS_GPIO_J8_36 = 16, RPI_BPLUS_GPIO_J8_37 = 26,
RPI_BPLUS_GPIO_J8_38 = 20,
RPI_BPLUS_GPIO_J8_40 = 21
}
GPIO Pin Numbers. More...
enum bcm2835SPIBitOrder { BCM2835_SPI_BIT_ORDER_LSBFIRST = 0,
BCM2835_SPI_BIT_ORDER_MSBFIRST = 1 }
bcm2835SPIBitOrder SPI Bit order Specifies the SPI data bit ordering for bcm2835_spi_setBitOrder()
http://www.airspayce.com/mikem/bcm2835/group__constants.html[2020/1/28 11:01:35]
bcm2835: Constants for passing to and from library functions
More...
enum bcm2835SPIMode { BCM2835_SPI_MODE0 = 0, BCM2835_SPI_MODE1 = 1, BCM2835_SPI_MODE2 = 2,
BCM2835_SPI_MODE3 = 3 }
SPI Data mode Specify the SPI data mode to be passed to bcm2835_spi_setDataMode() More...
enum bcm2835SPIChipSelect { BCM2835_SPI_CS0 = 0, BCM2835_SPI_CS1 = 1, BCM2835_SPI_CS2 = 2,
BCM2835_SPI_CS_NONE = 3 }
bcm2835SPIChipSelect Specify the SPI chip select pin(s) More...
enum bcm2835SPIClockDivider {
BCM2835_SPI_CLOCK_DIVIDER_65536 = 0, BCM2835_SPI_CLOCK_DIVIDER_32768 = 32768,
BCM2835_SPI_CLOCK_DIVIDER_16384 = 16384, BCM2835_SPI_CLOCK_DIVIDER_8192 = 8192,
BCM2835_SPI_CLOCK_DIVIDER_4096 = 4096, BCM2835_SPI_CLOCK_DIVIDER_2048 = 2048,
BCM2835_SPI_CLOCK_DIVIDER_1024 = 1024, BCM2835_SPI_CLOCK_DIVIDER_512 = 512,
BCM2835_SPI_CLOCK_DIVIDER_256 = 256, BCM2835_SPI_CLOCK_DIVIDER_128 = 128,
BCM2835_SPI_CLOCK_DIVIDER_64 = 64, BCM2835_SPI_CLOCK_DIVIDER_32 = 32,
BCM2835_SPI_CLOCK_DIVIDER_16 = 16, BCM2835_SPI_CLOCK_DIVIDER_8 = 8,
BCM2835_SPI_CLOCK_DIVIDER_4 = 4, BCM2835_SPI_CLOCK_DIVIDER_2 = 2,
BCM2835_SPI_CLOCK_DIVIDER_1 = 1
}
bcm2835spiclockdivide指定用于从系统时钟生成SPI时钟的分频器。下图给出了除法器、时钟周期和时钟频
率。时钟划分基于RPi1和RPi2上250MHz和RPi3上400MHz的名义核心时钟速率。据报道(与文档相反)任何偶
数分隔符都可以使用。每个分频器显示的频率已经通过测量RPi1和RPi2得到确认。RPi3上的系统时钟频率是不
同的,因此从给定除法器得到的频率是不同的。有关可靠的SPI速度信息,请参阅“SPI引脚”中的注释。注意:可
以通过put将RPi 3的核心时钟频率更改回250MHz More...
enum bcm2835I2CClockDivider { BCM2835_I2C_CLOCK_DIVIDER_2500 = 2500,
BCM2835_I2C_CLOCK_DIVIDER_626 = 626, BCM2835_I2C_CLOCK_DIVIDER_150 = 150,
BCM2835_I2C_CLOCK_DIVIDER_148 = 148 }
bcm2835i2cclockdivide指定用于从系统时钟生成I2C时钟的分频器。时钟划分是基于250MHz的公称基本时钟
速率 More...
enum bcm2835I2CReasonCodes { BCM2835_I2C_REASON_OK = 0x00,
BCM2835_I2C_REASON_ERROR_NACK = 0x01, BCM2835_I2C_REASON_ERROR_CLKT = 0x02,
BCM2835_I2C_REASON_ERROR_DATA = 0x04 }
bcm2835I2CReasonCodes指定bcm2835_i2c_write和bcm2835_i2c_read函数的原因代码。More...
变量
off_t bcm2835_peripherals_base
size_t bcm2835_peripherals_size
uint32_t * bcm2835_peripherals
volatile uint32_t * bcm2835_st
volatile uint32_t * bcm2835_gpio
volatile uint32_t * bcm2835_pwm
http://www.airspayce.com/mikem/bcm2835/group__constants.html[2020/1/28 11:01:35]
bcm2835: Constants for passing to and from library functions
volatile uint32_t * bcm2835_clk
volatile uint32_t * bcm2835_pads
volatile uint32_t * bcm2835_spi0
volatile uint32_t * bcm2835_bsc0
volatile uint32_t * bcm2835_bsc1
volatile uint32_t * bcm2835_aux
volatile uint32_t * bcm2835_spi1
详细描述
这里的值被设计为传递给bcm2835库中的各个函数。
宏定义文档
◆ BCM2835_AUX_BASE
#define BCM2835_AUX_BASE 0x215000
AUX 寄存器的基地址
◆ BCM2835_AUX_ENABLE_SPI0
#define BCM2835_AUX_ENABLE_SPI0 0x02
SPI0 (SPI1 in the device)
◆ BCM2835_AUX_ENABLE_SPI1
#define BCM2835_AUX_ENABLE_SPI1 0x04
SPI1 (SPI2 in the device)
◆ BCM2835_AUX_IRQ
#define BCM2835_AUX_IRQ 0x0000
xxx
http://www.airspayce.com/mikem/bcm2835/group__constants.html[2020/1/28 11:01:35]