Skip to content

Commit

Permalink
latest stub flasher
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason2866 committed Feb 10, 2024
1 parent 0303c8b commit cf5759f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions flasher_stub/include/rom_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ int uart_rx_one_char(uint8_t *ch);
uint8_t uart_rx_one_char_block();
int uart_tx_one_char(char ch);

#if ESP32C6 || ESP32H2
#if ESP32C6 || ESP32H2 || ESP32C5BETA3 || ESP32P4
/* uart_tx_one_char doesn't send data to USB device serial, needs to be replaced */
int uart_tx_one_char2(char ch);
#define uart_tx_one_char(ch) uart_tx_one_char2(ch)
#endif // ESP32C6 || ESP32H2
#endif // ESP32C6 || ESP32H2 || ESP32C5BETA3 || ESP32P4

void uart_div_modify(uint32_t uart_no, uint32_t baud_div);

Expand Down
6 changes: 3 additions & 3 deletions flasher_stub/stub_flasher.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static bool can_use_max_cpu_freq()
#endif
}

#if ESP32C6 || ESP32H2
#if ESP32C6 || ESP32H2 || ESP32C5BETA3
static uint32_t pcr_sysclk_conf_reg = 0;
#else
static uint32_t cpu_per_conf_reg = 0;
Expand All @@ -75,7 +75,7 @@ static void set_max_cpu_freq()
if (can_use_max_cpu_freq())
{
/* Set CPU frequency to max. This also increases SPI speed. */
#if ESP32C6 || ESP32H2
#if ESP32C6 || ESP32H2 || ESP32C5BETA3
pcr_sysclk_conf_reg = READ_REG(PCR_SYSCLK_CONF_REG);
WRITE_REG(PCR_SYSCLK_CONF_REG, (pcr_sysclk_conf_reg & ~PCR_SOC_CLK_SEL_M) | (PCR_SOC_CLK_MAX << PCR_SOC_CLK_SEL_S));
#else
Expand All @@ -92,7 +92,7 @@ static void reset_cpu_freq()
{
/* Restore saved sysclk_conf and cpu_per_conf registers.
Use only if set_max_cpu_freq() has been called. */
#if ESP32C6 || ESP32H2
#if ESP32C6 || ESP32H2 || ESP32C5BETA3
if (can_use_max_cpu_freq() && pcr_sysclk_conf_reg != 0)
{
WRITE_REG(PCR_SYSCLK_CONF_REG, (READ_REG(PCR_SYSCLK_CONF_REG) & ~PCR_SOC_CLK_SEL_M) | (pcr_sysclk_conf_reg & PCR_SOC_CLK_SEL_M));
Expand Down

0 comments on commit cf5759f

Please sign in to comment.