| 86 | } |
| 87 | |
| 88 | int gpio_direction_output(unsigned int gpio, int value) |
| 89 | { |
| 90 | unsigned int offset; |
| 91 | int ret=0; |
| 92 | |
| 93 | rt_ubase_t temp = rt_hw_interrupt_disable(); |
| 94 | ret = gpio_to_base(gpio); |
| 95 | if (ret < 0) { |
| 96 | goto gpio_free; |
| 97 | } |
| 98 | |
| 99 | offset = gpio & ((1 << GPIO_GRP_MASK) -1); |
| 100 | |
| 101 | if (value) { |
| 102 | gpio_set(offset); |
| 103 | } |
| 104 | else { |
| 105 | gpio_clr(offset); |
| 106 | } |
| 107 | |
| 108 | gpio_dirout(offset); |
| 109 | |
| 110 | gpio_free: |
| 111 | rt_hw_interrupt_enable(temp); |
| 112 | |
| 113 | return ret; |
| 114 | } |
| 115 | |
| 116 | int gpio_set_value(unsigned int gpio, int value) |
| 117 | { |
no test coverage detected