text
stringlengths
1
9.98k
__index_level_0__
int64
0
4.17k
/* */ / / // The Lowlevel layer for SPI Flash #pragma once #include "gpspi_flash_ll.h" #include "spimem_flash_ll.h" #ifdef __cplusplus extern "C" { #endif // TODO: [ESP32C5] IDF-8715 #define spi_flash_ll_calculate_clock_reg(host_id, clock_div) (((host_id)<=SPI1_HOST) ? spimem_flash_ll_calculate_clock_reg(clock...
391
#define SPI_FLASH_LL_CONTINUOUS_MODE_BIT_NUMS (8) typedef union { gpspi_flash_ll_clock_reg_t gpspi; spimem_flash_ll_clock_reg_t spimem; } spi_flash_ll_clock_reg_t; #ifdef GPSPI_BUILD #define spi_flash_ll_reset(dev) gpspi_flash_ll_reset((spi_dev_t*)dev) #define spi_flash_ll_cmd_...
391
/* */ // The LL layer for Timer Group register operations. // Note that most of the register operations in this layer are non-atomic operations. #pragma once #ifdef __cplusplus extern "C" { #endif #include #include #include "hal/misc.h" #include "hal/wdt_types.h" #include "soc/rtc_cntl_periph.h" #include "soc/ef...
392
wdt_en = 1; abort(); } /** */ FORCE_INLINE_ATTR void lpwdt_ll_disable(lp_wdt_dev_t *hw) { // TODO: [ESP32C5] IDF-8635 // hw->config0.wdt_en = 0; abort(); } /** */ FORCE_INLINE_ATTR bool lpwdt_ll_check_if_enabled(lp_wdt_dev_t *hw) { // TODO: [ESP32C5] IDF-8635 // return (hw->config0.wdt_en) ?...
392
wdt_stg2 = behavior; // hw->config3.val = timeout_ticks; // break; // case WDT_STAGE3: // hw->config0.wdt_stg3 = behavior; // hw->config4.val = timeout_ticks; // break; // default: // abort(); // } abort(); } /** */ FORCE_INLINE_ATTR void lpwdt_ll_disabl...
392
wdt_cpu_reset_length = length; abort(); } /** */ FORCE_INLINE_ATTR void lpwdt_ll_set_sys_reset_length(lp_wdt_dev_t *hw, wdt_reset_sig_length_t length) { // TODO: [ESP32C5] IDF-8635 // hw->config0.wdt_sys_reset_length = length; abort(); } /** */ FORCE_INLINE_ATTR void lpwdt_ll_set_flashboot_en(lp_wdt...
392
wdt_pause_in_slp = (enable) ? 1 : 0; abort(); } /** */ FORCE_INLINE_ATTR void lpwdt_ll_set_chip_reset_en(lp_wdt_dev_t *hw, bool enable) { // TODO: [ESP32C5] IDF-8635 // hw->config0.wdt_chip_reset_en = (enable) ? 1 : 0; abort(); } /** */ FORCE_INLINE_ATTR void lpwdt_ll_set_chip_reset_width(lp_wdt_dev...
392
lp_wdt_int_ena = (enable) ? 1 : 0; abort(); } /** */ FORCE_INLINE_ATTR bool lpwdt_ll_check_intr_status(lp_wdt_dev_t *hw) { // TODO: [ESP32C5] IDF-8635 // return (hw->int_st.lp_wdt_int_st) ? true : false; abort(); return (bool)0; } /** */ FORCE_INLINE_ATTR void lpwdt_ll_clear_intr_status(lp_wdt_d...
392
/* */ #pragma once #include #include #include "hal/assert.h" #include "soc/periph_defs.h" #include "soc/pcr_reg.h" #include "soc/soc.h" #include "soc/soc_caps.h" #include "esp_attr.h" #ifdef __cplusplus extern "C" { #endif static inline uint32_t periph_ll_get_clk_en_mask(periph_module_t periph) { // Only add...
393
= 0; } #ifdef __cplusplus } #endif
393
/* */ #pragma once #include #include #include "hal/assert.h" #include "hal/ecc_types.h" #include "soc/ecc_mult_reg.h" #include "soc/pcr_struct.h" #ifdef __cplusplus extern "C" { #endif typedef enum { ECC_PARAM_PX = 0x0, ECC_PARAM_PY, ECC_PARAM_K, ECC_PARAM_QX, ECC_PARAM_QY, ECC_PARAM_QZ, }...
394
/* */ / / // The Lowlevel layer for SPI Flash #pragma once #include #include "soc/spi_periph.h" #include "soc/spi_struct.h" #include "hal/spi_types.h" #include "hal/spi_flash_types.h" #include // For MIN/MAX #include #include #include "hal/misc.h" #ifdef __cplusplus extern "C" { #endif //NOTE: These macros ...
395
val = 0; // dev->dma_conf.slv_tx_seg_trans_clr_en = 1; // dev->dma_conf.slv_rx_seg_trans_clr_en = 1; // dev->dma_conf.dma_slv_seg_trans_en = 0; abort(); } /** */ static inline bool gpspi_flash_ll_cmd_is_done(const spi_dev_t *dev) { // TODO: [ESP32C5] IDF-8698, IDF-8699 // return (dev->cmd.usr ...
395
buf = word; abort(); } /** */ static inline void gpspi_flash_ll_set_buffer_data(spi_dev_t *dev, const void *buffer, uint32_t length) { // TODO: [ESP32C5] IDF-8698, IDF-8699 // // Load data registers, word at a time // int num_words = (length + 3) / 4; // for (int i = 0; i data_buf[i].buf = word; ...
395
usr == 0; abort(); return (bool)0; } /** */ static inline void gpspi_flash_ll_read_phase(spi_dev_t *dev) { // TODO: [ESP32C5] IDF-8698, IDF-8699 // typeof (dev->user) user = { // .usr_mosi = 0, // .usr_miso = 1, // .usr_addr = 1, // .usr_command = 1, // }; // de...
395
val &= ~(SPI_FWRITE_QUAD_M | SPI_FWRITE_DUAL_M); // // switch (read_mode) { // case SPI_FLASH_FASTRD: // //the default option // case SPI_FLASH_SLOWRD: // break; // case SPI_FLASH_QIO: // ctrl.fread_quad = 1; // ctrl.faddr_quad = 1; // user.fwrite_quad = 1; ...
395
val = *clock_val; abort(); } /** */ static inline void gpspi_flash_ll_set_miso_bitlen(spi_dev_t *dev, uint32_t bitlen) { // TODO: [ESP32C5] IDF-8698, IDF-8699 // dev->user.usr_miso = bitlen > 0; // if (bitlen) { // dev->ms_dlen.ms_data_bitlen = bitlen - 1; // } abort(); } /** */ stat...
395
usr_addr ? dev->user1.usr_addr_bitlen + 1 : 0; abort(); return (int)0; } /** */ static inline void gpspi_flash_ll_set_addr_bitlen(spi_dev_t *dev, uint32_t bitlen) { // TODO: [ESP32C5] IDF-8698, IDF-8699 // dev->user1.usr_addr_bitlen = (bitlen - 1); // dev->user.usr_addr = bitlen ? 1 : 0; abort...
395
cs_hold_time = hold_n - 1; // dev->user.cs_hold = (hold_n > 0? 1: 0); abort(); } static inline void gpspi_flash_ll_set_cs_setup(spi_dev_t *dev, uint32_t cs_setup_time) { // TODO: [ESP32C5] IDF-8698, IDF-8699 // dev->user.cs_setup = (cs_setup_time > 0 ? 1 : 0); // dev->user1.cs_setup_time = cs_setup...
395
/* */ / / // The LL layer for ESP32-C5 GPIO register operations #pragma once #include #include #include "soc/soc.h" #include "soc/gpio_periph.h" #include "soc/gpio_struct.h" #include "soc/lp_aon_struct.h" #include "soc/lp_io_struct.h" #include "soc/pmu_struct.h" #include "soc/pcr_struct.h" #include "soc/clk_tre...
396
gpio[gpio_num].fun_wpu; *pd = IOMUX.gpio[gpio_num].fun_wpd; *ie = IOMUX.gpio[gpio_num].fun_ie; *oe = (hw->enable.val & (1 > gpio_num; *od = hw->pin[gpio_num].pad_driver; *drv = IOMUX.gpio[gpio_num].fun_drv; *fun_sel = IOMUX.gpio[gpio_num].mcu_sel; *sig_out = hw->func_out_sel_cfg[gpio_num].ou...
396
If this efuse is burnt, the gpio pin // which should be checked is USB_INT_PHY0_DM_GPIO_NUM instead. // TODO: read the specific efuse with efuse_ll.h if (gpio_num == USB_INT_PHY0_DP_GPIO_NUM) { USB_SERIAL_JTAG.conf0.pad_pull_override = 1; USB_SERIAL_JTAG.conf0.dp_pullup = 0; } IOMUX...
396
status_w1tc = mask; } /** */ __attribute__((always_inline)) static inline void gpio_ll_clear_intr_status_high(gpio_dev_t *hw, uint32_t mask) { // Less than 32 GPIOs on ESP32-C5 Do nothing. } /** */ __attribute__((always_inline)) static inline void gpio_ll_intr_enable_on_core(gpio_dev_t *hw, uint32_t core_id, u...
396
gpio[gpio_num].filter_en = 1; } /** */ static inline void gpio_ll_pin_filter_disable(gpio_dev_t *hw, uint32_t gpio_num) { IOMUX.gpio[gpio_num].filter_en = 0; } /** */ static inline void gpio_ll_pin_input_hysteresis_enable(gpio_dev_t *hw, uint32_t gpio_num) { // On ESP32C5, there is an efuse bit that contro...
396
out_sel = SIG_GPIO_OUT_IDX; } /** */ __attribute__((always_inline)) static inline void gpio_ll_output_enable(gpio_dev_t *hw, uint32_t gpio_num) { hw->enable_w1ts.enable_w1ts = (0x1 pin[gpio_num].pad_driver = 0; } /** */ static inline void gpio_ll_od_enable(gpio_dev_t *hw, uint32_t gpio_num) { hw->pin[gpio...
396
gpio[gpio_num].fun_drv); } /** */ static inline void gpio_ll_hold_en(gpio_dev_t *hw, uint32_t gpio_num) { LP_AON.gpio_hold0.gpio_hold0 |= GPIO_HOLD_MASK[gpio_num]; } /** */ static inline void gpio_ll_hold_dis(gpio_dev_t *hw, uint32_t gpio_num) { LP_AON.gpio_hold0.gpio_hold0 &= ~GPIO_HOLD_MASK[gpio_num]; }...
396
usb_pad_enable = 0; } PIN_FUNC_SELECT(pin_name, func); } /** */ static inline __attribute__((always_inline)) void gpio_ll_set_pin_ctrl(uint32_t val, uint32_t bmap, uint32_t shift) { SET_PERI_REG_BITS(PIN_CTRL, bmap, val, shift); } /** */ __attribute__((always_inline)) static inline void gpio_ll_func_sel...
396
iomux_clk_conf.iomux_func_clk_sel = 0; break; case SOC_MOD_CLK_RC_FAST: PCR.iomux_clk_conf.iomux_func_clk_sel = 1; break; case SOC_MOD_CLK_PLL_F80M: PCR.iomux_clk_conf.iomux_func_clk_sel = 2; break; default: // Unsupported IO_MUX clock source HAL_ASSER...
396
gpio[gpio_num].slp_sel = 1; } /** */ static inline void gpio_ll_sleep_sel_dis(gpio_dev_t *hw, uint32_t gpio_num) { IOMUX.gpio[gpio_num].slp_sel = 0; } /** */ static inline void gpio_ll_sleep_pullup_dis(gpio_dev_t *hw, uint32_t gpio_num) { IOMUX.gpio[gpio_num].mcu_wpu = 0; } /** */ static inline void gp...
396
gpio[gpio_num].mcu_oe = 0; } /** */ static inline void gpio_ll_sleep_output_enable(gpio_dev_t *hw, uint32_t gpio_num) { IOMUX.gpio[gpio_num].mcu_oe = 1; } #ifdef __cplusplus } #endif
396
/* */ #pragma once #include #include #include #include "hal/assert.h" #include "hal/mpi_types.h" #include "soc/hwcrypto_periph.h" #include "soc/system_reg.h" #include "soc/system_struct.h" #include "soc/mpi_periph.h" #ifdef __cplusplus extern "C" { #endif /** */ static inline void mpi_ll_enable_bus_clock(bool ...
397
..) (void)__DECLARE_RCC_ATOMIC_ENV; mpi_ll_reset_register(__VA_ARGS__) static inline size_t mpi_ll_calculate_hardware_words(size_t words) { return words; } static inline void mpi_ll_clear_power_control_bit(void) { REG_CLR_BIT(SYSTEM_RSA_PD_CTRL_REG, SYSTEM_RSA_MEM_PD); } static inline void mpi_ll_set_power_c...
397
If num_words is higher than the number of words (n) in the bignum then these additional words will be zeroed in the memory buffer. */ static inline void mpi_ll_write_to_mem_block(mpi_param_t param, size_t offset, const uint32_t* p, size_t n, size_t num_words) { uint32_t mem_base = MPI_LL_BLOCK_BASES[param] ...
397
Reads z_words words from block. */ static inline void mpi_ll_read_from_mem_block(uint32_t* p, size_t n, size_t num_words) { uint32_t mem_base = MPI_LL_BLOCK_BASES[MPI_PARAM_Z]; /* Copy data from memory block registers */ const size_t REG_WIDTH = sizeof(uint32_t); for (size_t i = 0; i < num_words; i...
397
/* */ / / // The Lowlevel layer for TWAI #pragma once #include #include #include #include "esp_assert.h" #include "hal/misc.h" #include "hal/assert.h" #include "hal/twai_types.h" #include "soc/twai_periph.h" #include "soc/twai_struct.h" #include "soc/system_struct.h" #define TWAI_LL_GET_HW(controller_id) ((co...
398
lom = 0; hw->mode_reg.stm = 1; } else if (mode == TWAI_MODE_LISTEN_ONLY) { //Listen Only Mode hw->mode_reg.lom = 1; hw->mode_reg.stm = 0; } } /* Command Register */ /** */ __attribute__((always_inline)) static inline void twai_ll_set_cmd_tx(twai_dev_t *hw) { hw->command_re...
398
srr = 1; } /** */ __attribute__((always_inline)) static inline void twai_ll_set_cmd_self_rx_single_shot(twai_dev_t *hw) { hw->command_reg.val = 0x12; //Set command_reg.srr and command_reg.at simultaneously for single shot self reception request } /* Status Register */ /** */ __attribute__((always_inline)) st...
398
val = intr_mask; } /* Bus Timing Registers */ /** */ __attribute__((always_inline)) static inline bool twai_ll_check_brp_validation(uint32_t brp) { bool valid = (brp >= SOC_TWAI_BRP_MIN) && (brp bus_timing_0_reg.brp = (brp / 2) - 1; hw->bus_timing_0_reg.sjw = sjw - 1; hw->bus_timing_1_reg.tseg1 = tseg1...
398
val; } /* RX Error Count Register */ /** */ __attribute__((always_inline)) static inline uint32_t twai_ll_get_rec(twai_dev_t *hw) { return hw->rx_error_counter_reg.val; } /** */ __attribute__((always_inline)) static inline void twai_ll_set_rec(twai_dev_t *hw, uint32_t rec) { HAL_FORCE_MODIFY_U32_REG_FIEL...
398
acr[i], byte, ((code_swapped >> (i * 8)) & 0xFF)); HAL_FORCE_MODIFY_U32_REG_FIELD(hw->acceptance_filter.amr[i], byte, ((mask_swapped >> (i * 8)) & 0xFF)); } hw->mode_reg.afm = single_filter; } /* TX/RX Buffer Registers */ /** */ __attribute__((always_inline)) static inline void twai_ll_set_tx_buffe...
398
1 : 0; tx_frame->single_shot = (flags & TWAI_MSG_FLAG_SS) ? 1 : 0; //Set ID. The ID registers are big endian and left aligned, therefore a bswap will be required if (is_extd) { uint32_t id_temp = HAL_SWAP32((id & TWAI_EXTD_ID_MASK) > 8*(3-i)) for (int i = 0; i extended.id[i] = (id_temp >> ...
398
The ID registers are big endian and left aligned, therefore a bswap will be required if (rx_frame->frame_format) { uint32_t id_temp = 0; for (int i = 0; i extended.id[i] > 3; //((byte[i] > 3) *id = id_temp & TWAI_EXTD_ID_MASK; } else { uint32_t id_temp = 0; for (int i =...
398
co = 0; HAL_FORCE_MODIFY_U32_REG_FIELD(hw->clock_divider_reg, cd, 255); } else { hw->clock_divider_reg.co = 1; HAL_FORCE_MODIFY_U32_REG_FIELD(hw->clock_divider_reg, cd, 0); } } #ifdef __cplusplus } #endif
398
/* */ // The LL layer for Timer Group register operations. // Note that most of the register operations in this layer are non-atomic operations. #pragma once #ifdef __cplusplus extern "C" { #endif #include #include #include "soc/timer_periph.h" #include "soc/timer_group_struct.h" #include "hal/wdt_types.h" #incl...
399
wdt_en = 1; } /** */ FORCE_INLINE_ATTR void mwdt_ll_disable(timg_dev_t *hw) { hw->wdtconfig0.wdt_en = 0; } /** */ FORCE_INLINE_ATTR bool mwdt_ll_check_if_enabled(timg_dev_t *hw) { return (hw->wdtconfig0.wdt_en) ? true : false; } /** */ FORCE_INLINE_ATTR void mwdt_ll_config_stage(timg_dev_t *hw, wdt_stage_...
399
wdt_conf_update_en = 1; } /** */ FORCE_INLINE_ATTR void mwdt_ll_disable_stage(timg_dev_t *hw, uint32_t stage) { switch (stage) { case WDT_STAGE0: hw->wdtconfig0.wdt_stg0 = WDT_STAGE_ACTION_OFF; break; case WDT_STAGE1: hw->wdtconfig0.wdt_stg1 = WDT_STAGE_ACTION_OFF; break; ...
399
wdt_sys_reset_length = length; //Config registers are updated asynchronously hw->wdtconfig0.wdt_conf_update_en = 1; } /** */ FORCE_INLINE_ATTR void mwdt_ll_set_flashboot_en(timg_dev_t *hw, bool enable) { hw->wdtconfig0.wdt_flashboot_mod_en = (enable) ? 1 : 0; //Config registers are updated asynchronou...
399
wdt_wkey = 0; } /** */ FORCE_INLINE_ATTR void mwdt_ll_write_protect_disable(timg_dev_t *hw) { hw->wdtwprotect.wdt_wkey = TIMG_WDT_WKEY_VALUE; } /** */ FORCE_INLINE_ATTR void mwdt_ll_clear_intr_status(timg_dev_t *hw) { hw->int_clr_timers.wdt_int_clr = 1; } /** */ FORCE_INLINE_ATTR void mwdt_ll_set_intr_ena...
399
/* */ #pragma once #include #include #include "soc/hwcrypto_reg.h" #include "hal/aes_types.h" #ifdef __cplusplus extern "C" { #endif /** typedef enum { ESP_AES_STATE_IDLE = 0, /* AES accelerator is idle */ ESP_AES_STATE_BUSY, /* Transform in progress */ ESP_AES_STATE_DONE, /* Transform comple...
400
0 : MODE_DECRYPT_BIT; /* See TRM for the mapping between keylength and mode bit */ REG_WRITE(AES_MODE_REG, mode_reg_base + ((key_bytes / 8) - 2)); } /** */ static inline void aes_ll_write_block(const void *input) { uint32_t input_word; for (int i = 0; i < AES_BLOCK_WORDS; i++) { memcpy(&inp...
400
/* */ / / // The Lowlevel layer for SPI Flash #pragma once #include #include // For MIN/MAX #include #include #include "soc/spi_periph.h" #include "soc/spi_mem_struct.h" #include "hal/assert.h" #include "hal/spi_types.h" #include "hal/spi_flash_types.h" #include "hal/misc.h" #ifdef __cplusplus extern "C" { ...
401
val = 0; dev->cmd.flash_se = 1; } /** */ static inline void spimem_flash_ll_erase_block(spi_mem_dev_t *dev) { dev->cmd.flash_be = 1; } /** */ static inline void spimem_flash_ll_suspend(spi_mem_dev_t *dev) { dev->flash_sus_ctrl.flash_pes = 1; } /** */ static inline void spimem_flash_ll_resume(spi_mem_d...
401
sus_timeout_cnt = 5; dev->flash_sus_ctrl.pes_end_en = sus_check_sus_en; } /** static inline void spimem_flash_ll_res_check_sus_setup(spi_mem_dev_t *dev, bool res_check_sus_en) { dev->flash_sus_ctrl.sus_timeout_cnt = 5; dev->flash_sus_ctrl.per_end_en = res_check_sus_en; } /** */ static inline void spimem_...
401
flash_per_wait_en = auto_waiti; dev->flash_sus_ctrl.flash_pes_wait_en = auto_waiti; } /** */ static inline void spimem_flash_ll_set_wait_idle_dummy_phase(spi_mem_dev_t *dev, uint32_t extra_dummy) { // Not supported on this chip. } /** */ static inline bool spimem_flash_ll_sus_status(spi_mem_dev_t *dev) { ...
401
usr_dummy = 0; spimem_flash_ll_set_buffer_data(dev, buffer, length); dev->cmd.flash_pp = 1; } /** */ static inline void spimem_flash_ll_user_start(spi_mem_dev_t *dev, bool pe_ops) { uint32_t usr_pe = (pe_ops ? 0x60000 : 0x40000); dev->cmd.val |= usr_pe; } /** */ static inline bool spimem_flash_ll_ho...
401
val &= ~(SPI_MEM_FREAD_QIO_M | SPI_MEM_FREAD_QUAD_M | SPI_MEM_FREAD_DIO_M | SPI_MEM_FREAD_DUAL_M); ctrl.val |= SPI_MEM_FASTRD_MODE_M; switch (read_mode) { case SPI_FLASH_FASTRD: //the default option break; case SPI_FLASH_QIO: ctrl.fread_qio = 1; break; case SPI_FLASH_...
401
usr_mosi = bitlen > 0; dev->mosi_dlen.usr_mosi_bit_len = bitlen ? (bitlen - 1) : 0; } /** */ static inline void spimem_flash_ll_set_command(spi_mem_dev_t *dev, uint32_t command, uint32_t bitlen) { dev->user.usr_command = 1; typeof(dev->user2) user2 = { .usr_command_value = command, .usr_co...
401
usr_dummy = dummy_n ? 1 : 0; dev->user1.usr_dummy_cyclelen = dummy_n - 1; } /** */ static inline void spimem_flash_ll_set_dummy_out(spi_mem_dev_t *dev, uint32_t out_en, uint32_t out_lev) { dev->ctrl.fdummy_out = out_en; dev->ctrl.q_pol = out_lev; dev->ctrl.d_pol = out_lev; } /** */ static inline voi...
401
h` if (clkdiv == 1) { div_parameter = (1 ctrl.wp = level; } /** */ static inline uint32_t spimem_flash_ll_get_ctrl_val(spi_mem_dev_t *dev) { return dev->ctrl.val; } #ifdef __cplusplus } #endif
401
/* */ // The LL layer for I2C register operations #pragma once #include "stdbool.h" #include "hal/misc.h" #include "hal/assert.h" #include "soc/i2c_periph.h" #include "soc/soc_caps.h" #include "soc/i2c_struct.h" #include "hal/i2c_types.h" #include "soc/rtc_cntl_reg.h" #include "soc/clk_tree_defs.h" #include "soc/sy...
402
conf_upgate = 1; } /** */ static inline void i2c_ll_enable_bus_clock(int i2c_port, bool enable) { (void)i2c_port; SYSTEM.perip_clk_en0.reg_i2c_ext0_clk_en = enable; } /// use a macro to wrap the function, force the caller to use it in a critical section /// the critical section needs to declare the __DECLARE...
402
hw->scl_low_period.period = bus_cfg->scl_low - 1; hw->scl_high_period.period = bus_cfg->scl_high; hw->scl_high_period.scl_wait_high_period = bus_cfg->scl_wait_high; //sda sample hw->sda_hold.time = bus_cfg->sda_hold - 1; hw->sda_sample.time = bus_cfg->sda_sample - 1; //setup hw->scl_rst...
402
tx_fifo_rst = 1; hw->fifo_conf.tx_fifo_rst = 0; } /** */ __attribute__((always_inline)) static inline void i2c_ll_rxfifo_rst(i2c_dev_t *hw) { hw->fifo_conf.rx_fifo_rst = 1; hw->fifo_conf.rx_fifo_rst = 0; } /** */ __attribute__((always_inline)) static inline void i2c_ll_clear_intr_mask(i2c_dev_t *hw, uin...
402
time_out_value = tout; } /** */ static inline void i2c_ll_slave_broadcast_enable(i2c_dev_t *hw, bool broadcast_en) { hw->ctr.addr_broadcasting_en = broadcast_en; } /** */ __attribute__((always_inline)) static inline void i2c_ll_slave_get_stretch_cause(i2c_dev_t *hw, i2c_slave_stretch_cause_t *stretch_cause) { ...
402
addr = addr_14_7 | addr_6_0; hw->ctr.addr_10bit_rw_check_en = addr_10bit_en; } else { hw->slave_addr.addr = slave_addr; } } /** */ __attribute__((always_inline)) static inline void i2c_ll_master_write_cmd_reg(i2c_dev_t *hw, i2c_ll_hw_cmd_t cmd, int cmd_idx) { hw->command[cmd_idx].val = cmd...
402
tx_fifo_wm_thrhd = empty_thr; } /** */ static inline void i2c_ll_set_rxfifo_full_thr(i2c_dev_t *hw, uint8_t full_thr) { hw->fifo_conf.fifo_prt_en = 1; hw->fifo_conf.rx_fifo_wm_thrhd = full_thr; } /** */ static inline void i2c_ll_set_data_mode(i2c_dev_t *hw, i2c_trans_mode_t tx_mode, i2c_trans_mode_t rx_mode...
402
rx_fifo_cnt; } /** */ __attribute__((always_inline)) static inline void i2c_ll_get_txfifo_len(i2c_dev_t *hw, uint32_t *length) { *length = SOC_I2C_FIFO_LEN - hw->sr.tx_fifo_cnt; } /** */ static inline void i2c_ll_get_tout(i2c_dev_t *hw, int *timeout) { *timeout = hw->timeout.time_out_value; } /** */ __att...
402
fifo_addr_cfg_en = addr_wr_en; } /** */ static inline void i2c_ll_master_set_filter(i2c_dev_t *hw, uint8_t filter_num) { if (filter_num > 0) { hw->filter_cfg.scl_thres = filter_num; hw->filter_cfg.sda_thres = filter_num; hw->filter_cfg.scl_en = 1; hw->filter_cfg.sda_en = 1; } e...
402
while (hw->scl_sp_conf.scl_rst_slv_en); hw->ctr.conf_upgate = 1; } /** */ static inline void i2c_ll_set_source_clk(i2c_dev_t *hw, i2c_clock_source_t src_clk) { // src_clk : (1) for RTC_CLK, (0) for XTAL hw->clk_conf.sclk_sel = (src_clk == I2C_CLK_SRC_RC_FAST) ? 1 : 0; } /** */ static inline void i2...
402
slv_tx_auto_start_en = slv_ex_auto_en; } /** */ static inline volatile void *i2c_ll_get_interrupt_status_reg(i2c_dev_t *dev) { return &dev->int_status; } /** */ static inline void i2c_ll_slave_enable_scl_stretch(i2c_dev_t *dev, bool enable) { dev->scl_stretch_conf.slave_scl_stretch_en = enable; } /** */ _...
402
2) */ static inline void i2c_ll_set_scl_clk_timing(i2c_dev_t *hw, int high_period, int low_period, int wait_high_period) { hw->scl_low_period.period = low_period; hw->scl_high_period.period = high_period; hw->scl_high_period.scl_wait_high_period = wait_high_period; } /** */ static inline void i2c_ll_get...
402
end_detect) { *event = I2C_INTR_EVENT_END_DET; } else if (int_sts.trans_complete) { *event = I2C_INTR_EVENT_TRANS_DONE; } else { *event = I2C_INTR_EVENT_ERR; } } /** */ __attribute__((always_inline)) static inline void i2c_ll_slave_get_event(i2c_dev_t *hw, i2c_intr_event_t *event) ...
402
val = UINT32_MAX; hw->int_ena.val = I2C_LL_MASTER_RX_INT; } /** */ static inline void i2c_ll_master_disable_tx_it(i2c_dev_t *hw) { hw->int_ena.val &= (~I2C_LL_MASTER_TX_INT); } /** */ __attribute__((always_inline)) static inline void i2c_ll_master_disable_rx_it(i2c_dev_t *hw) { hw->int_ena.val &= (~I2C_...
402
period = hight_period - 10; hw->scl_high_period.scl_wait_high_period = hight_period - hw->scl_high_period.period; } /** */ static inline void i2c_ll_get_data_mode(i2c_dev_t *hw, i2c_trans_mode_t *tx_mode, i2c_trans_mode_t *rx_mode) { *tx_mode = (i2c_trans_mode_t)(hw->ctr.tx_lsb_first); *rx_mode = (i2c_tra...
402
/* */ #pragma once #include /* Required for NULL constant */ #include #include #include "hal/gdma_types.h" #include "soc/gdma_struct.h" #include "soc/gdma_reg.h" #include "soc/system_struct.h" #ifdef __cplusplus extern "C" { #endif #define GDMA_LL_GET_HW(id) (((id) == 0) ? (&GDMA) : NULL) #define GDMA_LL_CHANNE...
403
st.val & GDMA_LL_RX_EVENT_MASK; } } /** */ static inline void gdma_ll_rx_enable_interrupt(gdma_dev_t *dev, uint32_t channel, uint32_t mask, bool enable) { if (enable) { dev->intr[channel].ena.val |= (mask & GDMA_LL_RX_EVENT_MASK); } else { dev->intr[channel].ena.val &= ~(mask & GDMA_LL_RX_...
403
in.in_conf0.in_data_burst_en = enable; } /** */ static inline void gdma_ll_rx_enable_descriptor_burst(gdma_dev_t *dev, uint32_t channel, bool enable) { dev->channel[channel].in.in_conf0.indscr_burst_en = enable; } /** */ __attribute__((always_inline)) static inline void gdma_ll_rx_reset_channel(gdma_dev_t *dev,...
403
in.in_pop.infifo_pop = 1; return dev->channel[channel].in.in_pop.infifo_rdata; } /** */ __attribute__((always_inline)) static inline void gdma_ll_rx_set_desc_addr(gdma_dev_t *dev, uint32_t channel, uint32_t addr) { dev->channel[channel].in.in_link.addr = addr; } /** */ __attribute__((always_inline)) static ...
403
in.in_link.park; } /** */ __attribute__((always_inline)) static inline uint32_t gdma_ll_rx_get_success_eof_desc_addr(gdma_dev_t *dev, uint32_t channel) { return dev->channel[channel].in.in_suc_eof_des_addr; } /** */ __attribute__((always_inline)) static inline uint32_t gdma_ll_rx_get_error_eof_desc_addr(gdma_de...
403
in.in_peri_sel.sel = GDMA_LL_INVALID_PERIPH_ID; dev->channel[channel].in.in_conf0.mem_trans_en = false; } ///////////////////////////////////// TX ///////////////////////////////////////// /** */ __attribute__((always_inline)) static inline uint32_t gdma_ll_tx_get_interrupt_status(gdma_dev_t *dev, uint32_t channe...
403
st); } /** */ static inline void gdma_ll_tx_enable_owner_check(gdma_dev_t *dev, uint32_t channel, bool enable) { dev->channel[channel].out.out_conf1.out_check_owner = enable; } /** */ static inline void gdma_ll_tx_enable_data_burst(gdma_dev_t *dev, uint32_t channel, bool enable) { dev->channel[channel].out....
403
out.out_conf0.out_rst = 1; dev->channel[channel].out.out_conf0.out_rst = 0; } /** */ static inline bool gdma_ll_tx_is_fifo_full(gdma_dev_t *dev, uint32_t channel, uint32_t fifo_level) { return dev->channel[channel].out.outfifo_status.val & 0x01; } /** */ static inline bool gdma_ll_tx_is_fifo_empty(gdma_dev_...
403
out.out_link.addr = addr; } /** */ __attribute__((always_inline)) static inline void gdma_ll_tx_start(gdma_dev_t *dev, uint32_t channel) { dev->channel[channel].out.out_link.start = 1; } /** */ __attribute__((always_inline)) static inline void gdma_ll_tx_stop(gdma_dev_t *dev, uint32_t channel) { dev->channe...
403
out.out_dscr; } /** */ static inline void gdma_ll_tx_set_priority(gdma_dev_t *dev, uint32_t channel, uint32_t prio) { dev->channel[channel].out.out_pri.tx_pri = prio; } /** */ static inline void gdma_ll_tx_connect_to_periph(gdma_dev_t *dev, uint32_t channel, gdma_trigger_peripheral_t periph, int periph_id) { ...
403
/* */ // The LL layer of the USB-serial-jtag controller #pragma once #include #include "esp_attr.h" #include "soc/usb_serial_jtag_reg.h" #include "soc/usb_serial_jtag_struct.h" #include "soc/system_struct.h" #ifdef __cplusplus extern "C" { #endif //The in and out endpoints are this long. #define USB_SERIAL_JTAG_P...
404
int_ena.val |= mask; } /** */ static inline void usb_serial_jtag_ll_disable_intr_mask(uint32_t mask) { USB_SERIAL_JTAG.int_ena.val &= (~mask); } /** */ static inline uint32_t usb_serial_jtag_ll_get_intsts_mask(void) { return USB_SERIAL_JTAG.int_st.val; } /** */ static inline __attribute__((always_inline))...
404
USB_SERIAL_JTAG.ep1_conf.serial_in_ep_data_free) break; USB_SERIAL_JTAG.ep1.rdwr_byte = buf[i]; } return i; } /** */ static inline int usb_serial_jtag_ll_rxfifo_data_available(void) { return USB_SERIAL_JTAG.ep1_conf.serial_out_ep_data_avail; } /** */ static inline int usb_serial_jtag_ll_txfifo_w...
404
reg_usb_device_clk_en = clk_en; } // SYSTEM.perip_clk_enx are shared registers, so this function must be used in an atomic way #define usb_serial_jtag_ll_enable_bus_clock(...) (void)__DECLARE_RCC_ATOMIC_ENV; usb_serial_jtag_ll_enable_bus_clock(__VA_ARGS__) /** */ FORCE_INLINE_ATTR void usb_serial_jtag_ll_reset_regis...
404
/* */ #pragma once #include #include "soc/ext_mem_defs.h" #include "soc/memprot_defs.h" #include "soc/periph_defs.h" #include "hal/memprot_types.h" #ifdef __cplusplus extern "C" { #endif /* static inline void memprot_ll_set_iram0_dram0_split_line_lock(void) { REG_WRITE(SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SPLIT_...
405
(addr dummy (!) -> force -> data) - .dummy section seems to have wrong mapping (it doesn't fall inline with .rtctext) */ static inline memprot_hal_err_t memprot_ll_set_rtcfast_split_line(const void *line_addr, memprot_hal_world_t world) { uint32_t addr = (uint32_t)line_addr; uint32_t mask; if (addr = SO...
405
= 0) { return MEMP_HAL_ERR_SPLIT_ADDR_UNALIGNED; } uint32_t category[3] = {0}; if (addr = DRAM0_SRAM_LEVEL_2_LOW && addr > I_D_SPLIT_LINE_SHIFT) & SENSITIVE_CORE_X_IRAM0_DRAM0_DMA_SRAM_SPLITADDR_V) 0; } static inline void memprot_ll_dram0_set_monitor_intrclr(void) { REG_SET_BIT(SENSITIVE_CORE...
405
(addr << I_D_FAULT_ADDR_SHIFT) + DRAM0_VIOLATE_STATUS_ADDR_OFFSET : 0; } static inline uint32_t memprot_ll_dram0_get_monitor_status_fault_wr(void) { return REG_GET_FIELD(SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_3_REG, SENSITIVE_CORE_0_DRAM0_PMS_MONITOR_VIOLATE_STATUS_WR); } static inline uint32_t memprot_ll_dram0_get_...
405
/* */ #pragma once #include #include #include "soc/soc_caps.h" #include "hal/efuse_ll.h" #include_next "hal/efuse_hal.h" #ifdef __cplusplus extern "C" { #endif /** */ void efuse_hal_set_timing(uint32_t apb_freq_hz); /** */ void efuse_hal_read(void); /** */ void efuse_hal_clear_program_registers(void); /** ...
406
/* */ / / // The Lowlevel layer for SPI Flash Encryption. #include #include #include "soc/system_reg.h" #include "soc/xts_aes_reg.h" #include "soc/soc.h" #include "soc/soc_caps.h" #include "hal/assert.h" #ifdef __cplusplus extern "C" { #endif /// Choose type of chip you want to encrypt manully typedef enum { ...
407
= 0x3) { } } /** */ static inline void spi_flash_encrypt_ll_destroy(void) { REG_WRITE(XTS_AES_DESTROY_REG, 1); } /** */ static inline bool spi_flash_encrypt_ll_check(uint32_t address, uint32_t length) { return ((address % length) == 0) ? true : false; } #ifdef __cplusplus } #endif
407
/* */ /** */ #pragma once #include #include "soc/soc.h" #include "soc/rtc_cntl_struct.h" #ifdef __cplusplus extern "C" { #endif #define PWDET_CONF_REG 0x6000E060 #define PWDET_SAR_POWER_FORCE BIT(7) #define PWDET_SAR_POWER_CNTL BIT(6) typedef enum { SAR_CTRL_LL_POWER_FSM, //SAR power controlle...
408
/* */ // The LL layer for Timer Group register operations. // Note that most of the register operations in this layer are non-atomic operations. #pragma once #ifdef __cplusplus extern "C" { #endif #include #include #include "hal/misc.h" #include "hal/wdt_types.h" #include "soc/rtc_cntl_periph.h" #include "soc/rt...
409
en = 1; } /** */ FORCE_INLINE_ATTR void rwdt_ll_disable(rtc_cntl_dev_t *hw) { hw->wdt_config0.en = 0; } /** */ FORCE_INLINE_ATTR bool rwdt_ll_check_if_enabled(rtc_cntl_dev_t *hw) { return (hw->wdt_config0.en) ? true : false; } /** */ FORCE_INLINE_ATTR void rwdt_ll_config_stage(rtc_cntl_dev_t *hw, wdt_stag...
409
stg0 = WDT_STAGE_ACTION_OFF; break; case WDT_STAGE1: hw->wdt_config0.stg1 = WDT_STAGE_ACTION_OFF; break; case WDT_STAGE2: hw->wdt_config0.stg2 = WDT_STAGE_ACTION_OFF; break; case WDT_STAGE3: hw->wdt_config0.stg3 = WDT_STAGE_ACTION_OFF; break; defau...
409
appcpu_reset_en = (enable) ? 1 : 0; } /** */ FORCE_INLINE_ATTR void rwdt_ll_set_pause_in_sleep_en(rtc_cntl_dev_t *hw, bool enable) { hw->wdt_config0.pause_in_slp = (enable) ? 1 : 0; } /** */ FORCE_INLINE_ATTR void rwdt_ll_set_chip_reset_en(rtc_cntl_dev_t *hw, bool enable) { hw->wdt_config0.chip_reset_en = (...
409