text
stringlengths
1
9.98k
__index_level_0__
int64
0
4.17k
rtc_wdt) ? true : false; } /** */ FORCE_INLINE_ATTR void rwdt_ll_clear_intr_status(rtc_cntl_dev_t *hw) { hw->int_clr.rtc_wdt = 1; } #ifdef __cplusplus } #endif
409
/* */ // The LL layer for UART register operations. // Note that most of the register operations in this layer are non-atomic operations. #pragma once #include #include "hal/misc.h" #include "hal/uart_types.h" #include "soc/uart_reg.h" #include "soc/uart_struct.h" #include "soc/system_struct.h" #include "soc/syst...
410
sclk_en = 0; hw->clk_conf.rx_sclk_en = 0; hw->clk_conf.tx_sclk_en = 0; } /** */ FORCE_INLINE_ATTR void uart_ll_set_sclk(uart_dev_t *hw, soc_module_clk_t source_clk) { switch (source_clk) { case UART_SCLK_APB: hw->clk_conf.sclk_sel = 1; break; case UART_SCLK_RTC: ...
410
div_int = clk_div >> 4; hw->clk_div.div_frag = clk_div & 0xf; HAL_FORCE_MODIFY_U32_REG_FIELD(hw->clk_conf, sclk_div_num, sclk_div - 1); #undef DIV_UP } /** */ static inline uint32_t uart_ll_get_baudrate(uart_dev_t *hw, uint32_t sclk_freq) { typeof(hw->clk_div) div_reg; div_reg.val = hw->clk_div.val; ...
410
val; } /** */ FORCE_INLINE_ATTR void uart_ll_read_rxfifo(uart_dev_t *hw, uint8_t *buf, uint32_t rd_len) { for (int i = 0; i ahb_fifo.rw_byte; } } /** */ FORCE_INLINE_ATTR void uart_ll_write_txfifo(uart_dev_t *hw, const uint8_t *buf, uint32_t wr_len) { // Write to the FIFO should make sure only involve w...
410
txfifo_cnt; } /** */ FORCE_INLINE_ATTR void uart_ll_set_stop_bits(uart_dev_t *hw, uart_stop_bits_t stop_bit) { hw->conf0.stop_bit_num = stop_bit; } /** */ FORCE_INLINE_ATTR void uart_ll_get_stop_bits(uart_dev_t *hw, uart_stop_bits_t *stop_bit) { *stop_bit = (uart_stop_bits_t)hw->conf0.stop_bit_num; } /** ...
410
txfifo_empty_thrhd = empty_thrhd; } /** */ FORCE_INLINE_ATTR void uart_ll_set_rx_idle_thr(uart_dev_t *hw, uint32_t rx_idle_thr) { hw->idle_conf.rx_idle_thrhd = rx_idle_thr; } /** */ FORCE_INLINE_ATTR void uart_ll_set_tx_idle_num(uart_dev_t *hw, uint32_t idle_num) { hw->idle_conf.tx_idle_num = idle_num; } /...
410
tx_flow_en = 1; } else { hw->conf0.tx_flow_en = 0; } } /** */ FORCE_INLINE_ATTR void uart_ll_get_hw_flow_ctrl(uart_dev_t *hw, uart_hw_flowcontrol_t *flow_ctrl) { *flow_ctrl = UART_HW_FLOWCTRL_DISABLE; if (hw->conf1.rx_flow_en) { *flow_ctrl = (uart_hw_flowcontrol_t)((unsigned int)(*flow...
410
sw_flow_con_en = 0; hw->flow_conf.xonoff_del = 0; } } /** */ FORCE_INLINE_ATTR void uart_ll_set_at_cmd_char(uart_dev_t *hw, uart_at_cmd_t *cmd_char) { HAL_FORCE_MODIFY_U32_REG_FIELD(hw->at_cmd_char, data, cmd_char->cmd_char); HAL_FORCE_MODIFY_U32_REG_FIELD(hw->at_cmd_char, char_num, cmd_char->char...
410
active_threshold = wakeup_thrd - UART_LL_MIN_WAKEUP_THRESH; } /** */ FORCE_INLINE_ATTR void uart_ll_set_mode_normal(uart_dev_t *hw) { hw->rs485_conf.en = 0; hw->rs485_conf.tx_rx_en = 0; hw->rs485_conf.rx_busy_tx_en = 0; hw->conf0.irda_en = 0; } /** */ FORCE_INLINE_ATTR void uart_ll_set_mode_rs485_ap...
410
rx_busy_tx_en = 0; hw->conf0.irda_en = 0; hw->rs485_conf.dl0_en = 1; hw->rs485_conf.dl1_en = 1; hw->rs485_conf.en = 1; } /** */ FORCE_INLINE_ATTR void uart_ll_set_mode_collision_detect(uart_dev_t *hw) { hw->conf0.irda_en = 0; // Enable full-duplex mode hw->rs485_conf.tx_rx_en = 1; // T...
410
active_threshold + UART_LL_MIN_WAKEUP_THRESH; } /** */ FORCE_INLINE_ATTR void uart_ll_get_data_bit_num(uart_dev_t *hw, uart_word_length_t *data_bit) { *data_bit = (uart_word_length_t)hw->conf0.bit_num; } /** */ FORCE_INLINE_ATTR bool uart_ll_is_tx_idle(uart_dev_t *hw) { return ((hw->status.txfifo_cnt == 0) ...
410
val = hw->conf0.val; conf0_reg.irda_tx_inv = (inv_mask & UART_SIGNAL_IRDA_TX_INV) ? 1 : 0; conf0_reg.irda_rx_inv = (inv_mask & UART_SIGNAL_IRDA_RX_INV) ? 1 : 0; conf0_reg.rxd_inv = (inv_mask & UART_SIGNAL_RXD_INV) ? 1 : 0; conf0_reg.cts_inv = (inv_mask & UART_SIGNAL_CTS_INV) ? 1 : 0; conf0_reg.dsr_i...
410
rx_tout_en > 0) { tout_thrd = hw->mem_conf.rx_tout_thrhd; } return tout_thrd; } /** */ FORCE_INLINE_ATTR uint16_t uart_ll_max_tout_thrd(uart_dev_t *hw) { return UART_RX_TOUT_THRHD_V; } /** */ FORCE_INLINE_ATTR void uart_ll_set_autobaud_en(uart_dev_t *hw, bool enable) { hw->conf0.autobaud_en ...
410
err_wr_mask = discard ? 1 : 0; } #ifdef __cplusplus } #endif
410
/* */ / / // The LL layer for SPI register operations #pragma once #include //for abs() #include #include "esp_attr.h" #include "esp_types.h" #include "soc/spi_periph.h" #include "soc/spi_struct.h" #include "soc/system_struct.h" #include "soc/lldesc.h" #include "hal/assert.h" #include "hal/misc.h" #include "hal...
411
mst_clk_sel = 0; break; default: hw->clk_gate.mst_clk_sel = 1; break; } } /** */ static inline void spi_ll_master_init(spi_dev_t *hw) { //Reset timing hw->user1.cs_setup_time = 0; hw->user1.cs_hold_time = 0; //use all 64 bytes of the buffer hw->user...
411
usr_miso_highpart = 0; hw->user.usr_mosi_highpart = 0; // Configure DMA In-Link to not be terminated when transaction bit counter exceeds hw->dma_conf.rx_eof_en = 0; hw->dma_conf.dma_seg_trans_en = 0; //Disable unneeded ints hw->dma_int_ena.val &= ~SPI_LL_UNUSED_INT_MASK; } /** */ static inl...
411
usr = 1; } /** */ static inline uint32_t spi_ll_get_running_cmd(spi_dev_t *hw) { return hw->cmd.val; } /** */ static inline void spi_ll_slave_reset(spi_dev_t *hw) { hw->slave.soft_reset = 1; hw->slave.soft_reset = 0; } /** */ static inline void spi_ll_cpu_tx_fifo_reset(spi_dev_t *hw) { hw->dma_con...
411
outfifo_empty_err = 1; } /* **/ /** */ static inline void spi_ll_dma_rx_enable(spi_dev_t *hw, bool enable) { hw->dma_conf.dma_rx_ena = enable; } /** */ static inline void spi_ll_dma_tx_enable(spi_dev_t *hw, bool enable) { hw->dma_conf.dma_tx_ena = enable; } /** */ static inline void spi_ll_dma_set_rx_eof...
411
master_cs_pol |= (1 misc.master_cs_pol &= ~(1 ctrl.wr_bit_order = lsbfirst; } /** */ static inline void spi_ll_set_rx_lsbfirst(spi_dev_t *hw, bool lsbfirst) { hw->ctrl.rd_bit_order = lsbfirst; } /** */ static inline void spi_ll_master_set_mode(spi_dev_t *hw, uint8_t mode) { //Configure polarity if (mode...
411
rsck_i_edge = 1; hw->user.tsck_i_edge = 1; hw->slave.clk_mode_13 = 1; } else if (mode == 2) { hw->misc.ck_idle_edge = 1; hw->user.rsck_i_edge = 1; hw->user.tsck_i_edge = 1; hw->slave.clk_mode_13 = 0; } else if (mode == 3) { hw->misc.ck_idle_edge = 1; ...
411
faddr_dual = (line_mode.addr_lines == 2); hw->ctrl.faddr_quad = (line_mode.addr_lines == 4); hw->ctrl.fread_dual = (line_mode.data_lines == 2); hw->user.fwrite_dual = (line_mode.data_lines == 2); hw->ctrl.fread_quad = (line_mode.data_lines == 4); hw->user.fwrite_quad = (line_mode.data_lines == 4); }...
411
val = *(uint32_t *)val; } /** */ static inline int spi_ll_freq_for_pre_n(int fapb, int pre, int n) { return (fapb / (pre * n)); } /** */ static inline int spi_ll_master_cal_clock(int fapb, int hz, int duty_cycle, spi_ll_clock_val_t *out_reg) { typeof(GPSPI2.clock) reg; int eff_clk; //In hw, n, h an...
411
int pre, n, h, l; int bestn = -1; int bestpre = -1; int besterr = 0; int errval; for (n = 2; n 16) { pre = 16; } errval = abs(spi_ll_freq_for_pre_n(fapb, pre, n) - hz); if (bestn == -1 || errval user1.cs_hold_time = ho...
411
usr_command_bitlen = bitlen - 1; hw->user.usr_command = bitlen ? 1 : 0; } /** */ static inline void spi_ll_set_addr_bitlen(spi_dev_t *hw, int bitlen) { hw->user1.usr_addr_bitlen = bitlen - 1; hw->user.usr_addr = bitlen ? 1 : 0; } /** */ static inline void spi_ll_set_address(spi_dev_t *hw, uint64_t addr,...
411
usr_dummy = dummy_n ? 1 : 0; HAL_FORCE_MODIFY_U32_REG_FIELD(hw->user1, usr_dummy_cyclelen, dummy_n - 1); } /** */ static inline void spi_ll_enable_miso(spi_dev_t *hw, int enable) { hw->user.usr_miso = enable; } /** */ static inline void spi_ll_enable_mosi(spi_dev_t *hw, int enable) { hw->user.usr_mosi =...
411
rd_dma_done, dma_int_raw.rd_dma_done, dma_int_clr.rd_dma_done=1) \ item(SPI_LL_INTR_WRDMA, dma_int_ena.wr_dma_done, dma_int_raw.wr_dma_done, dma_int_clr.wr_dma_done=1) \ item(SPI_LL_INTR_SEG_DONE, dma_int_ena.dma_seg_trans_done, dma_int_raw.dma_seg_trans_done, dma_int_cl...
411
..) if (intr_mask & (intr_bit)) hw->en_reg = 0; FOR_EACH_ITEM(DIS_INTR, INTR_LIST); #undef DIS_INTR } static inline void spi_ll_set_intr(spi_dev_t *hw, spi_ll_intr_t intr_mask) { #define SET_INTR(intr_bit, _, st_reg, ...) if (intr_mask & (intr_bit)) hw->st_reg = 1; FOR_EACH_ITEM(SET_INTR, INTR_LIST); #undef SE...
411
trans_done = 0; } /** */ static inline void spi_ll_set_int_stat(spi_dev_t *hw) { hw->dma_int_raw.trans_done = 1; } /** */ static inline void spi_ll_enable_int(spi_dev_t *hw) { hw->dma_int_ena.trans_done = 1; } /* **/ static inline void spi_ll_slave_hd_set_len_cond(spi_dev_t *hw, spi_ll_trans_len_cond_t co...
411
data_lines == 2) { if (line_mode.addr_lines == 2) { cmd_mod = 0x50; //CMD:1-bit, ADDR:2-bit, DATA:2-bit } else { cmd_mod = 0x10; //CMD:1-bit, ADDR:1-bit, DATA:2-bit } } else if (line_mode.data_lines == 4) { if (line_mode.addr_lines == 4) { cmd_mod ...
411
/* */ // Attention: Timer Group has 3 independent functions: General Purpose Timer, Watchdog Timer and Clock calibration. // This Low Level driver only serve the General Purpose Timer function. #pragma once #include #include "hal/assert.h" #include "hal/misc.h" #include "hal/timer_types.h" #include "soc...
412
timer_clk_is_active = en; } /** */ __attribute__((always_inline)) static inline void timer_ll_enable_alarm(timg_dev_t *hw, uint32_t timer_num, bool en) { hw->hw_timer[timer_num].config.tx_alarm_en = en; } /** */ static inline void timer_ll_set_clock_prescale(timg_dev_t *hw, uint32_t timer_num, uint32_t divider)...
412
config.tx_en = en; } /** */ __attribute__((always_inline)) static inline void timer_ll_trigger_soft_capture(timg_dev_t *hw, uint32_t timer_num) { hw->hw_timer[timer_num].update.tx_update = 1; // Timer register is in a different clock domain from Timer hardware logic // We need to wait for the update to ta...
412
loadhi.tx_load_hi = (uint32_t) (load_val >> 32); hw->hw_timer[timer_num].loadlo.tx_load_lo = (uint32_t) load_val; } /** */ __attribute__((always_inline)) static inline uint64_t timer_ll_get_reload_value(timg_dev_t *hw, uint32_t timer_num) { return ((uint64_t)hw->hw_timer[timer_num].loadhi.tx_load_hi hw_timer[...
412
val = mask; } /** */ static inline void timer_ll_enable_register_clock_always_on(timg_dev_t *hw, bool en) { hw->regclk.clk_en = en; } /** */ static inline volatile void *timer_ll_get_intr_status_reg(timg_dev_t *hw) { return &hw->int_st_timers.val; } #ifdef __cplusplus } #endif
412
/* */ #pragma once #include #include "soc/soc.h" #include "soc/clk_tree_defs.h" #include "soc/system_reg.h" #include "soc/rtc_cntl_reg.h" #include "hal/regi2c_ctrl.h" #include "soc/regi2c_bbpll.h" #include "hal/assert.h" #include "hal/log.h" #include "esp32c3/rom/rtc.h" #ifdef __cplusplus extern "C" { #endif #def...
413
xtal_xpd_st; enabled = !disabled bool enabled = !xtal_xpd_sw || xtal_xpd_st; return enabled; } /** */ static inline __attribute__((always_inline)) void clk_ll_rc_fast_enable(void) { CLEAR_PERI_REG_MASK(RTC_CNTL_CLK_CONF_REG, RTC_CNTL_ENB_CK8M); REG_SET_FIELD(RTC_CNTL_TIMER1_REG, RTC_CNTL_CK8M_WAIT, CL...
413
= 0 && xtal_freq_reg != UINT32_MAX) { return xtal_freq_reg & ~RTC_DISABLE_ROM_LOG & UINT16_MAX; } // If the format in reg is invalid return 0; } /** */ static inline __attribute__((always_inline)) void clk_ll_apb_store_freq_hz(uint32_t apb_freq_hz) { uint32_t val = apb_freq_hz >> 12; WRITE...
413
/* */ // The LL layer for xtal32k WDT register operations. // Note that most of the register operations in this layer are non-atomic operations. #pragma once #include #include "soc/rtc_cntl_periph.h" #ifdef __cplusplus extern "C" { #endif #define XT_WDT_LL_XTAL32_DEAD_INTR_MASK RTC_CNTL_XTAL32K_DEAD_INT_ST_M /*...
414
xtal32k_auto_backup = enable; } /** */ inline void xt_wdt_ll_intr_enable(rtc_cntl_dev_t *hw, bool enable) { hw->int_ena.rtc_xtal32k_dead = enable; } #ifdef __cplusplus } #endif
414
/* */ / / #pragma once #include #include #include "soc/system_reg.h" #include "soc/system_struct.h" #include "soc/hwcrypto_reg.h" #include "hal/hmac_types.h" #define SHA256_BLOCK_SZ 64 #define SHA256_DIGEST_SZ 32 #define EFUSE_KEY_PURPOSE_HMAC_DOWN_JTAG 6 #define EFUSE_KEY_PURPOSE_HMAC_DOWN_DIGITAL_SIGNATURE ...
415
..) (void)__DECLARE_RCC_ATOMIC_ENV; hmac_ll_reset_register(__VA_ARGS__) /** */ static inline void hmac_ll_start(void) { REG_WRITE(HMAC_SET_START_REG, 1); } /** */ static inline void hmac_ll_config_output(hmac_hal_output_t config) { switch(config) { case HMAC_OUTPUT_USER: REG_WRITE(HMAC_SET_PARA_...
415
= 0); } /** */ static inline void hmac_ll_write_block_512(const uint32_t *block) { const size_t REG_WIDTH = sizeof(uint32_t); for (size_t i = 0; i < SHA256_BLOCK_SZ / REG_WIDTH; i++) { REG_WRITE(HMAC_WDATA_BASE + (i * REG_WIDTH), block[i]); } REG_WRITE(HMAC_SET_MESSAGE_ONE_REG, 1); } /** */...
415
/* */ /** */ #pragma once #include #include #include #include "hal/misc.h" #include "hal/assert.h" #include "soc/rmt_struct.h" #include "soc/system_struct.h" #include "hal/rmt_types.h" #ifdef __cplusplus extern "C" { #endif #define RMT_LL_EVENT_TX_DONE(channel) (1 sys_conf.clk_en = enable; // register clo...
416
sclk_div_a = divider_numerator; dev->sys_conf.sclk_div_b = divider_denominator; switch (src) { case RMT_CLK_SRC_APB: dev->sys_conf.sclk_sel = 1; break; case RMT_CLK_SRC_RC_FAST: dev->sys_conf.sclk_sel = 2; break; case RMT_CLK_SRC_XTAL: dev->sys_conf.sclk_sel =...
416
mem_rd_rst = 1; dev->tx_conf[channel].mem_rd_rst = 0; dev->tx_conf[channel].mem_rst = 1; dev->tx_conf[channel].mem_rst = 0; } /** */ __attribute__((always_inline)) static inline void rmt_ll_tx_start(rmt_dev_t *dev, uint32_t channel) { // update other configuration registers before start transmitting ...
416
tx_conti_mode = enable; } /** */ __attribute__((always_inline)) static inline void rmt_ll_tx_set_loop_count(rmt_dev_t *dev, uint32_t channel, uint32_t count) { HAL_ASSERT(count tx_lim[channel].tx_loop_num = count; } /** */ __attribute__((always_inline)) static inline void rmt_ll_tx_reset_loop_count(rmt_dev_t *d...
416
val &= ~channel_mask; } /** */ __attribute__((always_inline)) static inline void rmt_ll_tx_fix_idle_level(rmt_dev_t *dev, uint32_t channel, uint8_t level, bool enable) { dev->tx_conf[channel].idle_out_en = enable; dev->tx_conf[channel].idle_out_lv = level; } /** */ static inline void rmt_ll_tx_set_limit(rmt...
416
carrier_en = enable; } /** */ static inline void rmt_ll_tx_set_carrier_level(rmt_dev_t *dev, uint32_t channel, uint8_t level) { dev->tx_conf[channel].carrier_out_lv = level; } /** */ static inline void rmt_ll_tx_enable_carrier_always_on(rmt_dev_t *dev, uint32_t channel, bool enable) { dev->tx_conf[channel]....
416
conf1.mem_rst = 1; dev->rx_conf[channel].conf1.mem_rst = 0; } /** */ __attribute__((always_inline)) static inline void rmt_ll_rx_enable(rmt_dev_t *dev, uint32_t channel, bool enable) { dev->rx_conf[channel].conf1.rx_en = enable; // rx won't be enabled until configurations updated dev->rx_conf[channel]...
416
conf1.rx_filter_en = enable; } /** */ __attribute__((always_inline)) static inline void rmt_ll_rx_set_filter_thres(rmt_dev_t *dev, uint32_t channel, uint32_t thres) { HAL_FORCE_MODIFY_U32_REG_FIELD(dev->rx_conf[channel].conf1, rx_filter_thres, thres); } /** */ __attribute__((always_inline)) static inline uint32...
416
conf0.carrier_en = enable; } /** */ static inline void rmt_ll_rx_set_carrier_level(rmt_dev_t *dev, uint32_t channel, uint8_t level) { dev->rx_conf[channel].conf0.carrier_out_lv = level; } /** */ static inline void rmt_ll_rx_enable_wrap(rmt_dev_t *dev, uint32_t channel, bool enable) { dev->rx_conf[channel].c...
416
val & RMT_LL_EVENT_TX_MASK(channel); } /** */ static inline uint32_t rmt_ll_tx_get_interrupt_status_raw(rmt_dev_t *dev, uint32_t channel) { return dev->int_raw.val & (RMT_LL_EVENT_TX_MASK(channel) | RMT_LL_EVENT_TX_ERROR(channel)); } /** */ static inline uint32_t rmt_ll_rx_get_interrupt_status_raw(rmt_dev_t *de...
416
val; } __attribute__((always_inline)) static inline uint32_t rmt_ll_rx_get_status_word(rmt_dev_t *dev, uint32_t channel) { return dev->rx_status[channel].val; } __attribute__((always_inline)) static inline uint32_t rmt_ll_tx_get_channel_clock_div(rmt_dev_t *dev, uint32_t channel) { uint32_t div = HAL_FORCE_RE...
416
conf0.mem_size; } __attribute__((always_inline)) static inline bool rmt_ll_tx_is_loop_enabled(rmt_dev_t *dev, uint32_t channel) { return dev->tx_conf[channel].tx_conti_mode; } __attribute__((always_inline)) static inline rmt_clock_source_t rmt_ll_get_group_clock_src(rmt_dev_t *dev, uint32_t channel) { rmt_clo...
416
mem_force_pd) || !(dev->sys_conf.mem_force_pu); } __attribute__((always_inline)) static inline uint32_t rmt_ll_rx_get_mem_owner(rmt_dev_t *dev, uint32_t channel) { return dev->rx_conf[channel].conf1.mem_owner; } __attribute__((always_inline)) static inline uint32_t rmt_ll_rx_get_limit(rmt_dev_t *dev, uint32_t cha...
416
val >> 8) & 0x03; } __attribute__((always_inline)) static inline uint32_t rmt_ll_get_rx_thres_interrupt_status(rmt_dev_t *dev) { return (dev->int_st.val >> 10) & 0x03; } __attribute__((always_inline)) static inline uint32_t rmt_ll_get_tx_loop_interrupt_status(rmt_dev_t *dev) { return (dev->int_st.val >> 12) &...
416
/* */ #pragma once #include #include #include "soc/efuse_periph.h" #include "hal/assert.h" #include "rom/efuse.h" #ifdef __cplusplus extern "C" { #endif // Always inline these functions even no gcc optimization is applied. / eFuse fields / __attribute__((always_inline)) static inline uint32_t efuse_ll_get_flas...
417
rd_repeat_data3.err_rst_enable; } // use efuse_hal_get_major_chip_version() to get major chip version __attribute__((always_inline)) static inline uint32_t efuse_ll_get_chip_wafer_version_major(void) { return EFUSE.rd_mac_spi_sys_5.wafer_version_major; } // use efuse_hal_get_minor_chip_version() to get minor chip...
417
rd_repeat_data4.disable_blk_version_major; } __attribute__((always_inline)) static inline uint32_t efuse_ll_get_chip_ver_pkg(void) { return EFUSE.rd_mac_spi_sys_3.pkg_version; } __attribute__((always_inline)) static inline uint32_t efuse_ll_get_ocode(void) { // EFUSE_BLK2, 140, 8, ADC OCode return...
417
rd_mac_spi_sys_5.v_dig_dbias20_1 << 3) + EFUSE.rd_mac_spi_sys_4.v_dig_dbias20; } __attribute__((always_inline)) static inline uint32_t efuse_ll_get_dig_dbias_hvt(void) { // EFUSE_BLK1, 165, 5, BLOCK1 digital dbias when hvt return EFUSE.rd_mac_spi_sys_5.dig_dbias_hvt; } / eFuse control functions / ...
417
conf.op_code = EFUSE_WRITE_OP_CODE; } __attribute__((always_inline)) static inline void efuse_ll_set_dac_num(uint8_t val) { EFUSE.dac_conf.dac_num = val; } __attribute__((always_inline)) static inline void efuse_ll_set_dac_clk_div(uint8_t val) { EFUSE.dac_conf.dac_clk_div = val; } __attribute__((always_inlin...
417
/* */ #pragma once #include #include "hal/misc.h" #include "hal/assert.h" #include "soc/gpio_sd_struct.h" #ifdef __cplusplus extern "C" { #endif /** */ static inline void sdm_ll_enable_clock(gpio_sd_dev_t *hw, bool en) { hw->misc.function_clk_en = en; } /** */ __attribute__((always_inline)) static inline v...
418
/* */ #include #include "esp_attr.h" #include "soc/system_reg.h" #ifdef __cplusplus extern "C" { #endif /** */ FORCE_INLINE_ATTR void crosscore_int_ll_clear_interrupt(int core_id) { WRITE_PERI_REG(SYSTEM_CPU_INTR_FROM_CPU_0_REG, 0); } /** */ FORCE_INLINE_ATTR void crosscore_int_ll_trigger_interrupt(int co...
419
/* */ #pragma once #include #include "soc/soc.h" #include "soc/regi2c_defs.h" #ifdef __cplusplus extern "C" { #endif /** */ static inline void regi2c_ctrl_ll_i2c_reset(void) { SET_PERI_REG_BITS(ANA_CONFIG_REG, ANA_CONFIG_M, ANA_CONFIG_M, ANA_CONFIG_S); } /** */ static inline void regi2c_ctrl_ll_i2c_bbpll_e...
420
/* */ / / #pragma once #include #include #include #include "soc/hwcrypto_reg.h" #include "soc/soc_caps.h" #include "soc/system_struct.h" #include "hal/ds_types.h" #ifdef __cplusplus extern "C" { #endif /** */ static inline void ds_ll_enable_bus_clock(bool enable) { SYSTEM.perip_clk_en1.reg_crypto_ds_clk...
421
true : false; } /** */ static inline void ds_ll_wait_busy(void) { while (ds_ll_busy()); } /** */ static inline ds_key_check_t ds_ll_key_error_source(void) { uint32_t key_error = REG_READ(DS_QUERY_KEY_WRONG_REG); if (key_error == 0) { return DS_NO_KEY_INPUT; } else { return DS_OTHER_...
421
addr, from, frags[i].len); asm volatile ("fence"); from += frags[i].len; } } /** */ static inline void ds_ll_start_sign(void) { REG_WRITE(DS_SET_ME_REG, 1); } /** */ static inline ds_signature_check_t ds_ll_check_signature(void) { uint32_t result = REG_READ(DS_QUERY_CHECK_REG); switc...
421
/* */ #pragma once #include #include "soc/hwcrypto_reg.h" #include "hal/sha_types.h" #ifdef __cplusplus extern "C" { #endif /** */ static inline void sha_ll_start_block(esp_sha_type sha_type) { REG_WRITE(SHA_MODE_REG, sha_type); REG_WRITE(SHA_START_REG, 1); } /** */ static inline void sha_ll_continue_b...
422
/* */ // The LL layer for MMU register operations #pragma once #include "esp_types.h" #include "soc/extmem_reg.h" #include "soc/ext_mem_defs.h" #include "hal/assert.h" #include "hal/mmu_types.h" #ifdef __cplusplus extern "C" { #endif /** */ static inline uint32_t mmu_ll_vaddr_to_laddr(uint32_t vaddr) { retu...
423
false : true; } /** */ static inline mmu_target_t mmu_ll_get_entry_target(uint32_t mmu_id, uint32_t entry_id) { (void)mmu_id; HAL_ASSERT(entry_id < SOC_MMU_ENTRY_NUM); return MMU_TARGET_FLASH0; } /** */ static inline uint32_t mmu_ll_entry_id_to_paddr_base(uint32_t mmu_id, uint32_t entry_id) { (voi...
423
/* */ // The LL layer for DEBUG_ASSIST peripheral #pragma once #include "soc/assist_debug_reg.h" #define ASSIST_DEBUG_SP_SPILL_BITS (ASSIST_DEBUG_CORE_0_SP_SPILL_MIN_ENA | ASSIST_DEBUG_CORE_0_SP_SPILL_MAX_ENA) #ifndef __ASSEMBLER__ #include #include #include "esp_attr.h" #include "hal/assert.h" #ifdef __cplus...
424
/* */ // The LL layer for I2S register operations / / #pragma once #include #include "hal/misc.h" #include "hal/assert.h" #include "soc/i2s_periph.h" #include "soc/i2s_struct.h" #include "soc/system_struct.h" #include "hal/i2s_types.h" #include "hal/hal_utils.h" #ifdef __cplusplus extern "C" { #endif #define I2...
425
perip_clk_en0.reg_i2s1_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_RCC_ATOMIC_ENV variable in advance #define i2s_ll_enable_bus_clock(...) (void)__DECLARE_RCC_ATOMIC_ENV; i2s_ll_enable_bus_clock(__VA_A...
425
..) (void)__DECLARE_RCC_ATOMIC_ENV; i2s_ll_enable_core_clock(__VA_ARGS__) /** */ static inline void i2s_ll_tx_enable_clock(i2s_dev_t *hw) { hw->tx_clkm_conf.tx_clk_active = 1; } /** */ static inline void i2s_ll_rx_enable_clock(i2s_dev_t *hw) { hw->rx_clkm_conf.rx_clk_active = 1; } /** */ static inline voi...
425
tx_reset = 1; hw->tx_conf.tx_reset = 0; } /** */ static inline void i2s_ll_rx_reset(i2s_dev_t *hw) { hw->rx_conf.rx_reset = 1; hw->rx_conf.rx_reset = 0; } /** */ static inline void i2s_ll_tx_reset_fifo(i2s_dev_t *hw) { hw->tx_conf.tx_fifo_reset = 1; hw->tx_conf.tx_fifo_reset = 0; } /** */ stat...
425
rx_clk_sel = 0; break; case I2S_CLK_SRC_PLL_160M: hw->rx_clkm_conf.rx_clk_sel = 2; break; case I2S_CLK_SRC_EXTERNAL: hw->rx_clkm_conf.rx_clk_sel = 3; break; default: HAL_ASSERT(false && "unsupported clock source"); break; } } /** */ static inline...
425
rx_clkm_div_x = x; div.rx_clkm_div_y = y; div.rx_clkm_div_z = z; div.rx_clkm_div_yn1 = yn1; hw->rx_clkm_div_conf.val = div.val; } /** */ static inline void i2s_ll_tx_set_mclk(i2s_dev_t *hw, const hal_utils_clk_div_t *mclk_div) { /* Workaround for inaccurate clock while switching from a relatively ...
425
rx_bck_div_num = val - 1; } /** */ static inline void i2s_ll_rx_set_mclk(i2s_dev_t *hw, const hal_utils_clk_div_t *mclk_div) { /* Workaround for inaccurate clock while switching from a relatively low sample rate to a high sample rate i2s_ll_rx_set_raw_clk_div(hw, 7, 317, 7, 3, 0); uint32_t div_x = 0; ...
425
tx_update = 1; while (hw->tx_conf.tx_update); hw->tx_conf.tx_start = 1; } /** */ static inline void i2s_ll_rx_start(i2s_dev_t *hw) { // Have to update registers before start hw->rx_conf.rx_update = 1; while (hw->rx_conf.rx_update); hw->rx_conf.rx_start = 1; } /** */ static inline void i2s_ll...
425
tx_tdm_chan_bits = chan_bit - 1; } /** */ static inline void i2s_ll_rx_set_sample_bit(i2s_dev_t *hw, uint8_t chan_bit, int data_bit) { hw->rx_conf1.rx_bits_mod = data_bit - 1; hw->rx_conf1.rx_tdm_chan_bits = chan_bit - 1; } /** */ static inline void i2s_ll_tx_set_half_sample_bit(i2s_dev_t *hw, int half_samp...
425
rx_tdm_tot_chan_num = total_num - 1; } /** */ static inline void i2s_ll_tx_set_active_chan_mask(i2s_dev_t *hw, uint32_t chan_mask) { uint32_t tdm_ctrl = hw->tx_tdm_ctrl.val; tdm_ctrl &= 0xFFFF0000; tdm_ctrl |= chan_mask; hw->tx_tdm_ctrl.val = tdm_ctrl; } /** */ static inline void i2s_ll_rx_set_activ...
425
rx_tdm_tot_chan_num = 1; // rx_tdm_tot_chan_num = 2 slots - 1 = 1 uint32_t chan_mask = 0; switch (slot_mask) { case I2S_STD_SLOT_LEFT: chan_mask |= 0x01; break; case I2S_STD_SLOT_RIGHT: chan_mask |= 0x02; break; case I2S_STD_SLOT_BOTH: chan_mask |= 0x03; ...
425
pcm2pdm_conv_en = false; } /** */ static inline void i2s_ll_rx_enable_tdm(i2s_dev_t *hw) { hw->rx_conf.rx_pdm_en = false; hw->rx_conf.rx_tdm_en = true; } /** */ static inline void i2s_ll_tx_enable_std(i2s_dev_t *hw) { i2s_ll_tx_enable_tdm(hw); } /** */ static inline void i2s_ll_rx_enable_std(i2s_dev_t...
425
tx_pdm_lp_in_shift = sig_scale; } /** */ static inline void i2s_ll_tx_set_pdm_sinc_scale(i2s_dev_t *hw, i2s_pdm_sig_scale_t sig_scale) { hw->tx_pcm2pdm_conf.tx_pdm_sinc_in_shift = sig_scale; } /** */ static inline void i2s_ll_tx_set_pdm_sd_scale(i2s_dev_t *hw, i2s_pdm_sig_scale_t sig_scale) { hw->tx_pcm2pdm...
425
tx_pdm_sigmadelta_dither2 = dither2; } /** */ static inline void i2s_ll_tx_set_pdm_over_sample_ratio(i2s_dev_t *hw, uint32_t ovr) { hw->tx_pcm2pdm_conf.tx_pdm_sinc_osr2 = ovr; } /** */ static inline void i2s_ll_tx_set_pdm_fpfs(i2s_dev_t *hw, uint32_t fp, uint32_t fs) { hw->tx_pcm2pdm_conf1.tx_pdm_fp = fp; ...
425
tx_pcm_bypass = !pcm_cfg; } /** */ static inline void i2s_ll_rx_set_pcm_type(i2s_dev_t *hw, i2s_pcm_compress_t pcm_cfg) { hw->rx_conf.rx_pcm_conf = pcm_cfg; hw->rx_conf.rx_pcm_bypass = !pcm_cfg; } /** */ static inline void i2s_ll_tx_enable_left_align(i2s_dev_t *hw, bool ena) { hw->tx_conf.tx_left_align ...
425
tx_tdm_skip_msk_en = skip_mask_ena; } /** */ static inline void i2s_ll_set_single_data(i2s_dev_t *hw, uint32_t data) { hw->conf_single_data = data; } /** */ static inline void i2s_ll_tx_enable_mono_mode(i2s_dev_t *hw, bool mono_ena) { hw->tx_conf.tx_mono = mono_ena; hw->tx_conf.tx_chan_equal = mono_ena...
425
tx_chan_mod = mask == I2S_PDM_SLOT_LEFT ? 1 : 2; } else { hw->tx_conf.tx_chan_mod = mask == I2S_PDM_SLOT_LEFT ? 4 : 3; } } else { hw->tx_conf.tx_chan_mod = 0; } } /** */ static inline void i2s_ll_tx_pdm_line_mode(i2s_dev_t *hw, i2s_pdm_tx_line_mode_t line_mode) { hw->tx...
425
/* */ / / // The LL for temperature sensor #pragma once #include #include #include "hal/regi2c_ctrl.h" #include "soc/regi2c_saradc.h" #include "soc/apb_saradc_struct.h" #include "soc/soc.h" #include "soc/soc_caps.h" #include "soc/system_struct.h" #include "hal/temperature_sensor_types.h" #include "hal/assert.h"...
426
..) do {(void)__DECLARE_RCC_ATOMIC_ENV; temperature_sensor_ll_bus_clk_enable(__VA_ARGS__);} while(0) /** */ static inline void temperature_sensor_ll_reset_module(void) { SYSTEM.perip_rst_en1.reg_tsens_rst = 1; SYSTEM.perip_rst_en1.reg_tsens_rst = 0; } /// use a macro to wrap the function, force the caller to...
426
apb_tsens_ctrl2.tsens_clk_sel = clk_sel; } /** */ static inline void temperature_sensor_ll_set_range(uint32_t range) { REGI2C_WRITE_MASK(I2C_SAR_ADC, I2C_SARADC_TSENS_DAC, range); } /** */ static inline uint32_t temperature_sensor_ll_get_raw_value(void) { return HAL_FORCE_READ_U32_REG_FIELD(APB_SARADC.apb_t...
426
/* */ // The LL layer for LEDC register operations. // Note that most of the register operations in this layer are non-atomic operations. #pragma once #include "hal/ledc_types.h" #include "soc/ledc_periph.h" #include "soc/ledc_struct.h" #include "soc/system_struct.h" #include "hal/assert.h" #ifdef __cplusplus exte...
427
timer[timer_sel].conf.low_speed_update = 1; } /** */ static inline void ledc_ll_timer_rst(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_timer_t timer_sel) { hw->timer_group[speed_mode].timer[timer_sel].conf.rst = 1; hw->timer_group[speed_mode].timer[timer_sel].conf.rst = 0; } /** */ static inline void ledc_l...
427
timer[timer_sel].conf.clock_divider; } /** */ static inline void ledc_ll_get_clock_source(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_timer_t timer_sel, ledc_clk_src_t *clk_src) { *clk_src = LEDC_APB_CLK; } /** */ static inline void ledc_ll_set_duty_resolution(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_timer...
427
channel[channel_num].hpoint.hpoint = hpoint_val; } /** */ static inline void ledc_ll_get_hpoint(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, uint32_t *hpoint_val) { *hpoint_val = hw->channel_group[speed_mode].channel[channel_num].hpoint.hpoint; } /** */ static inline void ledc_ll_set_duty...
427
conf1.duty_num = duty_num; } /** */ static inline void ledc_ll_set_duty_cycle(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, uint32_t duty_cycle) { hw->channel_group[speed_mode].channel[channel_num].conf1.duty_cycle = duty_cycle; } /** */ static inline void ledc_ll_set_duty_scale(ledc_dev_t...
427
conf1.val = conf1_reg.val; } /** */ __attribute__((always_inline)) static inline void ledc_ll_set_sig_out_en(ledc_dev_t *hw, ledc_mode_t speed_mode, ledc_channel_t channel_num, bool sig_out_en) { hw->channel_group[speed_mode].channel[channel_num].conf0.sig_out_en = sig_out_en; } /** */ static inline void ledc_l...
427
val = fade_end_intr_en ? (value | BIT(int_en_base + channel_num)) : (value & (~(BIT(int_en_base + channel_num)))); } /** */ static inline void ledc_ll_get_fade_end_intr_status(ledc_dev_t *hw, ledc_mode_t speed_mode, uint32_t *intr_status) { uint32_t value = hw->int_st.val; uint32_t int_en_base = LEDC_DUTY_CHN...
427