MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / gpio_to_base

Function gpio_to_base

bsp/dm365/drivers/gpio.c:36–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 #define GPIO_GRP_MASK (5)
35
36static int gpio_to_base(unsigned int gpio)
37{
38 unsigned int grp_idx;
39 int ret;
40
41 grp_idx = gpio >> GPIO_GRP_MASK;
42
43 switch (grp_idx) {
44 case 0:
45 dm365_gpio_base = (unsigned int)GPIO0_BASE;
46 ret = 0;
47 break;
48 case 1:
49 dm365_gpio_base = (unsigned int)GPIO1_BASE;
50 ret = 0;
51 break;
52 case 2:
53 dm365_gpio_base = (unsigned int)GPIO2_BASE;
54 ret = 0;
55 break;
56 case 3:
57 dm365_gpio_base = (unsigned int)GPIO3_BASE;
58 ret = 0;
59 break;
60 default:
61 ret =-RT_EIO;
62 break;
63 }
64 return ret;
65}
66
67
68int gpio_direction_input(unsigned int gpio)

Callers 4

gpio_direction_inputFunction · 0.85
gpio_direction_outputFunction · 0.85
gpio_set_valueFunction · 0.85
gpio_get_valueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected