Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb1e2b1

Browse files
committed
feat(esp8266): refactor function "os_update_cpu_frequency"
1 parent 3f9eccd commit bb1e2b1

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

components/esp8266/lib/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
gwen:
2-
core: e1fe83a
2+
core: 71005fb
33
net80211: e1fe83a
44
pp: e1fe83a
55
wpa: e1fe83a

components/esp8266/lib/libcore.a

-1.13 KB
Binary file not shown.
-1.13 KB
Binary file not shown.

components/esp8266/source/system_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
static const char* TAG = "system_api";
3333

3434
static uint8_t base_mac_addr[6] = { 0 };
35+
uint32_t g_esp_ticks_per_us = 80;
3536

3637
// Bootloader can get this information
3738
const __attribute__((section(".SystemInfoVector.text"))) esp_sys_info_t g_esp_sys_info = {
@@ -366,3 +367,18 @@ uint32_t esp_get_old_sysconf_addr(void)
366367
{
367368
return rtc_sys_info.old_sysconf_addr;
368369
}
370+
371+
void os_update_cpu_frequency(uint32_t ticks_per_us)
372+
{
373+
extern uint32_t _xt_tick_divisor;
374+
375+
if (REG_READ(DPORT_CTL_REG) & DPORT_CTL_DOUBLE_CLK) {
376+
g_esp_ticks_per_us = CPU_CLK_FREQ * 2 / 1000000;
377+
_xt_tick_divisor = (CPU_CLK_FREQ * 2 / CONFIG_FREERTOS_HZ);
378+
} else {
379+
g_esp_ticks_per_us = CPU_CLK_FREQ / 1000000;;
380+
_xt_tick_divisor = (CPU_CLK_FREQ / CONFIG_FREERTOS_HZ);
381+
}
382+
}
383+
384+
void ets_update_cpu_frequency(uint32_t ticks_per_us) __attribute__((alias("os_update_cpu_frequency")));

components/freertos/port/esp8266/include/freertos/portmacro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void esp_increase_tick_cnt(const TickType_t ticks);
213213
extern void esp_vApplicationIdleHook( void );
214214
extern void esp_vApplicationTickHook( void );
215215

216-
extern const uint32_t g_esp_ticks_per_us;
216+
extern uint32_t g_esp_ticks_per_us;
217217

218218
/*
219219
* @brief Get FreeRTOS system idle ticks

0 commit comments

Comments
 (0)