bcm2835  1.52
 All Functions Variables Enumerations Enumerator Modules Pages
bcm2835.h
1 /* bcm2835.h
2 
3  C and C++ support for Broadcom BCM 2835 as used in Raspberry Pi
4 
5  Author: Mike McCauley
6  Copyright (C) 2011-2013 Mike McCauley
7  $Id: bcm2835.h,v 1.20 2015/03/31 04:55:41 mikem Exp mikem $
8 */
9 
478 /* Defines for BCM2835 */
479 #ifndef BCM2835_H
480 #define BCM2835_H
481 
482 #include <stdint.h>
483 
484 #define BCM2835_VERSION 10050 /* Version 1.50 */
485 
486 /* RPi 2 is ARM v7, and has DMB instruction for memory barriers.
487  Older RPis are ARM v6 and don't, so a coprocessor instruction must be used instead.
488  However, not all versions of gcc in all distros support the dmb assembler instruction even on conmpatible processors.
489  This test is so any ARMv7 or higher processors with suitable GCC will use DMB.
490 */
491 #if __ARM_ARCH >= 7
492 #define BCM2835_HAVE_DMB
493 #endif
494 
501 #define HIGH 0x1
502 
503 #define LOW 0x0
504 
506 #define BCM2835_CORE_CLK_HZ 250000000
509 #define BMC2835_RPI2_DT_FILENAME "/proc/device-tree/soc/ranges"
510 
511 #define BMC2835_RPI2_DT_PERI_BASE_ADDRESS_OFFSET 4
512 
513 #define BMC2835_RPI2_DT_PERI_SIZE_OFFSET 8
514 
522 #define BCM2835_PERI_BASE 0x20000000
523 
524 #define BCM2835_PERI_SIZE 0x01000000
525 
529 #define BCM2835_ST_BASE 0x3000
530 
531 #define BCM2835_GPIO_PADS 0x100000
532 
533 #define BCM2835_CLOCK_BASE 0x101000
534 
535 #define BCM2835_GPIO_BASE 0x200000
536 
537 #define BCM2835_SPI0_BASE 0x204000
538 
539 #define BCM2835_BSC0_BASE 0x205000
540 
541 #define BCM2835_GPIO_PWM 0x20C000
542 
543 #define BCM2835_BSC1_BASE 0x804000
544 
548 extern uint32_t *bcm2835_peripherals_base;
550 extern uint32_t bcm2835_peripherals_size;
551 
553 extern uint32_t *bcm2835_peripherals;
554 
558 extern volatile uint32_t *bcm2835_st;
559 
563 extern volatile uint32_t *bcm2835_gpio;
564 
568 extern volatile uint32_t *bcm2835_pwm;
569 
573 extern volatile uint32_t *bcm2835_clk;
574 
578 extern volatile uint32_t *bcm2835_pads;
579 
583 extern volatile uint32_t *bcm2835_spi0;
584 
588 extern volatile uint32_t *bcm2835_bsc0;
589 
593 extern volatile uint32_t *bcm2835_bsc1;
594 
598 typedef enum
599 {
609 
611 #define BCM2835_PAGE_SIZE (4*1024)
612 
613 #define BCM2835_BLOCK_SIZE (4*1024)
614 
615 
616 /* Defines for GPIO
617  The BCM2835 has 54 GPIO pins.
618  BCM2835 data sheet, Page 90 onwards.
619 */
623 #define BCM2835_GPFSEL0 0x0000
624 #define BCM2835_GPFSEL1 0x0004
625 #define BCM2835_GPFSEL2 0x0008
626 #define BCM2835_GPFSEL3 0x000c
627 #define BCM2835_GPFSEL4 0x0010
628 #define BCM2835_GPFSEL5 0x0014
629 #define BCM2835_GPSET0 0x001c
630 #define BCM2835_GPSET1 0x0020
631 #define BCM2835_GPCLR0 0x0028
632 #define BCM2835_GPCLR1 0x002c
633 #define BCM2835_GPLEV0 0x0034
634 #define BCM2835_GPLEV1 0x0038
635 #define BCM2835_GPEDS0 0x0040
636 #define BCM2835_GPEDS1 0x0044
637 #define BCM2835_GPREN0 0x004c
638 #define BCM2835_GPREN1 0x0050
639 #define BCM2835_GPFEN0 0x0058
640 #define BCM2835_GPFEN1 0x005c
641 #define BCM2835_GPHEN0 0x0064
642 #define BCM2835_GPHEN1 0x0068
643 #define BCM2835_GPLEN0 0x0070
644 #define BCM2835_GPLEN1 0x0074
645 #define BCM2835_GPAREN0 0x007c
646 #define BCM2835_GPAREN1 0x0080
647 #define BCM2835_GPAFEN0 0x0088
648 #define BCM2835_GPAFEN1 0x008c
649 #define BCM2835_GPPUD 0x0094
650 #define BCM2835_GPPUDCLK0 0x0098
651 #define BCM2835_GPPUDCLK1 0x009c
656 typedef enum
657 {
668 
672 typedef enum
673 {
678 
680 #define BCM2835_PADS_GPIO_0_27 0x002c
681 #define BCM2835_PADS_GPIO_28_45 0x0030
682 #define BCM2835_PADS_GPIO_46_53 0x0034
685 #define BCM2835_PAD_PASSWRD (0x5A << 24)
686 #define BCM2835_PAD_SLEW_RATE_UNLIMITED 0x10
687 #define BCM2835_PAD_HYSTERESIS_ENABLED 0x08
688 #define BCM2835_PAD_DRIVE_2mA 0x00
689 #define BCM2835_PAD_DRIVE_4mA 0x01
690 #define BCM2835_PAD_DRIVE_6mA 0x02
691 #define BCM2835_PAD_DRIVE_8mA 0x03
692 #define BCM2835_PAD_DRIVE_10mA 0x04
693 #define BCM2835_PAD_DRIVE_12mA 0x05
694 #define BCM2835_PAD_DRIVE_14mA 0x06
695 #define BCM2835_PAD_DRIVE_16mA 0x07
700 typedef enum
701 {
706 
721 typedef enum
722 {
741  /* RPi Version 2 */
769  /* RPi Version 2, new plug P5 */
775  /* RPi B+ J8 header, also RPi 2 40 pin GPIO header */
802 } RPiGPIOPin;
803 
804 /* Defines for SPI
805  GPIO register offsets from BCM2835_SPI0_BASE.
806  Offsets into the SPI Peripheral block in bytes per 10.5 SPI Register Map
807 */
808 #define BCM2835_SPI0_CS 0x0000
809 #define BCM2835_SPI0_FIFO 0x0004
810 #define BCM2835_SPI0_CLK 0x0008
811 #define BCM2835_SPI0_DLEN 0x000c
812 #define BCM2835_SPI0_LTOH 0x0010
813 #define BCM2835_SPI0_DC 0x0014
815 /* Register masks for SPI0_CS */
816 #define BCM2835_SPI0_CS_LEN_LONG 0x02000000
817 #define BCM2835_SPI0_CS_DMA_LEN 0x01000000
818 #define BCM2835_SPI0_CS_CSPOL2 0x00800000
819 #define BCM2835_SPI0_CS_CSPOL1 0x00400000
820 #define BCM2835_SPI0_CS_CSPOL0 0x00200000
821 #define BCM2835_SPI0_CS_RXF 0x00100000
822 #define BCM2835_SPI0_CS_RXR 0x00080000
823 #define BCM2835_SPI0_CS_TXD 0x00040000
824 #define BCM2835_SPI0_CS_RXD 0x00020000
825 #define BCM2835_SPI0_CS_DONE 0x00010000
826 #define BCM2835_SPI0_CS_TE_EN 0x00008000
827 #define BCM2835_SPI0_CS_LMONO 0x00004000
828 #define BCM2835_SPI0_CS_LEN 0x00002000
829 #define BCM2835_SPI0_CS_REN 0x00001000
830 #define BCM2835_SPI0_CS_ADCS 0x00000800
831 #define BCM2835_SPI0_CS_INTR 0x00000400
832 #define BCM2835_SPI0_CS_INTD 0x00000200
833 #define BCM2835_SPI0_CS_DMAEN 0x00000100
834 #define BCM2835_SPI0_CS_TA 0x00000080
835 #define BCM2835_SPI0_CS_CSPOL 0x00000040
836 #define BCM2835_SPI0_CS_CLEAR 0x00000030
837 #define BCM2835_SPI0_CS_CLEAR_RX 0x00000020
838 #define BCM2835_SPI0_CS_CLEAR_TX 0x00000010
839 #define BCM2835_SPI0_CS_CPOL 0x00000008
840 #define BCM2835_SPI0_CS_CPHA 0x00000004
841 #define BCM2835_SPI0_CS_CS 0x00000003
846 typedef enum
847 {
851 
855 typedef enum
856 {
862 
866 typedef enum
867 {
873 
888 typedef enum
889 {
908 
909 /* Defines for I2C
910  GPIO register offsets from BCM2835_BSC*_BASE.
911  Offsets into the BSC Peripheral block in bytes per 3.1 BSC Register Map
912 */
913 #define BCM2835_BSC_C 0x0000
914 #define BCM2835_BSC_S 0x0004
915 #define BCM2835_BSC_DLEN 0x0008
916 #define BCM2835_BSC_A 0x000c
917 #define BCM2835_BSC_FIFO 0x0010
918 #define BCM2835_BSC_DIV 0x0014
919 #define BCM2835_BSC_DEL 0x0018
920 #define BCM2835_BSC_CLKT 0x001c
922 /* Register masks for BSC_C */
923 #define BCM2835_BSC_C_I2CEN 0x00008000
924 #define BCM2835_BSC_C_INTR 0x00000400
925 #define BCM2835_BSC_C_INTT 0x00000200
926 #define BCM2835_BSC_C_INTD 0x00000100
927 #define BCM2835_BSC_C_ST 0x00000080
928 #define BCM2835_BSC_C_CLEAR_1 0x00000020
929 #define BCM2835_BSC_C_CLEAR_2 0x00000010
930 #define BCM2835_BSC_C_READ 0x00000001
932 /* Register masks for BSC_S */
933 #define BCM2835_BSC_S_CLKT 0x00000200
934 #define BCM2835_BSC_S_ERR 0x00000100
935 #define BCM2835_BSC_S_RXF 0x00000080
936 #define BCM2835_BSC_S_TXE 0x00000040
937 #define BCM2835_BSC_S_RXD 0x00000020
938 #define BCM2835_BSC_S_TXD 0x00000010
939 #define BCM2835_BSC_S_RXR 0x00000008
940 #define BCM2835_BSC_S_TXW 0x00000004
941 #define BCM2835_BSC_S_DONE 0x00000002
942 #define BCM2835_BSC_S_TA 0x00000001
944 #define BCM2835_BSC_FIFO_SIZE 16
950 typedef enum
951 {
957 
961 typedef enum
962 {
968 
969 /* Defines for ST
970  GPIO register offsets from BCM2835_ST_BASE.
971  Offsets into the ST Peripheral block in bytes per 12.1 System Timer Registers
972  The System Timer peripheral provides four 32-bit timer channels and a single 64-bit free running counter.
973  BCM2835_ST_CLO is the System Timer Counter Lower bits register.
974  The system timer free-running counter lower register is a read-only register that returns the current value
975  of the lower 32-bits of the free running counter.
976  BCM2835_ST_CHI is the System Timer Counter Upper bits register.
977  The system timer free-running counter upper register is a read-only register that returns the current value
978  of the upper 32-bits of the free running counter.
979 */
980 #define BCM2835_ST_CS 0x0000
981 #define BCM2835_ST_CLO 0x0004
982 #define BCM2835_ST_CHI 0x0008
987 /* Defines for PWM, word offsets (ie 4 byte multiples) */
988 #define BCM2835_PWM_CONTROL 0
989 #define BCM2835_PWM_STATUS 1
990 #define BCM2835_PWM_DMAC 2
991 #define BCM2835_PWM0_RANGE 4
992 #define BCM2835_PWM0_DATA 5
993 #define BCM2835_PWM_FIF1 6
994 #define BCM2835_PWM1_RANGE 8
995 #define BCM2835_PWM1_DATA 9
996 
997 /* Defines for PWM Clock, word offsets (ie 4 byte multiples) */
998 #define BCM2835_PWMCLK_CNTL 40
999 #define BCM2835_PWMCLK_DIV 41
1000 #define BCM2835_PWM_PASSWRD (0x5A << 24)
1002 #define BCM2835_PWM1_MS_MODE 0x8000
1003 #define BCM2835_PWM1_USEFIFO 0x2000
1004 #define BCM2835_PWM1_REVPOLAR 0x1000
1005 #define BCM2835_PWM1_OFFSTATE 0x0800
1006 #define BCM2835_PWM1_REPEATFF 0x0400
1007 #define BCM2835_PWM1_SERIAL 0x0200
1008 #define BCM2835_PWM1_ENABLE 0x0100
1010 #define BCM2835_PWM0_MS_MODE 0x0080
1011 #define BCM2835_PWM_CLEAR_FIFO 0x0040
1012 #define BCM2835_PWM0_USEFIFO 0x0020
1013 #define BCM2835_PWM0_REVPOLAR 0x0010
1014 #define BCM2835_PWM0_OFFSTATE 0x0008
1015 #define BCM2835_PWM0_REPEATFF 0x0004
1016 #define BCM2835_PWM0_SERIAL 0x0002
1017 #define BCM2835_PWM0_ENABLE 0x0001
1025 typedef enum
1026 {
1027  BCM2835_PWM_CLOCK_DIVIDER_2048 = 2048,
1028  BCM2835_PWM_CLOCK_DIVIDER_1024 = 1024,
1029  BCM2835_PWM_CLOCK_DIVIDER_512 = 512,
1030  BCM2835_PWM_CLOCK_DIVIDER_256 = 256,
1031  BCM2835_PWM_CLOCK_DIVIDER_128 = 128,
1032  BCM2835_PWM_CLOCK_DIVIDER_64 = 64,
1033  BCM2835_PWM_CLOCK_DIVIDER_32 = 32,
1034  BCM2835_PWM_CLOCK_DIVIDER_16 = 16,
1035  BCM2835_PWM_CLOCK_DIVIDER_8 = 8,
1036  BCM2835_PWM_CLOCK_DIVIDER_4 = 4,
1037  BCM2835_PWM_CLOCK_DIVIDER_2 = 2,
1038  BCM2835_PWM_CLOCK_DIVIDER_1 = 1
1039 } bcm2835PWMClockDivider;
1040 
1041 /* Historical name compatibility */
1042 #ifndef BCM2835_NO_DELAY_COMPATIBILITY
1043 #define delay(x) bcm2835_delay(x)
1044 #define delayMicroseconds(x) bcm2835_delayMicroseconds(x)
1045 #endif
1046 
1047 #ifdef __cplusplus
1048 extern "C" {
1049 #endif
1050 
1069  extern int bcm2835_init(void);
1070 
1074  extern int bcm2835_close(void);
1075 
1083  extern void bcm2835_set_debug(uint8_t debug);
1084 
1088  extern unsigned int bcm2835_version(void);
1089 
1105  extern uint32_t* bcm2835_regbase(uint8_t regbase);
1106 
1115  extern uint32_t bcm2835_peri_read(volatile uint32_t* paddr);
1116 
1127  extern uint32_t bcm2835_peri_read_nb(volatile uint32_t* paddr);
1128 
1129 
1141  extern void bcm2835_peri_write(volatile uint32_t* paddr, uint32_t value);
1142 
1155  extern void bcm2835_peri_write_nb(volatile uint32_t* paddr, uint32_t value);
1156 
1169  extern void bcm2835_peri_set_bits(volatile uint32_t* paddr, uint32_t value, uint32_t mask);
1183  extern void bcm2835_gpio_fsel(uint8_t pin, uint8_t mode);
1184 
1190  extern void bcm2835_gpio_set(uint8_t pin);
1191 
1197  extern void bcm2835_gpio_clr(uint8_t pin);
1198 
1204  extern void bcm2835_gpio_set_multi(uint32_t mask);
1205 
1211  extern void bcm2835_gpio_clr_multi(uint32_t mask);
1212 
1219  extern uint8_t bcm2835_gpio_lev(uint8_t pin);
1220 
1229  extern uint8_t bcm2835_gpio_eds(uint8_t pin);
1230 
1236  extern uint32_t bcm2835_gpio_eds_multi(uint32_t mask);
1237 
1243  extern void bcm2835_gpio_set_eds(uint8_t pin);
1244 
1249  extern void bcm2835_gpio_set_eds_multi(uint32_t mask);
1250 
1259  extern void bcm2835_gpio_ren(uint8_t pin);
1260 
1264  extern void bcm2835_gpio_clr_ren(uint8_t pin);
1265 
1274  extern void bcm2835_gpio_fen(uint8_t pin);
1275 
1279  extern void bcm2835_gpio_clr_fen(uint8_t pin);
1280 
1285  extern void bcm2835_gpio_hen(uint8_t pin);
1286 
1290  extern void bcm2835_gpio_clr_hen(uint8_t pin);
1291 
1296  extern void bcm2835_gpio_len(uint8_t pin);
1297 
1301  extern void bcm2835_gpio_clr_len(uint8_t pin);
1302 
1309  extern void bcm2835_gpio_aren(uint8_t pin);
1310 
1314  extern void bcm2835_gpio_clr_aren(uint8_t pin);
1315 
1322  extern void bcm2835_gpio_afen(uint8_t pin);
1323 
1327  extern void bcm2835_gpio_clr_afen(uint8_t pin);
1328 
1335  extern void bcm2835_gpio_pud(uint8_t pud);
1336 
1343  extern void bcm2835_gpio_pudclk(uint8_t pin, uint8_t on);
1344 
1350  extern uint32_t bcm2835_gpio_pad(uint8_t group);
1351 
1359  extern void bcm2835_gpio_set_pad(uint8_t group, uint32_t control);
1360 
1371  extern void bcm2835_delay (unsigned int millis);
1372 
1386  extern void bcm2835_delayMicroseconds (uint64_t micros);
1387 
1392  extern void bcm2835_gpio_write(uint8_t pin, uint8_t on);
1393 
1398  extern void bcm2835_gpio_write_multi(uint32_t mask, uint8_t on);
1399 
1404  extern void bcm2835_gpio_write_mask(uint32_t value, uint32_t mask);
1405 
1411  extern void bcm2835_gpio_set_pud(uint8_t pin, uint8_t pud);
1412 
1429  extern int bcm2835_spi_begin(void);
1430 
1435  extern void bcm2835_spi_end(void);
1436 
1443  extern void bcm2835_spi_setBitOrder(uint8_t order);
1444 
1450  extern void bcm2835_spi_setClockDivider(uint16_t divider);
1451 
1457  extern void bcm2835_spi_setDataMode(uint8_t mode);
1458 
1465  extern void bcm2835_spi_chipSelect(uint8_t cs);
1466 
1475  extern void bcm2835_spi_setChipSelectPolarity(uint8_t cs, uint8_t active);
1476 
1487  extern uint8_t bcm2835_spi_transfer(uint8_t value);
1488 
1500  extern void bcm2835_spi_transfernb(char* tbuf, char* rbuf, uint32_t len);
1501 
1509  extern void bcm2835_spi_transfern(char* buf, uint32_t len);
1510 
1517  extern void bcm2835_spi_writenb(char* buf, uint32_t len);
1518 
1535  extern int bcm2835_i2c_begin(void);
1536 
1541  extern void bcm2835_i2c_end(void);
1542 
1546  extern void bcm2835_i2c_setSlaveAddress(uint8_t addr);
1547 
1552  extern void bcm2835_i2c_setClockDivider(uint16_t divider);
1553 
1560  extern void bcm2835_i2c_set_baudrate(uint32_t baudrate);
1561 
1568  extern uint8_t bcm2835_i2c_write(const char * buf, uint32_t len);
1569 
1576  extern uint8_t bcm2835_i2c_read(char* buf, uint32_t len);
1577 
1592  extern uint8_t bcm2835_i2c_read_register_rs(char* regaddr, char* buf, uint32_t len);
1593 
1604  extern uint8_t bcm2835_i2c_write_read_rs(char* cmds, uint32_t cmds_len, char* buf, uint32_t buf_len);
1605 
1616  extern uint64_t bcm2835_st_read(void);
1617 
1622  extern void bcm2835_st_delay(uint64_t offset_micros, uint64_t micros);
1623 
1639  extern void bcm2835_pwm_set_clock(uint32_t divisor);
1640 
1647  extern void bcm2835_pwm_set_mode(uint8_t channel, uint8_t markspace, uint8_t enabled);
1648 
1654  extern void bcm2835_pwm_set_range(uint8_t channel, uint32_t range);
1655 
1662  extern void bcm2835_pwm_set_data(uint8_t channel, uint32_t data);
1663 
1665 #ifdef __cplusplus
1666 }
1667 #endif
1668 
1669 #endif /* BCM2835_H */
1670 
Definition: bcm2835.h:746
Definition: bcm2835.h:763
Definition: bcm2835.h:857
Definition: bcm2835.h:751
Definition: bcm2835.h:801
void bcm2835_pwm_set_clock(uint32_t divisor)
Definition: bcm2835.c:1205
Definition: bcm2835.h:749
volatile uint32_t * bcm2835_spi0
Definition: bcm2835.c:54
void bcm2835_gpio_set_multi(uint32_t mask)
Definition: bcm2835.c:238
void bcm2835_gpio_hen(uint8_t pin)
Definition: bcm2835.c:326
Definition: bcm2835.h:766
unsigned int bcm2835_version(void)
Definition: bcm2835.c:104
uint8_t bcm2835_gpio_lev(uint8_t pin)
Definition: bcm2835.c:252
Definition: bcm2835.h:731
Definition: bcm2835.h:904
Definition: bcm2835.h:954
Definition: bcm2835.h:869
void bcm2835_i2c_setSlaveAddress(uint8_t addr)
Definition: bcm2835.c:782
Definition: bcm2835.h:760
Definition: bcm2835.h:870
Definition: bcm2835.h:750
uint64_t bcm2835_st_read(void)
Definition: bcm2835.c:1161
Definition: bcm2835.h:753
Definition: bcm2835.h:964
Definition: bcm2835.h:906
Definition: bcm2835.h:658
Definition: bcm2835.h:661
Definition: bcm2835.h:780
void bcm2835_gpio_fen(uint8_t pin)
Definition: bcm2835.c:310
Definition: bcm2835.h:848
volatile uint32_t * bcm2835_st
Definition: bcm2835.c:57
bcm2835SPIChipSelect
bcm2835SPIChipSelect Specify the SPI chip select pin(s)
Definition: bcm2835.h:866
Definition: bcm2835.h:602
int bcm2835_i2c_begin(void)
Definition: bcm2835.c:738
Definition: bcm2835.h:793
Definition: bcm2835.h:748
Definition: bcm2835.h:791
Definition: bcm2835.h:894
Definition: bcm2835.h:744
Definition: bcm2835.h:902
int bcm2835_spi_begin(void)
Definition: bcm2835.c:535
Definition: bcm2835.h:785
Definition: bcm2835.h:754
bcm2835PUDControl
bcm2835PUDControl Pullup/Pulldown defines for bcm2835_gpio_pud()
Definition: bcm2835.h:672
uint8_t bcm2835_i2c_write_read_rs(char *cmds, uint32_t cmds_len, char *buf, uint32_t buf_len)
Definition: bcm2835.c:1059
void bcm2835_spi_end(void)
Definition: bcm2835.c:559
void bcm2835_gpio_clr_hen(uint8_t pin)
Definition: bcm2835.c:333
void bcm2835_gpio_set(uint8_t pin)
Definition: bcm2835.c:222
Definition: bcm2835.h:664
Definition: bcm2835.h:893
volatile uint32_t * bcm2835_clk
Definition: bcm2835.c:52
Definition: bcm2835.h:761
void bcm2835_gpio_aren(uint8_t pin)
Definition: bcm2835.c:358
uint8_t bcm2835_i2c_read_register_rs(char *regaddr, char *buf, uint32_t len)
Definition: bcm2835.c:968
Definition: bcm2835.h:786
Definition: bcm2835.h:737
Definition: bcm2835.h:730
uint8_t bcm2835_gpio_eds(uint8_t pin)
Definition: bcm2835.c:263
uint32_t bcm2835_peri_read_nb(volatile uint32_t *paddr)
Definition: bcm2835.c:135
Definition: bcm2835.h:777
uint8_t bcm2835_i2c_write(const char *buf, uint32_t len)
Definition: bcm2835.c:822
Definition: bcm2835.h:601
void bcm2835_gpio_fsel(uint8_t pin, uint8_t mode)
Definition: bcm2835.c:211
Definition: bcm2835.h:778
Definition: bcm2835.h:952
RPiGPIOPin
GPIO Pin Numbers.
Definition: bcm2835.h:721
int bcm2835_init(void)
Definition: bcm2835.c:1313
void bcm2835_gpio_set_eds(uint8_t pin)
Definition: bcm2835.c:279
Definition: bcm2835.h:798
void bcm2835_i2c_end(void)
Definition: bcm2835.c:769
Definition: bcm2835.h:892
Definition: bcm2835.h:739
int bcm2835_close(void)
Definition: bcm2835.c:1416
Definition: bcm2835.h:675
void bcm2835_spi_transfernb(char *tbuf, char *rbuf, uint32_t len)
Definition: bcm2835.c:630
Definition: bcm2835.h:953
uint32_t bcm2835_peri_read(volatile uint32_t *paddr)
Definition: bcm2835.c:112
Definition: bcm2835.h:662
void bcm2835_gpio_afen(uint8_t pin)
Definition: bcm2835.c:374
void bcm2835_spi_setDataMode(uint8_t mode)
Definition: bcm2835.c:585
Definition: bcm2835.h:787
Definition: bcm2835.h:789
void bcm2835_peri_write_nb(volatile uint32_t *paddr, uint32_t value)
Definition: bcm2835.c:166
Definition: bcm2835.h:758
Definition: bcm2835.h:752
bcm2835I2CReasonCodes
bcm2835I2CReasonCodes Specifies the reason codes for the bcm2835_i2c_write and bcm2835_i2c_read funct...
Definition: bcm2835.h:961
Definition: bcm2835.h:600
Definition: bcm2835.h:965
Definition: bcm2835.h:794
Definition: bcm2835.h:604
Definition: bcm2835.h:759
Definition: bcm2835.h:963
Definition: bcm2835.h:703
Definition: bcm2835.h:896
Definition: bcm2835.h:788
Definition: bcm2835.h:743
uint32_t bcm2835_gpio_pad(uint8_t group)
Definition: bcm2835.c:407
Definition: bcm2835.h:603
uint8_t bcm2835_spi_transfer(uint8_t value)
Definition: bcm2835.c:593
void bcm2835_gpio_pudclk(uint8_t pin, uint8_t on)
Definition: bcm2835.c:399
Definition: bcm2835.h:676
Definition: bcm2835.h:757
Definition: bcm2835.h:606
Definition: bcm2835.h:781
uint32_t bcm2835_gpio_eds_multi(uint32_t mask)
Definition: bcm2835.c:271
Definition: bcm2835.h:905
Definition: bcm2835.h:871
uint32_t * bcm2835_regbase(uint8_t regbase)
Definition: bcm2835.c:75
Definition: bcm2835.h:724
Definition: bcm2835.h:660
uint32_t * bcm2835_peripherals
Definition: bcm2835.c:46
Definition: bcm2835.h:756
Definition: bcm2835.h:674
Definition: bcm2835.h:790
volatile uint32_t * bcm2835_gpio
Definition: bcm2835.c:50
Definition: bcm2835.h:734
Definition: bcm2835.h:966
Definition: bcm2835.h:702
Definition: bcm2835.h:903
Definition: bcm2835.h:771
void bcm2835_i2c_set_baudrate(uint32_t baudrate)
Definition: bcm2835.c:813
Definition: bcm2835.h:890
void bcm2835_pwm_set_data(uint8_t channel, uint32_t data)
Definition: bcm2835.c:1273
void bcm2835_delayMicroseconds(uint64_t micros)
Definition: bcm2835.c:442
void bcm2835_gpio_clr_ren(uint8_t pin)
Definition: bcm2835.c:301
volatile uint32_t * bcm2835_pads
Definition: bcm2835.c:53
bcm2835FunctionSelect
bcm2835PortFunction Port function select modes for bcm2835_gpio_fsel()
Definition: bcm2835.h:656
void bcm2835_set_debug(uint8_t debug)
Definition: bcm2835.c:99
Definition: bcm2835.h:704
Definition: bcm2835.h:725
uint8_t bcm2835_i2c_read(char *buf, uint32_t len)
Definition: bcm2835.c:893
Definition: bcm2835.h:797
Definition: bcm2835.h:858
volatile uint32_t * bcm2835_bsc0
Definition: bcm2835.c:55
Definition: bcm2835.h:782
Definition: bcm2835.h:800
Definition: bcm2835.h:729
Definition: bcm2835.h:900
void bcm2835_spi_setBitOrder(uint8_t order)
void bcm2835_gpio_set_pad(uint8_t group, uint32_t control)
Definition: bcm2835.c:420
Definition: bcm2835.h:764
Definition: bcm2835.h:733
void bcm2835_peri_set_bits(volatile uint32_t *paddr, uint32_t value, uint32_t mask)
Definition: bcm2835.c:182
void bcm2835_st_delay(uint64_t offset_micros, uint64_t micros)
Definition: bcm2835.c:1195
Definition: bcm2835.h:897
Definition: bcm2835.h:735
uint32_t * bcm2835_peripherals_base
Definition: bcm2835.c:41
Definition: bcm2835.h:605
Definition: bcm2835.h:779
void bcm2835_gpio_len(uint8_t pin)
Definition: bcm2835.c:342
bcm2835SPIBitOrder
bcm2835SPIBitOrder SPI Bit order Specifies the SPI data bit ordering for bcm2835_spi_setBitOrder() ...
Definition: bcm2835.h:846
void bcm2835_gpio_clr_len(uint8_t pin)
Definition: bcm2835.c:349
Definition: bcm2835.h:898
volatile uint32_t * bcm2835_pwm
Definition: bcm2835.c:51
Definition: bcm2835.h:738
Definition: bcm2835.h:799
uint32_t bcm2835_peripherals_size
Definition: bcm2835.c:42
void bcm2835_gpio_ren(uint8_t pin)
Definition: bcm2835.c:294
Definition: bcm2835.h:663
Definition: bcm2835.h:784
void bcm2835_gpio_clr(uint8_t pin)
Definition: bcm2835.c:230
Definition: bcm2835.h:728
Definition: bcm2835.h:747
Definition: bcm2835.h:792
Definition: bcm2835.h:772
void bcm2835_spi_transfern(char *buf, uint32_t len)
Definition: bcm2835.c:718
Definition: bcm2835.h:901
Definition: bcm2835.h:727
Definition: bcm2835.h:665
void bcm2835_gpio_set_eds_multi(uint32_t mask)
Definition: bcm2835.c:287
Definition: bcm2835.h:666
void bcm2835_spi_chipSelect(uint8_t cs)
Definition: bcm2835.c:723
Definition: bcm2835.h:899
Definition: bcm2835.h:859
Definition: bcm2835.h:776
Definition: bcm2835.h:783
Definition: bcm2835.h:773
void bcm2835_gpio_clr_aren(uint8_t pin)
Definition: bcm2835.c:365
volatile uint32_t * bcm2835_bsc1
Definition: bcm2835.c:56
Definition: bcm2835.h:891
void bcm2835_spi_writenb(char *buf, uint32_t len)
Definition: bcm2835.c:673
Definition: bcm2835.h:732
Definition: bcm2835.h:726
Definition: bcm2835.h:767
Definition: bcm2835.h:895
Definition: bcm2835.h:607
void bcm2835_gpio_write_multi(uint32_t mask, uint8_t on)
Definition: bcm2835.c:492
void bcm2835_gpio_clr_afen(uint8_t pin)
Definition: bcm2835.c:381
void bcm2835_gpio_clr_fen(uint8_t pin)
Definition: bcm2835.c:317
void bcm2835_pwm_set_range(uint8_t channel, uint32_t range)
Definition: bcm2835.c:1261
void bcm2835_gpio_write_mask(uint32_t value, uint32_t mask)
Definition: bcm2835.c:501
Definition: bcm2835.h:770
bcm2835PadGroup
bcm2835PadGroup Pad group specification for bcm2835_gpio_pad()
Definition: bcm2835.h:700
Definition: bcm2835.h:723
void bcm2835_gpio_clr_multi(uint32_t mask)
Definition: bcm2835.c:245
void bcm2835_gpio_pud(uint8_t pud)
Definition: bcm2835.c:390
Definition: bcm2835.h:868
Definition: bcm2835.h:765
Definition: bcm2835.h:795
bcm2835I2CClockDivider
bcm2835I2CClockDivider Specifies the divider used to generate the I2C clock from the system clock...
Definition: bcm2835.h:950
Definition: bcm2835.h:745
Definition: bcm2835.h:762
void bcm2835_gpio_set_pud(uint8_t pin, uint8_t pud)
Definition: bcm2835.c:525
Definition: bcm2835.h:849
void bcm2835_peri_write(volatile uint32_t *paddr, uint32_t value)
Definition: bcm2835.c:151
void bcm2835_pwm_set_mode(uint8_t channel, uint8_t markspace, uint8_t enabled)
Definition: bcm2835.c:1224
bcm2835SPIClockDivider
bcm2835SPIClockDivider Specifies the divider used to generate the SPI clock from the system clock...
Definition: bcm2835.h:888
Definition: bcm2835.h:955
bcm2835SPIMode
SPI Data mode Specify the SPI data mode to be passed to bcm2835_spi_setDataMode() ...
Definition: bcm2835.h:855
void bcm2835_spi_setChipSelectPolarity(uint8_t cs, uint8_t active)
Definition: bcm2835.c:730
Definition: bcm2835.h:659
void bcm2835_i2c_setClockDivider(uint16_t divider)
Definition: bcm2835.c:797
void bcm2835_spi_setClockDivider(uint16_t divider)
Definition: bcm2835.c:579
Definition: bcm2835.h:736
Definition: bcm2835.h:860
Definition: bcm2835.h:796
bcm2835RegisterBase
bcm2835RegisterBase Register bases for bcm2835_regbase()
Definition: bcm2835.h:598
void bcm2835_gpio_write(uint8_t pin, uint8_t on)
Definition: bcm2835.c:483
Definition: bcm2835.h:755
void bcm2835_delay(unsigned int millis)
Definition: bcm2835.c:432
Definition: bcm2835.h:742