text
stringlengths
1
9.98k
__index_level_0__
int64
0
4.17k
usr_miso_highpart = 0; hw->user.usr_mosi_highpart = 0; //Disable unneeded ints hw->slave.val = 0; hw->user.val = 0; hw->dma_conf.val = 0; hw->dma_conf.slv_tx_seg_trans_clr_en = 1; hw->dma_conf.slv_rx_seg_trans_clr_en = 1; hw->dma_conf.dma_slv_seg_trans_en = 0; } /** */ static inline ...
878
val = 0; hw->user.val = 0; hw->ctrl.val = 0; hw->user.doutdin = 0; hw->user.sio = 0; hw->slave.soft_reset = 1; hw->slave.soft_reset = 0; hw->slave.slave_mode = 1; } /** */ static inline bool spi_ll_usr_is_done(spi_dev_t *hw) { return hw->dma_int_raw.trans_done_int; } /** */ static i...
878
rx_afifo_rst = 0; } /** */ static inline void spi_ll_dma_tx_fifo_reset(spi_dev_t *hw) { hw->dma_conf.dma_afifo_rst = 1; hw->dma_conf.dma_afifo_rst = 0; } /** */ static inline void spi_ll_dma_rx_fifo_reset(spi_dev_t *hw) { hw->dma_conf.rx_afifo_rst = 1; hw->dma_conf.rx_afifo_rst = 0; } /** */ stati...
878
buf = word; } } /** */ static inline void spi_ll_write_buffer_byte(spi_dev_t *hw, int byte_id, uint8_t *data, int len) { HAL_ASSERT(byte_id + len 0); HAL_ASSERT(byte_id >= 0); while (len > 0) { uint32_t word; int offset = byte_id % 4; int copy_len = 4 - offset; if (co...
878
buf; int offset = byte_id % 4; int copy_len = 4 - offset; if (copy_len > len) { copy_len = len; } memcpy(out_data, ((uint8_t *)&word) + offset, copy_len); byte_id += copy_len; out_data += copy_len; len -= copy_len; } } /* **/ /** */ sta...
878
ck_out_edge = 1; } else if (mode == 3) { hw->misc.ck_idle_edge = 1; hw->user.ck_out_edge = 0; } } /** */ static inline void spi_ll_slave_set_mode(spi_dev_t *hw, const int mode, bool dma_used) { if (mode == 0) { hw->misc.ck_idle_edge = 0; hw->user.rsck_i_edge = 0; hw...
878
doutdin = !half_duplex; } /** */ static inline void spi_ll_set_sio_mode(spi_dev_t *hw, int sio_mode) { hw->user.sio = sio_mode; } /** */ static inline void spi_ll_master_set_line_mode(spi_dev_t *hw, spi_line_mode_t line_mode) { hw->ctrl.val &= ~SPI_LL_ONE_LINE_CTRL_MASK; hw->user.val &= ~SPI_LL_ONE_LINE...
878
dma_slv_seg_trans_en = seg_trans; } /** */ static inline void spi_ll_master_select_cs(spi_dev_t *hw, int cs_id) { hw->misc.cs0_dis = (cs_id == 0) ? 0 : 1; hw->misc.cs1_dis = (cs_id == 1) ? 0 : 1; hw->misc.cs2_dis = (cs_id == 2) ? 0 : 1; hw->misc.cs3_dis = (cs_id == 3) ? 0 : 1; hw->misc.cs4_dis = (...
878
Value written to register is one lower than used value. if (hz > ((fapb / 4) * 3)) { //Using Fapb directly will give us the best result here. reg.clkcnt_l = 0; reg.clkcnt_h = 0; reg.clkcnt_n = 0; reg.clkdiv_pre = 0; reg.clk_equ_sysclk = 1; eff_clk = fapb; ...
878
cs_hold_time = hold; hw->user.cs_hold = hold ? 1 : 0; } /** */ static inline void spi_ll_master_set_cs_setup(spi_dev_t *hw, uint8_t setup) { hw->user1.cs_setup_time = setup - 1; hw->user.cs_setup = setup ? 1 : 0; } /* **/ /** */ static inline void spi_ll_set_mosi_bitlen(spi_dev_t *hw, size_t bitlen) { ...
878
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, int addrlen, uint32_t lsbfirst) { if (lsbfirst) { /* The output address start from the LSB of the highest byte, i.e. */ addr = HAL_SWAP32(addr)...
878
usr_miso = enable; } /** */ static inline void spi_ll_enable_mosi(spi_dev_t *hw, int enable) { hw->user.usr_mosi = enable; } /** */ static inline uint32_t spi_ll_slave_get_rcv_bitlen(spi_dev_t *hw) { return hw->slave1.slv_data_bitlen; } /* **/ //helper macros to generate code for each interrupts #define F...
878
slv_rd_dma_done_int, dma_int_clr.slv_rd_dma_done_int, dma_int_set.slv_rd_dma_done_int) \ item(SPI_LL_INTR_WRDMA, dma_int_ena.slv_wr_dma_done_int, dma_int_raw.slv_wr_dma_done_int, dma_int_clr.slv_wr_dma_done_int, dma_int_set.slv_wr_dma_done_int) \ item(SPI_LL_INTR_SEG_DONE, dma_...
878
slv_cmda_int, dma_int_raw.slv_cmda_int, dma_int_clr.slv_cmda_int, dma_int_set.slv_cmda_int) static inline void spi_ll_enable_intr(spi_dev_t *hw, spi_ll_intr_t intr_mask) { #define ENA_INTR(intr_bit, en_reg, ...) if (intr_mask & (intr_bit)) hw->en_reg = 1; FOR_EACH_ITEM(ENA_INTR, I...
878
..) if (intr_mask & (intr_bit) && hw->sta_reg) return true; FOR_EACH_ITEM(GET_INTR, INTR_LIST); return false; #undef GET_INTR } #undef FOR_EACH_ITEM #undef INTR_LIST /** */ static inline void spi_ll_disable_int(spi_dev_t *hw) { hw->dma_int_ena.trans_done_int = 0; } /** */ static inline void spi_ll_clea...
878
1 : 0; } static inline int spi_ll_slave_get_rx_byte_len(spi_dev_t *hw) { return hw->slave1.slv_data_bitlen / 8; } static inline uint32_t spi_ll_slave_hd_get_last_addr(spi_dev_t *hw) { return hw->slave1.slv_last_addr; } #undef SPI_LL_RST_MASK #undef SPI_LL_UNUSED_INT_MASK /** */ static inline uint8_t spi_l...
878
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 ...
878
/* */ // 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...
879
tx_divcnt_rst = 1; } /** */ __attribute__((always_inline)) static inline void timer_ll_enable_auto_reload(timg_dev_t *hw, uint32_t timer_num, bool en) { hw->hw_timer[timer_num].config.tx_autoreload = en; } /** */ static inline void timer_ll_set_count_direction(timg_dev_t *hw, uint32_t timer_num, gptimer_count_d...
879
hi.tx_hi hw_timer[timer_num].lo.tx_lo); } /** */ __attribute__((always_inline)) static inline void timer_ll_set_alarm_value(timg_dev_t *hw, uint32_t timer_num, uint64_t alarm_value) { hw->hw_timer[timer_num].alarmhi.tx_alarm_hi = (uint32_t)(alarm_value >> 32); hw->hw_timer[timer_num].alarmlo.tx_alarm_lo = (ui...
879
load.tx_load = 1; } /** */ static inline void timer_ll_enable_etm(timg_dev_t *hw, bool en) { hw->regclk.etm_en = en; } /** */ __attribute__((always_inline)) static inline void timer_ll_enable_intr(timg_dev_t *hw, uint32_t mask, bool en) { if (en) { hw->int_ena_timers.val |= mask; } else { ...
879
/* */ #pragma once #include /* Required for NULL constant */ #include #include #include "hal/dma2d_types.h" #include "soc/dma2d_channel.h" #include "soc/dma2d_struct.h" #include "hal/misc.h" #include "hal/assert.h" #include "soc/soc.h" #include "soc/hp_sys_clkrst_struct.h" #ifdef __cplusplus extern "C" { #endif ...
880
clk_en = enable; // Reset AXI master read data FIFO dev->rst_conf.axim_rd_rst = 1; dev->rst_conf.axim_rd_rst = 0; // Reset AXI master write data FIFO dev->rst_conf.axim_wr_rst = 1; dev->rst_conf.axim_wr_rst = 0; // Disable TX/RX arbiter weight config dev->out_arb_config.val = 0; dev-...
880
in_color_convert.in_color_input_sel_chn = input_sel; dev->in_channel0.in_color_convert.in_color_3b_proc_en_chn = proc_en; dev->in_channel0.in_color_convert.in_color_output_sel_chn = output_sel; if (proc_en) { HAL_ASSERT(table); typeof(dev->in_channel0.in_color_param_group) color_param_group...
880
param_h.val[0]; dev->in_channel0.in_color_param_group.param_h.val[1] = color_param_group.param_h.val[1]; dev->in_channel0.in_color_param_group.param_m.val[0] = color_param_group.param_m.val[0]; dev->in_channel0.in_color_param_group.param_m.val[1] = color_param_group.param_m.val[1]; dev->...
880
in_scramble.in_scramble_sel_post_chn = dma2d_ll_get_scramble_order_sel(order); } // Arbiter /** */ static inline void dma2d_ll_rx_enable_arb_weight(dma2d_dev_t *dev, bool enable) { dev->in_arb_config.in_weight_en = enable; } /** */ static inline void dma2d_ll_rx_set_arb_timeout(dma2d_dev_t *dev, uint32_t timeo...
880
out_int_st.val & DMA2D_LL_TX_EVENT_MASK; } /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_enable_interrupt(dma2d_dev_t *dev, uint32_t channel, uint32_t mask, bool enable) { if (enable) { dev->out_channel[channel].out_int_ena.val = dev->out_channel[channel].out_int_ena.val | (mask & D...
880
out_conf0.out_check_owner_chn = enable; } /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_enable_eof_mode(dma2d_dev_t *dev, uint32_t channel, bool enable) { dev->out_channel[channel].out_conf0.out_eof_mode_chn = enable; } /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_...
880
out_conf0.out_mem_burst_length_chn = sel; } /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_enable_descriptor_burst(dma2d_dev_t *dev, uint32_t channel, bool enable) { dev->out_channel[channel].out_conf0.outdscr_burst_en_chn = enable; } /** */ __attribute__((always_inline)) static inline voi...
880
out_conf0.out_dscr_port_en_chn = enable; } /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_set_macro_block_size(dma2d_dev_t *dev, uint32_t channel, dma2d_macro_block_size_t size) { uint32_t sel; switch (size) { case DMA2D_MACRO_BLOCK_SIZE_NONE: sel = 3; break; case...
880
out_link_addr.outlink_addr_chn = addr; } /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_start(dma2d_dev_t *dev, uint32_t channel) { dev->out_channel[channel].out_link_conf.outlink_start_chn = 1; } /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_stop(dma2d_dev_t *dev, u...
880
out_eof_des_addr.val; } /** */ __attribute__((always_inline)) static inline uint32_t dma2d_ll_tx_get_prefetched_desc_addr(dma2d_dev_t *dev, uint32_t channel) { return dev->out_channel[channel].out_dscr.val; } /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_set_priority(dma2d_dev_t *dev, uin...
880
out_conf0.out_reorder_en_chn = enable; } // COLOR SPACE CONVERTION FUNCTION /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_configure_color_space_conv(dma2d_dev_t *dev, uint32_t channel, dma2d_csc_tx_option_t csc_sel) { // L1 uint32_t input_sel = 7; // Disable CSC // L2 bool proc...
880
out_color_convert.out_color_input_sel_chn = input_sel; dev->out_channel[channel].out_color_convert.out_color_3b_proc_en_chn = proc_en; dev->out_channel[channel].out_color_convert.out_color_output_sel_chn = output_sel; if (proc_en) { HAL_ASSERT(table); typeof(dev->out_channel[channel].out_col...
880
out_color_param_group.param_h.val[0] = color_param_group.param_h.val[0]; dev->out_channel[channel].out_color_param_group.param_h.val[1] = color_param_group.param_h.val[1]; dev->out_channel[channel].out_color_param_group.param_m.val[0] = color_param_group.param_m.val[0]; dev->out_channel[channel]...
880
out_weight_en = enable; } /** */ static inline void dma2d_ll_tx_set_arb_timeout(dma2d_dev_t *dev, uint32_t timeout_num) { HAL_FORCE_MODIFY_U32_REG_FIELD(dev->out_arb_config, out_arb_timeout_num, timeout_num); } /** */ __attribute__((always_inline)) static inline void dma2d_ll_tx_set_arb_token_num(dma2d_dev_t *d...
880
/* */ #pragma once #include #include "soc/soc.h" #include "soc/clk_tree_defs.h" #include "soc/hp_sys_clkrst_reg.h" #include "soc/hp_sys_clkrst_struct.h" #include "soc/lp_clkrst_struct.h" #include "soc/pmu_reg.h" #include "hal/regi2c_ctrl.h" #include "soc/regi2c_cpll.h" #include "soc/regi2c_mpll.h" #include "soc/reg...
881
303031 MHz, refer to 'periph_rtc_apll_freq_set' for the calculation #define CLK_LL_APLL_MAX_HZ (125000000) // 125MHz, refer to 'periph_rtc_apll_freq_set' for the calculation #define CLK_LL_XTAL32K_CONFIG_DEFAULT() { \ .dac = 3, \ .dres = 3, \ .dgm = 3, \ .dbuf = 1, \ } /** */ typedef enum { CL...
881
root_clk_ctrl2, reg_apb_clk_div_num) + 1; } /** */ static inline __attribute__((always_inline)) void clk_ll_pll_f50m_set_divider(uint32_t divider) { HAL_ASSERT(divider >= 1); HAL_FORCE_MODIFY_U32_REG_FIELD(HP_SYS_CLKRST.ref_clk_ctrl0, reg_ref_50m_clk_div_num, divider - 1); } /** */ static inline __attribute...
881
lp_clk_conf.slow_clk_sel = 3 is for SOC_RTC_SLOW_CLK_SRC_OSC_SLOW (a 32kHz clock signal generated // by an external circuit connecting to XTAL_32K_N (i.e. GPIO0)), but we don't use it on ESP32P4, since osc_slow // clock can not be calibrated to get its actual frequency default: // Unsupported RTC_SL...
881
lp_clk_conf.ana_sel_ref_pll8m = field_value; } /** */ static inline __attribute__((always_inline)) soc_lp_pll_clk_src_t clk_ll_lp_pll_get_src(void) { uint32_t clk_sel = LP_AON_CLKRST.lp_clk_conf.ana_sel_ref_pll8m; switch (clk_sel) { case 0: return SOC_LP_PLL_CLK_SRC_RC32K; case 1: retu...
881
fast_clk_sel = 2; break; default: // Unsupported RTC_FAST_CLK mux input sel abort(); } } /** */ static inline __attribute__((always_inline)) soc_rtc_fast_clk_src_t clk_ll_rtc_fast_get_src(void) { uint32_t clk_sel = LP_AON_CLKRST.lp_clk_conf.fast_clk_sel; switch (clk_sel) { ...
881
= 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_rtc_slow_store_cal(uint32_t cal_value) { REG_WRITE(RTC_SLOW_CLK_CAL_REG, cal_value); ...
881
/* */ // The LL layer for ESP32-P4 PMU register operations // TODO: IDF-5731 #pragma once #include #include #include "soc/soc.h" #include "esp_attr.h" #include "hal/assert.h" #include "soc/pmu_struct.h" #include "hal/pmu_types.h" #ifdef __cplusplus extern "C" { #endif /** */ FORCE_INLINE_ATTR void pmu_ll_hp_se...
882
syscntl.power_det_bypass = bypass_en; } FORCE_INLINE_ATTR void pmu_ll_hp_set_uart_wakeup_enable(pmu_dev_t *hw, pmu_hp_mode_t mode, bool wakeup_en) { hw->hp_sys[mode].syscntl.uart_wakeup_en = wakeup_en; } FORCE_INLINE_ATTR void pmu_ll_hp_set_hold_all_lp_pad(pmu_dev_t *hw, pmu_hp_mode_t mode, bool hold_all) { h...
882
clk_power.val = xpd_flag; } FORCE_INLINE_ATTR void pmu_ll_hp_set_xtal_xpd(pmu_dev_t *hw, pmu_hp_mode_t mode, bool xpd_xtal) { hw->hp_sys[mode].xtal.xpd_xtal = xpd_xtal; } FORCE_INLINE_ATTR void pmu_ll_hp_set_dcm_mode(pmu_dev_t *hw, pmu_hp_mode_t mode, uint32_t dcm_mode) { hw->hp_sys[mode].bias.dcm_mode = mode...
882
backup.val = param; } FORCE_INLINE_ATTR void pmu_ll_hp_set_sleep_to_active_backup_enable(pmu_dev_t *hw) { hw->hp_sys[PMU_MODE_HP_ACTIVE].backup.hp_sleep2active_backup_en = 1; } FORCE_INLINE_ATTR void pmu_ll_hp_set_sleep_to_active_backup_disable(pmu_dev_t *hw) { hw->hp_sys[PMU_MODE_HP_ACTIVE].backup.hp_sleep2a...
882
backup.hp_modem2sleep_backup_en = 1; } FORCE_INLINE_ATTR void pmu_ll_hp_set_modem_to_sleep_backup_disable(pmu_dev_t *hw) { hw->hp_sys[PMU_MODE_HP_SLEEP].backup.hp_modem2sleep_backup_en = 0; } FORCE_INLINE_ATTR void pmu_ll_hp_set_backup_icg_func(pmu_dev_t *hw, pmu_hp_mode_t mode, uint32_t icg_func) { hw->hp_sy...
882
sysclk.dig_sysclk_sel = sysclk_sel; } FORCE_INLINE_ATTR void pmu_ll_hp_set_regulator_sleep_logic_xpd(pmu_dev_t *hw, pmu_hp_mode_t mode, bool slp_xpd) { hw->hp_sys[mode].regulator0.slp_logic_xpd = slp_xpd; } FORCE_INLINE_ATTR void pmu_ll_hp_set_regulator_sleep_memory_xpd(pmu_dev_t *hw, pmu_hp_mode_t mode, bool slp...
882
regulator0.dbias = dbias; } FORCE_INLINE_ATTR void pmu_ll_hp_set_regulator_driver_bar(pmu_dev_t *hw, pmu_hp_mode_t mode, uint32_t drv_b) { hw->hp_sys[mode].regulator1.drv_b = drv_b; } FORCE_INLINE_ATTR void pmu_ll_lp_set_regulator_slp_xpd(pmu_dev_t *hw, pmu_lp_mode_t mode, bool slp_xpd) { hw->lp_sys[mode].re...
882
xtal.xpd_xtal = xpd_xtal; } FORCE_INLINE_ATTR void pmu_ll_lp_set_dig_power(pmu_dev_t *hw, pmu_lp_mode_t mode, uint32_t flag) { hw->lp_sys[mode].dig_power.val = flag; } FORCE_INLINE_ATTR void pmu_ll_lp_set_clk_power(pmu_dev_t *hw, pmu_lp_mode_t mode, uint32_t xpd_flag) { hw->lp_sys[mode].clk_power.val = xpd_f...
882
bias.pd_cur = off; } FORCE_INLINE_ATTR void pmu_ll_lp_set_bias_sleep_enable(pmu_dev_t *hw, pmu_lp_mode_t mode, bool en) { HAL_ASSERT(mode == PMU_MODE_LP_SLEEP); hw->lp_sys[mode].bias.bias_sleep = en; } /****/ FORCE_INLINE_ATTR void pmu_ll_imm_set_clk_power(pmu_dev_t *hw, uint32_t flag) { hw->imm.clk_powe...
882
hp_apb_icg.update_dig_icg_apb_en = icg_apb_update; } FORCE_INLINE_ATTR void pmu_ll_imm_update_dig_icg_modem_code(pmu_dev_t *hw, bool icg_modem_update) { hw->imm.modem_icg.update_dig_icg_modem_en = icg_modem_update; } FORCE_INLINE_ATTR void pmu_ll_imm_set_lp_rootclk_sel(pmu_dev_t *hw, bool rootclk_sel) { if (r...
882
hp_pd[domain].force_reset = rst; } FORCE_INLINE_ATTR void pmu_ll_hp_set_power_force_isolate(pmu_dev_t *hw, pmu_hp_power_domain_t domain, bool iso) { hw->power.hp_pd[domain].force_iso = iso; } FORCE_INLINE_ATTR void pmu_ll_hp_set_power_force_power_up(pmu_dev_t *hw, pmu_hp_power_domain_t domain, bool fpu) { hw-...
882
lp_peri.force_iso = iso; } FORCE_INLINE_ATTR void pmu_ll_lp_set_power_force_power_up(pmu_dev_t *hw, bool fpu) { hw->power.lp_peri.force_pu = fpu; } FORCE_INLINE_ATTR void pmu_ll_lp_set_power_force_no_reset(pmu_dev_t *hw, bool no_rst) { hw->power.lp_peri.force_no_reset = no_rst; } FORCE_INLINE_ATTR void pmu_l...
882
mem_cntl.force_hp_mem_pu = fpu; } /*** */ FORCE_INLINE_ATTR void pmu_ll_hp_set_sleep_enable(pmu_dev_t *hw) { hw->wakeup.cntl0.sleep_req = 1; } FORCE_INLINE_ATTR void pmu_ll_hp_set_reject_enable(pmu_dev_t *hw, uint32_t reject) { hw->wakeup.cntl1.sleep_reject_ena = reject; hw->wakeup.cntl1.slp_reject_en = 1...
882
int_raw.wakeup == 1); } FORCE_INLINE_ATTR bool pmu_ll_hp_is_sleep_reject(pmu_dev_t *hw) { return (hw->hp_ext.int_raw.reject == 1); } FORCE_INLINE_ATTR void pmu_ll_hp_clear_wakeup_intr_status(pmu_dev_t *hw) { hw->hp_ext.int_clr.wakeup = 1; } FORCE_INLINE_ATTR void pmu_ll_hp_clear_reject_intr_status(pmu_dev_t ...
882
cntl3.lp_min_slp_val = slow_clk_cycle; } FORCE_INLINE_ATTR void pmu_ll_hp_set_modify_icg_cntl_wait_cycle(pmu_dev_t *hw, uint32_t cycle) { hw->hp_ext.clk_cntl.modify_icg_cntl_wait = cycle; } FORCE_INLINE_ATTR uint32_t pmu_ll_hp_get_modify_icg_cntl_wait_cycle(pmu_dev_t *hw) { return hw->hp_ext.clk_cntl.modify_i...
882
wait_timer1.powerdown_timer = cycle; } FORCE_INLINE_ATTR uint32_t pmu_ll_lp_get_digital_power_down_wait_cycle(pmu_dev_t *hw) { return hw->power.wait_timer1.powerdown_timer; } FORCE_INLINE_ATTR void pmu_ll_lp_set_analog_wait_target_cycle(pmu_dev_t *hw, uint32_t slow_clk_cycle) { hw->wakeup.cntl5.lp_ana_wait_ta...
882
wait_xtal_stable; } FORCE_INLINE_ATTR void pmu_ll_set_pll_stable_wait_cycle(pmu_dev_t *hw, uint32_t cycle) { hw->power.clk_wait.wait_pll_stable = cycle; } FORCE_INLINE_ATTR uint32_t pmu_ll_get_pll_stable_wait_cycle(pmu_dev_t *hw) { return hw->power.clk_wait.wait_pll_stable; } FORCE_INLINE_ATTR void pmu_ll_lp...
882
cntl7.ana_wait_target; } FORCE_INLINE_ATTR uint32_t pmu_ll_hp_set_lite_wakeup_enable(pmu_dev_t *hw, bool wakeup_en) { return hw->wakeup.cntl8.lp_lite_wakeup_ena = wakeup_en; } FORCE_INLINE_ATTR void pmu_ll_hp_set_digital_power_supply_wait_cycle(pmu_dev_t *hw, uint32_t cycle) { hw->power.wait_timer0.wait_timer...
882
/* */ / / #pragma once #include #include #include "soc/system_reg.h" #include "soc/hwcrypto_reg.h" #include "soc/hp_sys_clkrst_struct.h" #include "hal/hmac_hal.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_SIGNA...
883
reg_rst_en_hmac = 0; } /// 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 hmac_ll_reset_register(...) (void)__DECLARE_RCC_ATOMIC_ENV; hmac_ll_reset_register(__VA_ARGS__) /** */ stati...
883
= 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_WR_MESSAGE_MEM + (i * REG_WIDTH), block[i]); } REG_WRITE(HMAC_SET_MESSAGE_ONE_REG, 1); } /**...
883
/* */ /** */ #pragma once #include #include #include #include "hal/misc.h" #include "hal/assert.h" #include "hal/rmt_types.h" #include "soc/rmt_struct.h" #include "soc/hp_sys_clkrst_struct.h" #ifdef __cplusplus extern "C" { #endif #define RMT_LL_EVENT_TX_DONE(channel) (1 = 1); HAL_FORCE_MODIFY_U32_REG...
884
..) (void)__DECLARE_RCC_ATOMIC_ENV; rmt_ll_set_group_clock_src(__VA_ARGS__) /** */ static inline void rmt_ll_enable_group_clock(rmt_dev_t *dev, bool en) { (void)dev; HP_SYS_CLKRST.peri_clk_ctrl22.reg_rmt_clk_en = en; } /// use a macro to wrap the function, force the caller to use it in a critical section ///...
884
apb_fifo_mask = enable; } ////////////////////////////////////////TX Channel Specific///////////////////////////////////////////////////////////// /** */ static inline void rmt_ll_tx_reset_channels_clock_div(rmt_dev_t *dev, uint32_t channel_mask) { // write 1 to reset dev->ref_cnt_rst.val |= channel_mask & 0...
884
dma_access_en_chn = enable; } /** */ __attribute__((always_inline)) static inline void rmt_ll_tx_start(rmt_dev_t *dev, uint32_t channel) { // update other configuration registers before start transmitting dev->chnconf0[channel].conf_update_chn = 1; dev->chnconf0[channel].tx_start_chn = 1; } /** */ __att...
884
tx_conti_mode_chn = 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 chn_tx_lim[channel].tx_loop_num_chn = count; } /** */ __attribute__((always_inline)) static inline void rmt_ll_tx_reset_loop_count(...
884
val &= ~(0x0F); } /** */ static inline void rmt_ll_tx_sync_group_add_channels(rmt_dev_t *dev, uint32_t channel_mask) { dev->tx_sim.val |= (channel_mask & 0x0F); } /** */ static inline void rmt_ll_tx_sync_group_remove_channels(rmt_dev_t *dev, uint32_t channel_mask) { dev->tx_sim.val &= ~channel_mask; } /** ...
884
carrier_en_chn = enable; } /** */ static inline void rmt_ll_tx_set_carrier_level(rmt_dev_t *dev, uint32_t channel, uint8_t level) { dev->chnconf0[channel].carrier_out_lv_chn = level; } /** */ static inline void rmt_ll_tx_enable_carrier_always_on(rmt_dev_t *dev, uint32_t channel, bool enable) { dev->chnconf0...
884
conf1.apb_mem_rst_chm = 1; dev->chmconf[channel].conf1.apb_mem_rst_chm = 0; } /** */ static inline void rmt_ll_rx_enable_dma(rmt_dev_t *dev, uint32_t channel, bool enable) { HAL_ASSERT(channel == 3 && "only RX channel 3 has DMA ability"); dev->chmconf[channel].conf0.dma_access_en_chm = enable; } /** */ ...
884
conf1.mem_owner_chm = owner; } /** */ __attribute__((always_inline)) static inline void rmt_ll_rx_enable_filter(rmt_dev_t *dev, uint32_t channel, bool enable) { dev->chmconf[channel].conf1.rx_filter_en_chm = enable; } /** */ __attribute__((always_inline)) static inline void rmt_ll_rx_set_filter_thres(rmt_dev_t ...
884
conf0.carrier_en_chm = enable; } /** */ static inline void rmt_ll_rx_set_carrier_level(rmt_dev_t *dev, uint32_t channel, uint8_t level) { dev->chmconf[channel].conf0.carrier_out_lv_chm = level; } /** */ static inline void rmt_ll_rx_enable_wrap(rmt_dev_t *dev, uint32_t channel, bool enable) { dev->chmconf[ch...
884
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...
884
val; } __attribute__((always_inline)) static inline uint32_t rmt_ll_rx_get_status_word(rmt_dev_t *dev, uint32_t channel) { return dev->chmstatus[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...
884
conf0.mem_size_chm; } __attribute__((always_inline)) static inline bool rmt_ll_tx_is_loop_enabled(rmt_dev_t *dev, uint32_t channel) { return dev->chnconf0[channel].tx_conti_mode_chn; } __attribute__((always_inline)) static inline rmt_clock_source_t rmt_ll_get_group_clock_src(rmt_dev_t *dev, uint32_t channel) { ...
884
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->chmconf[channel].conf1.mem_owner_chm; } __attribute__((always_inline)) static inline uint32_t rmt_ll_rx_get_limit(rmt_dev_t *dev, uint32_t...
884
val >> 8) & 0x0F; } __attribute__((always_inline)) static inline uint32_t rmt_ll_get_rx_thres_interrupt_status(rmt_dev_t *dev) { return (dev->int_st.val >> 24) & 0x0F; } __attribute__((always_inline)) static inline uint32_t rmt_ll_get_tx_loop_interrupt_status(rmt_dev_t *dev) { return (dev->int_st.val >> 12) &...
884
/* */ / / #pragma once #include #include "soc/lpperi_struct.h" #include "soc/pmu_struct.h" #include "soc/lp_system_struct.h" #ifdef __cplusplus extern "C" { #endif #define LP_CORE_LL_WAKEUP_SOURCE_LP_IO BIT(9) #define LP_CORE_LL_WAKEUP_SOURCE_LP_UART BIT(10) #define LP_CORE_LL_WAKEUP_SOURCE_LP_TIMER_0 ...
885
..) (void)__DECLARE_RCC_ATOMIC_ENV; lp_core_ll_enable_bus_clock(__VA_ARGS__) /** static inline void lp_core_ll_reset_register(void) { LPPERI.reset_en.rst_en_lp_core = 1; LPPERI.reset_en.rst_en_lp_core = 0; } /// use a macro to wrap the function, force the caller to use it in a critical section /// the critica...
885
lp_ext.pwr2.wakeup_en = flags; } /** */ static inline uint32_t lp_core_ll_get_wakeup_source(void) { return PMU.lp_ext.pwr2.wakeup_en; } /** */ static inline void lp_core_ll_set_boot_address(intptr_t boot_address) { LP_SYS.lp_core_boot_addr.lp_cpu_boot_addr = boot_address; } /** */ static inline void lp_c...
885
/* */ / / // The LL layer for ESP32-P4 MCPWM register operations #pragma once #include #include "soc/soc_caps.h" #include "soc/mcpwm_struct.h" #include "soc/clk_tree_defs.h" #include "soc/hp_sys_clkrst_struct.h" #include "hal/mcpwm_types.h" #include "hal/misc.h" #include "hal/assert.h" #include #include "soc/so...
886
..) (void)__DECLARE_RCC_ATOMIC_ENV; mcpwm_ll_group_set_clock_prescale(__VA_ARGS__) /** */ static inline void mcpwm_ll_group_enable_shadow_mode(mcpwm_dev_t *mcpwm) { mcpwm->update_cfg.global_up_en = 1; mcpwm->update_cfg.op0_up_en = 1; mcpwm->update_cfg.op1_up_en = 1; mcpwm->update_cfg.op2_up_en = 1; } ...
886
val &= ~mask; } } /** */ __attribute__((always_inline)) static inline uint32_t mcpwm_ll_intr_get_status(mcpwm_dev_t *mcpwm) { return mcpwm->int_st.val; } /** */ __attribute__((always_inline)) static inline void mcpwm_ll_intr_clear_status(mcpwm_dev_t *mcpwm, uint32_t mask) { mcpwm->int_clr.val = mask; } ...
886
timer_cfg0, timer_period, peak); } } /** */ static inline void mcpwm_ll_timer_update_period_at_once(mcpwm_dev_t *mcpwm, int timer_id) { mcpwm->timer[timer_id].timer_cfg0.timer_period_upmethod = 0; } /** */ static inline void mcpwm_ll_timer_enable_update_period_on_tez(mcpwm_dev_t *mcpwm, int timer_id, bool e...
886
timer_cfg1.timer_mod = 0; break; case MCPWM_TIMER_COUNT_MODE_UP: mcpwm->timer[timer_id].timer_cfg1.timer_mod = 1; break; case MCPWM_TIMER_COUNT_MODE_DOWN: mcpwm->timer[timer_id].timer_cfg1.timer_mod = 2; break; case MCPWM_TIMER_COUNT_MODE_UP_DOWN: mcpwm->timer...
886
timer_cfg1.timer_start = 4; break; default: HAL_ASSERT(false); break; } } /** */ __attribute__((always_inline)) static inline uint32_t mcpwm_ll_timer_get_count_value(mcpwm_dev_t *mcpwm, int timer_id) { // status.value saves the "next count value", so need an extra round up here to ...
886
timer_cfg0, timer_period)) % (HAL_FORCE_READ_U32_REG_FIELD(mcpwm->timer[timer_id].timer_cfg0, timer_period) + 1); } /** */ __attribute__((always_inline)) static inline mcpwm_timer_direction_t mcpwm_ll_timer_get_count_direction(mcpwm_dev_t *mcpwm, int timer_id) { return mcpwm->timer[timer_id].timer_stat...
886
timer_synco_sel = 1; break; case MCPWM_TIMER_EVENT_FULL: mcpwm->timer[timer_id].timer_sync.timer_synco_sel = 2; break; default: HAL_ASSERT(false); break; } } /** */ static inline void mcpwm_ll_timer_disable_sync_out(mcpwm_dev_t *mcpwm, int timer_id) { // sync_ou...
886
timer_phase_direction = direction; } /** */ static inline void mcpwm_ll_timer_set_gpio_sync_input(mcpwm_dev_t *mcpwm, int timer, int gpio_sync_id) { mcpwm->timer_synci_cfg.val &= ~(0x07 timer_synci_cfg.val |= (gpio_sync_id + 4) timer_synci_cfg.val &= ~(0x07 timer_synci_cfg.val |= (timer_sync_id + 1) timer_synci_c...
886
timestamp[event_cmpr_id], op_tstmp_e, compare_value); } /** */ static inline void mcpwm_ll_operator_update_action_at_once(mcpwm_dev_t *mcpwm, int operator_id) { mcpwm->operators[operator_id].gen_cfg0.gen_cfg_upmethod = 0; } /** */ static inline void mcpwm_ll_operator_enable_update_action_on_tez(mcpwm_dev_t *mcp...
886
val |= (3 operators[operator_id].generator[generator_id].val = 0; } /** */ static inline void mcpwm_ll_generator_set_action_on_timer_event(mcpwm_dev_t *mcpwm, int operator_id, int generator_id, mcpwm_timer_direction_t direction, mcpwm_timer_event_t event...
886
generator[generator_id].val |= MCPWM_LL_GEN_ACTION_TO_REG_CAL(action) operators[operator_id].generator[generator_id].val &= ~(0x03 operators[operator_id].generator[generator_id].val |= MCPWM_LL_GEN_ACTION_TO_REG_CAL(action) operators[operator_id].generator[generator_id].val &= ~(0x03 operators[operator_id].generator[ge...
886
gen_force.gen_cntuforce_upmethod = 0; // update force method immediately if (generator_id == 0) { mcpwm->operators[operator_id].gen_force.gen_a_cntuforce_mode = 0; } else { mcpwm->operators[operator_id].gen_force.gen_b_cntuforce_mode = 0; } } /** */ static inline void mcpwm_ll_gen_disable_...
886
gen_force.gen_b_cntuforce_mode = level + 1; } } /** */ static inline void mcpwm_ll_gen_set_noncontinue_force_level(mcpwm_dev_t *mcpwm, int operator_id, int generator_id, int level) { if (generator_id == 0) { mcpwm->operators[operator_id].gen_force.gen_a_nciforce_mode = level + 1; } else { ...
886
dt_cfg.db_red_insel = generator; } /** */ static inline void mcpwm_ll_deadtime_fed_select_generator(mcpwm_dev_t *mcpwm, int operator_id, int generator) { mcpwm->operators[operator_id].dt_cfg.db_fed_insel = generator; } /** */ static inline void mcpwm_ll_deadtime_bypass_path(mcpwm_dev_t *mcpwm, int operator_id, ...
886
db_red_insel operators[operator_id].dt_cfg.db_fed_outinvert operators[operator_id].dt_cfg.db_red_outinvert operators[operator_id].dt_cfg.db_a_outbypass operators[operator_id].dt_cfg.db_b_outbypass operators[operator_id].dt_fed_cfg, db_fed, fed - 1); } /** */ static inline void mcpwm_ll_deadtime_set_rising_delay(mcpwm...
886
dt_cfg.db_red_upmethod &= ~(1 operators[operator_id].dt_cfg.db_fed_upmethod |= 1 operators[operator_id].dt_cfg.db_red_upmethod |= 1 operators[operator_id].dt_cfg.db_fed_upmethod &= ~(1 operators[operator_id].dt_cfg.db_red_upmethod &= ~(1 operators[operator_id].dt_cfg.db_fed_upmethod |= 1 operators[operator_id].dt_cfg.d...
886
carrier_cfg.chopper_duty = carrier_duty; } /** */ static inline void mcpwm_ll_carrier_out_invert(mcpwm_dev_t *mcpwm, int operator_id, bool invert) { mcpwm->operators[operator_id].carrier_cfg.chopper_out_invert = invert; } /** */ static inline void mcpwm_ll_carrier_in_invert(mcpwm_dev_t *mcpwm, int operator_id, ...
886