bcm2835 1.75
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.26 2020/01/11 05:07:13 mikem Exp mikem $
8*/
9
652/* Defines for BCM2835 */
653#ifndef BCM2835_H
654#define BCM2835_H
655
656#include <stdint.h>
657
658/* Some compilers need this, as reported by Sam James */
659#include <sys/types.h>
660/* Needed to compile with gcc -std=c99, as reported by John Blaiklock.*/
661#include <fcntl.h>
662
663#define BCM2835_VERSION 10075 /* Version 1.75 */
664
665// Define this if you want to use libcap2 to determine if you have the cap_sys_rawio capability
666// and therefore the capability of opening /dev/mem, even if you are not root.
667// See the comments above in the documentation for 'Running As Root'
668//#define BCM2835_HAVE_LIBCAP
669
670/* RPi 2 is ARM v7, and has DMB instruction for memory barriers.
671 Older RPis are ARM v6 and don't, so a coprocessor instruction must be used instead.
672 However, not all versions of gcc in all distros support the dmb assembler instruction even on compatible processors.
673 This test is so any ARMv7 or higher processors with suitable GCC will use DMB.
674*/
675#if __ARM_ARCH >= 7
676#define BCM2835_HAVE_DMB
677#endif
678
685#define HIGH 0x1
687#define LOW 0x0
688
690#ifndef MIN
691#define MIN(a, b) (a < b ? a : b)
692#endif
693
695#define BCM2835_CORE_CLK_HZ 250000000
698#define BMC2835_RPI2_DT_FILENAME "/proc/device-tree/soc/ranges"
699
707#define BCM2835_PERI_BASE 0x20000000
709#define BCM2835_PERI_SIZE 0x01000000
711#define BCM2835_RPI2_PERI_BASE 0x3F000000
713#define BCM2835_RPI4_PERI_BASE 0xFE000000
715#define BCM2835_RPI4_PERI_SIZE 0x01800000
716
720#define BCM2835_ST_BASE 0x3000
722#define BCM2835_GPIO_PADS 0x100000
724#define BCM2835_CLOCK_BASE 0x101000
726#define BCM2835_GPIO_BASE 0x200000
728#define BCM2835_SPI0_BASE 0x204000
730#define BCM2835_BSC0_BASE 0x205000
732#define BCM2835_GPIO_PWM 0x20C000
734#define BCM2835_AUX_BASE 0x215000
736#define BCM2835_SPI1_BASE 0x215080
738#define BCM2835_SPI2_BASE 0x2150C0
740#define BCM2835_BSC1_BASE 0x804000
741
742/* BEB */
744#define BCM2835_SMI_BASE 0x600000
745
746#include <stdlib.h>
747
751extern off_t bcm2835_peripherals_base;
753extern size_t bcm2835_peripherals_size;
754
756extern uint32_t *bcm2835_peripherals;
757
761extern volatile uint32_t *bcm2835_st;
762
766extern volatile uint32_t *bcm2835_gpio;
767
771extern volatile uint32_t *bcm2835_pwm;
772
776extern volatile uint32_t *bcm2835_clk;
777
781extern volatile uint32_t *bcm2835_pads;
782
786extern volatile uint32_t *bcm2835_spi0;
787
791extern volatile uint32_t *bcm2835_bsc0;
792
796extern volatile uint32_t *bcm2835_bsc1;
797
801extern volatile uint32_t *bcm2835_aux;
802
806extern volatile uint32_t *bcm2835_spi1;
807
808/* BEB */
812extern volatile uint32_t *bcm2835_smi;
813
817typedef enum
818{
829 /* BEB */
833
835#define BCM2835_PAGE_SIZE (4*1024)
837#define BCM2835_BLOCK_SIZE (4*1024)
838
839
840/* Defines for GPIO
841 The BCM2835 has 54 GPIO pins.
842 BCM2835 data sheet, Page 90 onwards.
843*/
847#define BCM2835_GPFSEL0 0x0000
848#define BCM2835_GPFSEL1 0x0004
849#define BCM2835_GPFSEL2 0x0008
850#define BCM2835_GPFSEL3 0x000c
851#define BCM2835_GPFSEL4 0x0010
852#define BCM2835_GPFSEL5 0x0014
853#define BCM2835_GPSET0 0x001c
854#define BCM2835_GPSET1 0x0020
855#define BCM2835_GPCLR0 0x0028
856#define BCM2835_GPCLR1 0x002c
857#define BCM2835_GPLEV0 0x0034
858#define BCM2835_GPLEV1 0x0038
859#define BCM2835_GPEDS0 0x0040
860#define BCM2835_GPEDS1 0x0044
861#define BCM2835_GPREN0 0x004c
862#define BCM2835_GPREN1 0x0050
863#define BCM2835_GPFEN0 0x0058
864#define BCM2835_GPFEN1 0x005c
865#define BCM2835_GPHEN0 0x0064
866#define BCM2835_GPHEN1 0x0068
867#define BCM2835_GPLEN0 0x0070
868#define BCM2835_GPLEN1 0x0074
869#define BCM2835_GPAREN0 0x007c
870#define BCM2835_GPAREN1 0x0080
871#define BCM2835_GPAFEN0 0x0088
872#define BCM2835_GPAFEN1 0x008c
873#define BCM2835_GPPUD 0x0094
874#define BCM2835_GPPUDCLK0 0x0098
875#define BCM2835_GPPUDCLK1 0x009c
877/* 2711 has a different method for pin pull-up/down/enable */
878#define BCM2835_GPPUPPDN0 0x00e4 /* Pin pull-up/down for pins 15:0 */
879#define BCM2835_GPPUPPDN1 0x00e8 /* Pin pull-up/down for pins 31:16 */
880#define BCM2835_GPPUPPDN2 0x00ec /* Pin pull-up/down for pins 47:32 */
881#define BCM2835_GPPUPPDN3 0x00f0 /* Pin pull-up/down for pins 57:48 */
882
886typedef enum
887{
898
902typedef enum
903{
906 BCM2835_GPIO_PUD_UP = 0x02
908
909/* need a value for pud functions that can't work unless RPI 4 */
910#define BCM2835_GPIO_PUD_ERROR 0x08
911
913#define BCM2835_PADS_GPIO_0_27 0x002c
914#define BCM2835_PADS_GPIO_28_45 0x0030
915#define BCM2835_PADS_GPIO_46_53 0x0034
918#define BCM2835_PAD_PASSWRD (0x5A << 24)
919#define BCM2835_PAD_SLEW_RATE_UNLIMITED 0x10
920#define BCM2835_PAD_HYSTERESIS_ENABLED 0x08
921#define BCM2835_PAD_DRIVE_2mA 0x00
922#define BCM2835_PAD_DRIVE_4mA 0x01
923#define BCM2835_PAD_DRIVE_6mA 0x02
924#define BCM2835_PAD_DRIVE_8mA 0x03
925#define BCM2835_PAD_DRIVE_10mA 0x04
926#define BCM2835_PAD_DRIVE_12mA 0x05
927#define BCM2835_PAD_DRIVE_14mA 0x06
928#define BCM2835_PAD_DRIVE_16mA 0x07
933typedef enum
934{
939
954typedef enum
955{
974 /* RPi Version 2 */
1002 /* RPi Version 2, new plug P5 */
1008 /* RPi B+ J8 header, also RPi 2 40 pin GPIO header */
1036
1037/* Defines for AUX
1038 GPIO register offsets from BCM2835_AUX_BASE.
1039*/
1040#define BCM2835_AUX_IRQ 0x0000
1041#define BCM2835_AUX_ENABLE 0x0004
1043#define BCM2835_AUX_ENABLE_UART1 0x01
1044#define BCM2835_AUX_ENABLE_SPI0 0x02
1045#define BCM2835_AUX_ENABLE_SPI1 0x04
1048#define BCM2835_AUX_SPI_CNTL0 0x0000
1049#define BCM2835_AUX_SPI_CNTL1 0x0004
1050#define BCM2835_AUX_SPI_STAT 0x0008
1051#define BCM2835_AUX_SPI_PEEK 0x000C
1052#define BCM2835_AUX_SPI_IO 0x0020
1053#define BCM2835_AUX_SPI_TXHOLD 0x0030
1055#define BCM2835_AUX_SPI_CLOCK_MIN 30500
1056#define BCM2835_AUX_SPI_CLOCK_MAX 125000000
1058#define BCM2835_AUX_SPI_CNTL0_SPEED 0xFFF00000
1059#define BCM2835_AUX_SPI_CNTL0_SPEED_MAX 0xFFF
1060#define BCM2835_AUX_SPI_CNTL0_SPEED_SHIFT 20
1062#define BCM2835_AUX_SPI_CNTL0_CS0_N 0x000C0000
1063#define BCM2835_AUX_SPI_CNTL0_CS1_N 0x000A0000
1064#define BCM2835_AUX_SPI_CNTL0_CS2_N 0x00060000
1066#define BCM2835_AUX_SPI_CNTL0_POSTINPUT 0x00010000
1067#define BCM2835_AUX_SPI_CNTL0_VAR_CS 0x00008000
1068#define BCM2835_AUX_SPI_CNTL0_VAR_WIDTH 0x00004000
1069#define BCM2835_AUX_SPI_CNTL0_DOUTHOLD 0x00003000
1070#define BCM2835_AUX_SPI_CNTL0_ENABLE 0x00000800
1071#define BCM2835_AUX_SPI_CNTL0_CPHA_IN 0x00000400
1072#define BCM2835_AUX_SPI_CNTL0_CLEARFIFO 0x00000200
1073#define BCM2835_AUX_SPI_CNTL0_CPHA_OUT 0x00000100
1074#define BCM2835_AUX_SPI_CNTL0_CPOL 0x00000080
1075#define BCM2835_AUX_SPI_CNTL0_MSBF_OUT 0x00000040
1076#define BCM2835_AUX_SPI_CNTL0_SHIFTLEN 0x0000003F
1078#define BCM2835_AUX_SPI_CNTL1_CSHIGH 0x00000700
1079#define BCM2835_AUX_SPI_CNTL1_IDLE 0x00000080
1080#define BCM2835_AUX_SPI_CNTL1_TXEMPTY 0x00000040
1081#define BCM2835_AUX_SPI_CNTL1_MSBF_IN 0x00000002
1082#define BCM2835_AUX_SPI_CNTL1_KEEP_IN 0x00000001
1084#define BCM2835_AUX_SPI_STAT_TX_LVL 0xF0000000
1085#define BCM2835_AUX_SPI_STAT_RX_LVL 0x00F00000
1086#define BCM2835_AUX_SPI_STAT_TX_FULL 0x00000400
1087#define BCM2835_AUX_SPI_STAT_TX_EMPTY 0x00000200
1088#define BCM2835_AUX_SPI_STAT_RX_FULL 0x00000100
1089#define BCM2835_AUX_SPI_STAT_RX_EMPTY 0x00000080
1090#define BCM2835_AUX_SPI_STAT_BUSY 0x00000040
1091#define BCM2835_AUX_SPI_STAT_BITCOUNT 0x0000003F
1093/* Defines for SPI
1094 GPIO register offsets from BCM2835_SPI0_BASE.
1095 Offsets into the SPI Peripheral block in bytes per 10.5 SPI Register Map
1096*/
1097#define BCM2835_SPI0_CS 0x0000
1098#define BCM2835_SPI0_FIFO 0x0004
1099#define BCM2835_SPI0_CLK 0x0008
1100#define BCM2835_SPI0_DLEN 0x000c
1101#define BCM2835_SPI0_LTOH 0x0010
1102#define BCM2835_SPI0_DC 0x0014
1104/* Register masks for SPI0_CS */
1105#define BCM2835_SPI0_CS_LEN_LONG 0x02000000
1106#define BCM2835_SPI0_CS_DMA_LEN 0x01000000
1107#define BCM2835_SPI0_CS_CSPOL2 0x00800000
1108#define BCM2835_SPI0_CS_CSPOL1 0x00400000
1109#define BCM2835_SPI0_CS_CSPOL0 0x00200000
1110#define BCM2835_SPI0_CS_RXF 0x00100000
1111#define BCM2835_SPI0_CS_RXR 0x00080000
1112#define BCM2835_SPI0_CS_TXD 0x00040000
1113#define BCM2835_SPI0_CS_RXD 0x00020000
1114#define BCM2835_SPI0_CS_DONE 0x00010000
1115#define BCM2835_SPI0_CS_TE_EN 0x00008000
1116#define BCM2835_SPI0_CS_LMONO 0x00004000
1117#define BCM2835_SPI0_CS_LEN 0x00002000
1118#define BCM2835_SPI0_CS_REN 0x00001000
1119#define BCM2835_SPI0_CS_ADCS 0x00000800
1120#define BCM2835_SPI0_CS_INTR 0x00000400
1121#define BCM2835_SPI0_CS_INTD 0x00000200
1122#define BCM2835_SPI0_CS_DMAEN 0x00000100
1123#define BCM2835_SPI0_CS_TA 0x00000080
1124#define BCM2835_SPI0_CS_CSPOL 0x00000040
1125#define BCM2835_SPI0_CS_CLEAR 0x00000030
1126#define BCM2835_SPI0_CS_CLEAR_RX 0x00000020
1127#define BCM2835_SPI0_CS_CLEAR_TX 0x00000010
1128#define BCM2835_SPI0_CS_CPOL 0x00000008
1129#define BCM2835_SPI0_CS_CPHA 0x00000004
1130#define BCM2835_SPI0_CS_CS 0x00000003
1135typedef enum
1136{
1140
1144typedef enum
1145{
1151
1155typedef enum
1156{
1162
1177typedef enum
1178{
1197
1198/* Defines for I2C
1199 GPIO register offsets from BCM2835_BSC*_BASE.
1200 Offsets into the BSC Peripheral block in bytes per 3.1 BSC Register Map
1201*/
1202#define BCM2835_BSC_C 0x0000
1203#define BCM2835_BSC_S 0x0004
1204#define BCM2835_BSC_DLEN 0x0008
1205#define BCM2835_BSC_A 0x000c
1206#define BCM2835_BSC_FIFO 0x0010
1207#define BCM2835_BSC_DIV 0x0014
1208#define BCM2835_BSC_DEL 0x0018
1209#define BCM2835_BSC_CLKT 0x001c
1211/* Register masks for BSC_C */
1212#define BCM2835_BSC_C_I2CEN 0x00008000
1213#define BCM2835_BSC_C_INTR 0x00000400
1214#define BCM2835_BSC_C_INTT 0x00000200
1215#define BCM2835_BSC_C_INTD 0x00000100
1216#define BCM2835_BSC_C_ST 0x00000080
1217#define BCM2835_BSC_C_CLEAR_1 0x00000020
1218#define BCM2835_BSC_C_CLEAR_2 0x00000010
1219#define BCM2835_BSC_C_READ 0x00000001
1221/* Register masks for BSC_S */
1222#define BCM2835_BSC_S_CLKT 0x00000200
1223#define BCM2835_BSC_S_ERR 0x00000100
1224#define BCM2835_BSC_S_RXF 0x00000080
1225#define BCM2835_BSC_S_TXE 0x00000040
1226#define BCM2835_BSC_S_RXD 0x00000020
1227#define BCM2835_BSC_S_TXD 0x00000010
1228#define BCM2835_BSC_S_RXR 0x00000008
1229#define BCM2835_BSC_S_TXW 0x00000004
1230#define BCM2835_BSC_S_DONE 0x00000002
1231#define BCM2835_BSC_S_TA 0x00000001
1233#define BCM2835_BSC_FIFO_SIZE 16
1234#define BCM2835_AUX_SPI_FIFO_SIZE 4
1235
1240typedef enum
1241{
1247
1251typedef enum
1252{
1260
1261/* Registers offets from BCM2835_SMI_BASE */
1262#define BCM2835_SMI_CS 0
1263#define BCM2835_SMI_LENGTH 1
1264#define BCM2835_SMI_ADRS 2
1265#define BCM2835_SMI_DATA 3
1266#define BCM2835_SMI_READ0 4
1267#define BCM2835_SMI_WRITE0 5
1268#define BCM2835_SMI_READ1 6
1269#define BCM2835_SMI_WRITE1 7
1270#define BCM2835_SMI_READ2 8
1271#define BCM2835_SMI_WRITE2 9
1272#define BCM2835_SMI_READ3 10
1273#define BCM2835_SMI_WRITE3 11
1274#define BCM2835_SMI_DMAC 12
1275#define BCM2835_SMI_DIRCS 13
1276#define BCM2835_SMI_DIRADDR 14
1277#define BCM2835_SMI_DIRDATA 15
1279/* Register masks for SMI_READ and SMI_WRITE */
1280#define BCM2835_SMI_RW_WIDTH_MSK 0xC0000000
1281#define BCM2835_SMI_RW_WID8 0x00000000
1282#define BCM2835_SMI_RW_WID16 0x40000000
1283#define BCM2835_SMI_RW_WID18 0x80000000
1284#define BCM2835_SMI_RW_WID9 0xC0000000
1285#define BCM2835_SMI_RW_SETUP_MSK 0x3F000000
1286#define BCM2835_SMI_RW_SETUP_LS 24
1287#define BCM2835_SMI_RW_MODE68 0x00800000
1288#define BCM2835_SMI_RW_MODE80 0x00000000
1289#define BCM2835_SMI_READ_FSETUP 0x00400000
1290#define BCM2835_SMI_WRITE_SWAP 0x00400000
1291#define BCM2835_SMI_RW_HOLD_MSK 0x003F0000
1292#define BCM2835_SMI_RW_HOLD_LS 16
1293#define BCM2835_SMI_RW_PACEALL 0x00008000
1294#define BCM2835_SMI_RW_PACE_MSK 0x00007F00
1295#define BCM2835_SMI_RW_PACE_LS 8
1296#define BCM2835_SMI_RW_DREQ 0x00000080
1297#define BCM2835_SMI_RW_STROBE_MSK 0x0000007F
1298#define BCM2835_SMI_RW_STROBE_LS 0
1300/* Registers masks for Direct Access control register */
1301#define BCM2835_SMI_DIRCS_ENABLE 0x00000001
1302#define BCM2835_SMI_DIRCS_START 0x00000002
1303#define BCM2835_SMI_DIRCS_DONE 0x00000004
1304#define BCM2835_SMI_DIRCS_WRITE 0x00000008
1306/* Registers masks for Direct Access address register */
1307#define BCM2835_SMI_DIRADRS_DEV_MSK 0x00000300
1308#define BCM2835_SMI_DIRADRS_DEV_LS 8
1309#define BCM2835_SMI_DIRADRS_DEV0 0x00000000
1310#define BCM2835_SMI_DIRADRS_DEV1 0x00000100
1311#define BCM2835_SMI_DIRADRS_DEV2 0x00000200
1312#define BCM2835_SMI_DIRADRS_DEV3 0x00000300
1313#define BCM2835_SMI_DIRADRS_MSK 0x0000003F
1314#define BCM2835_SMI_DIRADRS_LS 0
1316/* SMI clock control registers : defined as offset from bcm2835_clk */
1317#define SMICLK_CNTL (44) /* = 0xB0 */
1318#define SMICLK_DIV (45) /* = 0xB4 */
1319
1320
1321/* Defines for ST
1322 GPIO register offsets from BCM2835_ST_BASE.
1323 Offsets into the ST Peripheral block in bytes per 12.1 System Timer Registers
1324 The System Timer peripheral provides four 32-bit timer channels and a single 64-bit free running counter.
1325 BCM2835_ST_CLO is the System Timer Counter Lower bits register.
1326 The system timer free-running counter lower register is a read-only register that returns the current value
1327 of the lower 32-bits of the free running counter.
1328 BCM2835_ST_CHI is the System Timer Counter Upper bits register.
1329 The system timer free-running counter upper register is a read-only register that returns the current value
1330 of the upper 32-bits of the free running counter.
1331*/
1332#define BCM2835_ST_CS 0x0000
1333#define BCM2835_ST_CLO 0x0004
1334#define BCM2835_ST_CHI 0x0008
1339/* Defines for PWM, word offsets (ie 4 byte multiples) */
1340#define BCM2835_PWM_CONTROL 0
1341#define BCM2835_PWM_STATUS 1
1342#define BCM2835_PWM_DMAC 2
1343#define BCM2835_PWM0_RANGE 4
1344#define BCM2835_PWM0_DATA 5
1345#define BCM2835_PWM_FIF1 6
1346#define BCM2835_PWM1_RANGE 8
1347#define BCM2835_PWM1_DATA 9
1348
1349/* Defines for PWM Clock, word offsets (ie 4 byte multiples) */
1350#define BCM2835_PWMCLK_CNTL 40
1351#define BCM2835_PWMCLK_DIV 41
1352#define BCM2835_PWM_PASSWRD (0x5A << 24)
1354#define BCM2835_PWM1_MS_MODE 0x8000
1355#define BCM2835_PWM1_USEFIFO 0x2000
1356#define BCM2835_PWM1_REVPOLAR 0x1000
1357#define BCM2835_PWM1_OFFSTATE 0x0800
1358#define BCM2835_PWM1_REPEATFF 0x0400
1359#define BCM2835_PWM1_SERIAL 0x0200
1360#define BCM2835_PWM1_ENABLE 0x0100
1362#define BCM2835_PWM0_MS_MODE 0x0080
1363#define BCM2835_PWM_CLEAR_FIFO 0x0040
1364#define BCM2835_PWM0_USEFIFO 0x0020
1365#define BCM2835_PWM0_REVPOLAR 0x0010
1366#define BCM2835_PWM0_OFFSTATE 0x0008
1367#define BCM2835_PWM0_REPEATFF 0x0004
1368#define BCM2835_PWM0_SERIAL 0x0002
1369#define BCM2835_PWM0_ENABLE 0x0001
1377typedef enum
1378{
1379 BCM2835_PWM_CLOCK_DIVIDER_2048 = 2048,
1380 BCM2835_PWM_CLOCK_DIVIDER_1024 = 1024,
1381 BCM2835_PWM_CLOCK_DIVIDER_512 = 512,
1382 BCM2835_PWM_CLOCK_DIVIDER_256 = 256,
1383 BCM2835_PWM_CLOCK_DIVIDER_128 = 128,
1384 BCM2835_PWM_CLOCK_DIVIDER_64 = 64,
1385 BCM2835_PWM_CLOCK_DIVIDER_32 = 32,
1386 BCM2835_PWM_CLOCK_DIVIDER_16 = 16,
1387 BCM2835_PWM_CLOCK_DIVIDER_8 = 8,
1388 BCM2835_PWM_CLOCK_DIVIDER_4 = 4,
1389 BCM2835_PWM_CLOCK_DIVIDER_2 = 2,
1390 BCM2835_PWM_CLOCK_DIVIDER_1 = 1
1391} bcm2835PWMClockDivider;
1392
1393/* Historical name compatibility */
1394#ifndef BCM2835_NO_DELAY_COMPATIBILITY
1395#define delay(x) bcm2835_delay(x)
1396#define delayMicroseconds(x) bcm2835_delayMicroseconds(x)
1397#endif
1398
1399#ifdef __cplusplus
1400extern "C" {
1401#endif
1402
1421 extern int bcm2835_init(void);
1422
1426 extern int bcm2835_close(void);
1427
1435 extern void bcm2835_set_debug(uint8_t debug);
1436
1440 extern unsigned int bcm2835_version(void);
1441
1457 extern uint32_t* bcm2835_regbase(uint8_t regbase);
1458
1467 extern uint32_t bcm2835_peri_read(volatile uint32_t* paddr);
1468
1479 extern uint32_t bcm2835_peri_read_nb(volatile uint32_t* paddr);
1480
1481
1493 extern void bcm2835_peri_write(volatile uint32_t* paddr, uint32_t value);
1494
1507 extern void bcm2835_peri_write_nb(volatile uint32_t* paddr, uint32_t value);
1508
1521 extern void bcm2835_peri_set_bits(volatile uint32_t* paddr, uint32_t value, uint32_t mask);
1535 extern void bcm2835_gpio_fsel(uint8_t pin, uint8_t mode);
1536
1542 extern void bcm2835_gpio_set(uint8_t pin);
1543
1549 extern void bcm2835_gpio_clr(uint8_t pin);
1550
1556 extern void bcm2835_gpio_set_multi(uint32_t mask);
1557
1563 extern void bcm2835_gpio_clr_multi(uint32_t mask);
1564
1571 extern uint8_t bcm2835_gpio_lev(uint8_t pin);
1572
1581 extern uint8_t bcm2835_gpio_eds(uint8_t pin);
1582
1588 extern uint32_t bcm2835_gpio_eds_multi(uint32_t mask);
1589
1595 extern void bcm2835_gpio_set_eds(uint8_t pin);
1596
1601 extern void bcm2835_gpio_set_eds_multi(uint32_t mask);
1602
1611 extern void bcm2835_gpio_ren(uint8_t pin);
1612
1616 extern void bcm2835_gpio_clr_ren(uint8_t pin);
1617
1626 extern void bcm2835_gpio_fen(uint8_t pin);
1627
1631 extern void bcm2835_gpio_clr_fen(uint8_t pin);
1632
1637 extern void bcm2835_gpio_hen(uint8_t pin);
1638
1642 extern void bcm2835_gpio_clr_hen(uint8_t pin);
1643
1648 extern void bcm2835_gpio_len(uint8_t pin);
1649
1653 extern void bcm2835_gpio_clr_len(uint8_t pin);
1654
1661 extern void bcm2835_gpio_aren(uint8_t pin);
1662
1666 extern void bcm2835_gpio_clr_aren(uint8_t pin);
1667
1674 extern void bcm2835_gpio_afen(uint8_t pin);
1675
1679 extern void bcm2835_gpio_clr_afen(uint8_t pin);
1680
1689 extern void bcm2835_gpio_pud(uint8_t pud);
1690
1701 extern void bcm2835_gpio_pudclk(uint8_t pin, uint8_t on);
1702
1708 extern uint32_t bcm2835_gpio_pad(uint8_t group);
1709
1717 extern void bcm2835_gpio_set_pad(uint8_t group, uint32_t control);
1718
1729 extern void bcm2835_delay (unsigned int millis);
1730
1744 extern void bcm2835_delayMicroseconds (uint64_t micros);
1745
1750 extern void bcm2835_gpio_write(uint8_t pin, uint8_t on);
1751
1756 extern void bcm2835_gpio_write_multi(uint32_t mask, uint8_t on);
1757
1762 extern void bcm2835_gpio_write_mask(uint32_t value, uint32_t mask);
1763
1769 extern void bcm2835_gpio_set_pud(uint8_t pin, uint8_t pud);
1770
1777 extern uint8_t bcm2835_gpio_get_pud(uint8_t pin);
1778
1795 extern int bcm2835_spi_begin(void);
1796
1801 extern void bcm2835_spi_end(void);
1802
1810 extern void bcm2835_spi_setBitOrder(uint8_t order);
1811
1817 extern void bcm2835_spi_setClockDivider(uint16_t divider);
1818
1823 extern void bcm2835_spi_set_speed_hz(uint32_t speed_hz);
1824
1830 extern void bcm2835_spi_setDataMode(uint8_t mode);
1831
1838 extern void bcm2835_spi_chipSelect(uint8_t cs);
1839
1848 extern void bcm2835_spi_setChipSelectPolarity(uint8_t cs, uint8_t active);
1849
1860 extern uint8_t bcm2835_spi_transfer(uint8_t value);
1861
1873 extern void bcm2835_spi_transfernb(char* tbuf, char* rbuf, uint32_t len);
1874
1882 extern void bcm2835_spi_transfern(char* buf, uint32_t len);
1883
1890 extern void bcm2835_spi_writenb(const char* buf, uint32_t len);
1891
1900 extern void bcm2835_spi_write(uint16_t data);
1901
1907 extern int bcm2835_aux_spi_begin(void);
1908
1913 extern void bcm2835_aux_spi_end(void);
1914
1918 extern void bcm2835_aux_spi_setClockDivider(uint16_t divider);
1919
1925 extern uint16_t bcm2835_aux_spi_CalcClockDivider(uint32_t speed_hz);
1926
1933 extern void bcm2835_aux_spi_write(uint16_t data);
1934
1940 extern void bcm2835_aux_spi_writenb(const char *buf, uint32_t len);
1941
1949 extern void bcm2835_aux_spi_transfern(char *buf, uint32_t len);
1950
1959 extern void bcm2835_aux_spi_transfernb(const char *tbuf, char *rbuf, uint32_t len);
1960
1968 extern uint8_t bcm2835_aux_spi_transfer(uint8_t value);
1969
1986 extern int bcm2835_i2c_begin(void);
1987
1992 extern void bcm2835_i2c_end(void);
1993
1997 extern void bcm2835_i2c_setSlaveAddress(uint8_t addr);
1998
2003 extern void bcm2835_i2c_setClockDivider(uint16_t divider);
2004
2011 extern void bcm2835_i2c_set_baudrate(uint32_t baudrate);
2012
2019 extern uint8_t bcm2835_i2c_write(const char * buf, uint32_t len);
2020
2027 extern uint8_t bcm2835_i2c_read(char* buf, uint32_t len);
2028
2043 extern uint8_t bcm2835_i2c_read_register_rs(char* regaddr, char* buf, uint32_t len);
2044
2055 extern uint8_t bcm2835_i2c_write_read_rs(char* cmds, uint32_t cmds_len, char* buf, uint32_t buf_len);
2056
2073 extern int bcm2835_smi_begin (void);
2074
2079 extern void bcm2835_smi_end (void);
2080
2094 extern void bcm2835_smi_set_timing(uint32_t smichannel, uint32_t readchannel,
2095 uint32_t setupcycles, uint32_t strobecycles,
2096 uint32_t holdcycles, uint32_t pacecycles);
2097
2105 extern void bcm2835_smi_write (uint32_t smichannel, uint8_t data, uint32_t address);
2106
2114 extern uint32_t bcm2835_smi_read (uint32_t smichannel, uint32_t address);
2115
2127 extern uint64_t bcm2835_st_read(void);
2128
2133 extern void bcm2835_st_delay(uint64_t offset_micros, uint64_t micros);
2134
2150 extern void bcm2835_pwm_set_clock(uint32_t divisor);
2151
2158 extern void bcm2835_pwm_set_mode(uint8_t channel, uint8_t markspace, uint8_t enabled);
2159
2165 extern void bcm2835_pwm_set_range(uint8_t channel, uint32_t range);
2166
2173 extern void bcm2835_pwm_set_data(uint8_t channel, uint32_t data);
2174
2176#ifdef __cplusplus
2177}
2178#endif
2179
2180#endif /* BCM2835_H */
2181
volatile uint32_t * bcm2835_st
Definition: bcm2835.c:61
volatile uint32_t * bcm2835_smi
Definition: bcm2835.c:65
bcm2835PUDControl
bcm2835PUDControl Pullup/Pulldown defines for bcm2835_gpio_pud()
Definition: bcm2835.h:903
bcm2835SPIBitOrder
bcm2835SPIBitOrder SPI Bit order Specifies the SPI data bit ordering for bcm2835_spi_setBitOrder()
Definition: bcm2835.h:1136
bcm2835SPIChipSelect
bcm2835SPIChipSelect Specify the SPI chip select pin(s)
Definition: bcm2835.h:1156
volatile uint32_t * bcm2835_pads
Definition: bcm2835.c:57
bcm2835FunctionSelect
bcm2835PortFunction Port function select modes for bcm2835_gpio_fsel()
Definition: bcm2835.h:887
volatile uint32_t * bcm2835_spi0
Definition: bcm2835.c:58
volatile uint32_t * bcm2835_bsc1
Definition: bcm2835.c:60
volatile uint32_t * bcm2835_bsc0
Definition: bcm2835.c:59
RPiGPIOPin
GPIO Pin Numbers.
Definition: bcm2835.h:955
volatile uint32_t * bcm2835_aux
Definition: bcm2835.c:62
bcm2835SPIMode
SPI Data mode Specify the SPI data mode to be passed to bcm2835_spi_setDataMode()
Definition: bcm2835.h:1145
uint32_t * bcm2835_peripherals
Definition: bcm2835.c:50
volatile uint32_t * bcm2835_gpio
Definition: bcm2835.c:54
bcm2835I2CClockDivider
bcm2835I2CClockDivider Specifies the divider used to generate the I2C clock from the system clock....
Definition: bcm2835.h:1241
size_t bcm2835_peripherals_size
Definition: bcm2835.c:46
bcm2835PadGroup
bcm2835PadGroup Pad group specification for bcm2835_gpio_pad()
Definition: bcm2835.h:934
volatile uint32_t * bcm2835_spi1
Definition: bcm2835.c:63
bcm2835I2CReasonCodes
bcm2835I2CReasonCodes Specifies the reason codes for the bcm2835_i2c_write and bcm2835_i2c_read funct...
Definition: bcm2835.h:1252
volatile uint32_t * bcm2835_clk
Definition: bcm2835.c:56
off_t bcm2835_peripherals_base
Definition: bcm2835.c:45
volatile uint32_t * bcm2835_pwm
Definition: bcm2835.c:55
bcm2835SPIClockDivider
bcm2835SPIClockDivider Specifies the divider used to generate the SPI clock from the system clock....
Definition: bcm2835.h:1178
bcm2835RegisterBase
bcm2835RegisterBase Register bases for bcm2835_regbase()
Definition: bcm2835.h:818
@ BCM2835_GPIO_PUD_DOWN
Definition: bcm2835.h:905
@ BCM2835_GPIO_PUD_UP
Definition: bcm2835.h:906
@ BCM2835_GPIO_PUD_OFF
Definition: bcm2835.h:904
@ BCM2835_SPI_BIT_ORDER_LSBFIRST
Definition: bcm2835.h:1137
@ BCM2835_SPI_BIT_ORDER_MSBFIRST
Definition: bcm2835.h:1138
@ BCM2835_SPI_CS_NONE
Definition: bcm2835.h:1160
@ BCM2835_SPI_CS2
Definition: bcm2835.h:1159
@ BCM2835_SPI_CS1
Definition: bcm2835.h:1158
@ BCM2835_SPI_CS0
Definition: bcm2835.h:1157
@ BCM2835_GPIO_FSEL_ALT3
Definition: bcm2835.h:893
@ BCM2835_GPIO_FSEL_MASK
Definition: bcm2835.h:896
@ BCM2835_GPIO_FSEL_ALT1
Definition: bcm2835.h:891
@ BCM2835_GPIO_FSEL_OUTP
Definition: bcm2835.h:889
@ BCM2835_GPIO_FSEL_ALT5
Definition: bcm2835.h:895
@ BCM2835_GPIO_FSEL_ALT2
Definition: bcm2835.h:892
@ BCM2835_GPIO_FSEL_INPT
Definition: bcm2835.h:888
@ BCM2835_GPIO_FSEL_ALT0
Definition: bcm2835.h:890
@ BCM2835_GPIO_FSEL_ALT4
Definition: bcm2835.h:894
@ RPI_GPIO_P1_26
Definition: bcm2835.h:972
@ RPI_BPLUS_GPIO_J8_32
Definition: bcm2835.h:1028
@ RPI_BPLUS_GPIO_J8_16
Definition: bcm2835.h:1018
@ RPI_V2_GPIO_P5_04
Definition: bcm2835.h:1004
@ RPI_GPIO_P1_03
Definition: bcm2835.h:956
@ RPI_BPLUS_GPIO_J8_03
Definition: bcm2835.h:1009
@ RPI_V2_GPIO_P1_13
Definition: bcm2835.h:982
@ RPI_V2_GPIO_P1_24
Definition: bcm2835.h:990
@ RPI_V2_GPIO_P1_36
Definition: bcm2835.h:997
@ RPI_V2_GPIO_P5_03
Definition: bcm2835.h:1003
@ RPI_GPIO_P1_07
Definition: bcm2835.h:958
@ RPI_V2_GPIO_P1_03
Definition: bcm2835.h:975
@ RPI_GPIO_P1_08
Definition: bcm2835.h:959
@ RPI_GPIO_P1_18
Definition: bcm2835.h:966
@ RPI_BPLUS_GPIO_J8_35
Definition: bcm2835.h:1030
@ RPI_V2_GPIO_P1_07
Definition: bcm2835.h:977
@ RPI_GPIO_P1_16
Definition: bcm2835.h:965
@ RPI_BPLUS_GPIO_J8_08
Definition: bcm2835.h:1012
@ RPI_V2_GPIO_P1_15
Definition: bcm2835.h:983
@ RPI_V2_GPIO_P1_11
Definition: bcm2835.h:980
@ RPI_V2_GPIO_P1_38
Definition: bcm2835.h:999
@ RPI_GPIO_P1_12
Definition: bcm2835.h:962
@ RPI_BPLUS_GPIO_J8_11
Definition: bcm2835.h:1014
@ RPI_BPLUS_GPIO_J8_05
Definition: bcm2835.h:1010
@ RPI_GPIO_P1_22
Definition: bcm2835.h:969
@ RPI_BPLUS_GPIO_J8_26
Definition: bcm2835.h:1025
@ RPI_BPLUS_GPIO_J8_19
Definition: bcm2835.h:1020
@ RPI_V2_GPIO_P1_32
Definition: bcm2835.h:994
@ RPI_V2_GPIO_P1_40
Definition: bcm2835.h:1000
@ RPI_V2_GPIO_P5_06
Definition: bcm2835.h:1006
@ RPI_BPLUS_GPIO_J8_18
Definition: bcm2835.h:1019
@ RPI_GPIO_P1_05
Definition: bcm2835.h:957
@ RPI_V2_GPIO_P1_19
Definition: bcm2835.h:986
@ RPI_V2_GPIO_P1_26
Definition: bcm2835.h:991
@ RPI_BPLUS_GPIO_J8_29
Definition: bcm2835.h:1026
@ RPI_BPLUS_GPIO_J8_21
Definition: bcm2835.h:1021
@ RPI_V2_GPIO_P1_08
Definition: bcm2835.h:978
@ RPI_BPLUS_GPIO_J8_10
Definition: bcm2835.h:1013
@ RPI_V2_GPIO_P1_18
Definition: bcm2835.h:985
@ RPI_V2_GPIO_P1_37
Definition: bcm2835.h:998
@ RPI_V2_GPIO_P1_05
Definition: bcm2835.h:976
@ RPI_V2_GPIO_P1_35
Definition: bcm2835.h:996
@ RPI_GPIO_P1_19
Definition: bcm2835.h:967
@ RPI_GPIO_P1_15
Definition: bcm2835.h:964
@ RPI_BPLUS_GPIO_J8_40
Definition: bcm2835.h:1034
@ RPI_BPLUS_GPIO_J8_12
Definition: bcm2835.h:1015
@ RPI_V2_GPIO_P1_12
Definition: bcm2835.h:981
@ RPI_BPLUS_GPIO_J8_24
Definition: bcm2835.h:1024
@ RPI_GPIO_P1_23
Definition: bcm2835.h:970
@ RPI_BPLUS_GPIO_J8_33
Definition: bcm2835.h:1029
@ RPI_BPLUS_GPIO_J8_37
Definition: bcm2835.h:1032
@ RPI_V2_GPIO_P1_33
Definition: bcm2835.h:995
@ RPI_V2_GPIO_P1_23
Definition: bcm2835.h:989
@ RPI_V2_GPIO_P1_29
Definition: bcm2835.h:992
@ RPI_V2_GPIO_P1_16
Definition: bcm2835.h:984
@ RPI_GPIO_P1_10
Definition: bcm2835.h:960
@ RPI_V2_GPIO_P5_05
Definition: bcm2835.h:1005
@ RPI_BPLUS_GPIO_J8_38
Definition: bcm2835.h:1033
@ RPI_BPLUS_GPIO_J8_13
Definition: bcm2835.h:1016
@ RPI_V2_GPIO_P1_21
Definition: bcm2835.h:987
@ RPI_BPLUS_GPIO_J8_36
Definition: bcm2835.h:1031
@ RPI_V2_GPIO_P1_22
Definition: bcm2835.h:988
@ RPI_GPIO_P1_24
Definition: bcm2835.h:971
@ RPI_GPIO_P1_11
Definition: bcm2835.h:961
@ RPI_V2_GPIO_P1_10
Definition: bcm2835.h:979
@ RPI_GPIO_P1_21
Definition: bcm2835.h:968
@ RPI_BPLUS_GPIO_J8_07
Definition: bcm2835.h:1011
@ RPI_BPLUS_GPIO_J8_15
Definition: bcm2835.h:1017
@ RPI_V2_GPIO_P1_31
Definition: bcm2835.h:993
@ RPI_GPIO_P1_13
Definition: bcm2835.h:963
@ RPI_BPLUS_GPIO_J8_22
Definition: bcm2835.h:1022
@ RPI_BPLUS_GPIO_J8_23
Definition: bcm2835.h:1023
@ RPI_BPLUS_GPIO_J8_31
Definition: bcm2835.h:1027
@ BCM2835_SPI_MODE3
Definition: bcm2835.h:1149
@ BCM2835_SPI_MODE0
Definition: bcm2835.h:1146
@ BCM2835_SPI_MODE2
Definition: bcm2835.h:1148
@ BCM2835_SPI_MODE1
Definition: bcm2835.h:1147
@ BCM2835_I2C_CLOCK_DIVIDER_150
Definition: bcm2835.h:1244
@ BCM2835_I2C_CLOCK_DIVIDER_626
Definition: bcm2835.h:1243
@ BCM2835_I2C_CLOCK_DIVIDER_2500
Definition: bcm2835.h:1242
@ BCM2835_I2C_CLOCK_DIVIDER_148
Definition: bcm2835.h:1245
@ BCM2835_PAD_GROUP_GPIO_28_45
Definition: bcm2835.h:936
@ BCM2835_PAD_GROUP_GPIO_46_53
Definition: bcm2835.h:937
@ BCM2835_PAD_GROUP_GPIO_0_27
Definition: bcm2835.h:935
@ BCM2835_I2C_REASON_ERROR_TIMEOUT
Definition: bcm2835.h:1257
@ BCM2835_I2C_REASON_ERROR_NACK
Definition: bcm2835.h:1254
@ BCM2835_I2C_REASON_ERROR_DATA
Definition: bcm2835.h:1256
@ BCM2835_I2C_REASON_ERROR_CLKT
Definition: bcm2835.h:1255
@ BCM2835_I2C_REASON_OK
Definition: bcm2835.h:1253
@ BCM2835_SPI_CLOCK_DIVIDER_8192
Definition: bcm2835.h:1182
@ BCM2835_SPI_CLOCK_DIVIDER_8
Definition: bcm2835.h:1192
@ BCM2835_SPI_CLOCK_DIVIDER_1024
Definition: bcm2835.h:1185
@ BCM2835_SPI_CLOCK_DIVIDER_1
Definition: bcm2835.h:1195
@ BCM2835_SPI_CLOCK_DIVIDER_16384
Definition: bcm2835.h:1181
@ BCM2835_SPI_CLOCK_DIVIDER_4
Definition: bcm2835.h:1193
@ BCM2835_SPI_CLOCK_DIVIDER_128
Definition: bcm2835.h:1188
@ BCM2835_SPI_CLOCK_DIVIDER_2
Definition: bcm2835.h:1194
@ BCM2835_SPI_CLOCK_DIVIDER_256
Definition: bcm2835.h:1187
@ BCM2835_SPI_CLOCK_DIVIDER_65536
Definition: bcm2835.h:1179
@ BCM2835_SPI_CLOCK_DIVIDER_32
Definition: bcm2835.h:1190
@ BCM2835_SPI_CLOCK_DIVIDER_64
Definition: bcm2835.h:1189
@ BCM2835_SPI_CLOCK_DIVIDER_4096
Definition: bcm2835.h:1183
@ BCM2835_SPI_CLOCK_DIVIDER_32768
Definition: bcm2835.h:1180
@ BCM2835_SPI_CLOCK_DIVIDER_2048
Definition: bcm2835.h:1184
@ BCM2835_SPI_CLOCK_DIVIDER_512
Definition: bcm2835.h:1186
@ BCM2835_SPI_CLOCK_DIVIDER_16
Definition: bcm2835.h:1191
@ BCM2835_REGBASE_PADS
Definition: bcm2835.h:823
@ BCM2835_REGBASE_SPI0
Definition: bcm2835.h:824
@ BCM2835_REGBASE_AUX
Definition: bcm2835.h:827
@ BCM2835_REGBASE_CLK
Definition: bcm2835.h:822
@ BCM2835_REGBASE_BSC0
Definition: bcm2835.h:825
@ BCM2835_REGBASE_SPI1
Definition: bcm2835.h:828
@ BCM2835_REGBASE_GPIO
Definition: bcm2835.h:820
@ BCM2835_REGBASE_BSC1
Definition: bcm2835.h:826
@ BCM2835_REGBASE_SMI
Definition: bcm2835.h:830
@ BCM2835_REGBASE_PWM
Definition: bcm2835.h:821
@ BCM2835_REGBASE_ST
Definition: bcm2835.h:819
void bcm2835_gpio_pud(uint8_t pud)
Definition: bcm2835.c:482
void bcm2835_gpio_clr_fen(uint8_t pin)
Definition: bcm2835.c:408
void bcm2835_gpio_clr_multi(uint32_t mask)
Definition: bcm2835.c:336
void bcm2835_gpio_write(uint8_t pin, uint8_t on)
Definition: bcm2835.c:590
void bcm2835_gpio_pudclk(uint8_t pin, uint8_t on)
Definition: bcm2835.c:498
void bcm2835_gpio_hen(uint8_t pin)
Definition: bcm2835.c:417
void bcm2835_gpio_set(uint8_t pin)
Definition: bcm2835.c:313
void bcm2835_gpio_clr_hen(uint8_t pin)
Definition: bcm2835.c:424
void bcm2835_delay(unsigned int millis)
Definition: bcm2835.c:539
uint8_t bcm2835_gpio_eds(uint8_t pin)
Definition: bcm2835.c:354
void bcm2835_gpio_set_eds_multi(uint32_t mask)
Definition: bcm2835.c:378
void bcm2835_gpio_ren(uint8_t pin)
Definition: bcm2835.c:385
uint8_t bcm2835_gpio_lev(uint8_t pin)
Definition: bcm2835.c:343
void bcm2835_gpio_clr_aren(uint8_t pin)
Definition: bcm2835.c:456
void bcm2835_gpio_set_multi(uint32_t mask)
Definition: bcm2835.c:329
void bcm2835_gpio_afen(uint8_t pin)
Definition: bcm2835.c:465
void bcm2835_gpio_len(uint8_t pin)
Definition: bcm2835.c:433
void bcm2835_gpio_clr_afen(uint8_t pin)
Definition: bcm2835.c:473
void bcm2835_gpio_clr_ren(uint8_t pin)
Definition: bcm2835.c:392
void bcm2835_gpio_set_pud(uint8_t pin, uint8_t pud)
Definition: bcm2835.c:635
uint8_t bcm2835_gpio_get_pud(uint8_t pin)
Definition: bcm2835.c:672
void bcm2835_gpio_aren(uint8_t pin)
Definition: bcm2835.c:449
void bcm2835_gpio_write_mask(uint32_t value, uint32_t mask)
Definition: bcm2835.c:608
uint32_t bcm2835_gpio_pad(uint8_t group)
Definition: bcm2835.c:514
void bcm2835_gpio_set_eds(uint8_t pin)
Definition: bcm2835.c:370
void bcm2835_gpio_clr_len(uint8_t pin)
Definition: bcm2835.c:440
void bcm2835_gpio_write_multi(uint32_t mask, uint8_t on)
Definition: bcm2835.c:599
void bcm2835_gpio_set_pad(uint8_t group, uint32_t control)
Definition: bcm2835.c:527
void bcm2835_gpio_fen(uint8_t pin)
Definition: bcm2835.c:401
void bcm2835_delayMicroseconds(uint64_t micros)
Definition: bcm2835.c:549
uint32_t bcm2835_gpio_eds_multi(uint32_t mask)
Definition: bcm2835.c:362
void bcm2835_gpio_fsel(uint8_t pin, uint8_t mode)
Definition: bcm2835.c:302
void bcm2835_gpio_clr(uint8_t pin)
Definition: bcm2835.c:321
void bcm2835_i2c_end(void)
Definition: bcm2835.c:1251
uint8_t bcm2835_i2c_read(char *buf, uint32_t len)
Definition: bcm2835.c:1393
void bcm2835_i2c_setClockDivider(uint16_t divider)
Definition: bcm2835.c:1279
void bcm2835_i2c_setSlaveAddress(uint8_t addr)
Definition: bcm2835.c:1264
uint8_t bcm2835_i2c_write(const char *buf, uint32_t len)
Definition: bcm2835.c:1304
int bcm2835_i2c_begin(void)
Definition: bcm2835.c:1220
void bcm2835_i2c_set_baudrate(uint32_t baudrate)
Definition: bcm2835.c:1295
uint8_t bcm2835_i2c_write_read_rs(char *cmds, uint32_t cmds_len, char *buf, uint32_t buf_len)
Definition: bcm2835.c:1559
uint8_t bcm2835_i2c_read_register_rs(char *regaddr, char *buf, uint32_t len)
Definition: bcm2835.c:1468
unsigned int bcm2835_version(void)
Definition: bcm2835.c:195
int bcm2835_close(void)
Definition: bcm2835.c:2163
int bcm2835_init(void)
Definition: bcm2835.c:2008
void bcm2835_set_debug(uint8_t debug)
Definition: bcm2835.c:190
void bcm2835_peri_set_bits(volatile uint32_t *paddr, uint32_t value, uint32_t mask)
Definition: bcm2835.c:273
uint32_t bcm2835_peri_read_nb(volatile uint32_t *paddr)
Definition: bcm2835.c:226
void bcm2835_peri_write_nb(volatile uint32_t *paddr, uint32_t value)
Definition: bcm2835.c:257
uint32_t bcm2835_peri_read(volatile uint32_t *paddr)
Definition: bcm2835.c:203
void bcm2835_peri_write(volatile uint32_t *paddr, uint32_t value)
Definition: bcm2835.c:242
uint32_t * bcm2835_regbase(uint8_t regbase)
Definition: bcm2835.c:157
void bcm2835_pwm_set_clock(uint32_t divisor)
Definition: bcm2835.c:1900
void bcm2835_pwm_set_data(uint8_t channel, uint32_t data)
Definition: bcm2835.c:1968
void bcm2835_pwm_set_mode(uint8_t channel, uint8_t markspace, uint8_t enabled)
Definition: bcm2835.c:1919
void bcm2835_pwm_set_range(uint8_t channel, uint32_t range)
Definition: bcm2835.c:1956
uint32_t bcm2835_smi_read(uint32_t smichannel, uint32_t address)
Definition: bcm2835.c:1819
int bcm2835_smi_begin(void)
Definition: bcm2835.c:1661
void bcm2835_smi_write(uint32_t smichannel, uint8_t data, uint32_t address)
Definition: bcm2835.c:1788
void bcm2835_smi_end(void)
Definition: bcm2835.c:1723
void bcm2835_smi_set_timing(uint32_t smichannel, uint32_t readchannel, uint32_t setupcycles, uint32_t strobecycles, uint32_t holdcycles, uint32_t pacecycles)
Definition: bcm2835.c:1743
uint8_t bcm2835_aux_spi_transfer(uint8_t value)
Definition: bcm2835.c:1186
void bcm2835_spi_setBitOrder(uint8_t order)
Definition: bcm2835.c:737
void bcm2835_spi_transfern(char *buf, uint32_t len)
Definition: bcm2835.c:893
int bcm2835_aux_spi_begin(void)
Definition: bcm2835.c:950
void bcm2835_spi_chipSelect(uint8_t cs)
Definition: bcm2835.c:898
void bcm2835_aux_spi_transfernb(const char *tbuf, char *rbuf, uint32_t len)
Definition: bcm2835.c:1085
void bcm2835_spi_write(uint16_t data)
Definition: bcm2835.c:913
uint16_t bcm2835_aux_spi_CalcClockDivider(uint32_t speed_hz)
Definition: bcm2835.c:985
uint8_t bcm2835_spi_transfer(uint8_t value)
Definition: bcm2835.c:768
void bcm2835_spi_writenb(const char *buf, uint32_t len)
Definition: bcm2835.c:848
int bcm2835_spi_begin(void)
Definition: bcm2835.c:703
void bcm2835_aux_spi_write(uint16_t data)
Definition: bcm2835.c:1011
void bcm2835_spi_setDataMode(uint8_t mode)
Definition: bcm2835.c:760
void bcm2835_spi_transfernb(char *tbuf, char *rbuf, uint32_t len)
Definition: bcm2835.c:805
void bcm2835_spi_end(void)
Definition: bcm2835.c:727
void bcm2835_aux_spi_setClockDivider(uint16_t divider)
Definition: bcm2835.c:1006
void bcm2835_spi_set_speed_hz(uint32_t speed_hz)
Definition: bcm2835.c:753
void bcm2835_spi_setClockDivider(uint16_t divider)
Definition: bcm2835.c:747
void bcm2835_aux_spi_transfern(char *buf, uint32_t len)
Definition: bcm2835.c:1181
void bcm2835_spi_setChipSelectPolarity(uint8_t cs, uint8_t active)
Definition: bcm2835.c:905
void bcm2835_aux_spi_writenb(const char *buf, uint32_t len)
Definition: bcm2835.c:1033
void bcm2835_aux_spi_end(void)
Definition: bcm2835.c:974
uint64_t bcm2835_st_read(void)
Definition: bcm2835.c:1856
void bcm2835_st_delay(uint64_t offset_micros, uint64_t micros)
Definition: bcm2835.c:1890