Skip to content

Commit 03cc7dd

Browse files
committed
fixup
1 parent c7cd9ba commit 03cc7dd

File tree

2 files changed

+33
-28
lines changed

2 files changed

+33
-28
lines changed

include/esp-stub-lib/mem_utils.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,38 @@
77
#pragma once
88

99
#include <stdbool.h>
10+
#include <stdint.h>
1011

1112
/**
1213
* @brief Check if address is in external memory range.
1314
*
1415
* External flash memory mapped via the instruction bus.
1516
*/
16-
bool stub_lib_mem_is_irom(const void *p);
17+
bool stub_lib_mem_is_irom(uintptr_t addr);
1718

1819
/**
1920
* @brief Check if address is in external memory range.
2021
*
2122
* External flash memory mapped via the data bus.
2223
*/
23-
bool stub_lib_mem_is_drom(const void *p);
24+
bool stub_lib_mem_is_drom(uintptr_t addr);
2425

2526
/**
2627
* @brief Check if address is in internal memory range.
2728
*
2829
* Internal memory accessed via the instruction bus.
2930
*/
30-
bool stub_lib_mem_is_iram(const void *p);
31+
bool stub_lib_mem_is_iram(uintptr_t addr);
3132

3233
/**
3334
* @brief Check if address is in internal memory range.
3435
*
3536
* Internal memory accessed via the data bus.
3637
*/
37-
bool stub_lib_mem_is_dram(const void *p);
38+
bool stub_lib_mem_is_dram(uintptr_t addr);
3839

39-
bool stub_lib_mem_is_rtc_iram_fast(const void *p);
40-
bool stub_lib_mem_is_rtc_dram_fast(const void *p);
41-
bool stub_lib_mem_is_rtc_slow(const void *p);
40+
bool stub_lib_mem_is_rtc_iram_fast(uintptr_t addr);
41+
bool stub_lib_mem_is_rtc_dram_fast(uintptr_t addr);
42+
bool stub_lib_mem_is_rtc_slow(uintptr_t addr);
4243

43-
bool stub_lib_mem_is_tcm(const void *p);
44+
bool stub_lib_mem_is_tcm(uintptr_t addr);

src/mem_utils.c

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,79 +10,83 @@
1010

1111
#include <soc/soc.h>
1212

13-
bool stub_lib_mem_is_irom(const void *p)
13+
bool stub_lib_mem_is_irom(uintptr_t addr)
1414
{
1515
#if defined(SOC_IROM_LOW) && defined(SOC_IROM_HIGH)
16-
return (uintptr_t)p >= SOC_IROM_LOW && (uintptr_t)p < SOC_IROM_HIGH;
16+
return addr >= SOC_IROM_LOW && addr < SOC_IROM_HIGH;
1717
#else
18+
(void)addr;
1819
return false;
1920
#endif
2021
}
2122

22-
bool stub_lib_mem_is_drom(const void *p)
23+
bool stub_lib_mem_is_drom(uintptr_t addr)
2324
{
2425
#if defined(SOC_DROM_LOW) && defined(SOC_DROM_HIGH)
25-
return (uintptr_t)p >= SOC_DROM_LOW && (uintptr_t)p < SOC_DROM_HIGH;
26+
return addr >= SOC_DROM_LOW && addr < SOC_DROM_HIGH;
2627
#else
28+
(void)addr;
2729
return false;
2830
#endif
2931
}
3032

31-
bool stub_lib_mem_is_iram(const void *p)
33+
bool stub_lib_mem_is_iram(uintptr_t addr)
3234
{
3335
#if defined(SOC_IRAM_LOW) && defined(SOC_IRAM_HIGH)
34-
return (uintptr_t)p >= SOC_IRAM_LOW && (uintptr_t)p < SOC_IRAM_HIGH;
36+
return addr >= SOC_IRAM_LOW && addr < SOC_IRAM_HIGH;
3537
#else
38+
(void)addr;
3639
return false;
3740
#endif
3841
}
3942

40-
bool stub_lib_mem_is_dram(const void *p)
43+
bool stub_lib_mem_is_dram(uintptr_t addr)
4144
{
4245
#if defined(SOC_DRAM_LOW) && defined(SOC_DRAM_HIGH)
43-
return (uintptr_t)p >= SOC_DRAM_LOW && (uintptr_t)p < SOC_DRAM_HIGH;
46+
return addr >= SOC_DRAM_LOW && addr < SOC_DRAM_HIGH;
4447
#else
48+
(void)addr;
4549
return false;
4650
#endif
4751
}
4852

49-
bool stub_lib_mem_is_rtc_iram_fast(const void *p)
53+
bool stub_lib_mem_is_rtc_iram_fast(uintptr_t addr)
5054
{
5155
#if defined(SOC_RTC_IRAM_LOW) && defined(SOC_RTC_IRAM_HIGH)
52-
return (uintptr_t)p >= SOC_RTC_IRAM_LOW && (uintptr_t)p < SOC_RTC_IRAM_HIGH;
56+
return addr >= SOC_RTC_IRAM_LOW && addr < SOC_RTC_IRAM_HIGH;
5357
#else
54-
(void)p;
58+
(void)addr;
5559
return false;
5660
#endif
5761
}
5862

59-
bool stub_lib_mem_is_rtc_dram_fast(const void *p)
63+
bool stub_lib_mem_is_rtc_dram_fast(uintptr_t addr)
6064
{
6165
#if defined(SOC_RTC_DRAM_LOW) && defined(SOC_RTC_DRAM_HIGH)
62-
return (uintptr_t)p >= SOC_RTC_DRAM_LOW && (uintptr_t)p < SOC_RTC_DRAM_HIGH;
66+
return addr >= SOC_RTC_DRAM_LOW && addr < SOC_RTC_DRAM_HIGH;
6367
#else
64-
(void)p;
68+
(void)addr;
6569
return false;
6670
#endif
6771

6872
}
6973

70-
bool stub_lib_mem_is_rtc_slow(const void *p)
74+
bool stub_lib_mem_is_rtc_slow(uintptr_t addr)
7175
{
7276
#if defined(SOC_RTC_DATA_LOW) && defined(SOC_RTC_DATA_HIGH)
73-
return (uintptr_t)p >= SOC_RTC_DATA_LOW && (uintptr_t)p < SOC_RTC_DATA_HIGH;
77+
return addr >= SOC_RTC_DATA_LOW && addr < SOC_RTC_DATA_HIGH;
7478
#else
75-
(void)p;
79+
(void)addr;
7680
return false;
7781
#endif
7882
}
7983

80-
bool stub_lib_mem_is_tcm(const void *p)
84+
bool stub_lib_mem_is_tcm(uintptr_t addr)
8185
{
8286
#if defined(SOC_TCM_LOW) && defined(SOC_TCM_HIGH)
83-
return ((uintptr_t)p >= SOC_TCM_LOW && (uintptr_t)p < SOC_TCM_HIGH);
87+
return (addr >= SOC_TCM_LOW && addr < SOC_TCM_HIGH);
8488
#else
85-
(void)p;
89+
(void)addr;
8690
return false;
8791
#endif
8892
}

0 commit comments

Comments
 (0)