1 // Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 // The HAL layer for GPIO (common part)
16 
17 #include "soc/soc.h"
18 #include "soc/gpio_periph.h"
19 #include "hal/gpio_hal.h"
20 
gpio_hal_intr_enable_on_core(gpio_hal_context_t * hal,gpio_num_t gpio_num,uint32_t core_id)21 void gpio_hal_intr_enable_on_core(gpio_hal_context_t *hal, gpio_num_t gpio_num, uint32_t core_id)
22 {
23     if (gpio_num < 32) {
24         gpio_ll_clear_intr_status(hal->dev, BIT(gpio_num));
25     } else {
26         gpio_ll_clear_intr_status_high(hal->dev, BIT(gpio_num - 32));
27     }
28     gpio_ll_intr_enable_on_core(hal->dev, core_id, gpio_num);
29 }
30 
gpio_hal_intr_disable(gpio_hal_context_t * hal,gpio_num_t gpio_num)31 void gpio_hal_intr_disable(gpio_hal_context_t *hal, gpio_num_t gpio_num)
32 {
33     gpio_ll_intr_disable(hal->dev, gpio_num);
34     if (gpio_num < 32) {
35         gpio_ll_clear_intr_status(hal->dev, BIT(gpio_num));
36     } else {
37         gpio_ll_clear_intr_status_high(hal->dev, BIT(gpio_num - 32));
38     }
39 }
40