text
stringlengths
1
9.98k
__index_level_0__
int64
0
4.17k
oen_sel = 0; hw->func_out_sel_cfg[gpio_num].oen_inv_sel = oen_inv; gpio_ll_func_sel(hw, gpio_num, func); } /** */ static inline int gpio_ll_get_in_signal_connected_io(gpio_dev_t *hw, uint32_t in_sig_idx) { typeof(hw->func_in_sel_cfg[in_sig_idx]) reg; reg.val = hw->func_in_sel_cfg[in_sig_idx].val; ...
805
/* */ #pragma once #include #include #include #include "hal/assert.h" #include "hal/mpi_types.h" #include "soc/hwcrypto_periph.h" #include "soc/dport_reg.h" #include "soc/mpi_periph.h" #ifdef __cplusplus extern "C" { #endif /** */ static inline void mpi_ll_enable_bus_clock(bool enable) { if (enable) { ...
806
..) (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(DPORT_RSA_PD_CTRL_REG, DPORT_RSA_MEM_PD); } static inline void mpi_ll_set_power_con...
806
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] ...
806
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 */ esp_dport_access_read_buffer(p, mem_base, num_words); /* Zero any remaining l...
806
/* */ / / // 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_reg.h" #define TWAI_LL_GET_HW(controller_id) ((contr...
807
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...
807
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...
807
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...
807
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...
807
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...
807
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 >> ...
807
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 =...
807
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
807
/* */ // 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 "esp_assert.h" #include "soc/timer_periph.h" #include "soc/timer_group_struct.h" #include...
808
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_...
808
wdt_stg0 = WDT_STAGE_ACTION_OFF; break; case WDT_STAGE1: hw->wdtconfig0.wdt_stg1 = WDT_STAGE_ACTION_OFF; break; case WDT_STAGE2: hw->wdtconfig0.wdt_stg2 = WDT_STAGE_ACTION_OFF; break; case WDT_STAGE3: hw->wdtconfig0.wdt_stg3 = WDT_STAGE_ACTION_OFF; bre...
808
wdt_flashboot_mod_en = (enable) ? 1 : 0; } /** */ FORCE_INLINE_ATTR void mwdt_ll_set_prescaler(timg_dev_t *hw, uint32_t prescaler) { // In case the compiler optimise a 32bit instruction (e.g. s32i) into 8/16bit instruction (e.g. s8i, which is not allowed to access a register) // We take care of the "read-modi...
808
wdt_int_ena = (enable) ? 1 : 0; } /** */ FORCE_INLINE_ATTR void mwdt_ll_set_clock_source(timg_dev_t *hw, mwdt_clock_source_t clk_src) { /* No clk source option on S2, always use APB as clock source */ (void)hw; (void)clk_src; HAL_ASSERT(clk_src == MWDT_CLK_SRC_APB); } /** */ __attribute__((always_i...
808
/* */ #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 compl...
809
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...
809
/* */ / / // 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" { ...
810
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_cmd.flash_pes = 1; } /** */ static inline void spimem_flash_ll_resume(spi_mem_de...
810
dev->flash_waiti_ctrl.waiti_en = auto_waiti; // enable auto wait-idle function. } /** */ 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) { ...
810
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...
810
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_QOUT: ctrl.fread_quad = 1; break; case SPI_FLASH_DIO: ctrl.fread_dio = 1; ...
810
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...
810
usr_dummy = dummy_n ? 1 : 0; HAL_FORCE_MODIFY_U32_REG_FIELD(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_l...
810
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
810
/* */ / / #pragma once #ifdef __cplusplus extern "C" { #endif #include #include "soc/hwcrypto_reg.h" #include "soc/crypto_dma_reg.h" #include "soc/dport_reg.h" typedef enum { CRYPTO_DMA_AES= 0, CRYPTO_DMA_SHA, } crypto_dma_mode_t; /** static inline void crypto_dma_ll_reset(void) { SET_PERI_REG_MASK(...
811
/* */ // The LL layer for I2C register operations #pragma once #include #include "soc/i2c_periph.h" #include "soc/i2c_struct.h" #include "soc/clk_tree_defs.h" #include "soc/system_reg.h" #include "hal/i2c_types.h" #include "esp_attr.h" #include "hal/misc.h" #ifdef __cplusplus extern "C" { #endif /** */ typedef ...
812
scl_wait_high_period = bus_cfg->scl_wait_high; //sda sample hw->sda_hold.time = bus_cfg->sda_hold; hw->sda_sample.time = bus_cfg->sda_sample; //setup hw->scl_rstart_setup.time = bus_cfg->setup; hw->scl_stop_setup.time = bus_cfg->setup; //hold hw->scl_start_hold.time = bus_cfg->hold - 1; ...
812
val = mask; } /** */ __attribute__((always_inline)) static inline void i2c_ll_enable_intr_mask(i2c_dev_t *hw, uint32_t mask) { hw->int_ena.val |= mask; } /** */ __attribute__((always_inline)) static inline void i2c_ll_disable_intr_mask(i2c_dev_t *hw, uint32_t mask) { hw->int_ena.val &= (~mask); } /** */ _...
812
en_10bit = addr_10bit_en; if (addr_10bit_en) { uint16_t addr_14_7 = (slave_addr & 0xff) > 8) | 0x78; hw->slave_addr.addr = addr_14_7 | addr_6_0; } else { hw->slave_addr.addr = slave_addr; } } /** */ __attribute__((always_inline)) static inline void i2c_ll_master_write_cmd_reg(i2c_d...
812
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...
812
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->status_reg.tx_fifo_cnt; } /** */ static inline void i2c_ll_get_tout(i2c_dev_t *hw, int *timeout) { *timeout = hw->timeout.tout; } /** */ __attri...
812
thres = filter_num; hw->sda_filter_cfg.thres = filter_num; hw->scl_filter_cfg.en = 1; hw->sda_filter_cfg.en = 1; } else { hw->scl_filter_cfg.en = 0; hw->sda_filter_cfg.en = 0; } } /** */ static inline void i2c_ll_master_get_filter(i2c_dev_t *hw, uint8_t *filter_conf) { ...
812
val = 0; ctrl_reg.ms_mode = 1; ctrl_reg.sda_force_out = 1; ctrl_reg.scl_force_out = 1; hw->ctr.val = ctrl_reg.val; } /** */ static inline void i2c_ll_internal_od_enable(i2c_dev_t *hw, bool internal_od_ena) { hw->ctr.sda_force_out = (internal_od_ena == false); hw->ctr.scl_force_out = (internal_...
812
slave_scl_stretch_en = enable; } /** */ __attribute__((always_inline)) static inline void i2c_ll_slave_clear_stretch(i2c_dev_t *dev) { dev->scl_stretch_conf.slave_scl_stretch_clr = 1; } /** */ __attribute__((always_inline)) static inline bool i2c_ll_master_is_cmd_done(i2c_dev_t *hw, int cmd_idx) { return hw...
812
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...
812
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) ...
812
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_...
812
period = hight_period/2+2; 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_tran...
812
/* */ #pragma once #include #include "soc/memprot_defs.h" #include "hal/memprot_types.h" #include "soc/dport_reg.h" #include "soc/dport_access.h" #include "soc/periph_defs.h" #ifdef __cplusplus extern "C" { #endif /** */ static inline void memprot_ll_iram0_clear_intr(void) { DPORT_SET_PERI_REG_MASK(DPORT_PMS...
813
= 0) { return MEMP_HAL_ERR_SPLIT_ADDR_UNALIGNED; } //find possible split.address in low region blocks int uni_blocks_low = -1; if (addr >= IRAM0_SRAM_UNI_BLOCK_0_LOW) { uni_blocks_low++; } if (addr >= IRAM0_SRAM_UNI_BLOCK_1_LOW) { uni_blocks_low++; } if (addr >= ...
813
registers DPORT_WRITE_PERI_REG(DPORT_PMS_PRO_IRAM0_1_REG, uni_block_perm); DPORT_WRITE_PERI_REG(DPORT_PMS_PRO_IRAM0_2_REG, (uint32_t)(reg_split_addr | permission_mask)); return MEMP_HAL_OK; } static inline void memprot_ll_iram0_sram_get_split_sgnf_bits(bool *lw, bool *lr, bool *lx, bool *hw, bool *hr, bo...
813
1 : 0); DPORT_REG_SET_FIELD(DPORT_PMS_PRO_IRAM0_2_REG, DPORT_PMS_PRO_IRAM0_SRAM_4_H_R, hr ? 1 : 0); } static inline void memprot_ll_iram0_sram_set_write_perm(bool lw, bool hw) { DPORT_REG_SET_FIELD(DPORT_PMS_PRO_IRAM0_2_REG, DPORT_PMS_PRO_IRAM0_SRAM_4_L_W, lw ? 1 : 0); DPORT_REG_SET_FIELD(DPORT_PMS_PRO_IR...
813
= 0) { return MEMP_HAL_ERR_SPLIT_ADDR_UNALIGNED; } //conf reg [10:0] uint32_t reg_split_addr = IRAM0_RTCFAST_ADDR_TO_CONF_REG(addr); //prepare high & low permission mask (bits: [16:14] high range, [13:11] low range) uint32_t permission_mask = 0; if (lw) { permission_mask |= DPO...
813
1 : 0); DPORT_REG_SET_FIELD(DPORT_PMS_PRO_IRAM0_3_REG, DPORT_PMS_PRO_IRAM0_RTCFAST_H_R, hr ? 1 : 0); } static inline void memprot_ll_iram0_rtcfast_set_write_perm(bool lw, bool hw) { DPORT_REG_SET_FIELD(DPORT_PMS_PRO_IRAM0_3_REG, DPORT_PMS_PRO_IRAM0_RTCFAST_L_W, lw ? 1 : 0); DPORT_REG_SET_FIELD(DPORT_PMS_P...
813
= 0) { return MEMP_HAL_ERR_SPLIT_ADDR_UNALIGNED; } //set low region int uni_blocks_low = -1; if (addr >= DRAM0_SRAM_UNI_BLOCK_0_LOW) { uni_blocks_low++; } if (addr >= DRAM0_SRAM_UNI_BLOCK_1_LOW) { uni_blocks_low++; } if (addr >= DRAM0_SRAM_UNI_BLOCK_2_LOW) { ...
813
1 : 0); DPORT_REG_SET_FIELD(DPORT_PMS_PRO_DRAM0_2_REG, DPORT_PMS_PRO_DRAM0_RTCFAST_H_R, hr ? 1 : 0); } static inline void memprot_ll_dram0_rtcfast_set_write_perm(bool lw, bool hw) { DPORT_REG_SET_FIELD(DPORT_PMS_PRO_DRAM0_2_REG, DPORT_PMS_PRO_DRAM0_RTCFAST_L_W, lw ? 1 : 0); DPORT_REG_SET_FIELD(DPORT_PMS_P...
813
/* */ #pragma once #include #include #include "soc/soc_caps.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); /** */ void efuse_hal_program...
814
/* */ / / // The Lowlevel layer for SPI Flash Encryption. #include #include #include "soc/system_reg.h" #include "soc/hwcrypto_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 { ...
815
= 0x3) { } } /** */ static inline void spi_flash_encrypt_ll_destroy(void) { REG_WRITE(AES_XTS_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
815
/* */ /** */ #pragma once #include #include "soc/soc.h" #include "soc/sens_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 controlled by...
816
/* */ #pragma once #ifdef __cplusplus extern "C" { #endif #include #include #include "soc/cp_dma_struct.h" #define CP_DMA_LL_EVENT_RX_DONE (1 dma_conf.dma_in_rst = 1; dev->dma_conf.dma_in_rst = 0; } static inline void cp_dma_ll_reset_out_link(cp_dma_dev_t *dev) { dev->dma_conf.dma_out_rst = 1; ...
817
val |= mask; } else { dev->dma_int_ena.val &= ~mask; } } static inline __attribute__((always_inline)) uint32_t cp_dma_ll_get_intr_status(cp_dma_dev_t *dev) { return dev->dma_int_st.val; } static inline __attribute__((always_inline)) void cp_dma_ll_clear_intr_status(cp_dma_dev_t *dev, uint32_t mask...
817
dma_inlink_start = 1; // cleared automatically by HW } else { dev->dma_in_link.dma_inlink_stop = 1; // cleared automatically by HW } } static inline void cp_dma_ll_restart_tx(cp_dma_dev_t *dev) { dev->dma_out_link.dma_outlink_restart = 1; // cleared automatically by HW } static inline void cp_dma_...
817
val; } #ifdef __cplusplus } #endif
817
/* */ #pragma once #include "esp_bit_defs.h" #include "soc/dport_reg.h" #ifdef __cplusplus extern "C" { #endif static inline void trace_ll_set_mem_block(int block) { DPORT_WRITE_PERI_REG(DPORT_PMS_OCCUPY_3_REG, BIT(block-4)); } #ifdef __cplusplus } #endif
818
/* */ // 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...
819
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...
819
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_...
819
1 : 0; } /** */ FORCE_INLINE_ATTR void rwdt_ll_set_appcpu_reset_en(rtc_cntl_dev_t* hw, bool enable) { hw->wdt_config0.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; } /** ...
819
rtc_wdt = (enable) ? 1 : 0; } /** */ FORCE_INLINE_ATTR bool rwdt_ll_check_intr_status(rtc_cntl_dev_t *hw) { return (hw->int_st.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
819
/* */ // 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_reg.h" #include "soc/dport_r...
820
tick_ref_always_on) { default: case 0: *source_clk = (soc_module_clk_t)UART_SCLK_REF_TICK; break; case 1: *source_clk = (soc_module_clk_t)UART_SCLK_APB; break; } } /** */ FORCE_INLINE_ATTR void uart_ll_set_baudrate(uart_dev_t *hw, uint32_t ba...
820
val; } /** */ FORCE_INLINE_ATTR void uart_ll_clr_intsts_mask(uart_dev_t *hw, uint32_t mask) { hw->int_clr.val = mask; } /** */ FORCE_INLINE_ATTR uint32_t uart_ll_get_intr_ena_status(uart_dev_t *hw) { return hw->int_ena.val; } /** */ FORCE_INLINE_ATTR void uart_ll_read_rxfifo(uart_dev_t *hw, uint8_t *buf, ...
820
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; } /** */ FORCE_INLINE_ATTR void uart_ll_set_parity(uart_dev_t *hw, uart_parity_t parity_mode) { if(parity_mode != UART_PARITY_DIS...
820
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; } /** */ FORCE_INLINE_ATTR void uart_ll_tx_break(uart_dev_t *hw, uint32_t break_num) { if(break_num > 0) { HAL_FORCE_MODIFY_U32_REG_FIELD(hw...
820
rx_flow_en) { *flow_ctrl = (uart_hw_flowcontrol_t)((unsigned int)(*flow_ctrl) | (unsigned int)UART_HW_FLOWCTRL_RTS); } if(hw->conf0.tx_flow_en) { *flow_ctrl = (uart_hw_flowcontrol_t)((unsigned int)(*flow_ctrl) | (unsigned int)UART_HW_FLOWCTRL_CTS); } } /** */ FORCE_INLINE_ATTR void uart_ll...
820
bit_num = data_bit; } /** */ FORCE_INLINE_ATTR void uart_ll_set_rts_active_level(uart_dev_t *hw, int level) { hw->conf0.sw_rts = level & 0x1; } /** */ FORCE_INLINE_ATTR void uart_ll_set_dtr_active_level(uart_dev_t *hw, int level) { hw->conf0.sw_dtr = level & 0x1; } /** */ FORCE_INLINE_ATTR void uart_ll_se...
820
sw_rts = 1; // Must be set to 0 to automatically remove echo hw->rs485_conf.tx_rx_en = 0; // This is to void collision hw->rs485_conf.rx_busy_tx_en = 1; hw->conf0.irda_en = 0; hw->rs485_conf.en = 1; } /** */ FORCE_INLINE_ATTR void uart_ll_set_mode_collision_detect(uart_dev_t *hw) { hw->con...
820
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) ...
820
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_inv = (inv_mask & UART_SIGNAL_DSR_INV) ? 1 : 0; conf0_reg.txd_inv = (inv_mask & UART_SIGNAL_TXD_INV) ? 1 : 0; conf0_reg.rts_inv = (inv_mask & UART_SIGNAL_...
820
en = enable ? 1 : 0; } /** */ FORCE_INLINE_ATTR uint32_t uart_ll_get_rxd_edge_cnt(uart_dev_t *hw) { return hw->rxd_cnt.edge_cnt; } /** */ FORCE_INLINE_ATTR uint32_t uart_ll_get_pos_pulse_cnt(uart_dev_t *hw) { return hw->pospulse.min_cnt; } /** */ FORCE_INLINE_ATTR uint32_t uart_ll_get_neg_pulse_cnt(uart_d...
820
err_wr_mask = discard ? 1 : 0; } #ifdef __cplusplus } #endif
820
/* */ / / // The LL layer for ESP32-S2 SPI register operations #pragma once #include //for abs() #include #include "esp_types.h" #include "esp_attr.h" #include "soc/spi_periph.h" #include "soc/spi_struct.h" #include "soc/dport_reg.h" #include "soc/lldesc.h" #include "hal/assert.h" #include "hal/misc.h" #include...
821
val = 0; //use all 64 bytes of the buffer hw->user.usr_miso_highpart = 0; hw->user.usr_mosi_highpart = 0; //Disable unneeded ints hw->slave.val &= ~SPI_LL_UNUSED_INT_MASK; //disable a feature may cause transaction to be too long hw->user.usr_prep_hold = 0; } /** */ static inline void sp...
821
val = 0; hw->ctrl.val = 0; hw->user.sio = 0; hw->slave.soft_reset = 1; hw->slave.soft_reset = 0; hw->user.doutdin = 0; //we only support half duplex hw->slave.slave_mode = 1; } /** */ static inline void spi_ll_set_mosi_free_level(spi_dev_t *hw, bool level) { hw->ctrl.d_pol = level; /...
821
val |= SPI_LL_DMA_FIFO_RST_MASK; hw->dma_conf.val &= ~SPI_LL_DMA_FIFO_RST_MASK; } /** */ static inline void spi_ll_dma_rx_fifo_reset(spi_dev_t *hw) { hw->dma_conf.val |= SPI_LL_DMA_FIFO_RST_MASK; hw->dma_conf.val &= ~SPI_LL_DMA_FIFO_RST_MASK; } /** */ static inline void spi_ll_infifo_full_clr(spi_dev_t ...
821
= 4) { word = hw->data_buf[byte_addr / 4]; } memcpy(((uint8_t *)&word) + offset, data, copy_len); hw->data_buf[byte_addr / 4] = word; data += copy_len; byte_addr += copy_len; len -= copy_len; } } /* **/ /** */ static inline void spi_ll_master_set_pos_c...
821
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->user.tsck_i_edge = 0; hw->ctrl1.clk_mode_13 = 0; ...
821
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_USER_MASK; hw->ctrl.fcmd_dual = (line_mode.cmd_lines == 2); hw->ctrl.fcmd_quad = (line_mode.cmd_lines == 4); ...
821
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 = (cs_id == 4) ? 0 : 1; hw->misc.cs5_dis = (cs_id == 5) ? 0 : 1; } /** */ static inline void spi_ll_master_keep_cs(spi_dev_t *...
821
reg.clkcnt_l = 0; reg.clkcnt_h = 0; reg.clkcnt_n = 0; reg.clkdiv_pre = 0; reg.clk_equ_sysclk = 1; eff_clk = fapb; } else { //For best duty cycle resolution, we want n to be as close to 32 as possible, but //we also need a pre/n combo that gets us as c...
821
din0_num = 1; hw->din_num.din1_num = 1; } /** */ static inline void spi_ll_set_dummy(spi_dev_t *hw, int dummy_n) { hw->user.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_master_set_cs_hold(spi_dev_t *hw, int ho...
821
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,...
821
usr_miso = enable; } /** */ static inline void spi_ll_enable_mosi(spi_dev_t *hw, int enable) { hw->user.usr_mosi = enable; } /** */ static inline void spi_ll_slave_reset(spi_dev_t *hw) { hw->slave.soft_reset = 1; hw->slave.soft_reset = 0; } /** */ static inline uint32_t spi_ll_slave_get_rcv_bitlen(spi...
821
rd_dma_done=0) \ item(SPI_LL_INTR_WRDMA, slave.int_wr_dma_done_en, slave1.wr_dma_done, slave1.wr_dma_done=0) \ item(SPI_LL_INTR_IN_SUC_EOF, dma_int_ena.in_suc_eof, dma_int_raw.in_suc_eof, dma_int_clr.in_suc_eof=1) \ item(SPI_LL_INTR_OUT_EOF, dma_int_ena.out...
821
cmd7, dma_int_clr.cmd7=1) \ item(SPI_LL_INTR_CMD8, dma_int_ena.cmd8, dma_int_raw.cmd8, dma_int_clr.cmd8=1) \ item(SPI_LL_INTR_CMD9, dma_int_ena.cmd9, dma_int_raw.cmd9, dma_int_clr.cmd9=1) \ item(SPI_LL_INTR_CMDA, ...
821
..) if (intr_mask & (intr_bit)) hw->st_reg = 1; FOR_EACH_ITEM(SET_INTR, INTR_LIST); #undef SET_INTR } __attribute__((always_inline)) static inline void spi_ll_clear_intr(spi_dev_t *hw, spi_ll_intr_t intr_mask) { #define CLR_INTR(intr_bit, _, __, clr_reg) if (intr_mask & (intr_bit)) hw->clr_reg; FOR_EACH_ITEM(C...
821
int_trans_done_en = 1; } /* **/ static inline void spi_ll_slave_hd_set_len_cond(spi_dev_t *hw, spi_ll_trans_len_cond_t cond_mask) { hw->slv_rd_byte.rdbuf_bytelen_en = (cond_mask & SPI_LL_TRANS_LEN_COND_RDBUF) ? 1 : 0; hw->slv_rd_byte.wrbuf_bytelen_en = (cond_mask & SPI_LL_TRANS_LEN_COND_WRBUF) ? 1 : 0; hw...
821
..) (void)__DECLARE_RCC_RC_ATOMIC_ENV; spi_dma_ll_enable_bus_clock(__VA_ARGS__) /** */ static inline void spi_dma_ll_reset_register(spi_host_device_t host_id) { switch (host_id) { case SPI2_HOST: DPORT_SET_PERI_REG_MASK(DPORT_PERIP_RST_EN_REG, DPORT_SPI2_DMA_RST); DPORT_CLEAR_PERI_REG_MASK...
821
in_rst = 1; dma_in->dma_conf.in_rst = 0; } /** */ __attribute__((always_inline)) static inline void spi_dma_ll_rx_start(spi_dma_dev_t *dma_in, uint32_t channel, lldesc_t *addr) { dma_in->dma_in_link.addr = (int) addr & 0xFFFFF; dma_in->dma_in_link.start = 1; } /** */ static inline void spi_dma_ll_rx_sto...
821
out_rst = 1; dma_out->dma_conf.out_rst = 0; } /** */ __attribute__((always_inline)) static inline void spi_dma_ll_tx_start(spi_dma_dev_t *dma_out, uint32_t channel, lldesc_t *addr) { dma_out->dma_out_link.addr = (int) addr & 0xFFFFF; dma_out->dma_out_link.start = 1; } /** */ static inline void spi_dma_l...
821
out_auto_wrback = enable; } /** */ __attribute__((always_inline)) static inline uint32_t spi_dma_ll_get_out_eof_desc_addr(spi_dma_dev_t *dma_out, uint32_t channel) { return dma_out->dma_out_eof_des_addr; } static inline void spi_dma_ll_rx_restart(spi_dma_dev_t *dma_in, uint32_t channel) { dma_in->dma_in_link...
821
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 ...
821
/* */ // 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...
822
config.tx_alarm_en = en; // use level type interrupt hw->hw_timer[timer_num].config.tx_level_int_en = en; } /** */ static inline void timer_ll_set_clock_prescale(timg_dev_t *hw, uint32_t timer_num, uint32_t divider) { HAL_ASSERT(divider >= 2 && divider = 65536) { divider = 0; } HAL_FORCE_M...
822