C Libruary for BCM2835(BCM2835函数库头文件)

 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.13 2013/12/06 22:24:52 mikem Exp mikem $
8 //
310 
311 
312 
313 // Defines for BCM2835
314 #ifndef BCM2835_H
315 #define BCM2835_H
316 
317 #include <stdint.h>
318 
322 
323 
325 #define HIGH 0x1
326 
327 #define LOW 0x0
328 
330 #define BCM2835_CORE_CLK_HZ 250000000
331 
332 // Physical addresses for various peripheral register sets
334 #define BCM2835_PERI_BASE 0x20000000
335 
336 #define BCM2835_ST_BASE (BCM2835_PERI_BASE + 0x3000)
337 
338 #define BCM2835_GPIO_PADS (BCM2835_PERI_BASE + 0x100000)
339 
340 #define BCM2835_CLOCK_BASE (BCM2835_PERI_BASE + 0x101000)
341 
342 #define BCM2835_GPIO_BASE (BCM2835_PERI_BASE + 0x200000)
343 
344 #define BCM2835_SPI0_BASE (BCM2835_PERI_BASE + 0x204000)
345 
346 #define BCM2835_BSC0_BASE (BCM2835_PERI_BASE + 0x205000)
347 
348 #define BCM2835_GPIO_PWM (BCM2835_PERI_BASE + 0x20C000)
349 
350 #define BCM2835_BSC1_BASE (BCM2835_PERI_BASE + 0x804000)
351 
352 
355 extern volatile uint32_t *bcm2835_st;
356 
359 extern volatile uint32_t *bcm2835_gpio;
360 
363 extern volatile uint32_t *bcm2835_pwm;
364 
367 extern volatile uint32_t *bcm2835_clk;
368 
371 extern volatile uint32_t *bcm2835_pads;
372 
375 extern volatile uint32_t *bcm2835_spi0;
376 
379 extern volatile uint32_t *bcm2835_bsc0;
380 
383 extern volatile uint32_t *bcm2835_bsc1;
384 
386 #define BCM2835_PAGE_SIZE (4*1024)
387 
388 #define BCM2835_BLOCK_SIZE (4*1024)
389 
390 
391 // Defines for GPIO
392 // The BCM2835 has 54 GPIO pins.
393 // BCM2835 data sheet, Page 90 onwards.
395 #define BCM2835_GPFSEL0 0x0000
396 #define BCM2835_GPFSEL1 0x0004
397 #define BCM2835_GPFSEL2 0x0008
398 #define BCM2835_GPFSEL3 0x000c
399 #define BCM2835_GPFSEL4 0x0010
400 #define BCM2835_GPFSEL5 0x0014
401 #define BCM2835_GPSET0 0x001c
402 #define BCM2835_GPSET1 0x0020
403 #define BCM2835_GPCLR0 0x0028
404 #define BCM2835_GPCLR1 0x002c
405 #define BCM2835_GPLEV0 0x0034
406 #define BCM2835_GPLEV1 0x0038
407 #define BCM2835_GPEDS0 0x0040
408 #define BCM2835_GPEDS1 0x0044
409 #define BCM2835_GPREN0 0x004c
410 #define BCM2835_GPREN1 0x0050
411 #define BCM2835_GPFEN0 0x0058
412 #define BCM2835_GPFEN1 0x005c
413 #define BCM2835_GPHEN0 0x0064
414 #define BCM2835_GPHEN1 0x0068
415 #define BCM2835_GPLEN0 0x0070
416 #define BCM2835_GPLEN1 0x0074
417 #define BCM2835_GPAREN0 0x007c
418 #define BCM2835_GPAREN1 0x0080
419 #define BCM2835_GPAFEN0 0x0088
420 #define BCM2835_GPAFEN1 0x008c
421 #define BCM2835_GPPUD 0x0094
422 #define BCM2835_GPPUDCLK0 0x0098
423 #define BCM2835_GPPUDCLK1 0x009c
424 
425 
426 
427 typedef enum
428 {
439 
442 typedef enum
443 {
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值