]> granicus.if.org Git - esp-idf/commitdiff
component/esp32 : fix library sport access protections.
authorTian Hao <tianhao@espressif.com>
Sat, 13 May 2017 11:55:11 +0000 (19:55 +0800)
committerTian Hao <tianhao@espressif.com>
Sat, 13 May 2017 11:55:11 +0000 (19:55 +0800)
1. add esp32 library access DPORT register protections.
2. add bluetooth library access DPORT register protections.
3. change register operation(suffix/prefix) to new style.

components/bt/lib
components/esp32/dport_access.c
components/esp32/include/esp_dport_access.h
components/esp32/lib
components/soc/esp32/include/soc/dport_access.h

index cbdf2b94b13a9e7df47c83a45fb82c71ba718f7c..3d6345f075e3dc4a192d1b8e61ee6e94391f19b0 160000 (submodule)
@@ -1 +1 @@
-Subproject commit cbdf2b94b13a9e7df47c83a45fb82c71ba718f7c
+Subproject commit 3d6345f075e3dc4a192d1b8e61ee6e94391f19b0
index ff4c8b79caaa5f79bad320af5bd7339d7f4fda48..65b68f6e61c7001e6c46667d2fee4c5e3485b8f5 100644 (file)
@@ -131,6 +131,16 @@ void IRAM_ATTR esp_dport_access_stall_other_cpu_end(void)
 #endif /* CONFIG_FREERTOS_UNICORE */
 }
 
+void IRAM_ATTR esp_dport_access_stall_other_cpu_start_wrap(void)
+{
+    DPORT_STALL_OTHER_CPU_START();
+}
+
+void IRAM_ATTR esp_dport_access_stall_other_cpu_end_wrap(void)
+{
+    DPORT_STALL_OTHER_CPU_END();
+}
+
 static void dport_access_init_core0(void *arg)
 {
     int core_id = xPortGetCoreID();
index 14b589aa4a3afe3d40f728c5b4cc6b2702bb9bac..1dbdb082665dd35f41feb23ce7472e9c08df2406 100644 (file)
@@ -19,4 +19,12 @@ void esp_dport_access_stall_other_cpu_start(void);
 void esp_dport_access_stall_other_cpu_end(void);
 void esp_dport_access_int_init(void);
 
+#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
+#define DPORT_STALL_OTHER_CPU_START()
+#define DPORT_STALL_OTHER_CPU_END()
+#else
+#define DPORT_STALL_OTHER_CPU_START()   esp_dport_access_stall_other_cpu_start()
+#define DPORT_STALL_OTHER_CPU_END()     esp_dport_access_stall_other_cpu_end()
+#endif
+
 #endif /* _ESP_DPORT_ACCESS_H_ */
index 0c6d1e05a127dc1fef7c7b66d5ebf7c14111a77a..13a8292174f5c89e3bffb1580195a1343f24c70c 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 0c6d1e05a127dc1fef7c7b66d5ebf7c14111a77a
+Subproject commit 13a8292174f5c89e3bffb1580195a1343f24c70c
index 3371b71eb8946c9951f41174fc8268f1e8546793..e5d49cd9e4d92b38a38dc9badb68e71066ccdd49 100644 (file)
 
 #include <stdint.h>
 #include "esp_attr.h"
-
-void esp_dport_access_stall_other_cpu_start(void);
-void esp_dport_access_stall_other_cpu_end(void);
-
-#if defined(BOOTLOADER_BUILD) || defined(CONFIG_FREERTOS_UNICORE) || !defined(ESP_PLATFORM)
-#define DPORT_STALL_OTHER_CPU_START()
-#define DPORT_STALL_OTHER_CPU_END()
-#else
-#define DPORT_STALL_OTHER_CPU_START()   esp_dport_access_stall_other_cpu_start()
-#define DPORT_STALL_OTHER_CPU_END()     esp_dport_access_stall_other_cpu_end()
-#endif
+#include "esp_dport_access.h"
 
 //Registers Operation {{
 //Origin access operation for the base and some special scene
@@ -65,7 +55,7 @@ static inline uint32_t IRAM_ATTR DPORT_REG_READ(uint32_t reg)
 #define DPORT_REG_GET_FIELD(_r, _f) ((DPORT_REG_READ(_r) >> (_f##_S)) & (_f##_V))
 
 //set field to register, used when _f is not left shifted by _f##_S
-#define DPORT_REG_SET_FIELD(_r, _f, _v) DPORT_REG_WRITE((_r), ((DPORT_REG_READ(_r) & (~((_f) << (_f##_S))))|(((_v) & (_f))<<(_f##_S))))
+#define DPORT_REG_SET_FIELD(_r, _f, _v) DPORT_REG_WRITE((_r), ((DPORT_REG_READ(_r) & (~((_f##_V) << (_f##_S))))|(((_v) & (_f##_V))<<(_f##_S))))
 
 //get field value from a variable, used when _f is not left shifted by _f##_S
 #define DPORT_VALUE_GET_FIELD(_r, _f) (((_r) >> (_f##_S)) & (_f))
@@ -85,8 +75,9 @@ static inline uint32_t IRAM_ATTR DPORT_REG_READ(uint32_t reg)
 //generate a value from a field value, used when _f is left shifted by _f##_S
 #define DPORT_FIELD_TO_VALUE2(_f, _v) (((_v)<<_f##_S) & (_f))
 
-#define _READ_PERI_REG(addr) (*((volatile uint32_t *)(addr))) 
-#define _WRITE_PERI_REG(addr, val) (*((volatile uint32_t *)(addr))) = (uint32_t)(val) 
+//Origin access operation for the base and some special scene
+#define _DPORT_READ_PERI_REG(addr) (*((volatile uint32_t *)(addr))) 
+#define _DPORT_WRITE_PERI_REG(addr, val) (*((volatile uint32_t *)(addr))) = (uint32_t)(val) 
 
 //read value from register
 static inline uint32_t IRAM_ATTR DPORT_READ_PERI_REG(uint32_t addr) 
@@ -94,14 +85,14 @@ static inline uint32_t IRAM_ATTR DPORT_READ_PERI_REG(uint32_t addr)
     uint32_t val;
 
     DPORT_STALL_OTHER_CPU_START();
-    val = _READ_PERI_REG(addr);
+    val = _DPORT_READ_PERI_REG(addr);
     DPORT_STALL_OTHER_CPU_END();
     
     return val;
 }
 
 //write value to register
-#define DPORT_WRITE_PERI_REG(addr, val) _WRITE_PERI_REG(addr, val)  
+#define DPORT_WRITE_PERI_REG(addr, val) _DPORT_WRITE_PERI_REG(addr, val)  
 
 //clear bits of register controlled by mask
 #define DPORT_CLEAR_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)&(~(mask))))