embox

Форк
0
59 строк · 2.0 Кб
1
package embox.driver.gpio
2

3
module bcm283x_gpio extends api {
4
	/* 	RPI_VERSION == 0 then 0x20200000
5
		RPI_VERSION == 3 then 0x3F200000
6
		RPI_VERSION == 4 then 0xFE200000
7
	*/
8
	option number base_addr = 0x20200000
9

10
	/* Pi Zero configuration (RPI_VERSION == 0) */
11
	option number gpio_pins = 54
12
	/* Port A has 0-31 pins, Port B has 32-53 pins numbered as 0-21 */
13
	option number gpio_ports = 2
14

15
	/* There is confusion about this.  There are three banks, only the first two
16
	 * are linked to pins 0-53 (internally, of those, not all are on GPIO header)
17
	 * An interrupt exists for each bank and the highest interrupt is for any 
18
	 * GPIO pin.  We set just one, just the first bank for 
19
	 * all pins connected to the 40-pin header.
20
	 * 
21
	 * Bank0( pins:  0-31 ) - 49 (interrupt)
22
	 * Bank1( pins: 32-53 ) - 50 			 
23
	 * Bank2( pins: 54-96 ) - 51 (not used)
24
	 * all  ( pins: 00-96 ) - 52 
25
	 */
26
	option number gpu_irq_int = 49
27

28
	/* Due to architecture constraints, setting of pull-up/down can only be 
29
	 * applied accross all pins at the same time.  Hence, shadow registers 
30
	 * exist in driver implementation to allow setting value to apply
31
	 * per pin, then by applying _any_ setting to this pin (settings are
32
	 * ignored in this case) with gpio_setup_mode() will cause the 
33
	 * aggreggated pins settings to be applied for pull-up/down
34
	 * functionality. All other functionality will be applied immediately.
35
	 */
36

37
	/* Bit mask for pullups, defaults set to as per BCM2835 ARM Peripherals
38
	 * sec. 6.2 defaults for GPIO 0 thru 53
39
	 */
40
	option number gpu_pullup_porta_float = 0x30000000
41
	option number gpu_pullup_porta_down  = 0xCFFFFE00
42
	option number gpu_pullup_porta_up    = 0x000001FF
43

44
	option number gpu_pullup_portb_float = 0x00003000
45
	option number gpu_pullup_portb_down  = 0x00000FE3
46
	option number gpu_pullup_portb_up    = 0x003FC01C
47

48
	option string log_level="LOG_NONE"
49

50
	source "bcm283x_gpio.c"
51
	source "bcm283x_gpio.h"
52

53
	/* User API */
54
	@IncludeExport(path="drivers/gpio/bcm283x")
55
	source "bcm283x_gpio.h"
56

57
	depends embox.driver.gpio.core
58
	depends embox.arch.arm.libarch.delay
59
}
60

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.