1 /*
2 * Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include "sdkconfig.h"
8 #include "soc/dport_access.h"
9
esp_dport_access_reg_read(uint32_t reg)10 uint32_t IRAM_ATTR esp_dport_access_reg_read(uint32_t reg)
11 {
12 uint32_t apb;
13 unsigned int intLvl;
14
15 __asm__ __volatile__ ( \
16 "rsil %[LVL], "XTSTR (CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL)"\n" \
17 "movi %[APB], "XTSTR (0x3ff40078) "\n" \
18 "l32i %[APB], %[APB], 0\n" \
19 "l32i %[REG], %[REG], 0\n" \
20 "wsr %[LVL], "XTSTR (PS)"\n" \
21 "rsync\n" \
22 : [APB] "=a" (apb), [REG] "+a" (reg), [LVL] "=a" (intLvl) \
23 : \
24 : "memory" \
25 );
26 return reg;
27 }
28