Commit Graph

305 Commits

Author SHA1 Message Date
Ivan Grokhotkov
5b54ae76d4 esp_timer, hal: add support for non-integer systimer frequency
When ESP32-C2 is paired with a 26 MHz XTAL, the systimer tick
frequency becomes equal to 26 / 2.5 = 10.4 MHz. Previously we always
assumed that systimer tick frequency is integer (and 1 MHz * power of
two, above that!).
This commit introduces a new LL macro, SYSTIMER_LL_TICKS_PER_US_DIV.
It should be set in such a way that:

1. SYSTIMER_LL_TICKS_PER_US / SYSTIMER_LL_TICKS_PER_US_DIV equals the
   actual systimer tick frequency,
2. and SYSTIMER_LL_TICKS_PER_US is integer.

For ESP32-C2 this means that SYSTIMER_LL_TICKS_PER_US = 52 and
SYSTIMER_LL_TICKS_PER_US_DIV = 5.

This introduced two possible issues:

1. Overflow when multiplying systimer counter by 5
   - Should not be an issue, since systimer counter is 52-bit, so
     counter * 5 is no more than 55-bit.
2. The code needs to perform:
   - divide by 5: when converting from microseconds to ticks
   - divide by 52: when converting from ticks to microseconds
   The latter potentially introduces a performance issue for the
   esp_timer_get_time function.
2022-07-11 12:24:37 +08:00
Martin Vychodil
0c87ae2a91 System/Security: Memprot API unified (ESP32S3)
Added missing features and improvements
2022-07-09 22:57:51 +02:00
Michael (XIAO Xufeng)
a58362a429 Merge branch 'feature/efuse_rev_major_minor' into 'master'
efuse: Adds major and minor versions

See merge request espressif/esp-idf!18255
2022-07-07 11:48:54 +08:00
Cao Sen Miao
e218723e0e I2C: Make I2C clock frequency accurate 2022-07-06 11:58:08 +08:00
KonstantinKondrashov
0f8ff5aa15 efuse: Adds major and minor versions and others 2022-07-05 14:38:27 +08:00
Omar Chebib
cd48baf979 Refactor: move regi2c_*.h header files from esp_hw_support to soc component
When creating G0 layer, some regi2c_*.h headers were moved out from
esp_hw_support (G1) to soc (G0). In order to be consistent with that change,
move all the remaining regi2c_*.h headers to soc too.
2022-06-30 09:40:44 +00:00
Armando (Dou Yiwen)
e13d7f8351 Merge branch 'bugfix/s2_ap64_psram_crash_issue' into 'master'
psram: fix esp32s2 module with APS6404 PSRAM crash issue

Closes IDF-5361

See merge request espressif/esp-idf!18699
2022-06-29 11:19:17 +08:00
Armando
31b3f31ef4 ext_mem: make memory region check strict 2022-06-28 14:17:44 +08:00
morris
7fd9a91034 dma: move from driver to hw_support 2022-06-28 14:17:12 +08:00
Cao Sen Miao
2c0651a671 Add regi2c enable/disable reference count 2022-06-23 15:36:44 +08:00
Cao Sen Miao
3a820462ac temperature_sensor: Add temperature sensor support for ESP32-C2 2022-06-23 15:36:43 +08:00
Omar Chebib
8fae0f0753 G0: Support Xtensa targets for G0-only compilation
G0-only example now supports Xtensa targets. This means that G0 layer
does not depend on G1+ layers anymore
2022-06-20 11:34:20 +00:00
laokaiyao
28b8fc6a7e i2s: update documents for driver-NG 2022-06-15 10:30:04 +08:00
Darian
e213e66ba3 Merge branch 'refactor/esp_hw_support_cpu' into 'master'
esp_hw_support: Add new esp_cpu.h abstraction

Closes IDF-4769

See merge request espressif/esp-idf!17091
2022-06-14 21:11:30 +08:00
morris
919344547b Merge branch 'bugfix/rmt_register_file_s3' into 'master'
rmt: update register file after fixing csv of RMT peripheral (esp32s2/s3)

Closes IDFGH-7537

See merge request espressif/esp-idf!18392
2022-06-14 18:24:28 +08:00
Darian Leung
a8a3756b38 hal: Route CPU and Interrupt Controller HAL/LL to esp_cpu calls
This commit makes changes to cpu_ll.h, cpu_hal.h, and interrupt_controller_hal.h:

- Moved to esp_hw_support in order to be deprecated in the future
- HAL/LL API now route their calls to esp_cpu.h functions instead

Also updated soc_hal.h as follows:

- Removed __SOC_HAL_..._OTHER_CORES() macros as they dependend on cpu_hal.h
- Made soc_hal.h and soc_ll.h interfaces always inline, and removed soc_hal.c.

This commit also updates the XCHAL_ERRATUM_572 workaround by

- Removing it's HAL function and invoking the workaround it directly the bootloader
- Added missing workaround for the ESP32-S3
2022-06-14 14:40:03 +08:00
Darian Leung
149872131a hal: Move dedicated GPIO LL and HAL
This commit moves the dedicated GPIO LL and HAL functions from
cpu_ll.h to dedic_gpio_cpu_ll.h.

- cpu_ll_enable_cycle_count() has also been removed due to lack of feasible usage scenarios
2022-06-14 14:38:29 +08:00
songruojing
c8752cee6a clk_tree: Refactor rtc_clk.c by adding HAL layer for clock subsystem 2022-06-13 17:47:50 +08:00
morris
4094f13fd3 rmt: fix error in rmt register file
Closes https://github.com/espressif/esp-idf/issues/9100
2022-06-10 18:38:42 +08:00
Cao Sen Miao
6589daabb9 MMU: Add configurable mmu page size support on ESP32C2 2022-06-08 19:34:31 +08:00
Cao Sen Miao
6a2d3509dc spi_flash: Making XMC flash works more stable when brownout detected 2022-06-02 10:38:55 +08:00
KonstantinKondrashov
ac4c7d99fe dport: Move DPORT workaround to G0 2022-05-31 13:44:18 +08:00
Jiang Jiang Jian
f3922f1b7f Merge branch 'feature/flash_mmap_refactor' into 'master'
flash mmap: abstract R/W of MMU table instead of reg access

See merge request espressif/esp-idf!16882
2022-05-29 13:56:37 +08:00
Marius Vikhammer
9177e9fb37 Merge branch 'bugfix/cpu_cycle_count_not_iram' into 'master'
HAL: place cpu_ll_get_cycle_count in IRAM

Closes IDFGH-7431

See merge request espressif/esp-idf!18260
2022-05-27 10:40:50 +08:00
Marius Vikhammer
415ab25a49 HAL: place cpu_ll_get_cycle_count in IRAM
Closes https://github.com/espressif/esp-idf/issues/9008
2022-05-26 14:42:41 +08:00
songruojing
a5b09cf015 rtc_clk: Clean up some clock related enum and macro in soc/rtc.h, replace with new ones in
soc/clk_tree_defs.h
2022-05-24 22:59:41 +08:00
jiangguangming
9c6afee12f flash mmap: abstract R/W MMU table instead of reg access 2022-05-20 16:46:27 +08:00
Jing Li
ac0d16cdc8 Merge branch 'bugfix/fix_cannot_lslp_again_after_ulp_wakeup' into 'master'
sleep: fix cannot lightsleep again after a wakeup from ULP

Closes IDFGH-4396

See merge request espressif/esp-idf!17970
2022-05-13 22:25:23 +08:00
jingli
a85e187ea7 remove wrong function rtc_cntl_ll_ulp_wakeup_enable for esp32s2 and esp32s3 2022-05-12 21:51:21 +08:00
jingli
dd414b9305 esp_hw_‎support/sleep: ‎fix cannot lightsleep again after a wakeup from ULP
Since ulp wakeup signal are connected to ulp int raw(except esp32), we
need to clear ulp int raw before sleep when ulp wakeup enabled. Otherwise,
if the ulp int raw is already set, chip will not sleep properly.

Closes https://github.com/espressif/esp-idf/issues/6229
2022-05-12 17:57:08 +08:00
Armando
49747bb486 adc: create common adc hal layer 2022-05-07 19:20:44 +08:00
Armando (Dou Yiwen)
76be0c2624 Merge branch 'bugfix/fix_esp32_mmu_init_issue' into 'master'
mmu: add ll functions for mmu unmap

Closes OCD-526 and IDF-4962

See merge request espressif/esp-idf!17868
2022-05-05 22:21:18 +08:00
Armando
e09787d851 mmu: fix macro MMU_ENTRY_NUM and add new macro MMU_MAX_PADDR_PAGE_NUM 2022-04-27 11:35:07 +08:00
Armando
2764cd5682 mmu: simplify mmu_hal_init 2022-04-27 11:35:07 +08:00
jiangguangming
63ac5e4a99 mmu: add ll func used to invalidate the mmu entry 2022-04-27 11:35:07 +08:00
Simon
e4d85807ea Merge branch 'feature/spi_flash_esp8684_support' into 'master'
spi_flash: refactor spi_flash clock configuration logic and support esp32c2

Closes IDF-4474, IDF-4025, and IDF-4066

See merge request espressif/esp-idf!16602
2022-04-27 11:05:45 +08:00
Konstantin Kondrashov
df30b362a8 efuse: Validates data after burning and re-burnes it if necessary 2022-04-27 01:10:41 +08:00
Cao Sen Miao
4418a855ba spi_flash: refactor the spi_flash clock configuration, and add support for esp32c2 2022-04-26 15:22:37 +08:00
laokaiyao
b99ced08a2 i2s: fix only right case
Closes: https://github.com/espressif/esp-idf/issues/8538
2022-04-23 07:38:45 +00:00
Darian
7c5cf3988f Merge branch 'bugfix/twai_ll_parse_frame_buffer_typo' into 'master'
TWAI: Fix twai_ll_parse_frame_buffer() typo

Closes IDFGH-7140

See merge request espressif/esp-idf!17875
2022-04-22 21:29:59 +08:00
Darian Leung
09dc46552b twai: Fix twai_ll_parse_frame_buffer() typo
Closes https://github.com/espressif/esp-idf/issues/8743
2022-04-22 15:25:39 +08:00
Anton Maklakov
f4c190cadd Merge branch 'bugfix/abs_arguments' into 'master'
fix warnings:  abs() use again

Closes GCC-240

See merge request espressif/esp-idf!17846
2022-04-22 09:30:23 +08:00
morris
4280164be4 rmt: add more clock source caps 2022-04-21 13:59:47 +00:00
Anton Maklakov
7a066b7b56 components: correct abs() use for unsigned argument 2022-04-21 12:22:01 +07:00
morris
373d9b3dbc Merge branch 'feature/default_clk_for_gptimer' into 'master'
clk_tree: added default clock source for peripherals (GPTimer, RMT, LCD, TempSensor)

Closes IDF-4894

See merge request espressif/esp-idf!17759
2022-04-19 18:02:40 +08:00
songruojing
534346f4bb ledc: Provide support for esp32c2 and esp32h2
LEDC examples, unit test, and programming guide are all updated.
2022-04-14 08:15:14 +00:00
morris
f32a89826c clk_tree: added default clock source for peripheral 2022-04-14 15:44:56 +08:00
laokaiyao
f17edba20b i2s: extract std/pdm/tdm modes
Type structures of these modes are defined. Driver and HAL layer are modified to fit these concepts.
2022-03-22 10:14:45 +08:00
Armando (Dou Yiwen)
36457b1346 Merge branch 'refactor/adc_unify_adc_unit' into 'master'
adc: adc single driver NG pre-step - unify adc_ll_num_t and adc_unit_t

See merge request espressif/esp-idf!17408
2022-03-18 20:29:36 +08:00
Armando
386363cafd adc: unify adc_ll_num_t and adc_unit_t 2022-03-18 11:36:50 +08:00
morris
98e19b3355 Merge branch 'contrib/github_pr_8496' into 'master'
SPI  LCD support large color transfers (GitHub PR)

Closes IDFGH-6874

See merge request espressif/esp-idf!17391
2022-03-14 22:22:00 +08:00
Michael (XIAO Xufeng)
aab535fe4a Merge branch 'bugfix/regi2c_ctrl_spinlock_s2' into 'master'
hw_support: fixed regi2c not protected by lock on ESP32S2

See merge request espressif/esp-idf!16653
2022-03-13 02:47:53 +08:00
Michael (XIAO Xufeng)
d5bdf95580 hw_support: fixed regi2c not protected by lock on ESP32S2 2022-03-13 00:24:08 +08:00
Armando (Dou Yiwen)
6ed3ffbbf1 Merge branch 'refactor/remove_redundant_rom_cache_dependency' into 'master'
cache: remove redundant rom cache dependency in bootloader

Closes IDF-4523

See merge request espressif/esp-idf!17077
2022-03-12 10:11:39 +08:00
Armando
c1cbd7bbf6 cache/mmu: implememnt cache and mmu hal APIs in bootloader 2022-03-11 22:43:11 +08:00
morris
2c7cfdd784 spi: define tranfer max bit length in LL 2022-03-10 13:40:43 +08:00
morris
9f55712c03 rmt: document and improve LL driver 2022-03-09 10:58:12 +08:00
Zim Kalinowski
0440aca4e3 Merge branch 'feature/reevaluate_headers_include_dirs' into 'master'
esp_hw_support/esp_system: Re-evaluate header inclusions and include directories

See merge request espressif/esp-idf!16763
2022-03-08 01:32:24 +08:00
Simon
4bf4a020a6 Merge branch 'refactor/abstract_temperature_sensor' into 'master'
temperature_sensor: Refactor temperature sensor to new APIs (follow rule of driverNG) and support esp32s3

Closes IDF-3665, IDF-3367, and IDF-1793

See merge request espressif/esp-idf!16787
2022-03-07 20:17:39 +08:00
Sudeep Mohanty
a9fda54d39 esp_hw_support/esp_system: Re-evaluate header inclusions and include directories
This commit updates the visibility of various header files and cleans up
some unnecessary inclusions. Also, this commit removes certain header
include paths which were maintained for backward compatibility.
2022-03-07 11:18:08 +05:30
Armando (Dou Yiwen)
748037708f Merge branch 'bugfix/fix_adc_digital_not_reset_issue' into 'master'
adc: fix adc digital part not reset issue

Closes IDF-4680

See merge request espressif/esp-idf!17279
2022-03-06 13:49:18 +08:00
morris
a0283234cd Merge branch 'feature/support_esp32h2_gpio' into 'master'
esp32h2: support GPIO peripheral, IO_MUX, GPIO matrix

Closes IDF-4232 and IDF-3439

See merge request espressif/esp-idf!16609
2022-03-04 18:22:28 +08:00
Cao Sen Miao
b248046bcb Temperature_sensor: Create new temperature sensor API 2022-03-04 18:13:35 +08:00
Armando
4ca115be98 adc: fix adc digital not reset issue 2022-03-04 03:49:33 +00:00
songruojing
c8c137f2b7 esp32h2: support GPIO peripheral, IO_MUX, GPIO matrix.
Generic GPIO example is supported as well.
2022-03-04 11:25:05 +08:00
morris
ec8defaa96 pulse_cnt: new driver for PCNT peripheral 2022-03-03 22:38:32 +08:00
Konstantin Kondrashov
44e5ac2c59 Merge branch 'feature/efuse_hal' into 'master'
hal: Adds efuse hal layer

See merge request espressif/esp-idf!16354
2022-02-28 13:38:43 +08:00
KonstantinKondrashov
9605f3eb1a soc: Adds efuse hal
Replaced eFuse ROM funcs with hal layer
2022-02-24 22:20:09 +08:00
morris
8c91ef7599 Merge branch 'contrib/github_pr_8430' into 'master'
ADC Fix compiling when included from C++ (GitHub PR)

Closes IDFGH-6804

See merge request espressif/esp-idf!17216
2022-02-24 08:42:06 +00:00
Marius Vikhammer
06d8a5bf33 Merge branch 'bugfix/inline_intrmask_from_isr' into 'master'
freertos: always inline xPortSetInterruptMaskFromISR and vPortClearInterruptMaskFromISR

Closes IDFGH-6669

See merge request espressif/esp-idf!16970
2022-02-23 01:05:40 +00:00
morris
116197040f i2s: update copyright 2022-02-21 21:28:48 +08:00
morris
9887c7e780 rmt: do not support rx wrap on esp32s2
Closes https://github.com/espressif/esp-idf/issues/8354
2022-02-08 13:57:31 +08:00
Marius Vikhammer
ca6f76d831 spi flash: fix cache accessed while disabled issues at -O0
mask_get_id and gpio_hal_iomux_func_sel were called while cache
is disabled, but were not inlined as expected at -0O.
Force these functions to always be inlined.
2022-02-07 11:33:33 +08:00
laokaiyao
c4cfb654d2 uart: support light sleep on esp32s3 2022-01-25 17:43:02 +08:00
Michael (XIAO Xufeng)
403577e3ff adc_cal: fixed the assertion failure or returning wrong error code when ADC2 failed the arbitration
Issue exist since first IDF version supporting ESP32-S2.
2022-01-18 12:26:55 +08:00
Anton Maklakov
d500c8205e Merge branch 'bugfix/fix_spi_cs_hold_time_issue' into 'master'
spi_master: fix spi cs_ena_posttrans issue

Closes IDFGH-6077

See merge request espressif/esp-idf!15925
2022-01-07 04:06:12 +00:00
morris
8cdcb4e291 rmt: move RMT item definition from soc to driver 2022-01-06 21:43:12 +08:00
Armando
56a707eef4 spi_master: fix spi cs_ena_posttrans issue 2022-01-06 17:54:58 +08:00
songruojing
e0bc3a923c esp8684: support GPIO peripheral, IO_MUX, GPIO matrix.
Generic GPIO example and GPIO unit test on esp8684 are both supported as well.
2021-12-29 22:01:45 +08:00
morris
2c810f8451 timer: save alarm value in driver layer 2021-12-23 11:39:32 +08:00
Armando
4dc0d6b2fe adc: support adc dma driver on all chips 2021-12-16 00:19:15 +00:00
Omar Chebib
1e8a0909f6 LEDC: divisor calculation will now be rounded up when necessary
Closes https://github.com/espressif/esp-idf/issues/7722
2021-11-11 12:21:22 +08:00
Omar Chebib
aa2ca7dd94 LEDC: improved support for ESP32-C3 and refactored divisor calculation
As ESP32C3 does not have support for REF_TICK source clock, it is now not
possible to select it anymore.
Auto cfg clock has been improved for all boards.
2021-11-11 12:21:15 +08:00
Cao Sen Miao
09487761cf ESP8684: add freertos, hal, esp_system support 2021-11-06 17:33:44 +08:00
morris
e2275b1f63 gptimer: clean up hal and ll for driver-ng 2021-10-20 18:40:08 +08:00
Zim Kalinowski
a7c9949dd9 Fixed build problem when icluding gpio_ll.h from cpp file 2021-10-17 14:29:31 +08:00
SalimTerryLi
bd89dcc683
RMT: add loop_autostop driver support for esp32s3 2021-09-24 15:24:45 +08:00
songruojing
1fcd639224 usb: Add usb_phy driver to support operations on USB PHY 2021-09-13 12:39:56 +08:00
laokaiyao
c5afd7ce34 i2s: fix write failure on ESP32 in 32bit slave mode 2021-09-03 17:36:44 +08:00
Marius Vikhammer
bdf3a8ff29 Merge branch 'feature/xtwdt' into 'master'
WDT: Add support for XTAL32K Watchdog timer

Closes IDF-2575

See merge request espressif/esp-idf!15000
2021-09-02 02:44:47 +00:00
Marius Vikhammer
4869b3cd4a WDT: Add support for XTAL32K Watchdog timer 2021-09-02 09:09:00 +08:00
SalimTerryLi
6af8d2edee
hal: remove usages of esp_log in HAL 2021-09-01 13:58:47 +08:00
SalimTerryLi
874a720286
soc/ll: workaround compiler bug that generate 8/16 bits inst instead of 32 bits one
update all struct headers to be more "standardized":

- bit fields are properly wrapped with struct
- bitwidth sum should be 32 within same struct, so that it's correctly padded with reserved bits
- bit field should be uint32_t
- typedef volatile struct xxx{} yyy;: xxx must exists. refer: https://github.com/espressif/esp-idf/pull/3199

added helper macros to force peripheral registers being accessed in 32 bitwidth

added a check script into ci
2021-08-30 13:50:58 +08:00
Mahavir Jain
f7d2f283b3 Merge branch 'bugfix/bugfix/esp32s2_memprot_no_logging_2' into 'master'
System/Security: ESP32S2 Memprot uses no abort() calls neither does logging

Closes IDF-3634

See merge request espressif/esp-idf!14852
2021-08-27 11:17:31 +00:00
Martin Vychodil
58aed7df98 ESP32S2: No assert()/abort() in Memprot API, use esp_err_t instead
JIRA IDF-3634
2021-08-26 09:20:00 +02:00
Marius Vikhammer
3907634d20 aes: fix potential unaligned access of buffers
https://github.com/espressif/esp-idf/issues/7236
2021-08-25 10:48:26 +08:00
morris
0c41837b06 Merge branch 'refactor/timer_group-reg_file-update' into 'master'
refactor/timer_group update reg headers for c3 and s2

Closes IDF-3690

See merge request espressif/esp-idf!14761
2021-08-23 04:30:59 +00:00
morris
bb87fd8f08 Merge branch 'refactor/pcnt_driver_esp32s3' into 'master'
pcnt: soc update and hal refactor

See merge request espressif/esp-idf!14698
2021-08-20 04:23:15 +00:00
SalimTerryLi
443845fd54
timer_group: update reg headers for c3&s2&h2 and fix direct 8/16bit reg access 2021-08-19 18:56:32 +08:00
morris
71d475149d lcd: update doc unit test and example to support 8-line spi 2021-08-19 16:40:22 +08:00