text
stringlengths
1
9.98k
__index_level_0__
int64
0
4.17k
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]; esp_dport_access_read_buffer(p, mem_base, num_words); /* Zero any remaining limbs in the bignum, if the buffer is bigger ...
754
/* */ / / // 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...
755
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...
755
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...
755
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...
755
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...
755
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...
755
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 >> ...
755
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 =...
755
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
755
/* */ / / #pragma once #include #include #include #include "esp_bit_defs.h" #include "hal/assert.h" #include "soc/soc.h" #include "soc/spi_mem_reg.h" #include "soc/io_mux_reg.h" #ifdef __cplusplus extern "C" { #endif #define ARRAY_SIZE(arr) (sizeof((arr))/sizeof(*(arr))) #define MSPI_TIMING_LL_FLASH_OCT_MASK ...
756
/* */ // 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 "soc/timer_periph.h" #include "soc/timer_group_struct.h" #include "...
757
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_...
757
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...
757
wdt_flashboot_mod_en = (enable) ? 1 : 0; } /** */ FORCE_INLINE_ATTR void mwdt_ll_set_prescaler(timg_dev_t *hw, uint32_t prescaler) { HAL_FORCE_MODIFY_U32_REG_FIELD(hw->wdtconfig1, wdt_clk_prescale, prescaler); } /** */ FORCE_INLINE_ATTR void mwdt_ll_feed(timg_dev_t *hw) { hw->wdtfeed.wdt_feed = 1; } /** *...
757
/* */ #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...
758
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...
758
/* */ / / // The Lowlevel layer for SPI Flash #pragma once #include #include // For MIN/MAX #include #include #include "soc/spi_periph.h" #include "hal/assert.h" #include "soc/spi_mem_struct.h" #include "hal/spi_types.h" #include "hal/spi_flash_types.h" #include "hal/misc.h" #ifdef __cplusplus extern "C" { ...
759
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...
759
cs_hold_dly_res = dly_val; dev->sus_status.flash_per_dly_256 = 1; dev->sus_status.flash_pes_dly_256 = 1; } /** */ static inline void spimem_flash_set_cs_hold_delay(spi_mem_dev_t *dev, uint32_t cs_hold_delay) { SPIMEM0.ctrl2.cs_hold_delay = cs_hold_delay; } /** */ static inline void spimem_flash_ll_sus_s...
759
dev->flash_sus_cmd.flash_per_wait_en = 1; dev->flash_sus_cmd.flash_pes_wait_en = 1; } /** */ static inline void spimem_flash_ll_set_wait_idle_dummy_phase(spi_mem_dev_t *dev, uint32_t extra_dummy) { if (extra_dummy > 0) { dev->flash_waiti_ctrl.waiti_dummy_cyclelen = extra_dummy - 1; dev->f...
759
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...
759
fmem_ddr_en = 0; 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_QOUT: ctrl.fread_quad = 1; break; case SPI_FLASH_DIO: ...
759
val = *clock_val; } /** */ static inline void spimem_flash_ll_set_miso_bitlen(spi_mem_dev_t *dev, uint32_t bitlen) { dev->user.usr_miso = bitlen > 0; dev->miso_dlen.usr_miso_bit_len = bitlen ? (bitlen - 1) : 0; } /** */ static inline void spimem_flash_ll_set_mosi_bitlen(spi_mem_dev_t *dev, uint32_t bitlen) ...
759
usr_cmd_4byte = (bitlen == 32) ? 1 : 0 ; dev->user1.usr_addr_bitlen = (bitlen - 1); dev->user.usr_addr = bitlen ? 1 : 0; } /** */ static inline void spimem_flash_ll_set_address(spi_mem_dev_t *dev, uint32_t addr) { dev->addr = addr; } /** */ static inline void spimem_flash_ll_set_usr_address(spi_mem_dev_...
759
cs_setup = (cs_setup_time > 0 ? 1 : 0); dev->ctrl2.cs_setup_time = cs_setup_time - 1; } static inline void spimem_flash_ll_set_extra_dummy(spi_mem_dev_t *dev, uint32_t extra_dummy) { dev->timing_cali.extra_dummy_cyclelen = extra_dummy; } /** */ static inline uint8_t spimem_flash_ll_get_source_freq_mhz(void) ...
759
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
759
/* */ // 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 "soc/clk_tree_defs.h" #include "soc/system_struct.h" #include "hal/i2c_types.h" #include "esp_a...
760
conf_upgate = 1; } /** */ static inline void i2c_ll_enable_bus_clock(int i2c_port, bool enable) { if (i2c_port == 0) { SYSTEM.perip_clk_en0.i2c_ext0_clk_en = enable; } else if (i2c_port == 1) { SYSTEM.perip_clk_en0.i2c_ext1_clk_en = enable; } } /// use a macro to wrap the function, force ...
760
..) do {(void)__DECLARE_RCC_ATOMIC_ENV; i2c_ll_reset_register(__VA_ARGS__);} while(0) /** */ static inline void i2c_ll_master_set_bus_timing(i2c_dev_t *hw, i2c_hal_clk_config_t *bus_cfg) { HAL_FORCE_MODIFY_U32_REG_FIELD(hw->clk_conf, sclk_div_num, bus_cfg->clkm_div - 1); /* According to the Technical Referenc...
760
time_out_value = bus_cfg->tout; hw->to.time_out_en = 1; } /** */ static inline void i2c_ll_master_set_fractional_divider(i2c_dev_t *hw, uint8_t div_a, uint8_t div_b) { /* Set div_a and div_b to 0, as it's not necessary to use them */ HAL_FORCE_MODIFY_U32_REG_FIELD(hw->clk_conf, sclk_div_a, div_a); HAL...
760
val &= (~mask); } /** */ __attribute__((always_inline)) static inline void i2c_ll_get_intr_mask(i2c_dev_t *hw, uint32_t *intr_status) { *intr_status = hw->int_status.val; } /** */ static inline void i2c_ll_slave_set_fifo_mode(i2c_dev_t *hw, bool fifo_mode_en) { hw->fifo_conf.nonfifo_en = fifo_mode_en ? 0 : ...
760
addr_10bit_en = addr_10bit_en; if (addr_10bit_en) { uint16_t addr_14_7 = (slave_addr & 0xff) > 8) | 0x78; hw->slave_addr.slave_addr = addr_14_7 | addr_6_0; hw->ctr.addr_10bit_rw_check_en = addr_10bit_en; } else { hw->slave_addr.slave_addr = slave_addr; } } /** */ __attribut...
760
sda_hold_time = sda_hold; hw->sda_sample.sda_sample_time = sda_sample; } /** */ static inline void i2c_ll_set_txfifo_empty_thr(i2c_dev_t *hw, uint8_t empty_thr) { hw->fifo_conf.txfifo_wm_thrhd = empty_thr; } /** */ static inline void i2c_ll_set_rxfifo_full_thr(i2c_dev_t *hw, uint8_t full_thr) { hw->fifo...
760
ms_mode; } /** */ __attribute__((always_inline)) static inline void i2c_ll_get_rxfifo_cnt(i2c_dev_t *hw, uint32_t *length) { *length = hw->sr.rxfifo_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...
760
scl_stop_hold_time; } /** */ __attribute__((always_inline)) static inline void i2c_ll_write_txfifo(i2c_dev_t *hw, const uint8_t *ptr, uint8_t len) { for (int i = 0; i data, fifo_rdata, ptr[i]); } } /** */ __attribute__((always_inline)) static inline void i2c_ll_read_rxfifo(i2c_dev_t *hw, uint8_t *ptr, uint8...
760
scl_filter_thres = filter_num; hw->filter_cfg.sda_filter_thres = filter_num; hw->filter_cfg.scl_filter_en = 1; hw->filter_cfg.sda_filter_en = 1; } else { hw->filter_cfg.scl_filter_en = 0; hw->filter_cfg.sda_filter_en = 0; } } /** */ static inline void i2c_ll_master_get_...
760
val = 0; ctrl_reg.ms_mode = 1; ctrl_reg.clk_en = 1; ctrl_reg.sda_force_out = 1; ctrl_reg.scl_force_out = 1; hw->ctr.val = ctrl_reg.val; } /** */ static inline void i2c_ll_slave_init(i2c_dev_t *hw) { typeof(hw->ctr) ctrl_reg; ctrl_reg.val = 0; ctrl_reg.sda_force_out = 1; ctrl_reg.sc...
760
command_done; } //////////////////////////////////////////Deprecated Functions////////////////////////////////////////////////////////// /////////////////////////////The following functions are only used by the legacy driver///////////////////////////////// /////////////////////////////They might be removed in the nex...
760
scl_high_period.scl_high_period; *wait_high_period = hw->scl_high_period.scl_wait_high_period; *low_period = hw->scl_low_period.scl_low_period; } /** */ 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.scl_low_period = ...
760
trans_complete_int_st) { *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) { typeof(hw->int_status) int_sts; int_sts.val = hw->int_status....
760
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_LL_MASTER_RX_INT); } /** */ static inline void i2c_ll_slave_enable_tx_it(i2c_dev_t *hw) { hw->int_ena.val |= 0x2; } /** */ static inline void i2c...
760
scl_wait_high_period = high_period - high_period_output; } /** */ 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_trans_mode_t)(hw->ctr.rx_lsb_first); } /** */ static inline vo...
760
/* */ #pragma once #include /* For NULL declaration */ #include #include #include "hal/assert.h" #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) #def...
761
in.int_st.val; } } /** */ static inline void gdma_ll_rx_enable_interrupt(gdma_dev_t *dev, uint32_t channel, uint32_t mask, bool enable) { if (enable) { dev->channel[channel].in.int_ena.val |= mask; } else { dev->channel[channel].in.int_ena.val &= ~mask; } } /** */ __attribute__((alwa...
761
in.conf0.indscr_burst_en = enable; } /** */ __attribute__((always_inline)) static inline void gdma_ll_rx_reset_channel(gdma_dev_t *dev, uint32_t channel) { dev->channel[channel].in.conf0.in_rst = 1; dev->channel[channel].in.conf0.in_rst = 0; } /** */ static inline void gdma_ll_rx_set_ext_mem_block_size(gdma...
761
in.infifo_status.val & (1 (L1, L2, L3) */ static inline bool gdma_ll_rx_is_fifo_empty(gdma_dev_t *dev, uint32_t channel, uint32_t fifo_level) { return dev->channel[channel].in.infifo_status.val & (1 (L1, L2, L3) */ static inline uint32_t gdma_ll_rx_get_fifo_bytes(gdma_dev_t *dev, uint32_t channel, uint32_t fifo...
761
addr = addr; } /** */ __attribute__((always_inline)) static inline void gdma_ll_rx_start(gdma_dev_t *dev, uint32_t channel) { dev->channel[channel].in.link.start = 1; } /** */ __attribute__((always_inline)) static inline void gdma_ll_rx_stop(gdma_dev_t *dev, uint32_t channel) { dev->channel[channel].in.link...
761
in.err_eof_des_addr; } /** */ __attribute__((always_inline)) static inline uint32_t gdma_ll_rx_get_prefetched_desc_addr(gdma_dev_t *dev, uint32_t channel) { return dev->channel[channel].in.dscr; } /** */ static inline void gdma_ll_rx_set_weight(gdma_dev_t *dev, uint32_t channel, uint32_t weight) { dev->chan...
761
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 channel, bool raw) { if (raw) { return dev->channel[channel].out.int_raw.v...
761
out.int_st); } /** */ static inline void gdma_ll_tx_enable_owner_check(gdma_dev_t *dev, uint32_t channel, bool enable) { dev->channel[channel].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]....
761
out.conf0.out_rst = 1; dev->channel[channel].out.conf0.out_rst = 0; } /** */ static inline void gdma_ll_tx_set_ext_mem_block_size(gdma_dev_t *dev, uint32_t channel, uint8_t align) { uint32_t block_size = 0; switch (align) { case 64: // 64 Bytes alignment block_size = GDMA_LL_EXT_MEM_BK_SIZE_64...
761
outfifo_status.val & (1 (L1, L2, L3) */ static inline uint32_t gdma_ll_tx_get_fifo_bytes(gdma_dev_t *dev, uint32_t channel, uint32_t fifo_level) { switch (fifo_level) { case 1: return dev->channel[channel].out.outfifo_status.outfifo_cnt_l1; case 2: return dev->channel[channel].out.outfifo_...
761
out.link.start = 1; } /** */ __attribute__((always_inline)) static inline void gdma_ll_tx_stop(gdma_dev_t *dev, uint32_t channel) { dev->channel[channel].out.link.stop = 1; } /** */ __attribute__((always_inline)) static inline void gdma_ll_tx_restart(gdma_dev_t *dev, uint32_t channel) { dev->channel[channel...
761
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) { (void)periph; dev->channel[channel].out.peri_sel.sel = periph_id; } /** */ static inline void gdma_ll_tx_disconnect_from_periph(gdma_dev_t *de...
761
/* */ // The LL layer of the USB-serial-jtag controller #pragma once #include #include "esp_attr.h" #include "soc/system_struct.h" #include "soc/usb_serial_jtag_reg.h" #include "soc/usb_serial_jtag_struct.h" #ifdef __cplusplus extern "C" { #endif //The in and out endpoints are this long. #define USB_SERIAL_JTAG_P...
762
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))...
762
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...
762
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_register(...
762
/* */ #pragma once #include #include "soc/ext_mem_defs.h" #include "soc/memprot_defs.h" #include "hal/memprot_types.h" #include "soc/sensitive_reg.h" #include "soc/periph_defs.h" /* Uncomment to enable MPS debug assertions on false register writes. */ //#define PMS_DEBUG_ASSERTIONS #ifdef PMS_DEBUG_ASSERTIONS #i...
763
(reg_off = SOC_RTC_IRAM_HIGH) { return MEMP_HAL_ERR_SPLIT_ADDR_OUT_OF_RANGE; } if (addr % 0x4 != 0) { return MEMP_HAL_ERR_SPLIT_ADDR_UNALIGNED; } if (core != PRO_CPU_NUM && core != APP_CPU_NUM) { return MEMP_HAL_ERR_CORE_INVALID; } uint32_t mask; uint32_t val; ...
763
SENSITIVE_CORE_0_PIF_PMS_CONSTRAIN_9_REG : SENSITIVE_CORE_1_PIF_PMS_CONSTRAIN_9_REG; CLEAR_PERI_REG_MASK(reg, mask); #ifdef PMS_DEBUG_ASSERTIONS HAL_ASSERT((GET_PERI_REG_MASK(reg, mask) == 0) && "Value not stored to required register"); #endif REG_SET_BITS(reg, mask, (addr >> 2) & val); #ifdef PMS_DEBUG_A...
763
(reg_off << D_FAULT_ADDR_SHIFT) + DRAM0_VIOLATE_STATUS_ADDR_OFFSET : 0); return MEMP_HAL_OK; } static inline memprot_hal_err_t memprot_ll_dram0_get_monitor_status_fault_wr(const int core, uint32_t* regval) { switch (core) { case PRO_CPU_NUM: *regval = REG_GET_FIELD(SENSITIVE_CORE_0_DRAM0_...
763
/* */ #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); /** ...
764
/* */ / / // 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 { ...
765
= 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
765
/* */ /** */ #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...
766
force_xpd_sar = 0x2; } } /** */ static inline void sar_ctrl_ll_set_power_mode_from_pwdet(sar_ctrl_ll_power_t mode) { if (mode == SAR_CTRL_LL_POWER_FSM) { REG_CLR_BIT(PWDET_CONF_REG, PWDET_SAR_POWER_FORCE); } else if (mode == SAR_CTRL_LL_POWER_ON) { REG_SET_BIT(PWDET_CONF_REG, PWDET_SAR_POW...
766
/* */ #pragma once #include #include "soc/dport_reg.h" #include "soc/tracemem_config.h" #ifdef __cplusplus extern "C" { #endif static inline void trace_ll_set_mem_block(int cpu, int block) { uint32_t block_bits = 0; if (cpu == 0) { block_bits = TRACEMEM_CORE0_MUX_BLK_BITS(block); } else { ...
767
/* */ // 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/wdt_types.h" #include "hal/misc.h" #include "soc/rtc_cntl_periph.h" #include "soc/rt...
768
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...
768
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...
768
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 = (...
768
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
768
/* */ // 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...
769
sclk_sel = 2; break; case UART_SCLK_XTAL: hw->clk_conf.sclk_sel = 3; break; default: // Invalid UART clock source abort(); } } /** */ FORCE_INLINE_ATTR void uart_ll_get_sclk(uart_dev_t *hw, soc_module_clk_t *source_clk) { switch (hw->...
769
clkdiv = clk_div >> 4; hw->clkdiv.clkdiv_frag = clk_div & 0xf; HAL_FORCE_MODIFY_U32_REG_FIELD(hw->clk_conf, sclk_div_num, sclk_div - 1); #undef DIV_UP } /** */ FORCE_INLINE_ATTR uint32_t uart_ll_get_baudrate(uart_dev_t *hw, uint32_t sclk_freq) { uart_clkdiv_reg_t div_reg; div_reg.val = hw->clkdiv.val;...
769
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 fifo.rxfifo_rd_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 involv...
769
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; } /** ...
769
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; } /...
769
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...
769
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, at_cmd_char, cmd_char->cmd_char); HAL_FORCE_MODIFY_U32_REG_FIELD(hw->at_cmd_char, char_num, cmd_cha...
769
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.rs485_en = 0; hw->rs485_conf.rs485tx_rx_en= 0; hw->rs485_conf.rs485rxby_tx_en = 0; hw->conf0.irda_en = 0; } /** */ FORCE_INLINE_ATTR void uart_ll_set_m...
769
irda_en = 0; // Transmitters output signal loop back to the receivers input signal hw->rs485_conf.rs485tx_rx_en = 1 ; // Transmitter should send data when the receiver is busy hw->rs485_conf.rs485rxby_tx_en = 1; hw->conf0.sw_rts = 0; hw->rs485_conf.rs485_en = 1; } /** */ FORCE_INLINE_ATTR void...
769
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) ...
769
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_...
769
autobaud_en = enable ? 1 : 0; } /** */ FORCE_INLINE_ATTR uint32_t uart_ll_get_rxd_edge_cnt(uart_dev_t *hw) { return hw->rxd_cnt.rxd_edge_cnt; } /** */ FORCE_INLINE_ATTR uint32_t uart_ll_get_pos_pulse_cnt(uart_dev_t *hw) { return hw->pospulse.posedge_min_cnt; } /** */ FORCE_INLINE_ATTR uint32_t uart_ll_get...
769
err_wr_mask = discard ? 1 : 0; } #ifdef __cplusplus } #endif
769
/* */ / / // The LL layer for ESP32-S3 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" #inc...
770
clk_en = enable; } /** */ __attribute__((always_inline)) static inline void spi_ll_set_clk_source(spi_dev_t *hw, spi_clock_source_t clk_source){ switch (clk_source) { case SPI_CLK_SRC_XTAL: hw->clk_gate.mst_clk_sel = 0; break; default: hw->clk_gate.mst_clk_s...
770
val = 0; hw->user.val = 0; hw->ctrl.val = 0; hw->user.doutdin = 1; //we only support full duplex hw->user.sio = 0; hw->slave.slave_mode = 1; hw->slave.soft_reset = 1; hw->slave.soft_reset = 0; //use all 64 bytes of the buffer hw->user.usr_miso_highpart = 0; hw->user.usr_mosi_high...
770
update = 1; while (hw->cmd.update); //waiting config applied } /** */ static inline bool spi_ll_usr_is_done(spi_dev_t *hw) { return hw->dma_int_raw.trans_done; } /** */ static inline void spi_ll_user_start(spi_dev_t *hw) { hw->cmd.usr = 1; } /** */ static inline uint32_t spi_ll_get_running_cmd(spi_...
770
rx_afifo_rst = 1; hw->dma_conf.rx_afifo_rst = 0; } /** */ static inline void spi_ll_infifo_full_clr(spi_dev_t *hw) { hw->dma_int_clr.infifo_full_err = 1; } /** */ static inline void spi_ll_outfifo_empty_clr(spi_dev_t *hw) { hw->dma_int_clr.outfifo_empty_err = 1; } /* **/ /** */ static inline void spi...
770
= 4) { word = hw->data_buf[byte_id / 4]; //read } memcpy(((uint8_t *)&word) + offset, data, copy_len); //modify hw->data_buf[byte_id / 4] = word; //write data += copy_len; byte_id += copy_len; len -= copy_len; } } /** */ static i...
770
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...
770
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; ...
770
fcmd_oct = (line_mode.cmd_lines == 8); hw->ctrl.faddr_dual = (line_mode.addr_lines == 2); hw->ctrl.faddr_quad = (line_mode.addr_lines == 4); hw->ctrl.faddr_oct = (line_mode.addr_lines == 8); hw->ctrl.fread_dual = (line_mode.data_lines == 2); hw->user.fwrite_dual = (line_mode.data_lines == 2); hw...
770
0 : 1; hw->misc.cs5_dis = (cs_id == 5) ? 0 : 1; } if (hw == &GPSPI3) { 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; } } /** */ static inline void spi_ll_master_keep_cs(spi_dev_t *hw, int keep_ac...
770
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...
770
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) { if (bitlen > 0) { hw->ms_dlen.ms_data_bitlen = bitlen - 1; } } /** */ static inline void spi_ll_set_miso_bitlen(spi_dev_t *hw, size_t bitlen) {...
770