Skip to content

Commit 48c17ae

Browse files
author
Raffael Rostagno
committed
hal: esp32h2: Fix HAL files for initial support
Fix HAL files for initial ESP32-H2 support. Signed-off-by: Raffael Rostagno <[email protected]>
1 parent 7a169f1 commit 48c17ae

File tree

17 files changed

+52
-22
lines changed

17 files changed

+52
-22
lines changed

components/driver/gpio/include/driver/rtc_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num);
2828

2929
#define RTC_GPIO_IS_VALID_GPIO(gpio_num) rtc_gpio_is_valid_gpio(gpio_num)
3030

31-
#if SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
31+
#if SOC_RTCIO_PIN_COUNT > 0
3232
/**
3333
* @brief Get RTC IO index number by gpio number.
3434
*

components/esp_hw_support/port/esp32h2/cpu_region_protect.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ void esp_cpu_configure_region_protection(void)
127127
_Static_assert(SOC_IROM_MASK_LOW < SOC_IROM_MASK_HIGH, "Invalid I/D-ROM region");
128128

129129
if (esp_cpu_dbgr_is_attached()) {
130-
// Anti-FI check that cpu is really in ocd mode
131-
ESP_FAULT_ASSERT(esp_cpu_dbgr_is_attached());
132-
133130
// 5. IRAM and DRAM
134131
PMP_ENTRY_SET(5, SOC_IRAM_LOW, NONE);
135132
PMP_ENTRY_SET(6, SOC_IRAM_HIGH, PMP_TOR | RWX);

components/esp_hw_support/port/esp32h2/esp_cpu_intr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
void esp_cpu_intr_get_desc(int core_id, int intr_num, esp_cpu_intr_desc_t *intr_desc_ret)
1111
{
1212
/* On the ESP32-H2, interrupt:
13+
* - 0 is unavailable according to TRM
1314
* - 1 is for Wi-Fi
1415
* - 6 for "permanently disabled interrupt"
1516
*
1617
* Interrupts 3, 4 and 7 are unavailable for PULP CPU as they are bound to Core-Local Interrupts (CLINT)
1718
*/
1819
// [TODO: IDF-2465]
19-
const uint32_t rsvd_mask = BIT(1) | BIT(3) | BIT(4) | BIT(6) | BIT(7);
20+
const uint32_t rsvd_mask = BIT(0) | BIT(1) | BIT(3) | BIT(4) | BIT(6) | BIT(7);
2021

2122
intr_desc_ret->priority = 1;
2223
intr_desc_ret->type = ESP_CPU_INTR_TYPE_NA;

components/esp_hw_support/port/esp32h2/rtc_clk.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,14 @@ soc_rtc_fast_clk_src_t rtc_clk_fast_src_get(void)
159159

160160
static void rtc_clk_bbpll_disable(void)
161161
{
162+
#if defined(CLK_BBPLL_DISABLE)
163+
/* Disabling BBPLL is commented due to issues when transitioning
164+
* from PLL to XTAL clock sources. Comprehensive clock management
165+
* must be implemented for peripherals as well (ZEP-827).
166+
*/
162167
clk_ll_bbpll_disable();
163168
s_cur_pll_freq = 0;
169+
#endif
164170
}
165171

166172
static void rtc_clk_bbpll_enable(void)

components/esp_rom/include/esp32h2/rom/rtc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <stdbool.h>
1010
#include <stdint.h>
11+
#include <stddef.h>
1112

1213
#include "soc/soc.h"
1314
#include "soc/lp_aon_reg.h"

components/esp_rom/include/esp32h2/rom/uart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ typedef enum {
114114
} UartFlowCtrl;
115115

116116
typedef enum {
117-
EMPTY,
117+
EMPTY_,
118118
UNDER_WRITE,
119119
WRITE_OVER
120120
} RcvMsgBuffState;

components/esp_system/port/soc/esp32h2/clk.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <stdint.h>
88
#include <sys/cdefs.h>
9-
#include <sys/time.h>
109
#include <sys/param.h>
1110
#include "sdkconfig.h"
1211
#include "esp_attr.h"
@@ -35,8 +34,6 @@
3534
*/
3635
#define SLOW_CLK_CAL_CYCLES CONFIG_RTC_CLK_CAL_CYCLES
3736

38-
#define MHZ (1000000)
39-
4037
static void select_rtc_slow_clk(soc_rtc_slow_clk_src_t rtc_slow_clk_src);
4138
static __attribute__((unused)) void recalib_bbpll(void);
4239

components/esp_system/port/soc/esp32h2/reset_reason.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ static esp_reset_reason_t get_reset_reason(soc_reset_reason_t rtc_reset_reason,
6868
}
6969
}
7070

71-
static void esp_reset_reason_init(void)
71+
void esp_reset_reason_init(void)
7272
{
7373
esp_reset_reason_t hint = esp_reset_reason_get_hint();
7474
s_reset_reason = get_reset_reason(esp_rom_get_reset_reason(PRO_CPU_NUM), hint);

components/hal/esp32h2/include/hal/clk_tree_ll.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
extern "C" {
2626
#endif
2727

28+
#if !defined(DT_DRV_COMPAT)
29+
#undef MHZ
2830
#define MHZ (1000000)
31+
#endif
2932

3033
#define CLK_LL_PLL_8M_FREQ_MHZ (8)
3134
#define CLK_LL_PLL_48M_FREQ_MHZ (48)

components/hal/esp32h2/include/hal/uart_ll.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,18 @@ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_half_duplex(uart_dev_t *hw)
752752
uart_ll_update(hw);
753753
}
754754

755+
/**
756+
* @brief Get the rs485_half_duplex mode.
757+
*
758+
* @param hw Beginning address of the peripheral registers.
759+
*
760+
* @return True if RS485 half duplex mode enabled.
761+
*/
762+
FORCE_INLINE_ATTR bool uart_ll_is_mode_rs485_half_duplex(uart_dev_t *hw)
763+
{
764+
return (!hw->rs485_conf_sync.rs485rxby_tx_en && hw->rs485_conf_sync.rs485_en);
765+
}
766+
755767
/**
756768
* @brief Configure the UART work in collision_detect mode.
757769
*

0 commit comments

Comments
 (0)