From bd220bb578932e184848b5b42e0c008247b9eb09 Mon Sep 17 00:00:00 2001 From: Krzysztof Budzynski Date: Mon, 2 Mar 2020 04:18:44 +0800 Subject: [PATCH] Correct ULP REG_WR and REG_RD instruction for ESP32 and ESP32-S2. Closes https://github.com/espressif/esp-idf/issues/4776 --- docs/en/api-guides/ulp_instruction_set.rst | 26 ++++++++--------- docs/en/api-guides/ulps2_instruction_set.rst | 30 +++++++++----------- 2 files changed, 26 insertions(+), 30 deletions(-) diff --git a/docs/en/api-guides/ulp_instruction_set.rst b/docs/en/api-guides/ulp_instruction_set.rst index fee3a76db..1dc3149ca 100644 --- a/docs/en/api-guides/ulp_instruction_set.rst +++ b/docs/en/api-guides/ulp_instruction_set.rst @@ -851,24 +851,23 @@ Note that when accessing RTC memories and RTC registers, ULP coprocessor has low **REG_RD** *Addr, High, Low* **Operands** - - *Addr* – register address, in 32-bit words - - *High* – High part of R0 - - *Low* – Low part of R0 + - *Addr* – Register address, in 32-bit words + - *High* – Register end bit number + - *Low* – Register start bit number **Cycles** 4 cycles to execute, 4 cycles to fetch next instruction **Description** - The instruction reads up to 16 bits from a peripheral register into a general purpose register: ``R0 = REG[Addr][High:Low]``. + The instruction reads up to 16 bits from a peripheral register into a general purpose register: ``R0 = REG[Addr][High:Low]``. - This instruction can access registers in RTC_CNTL, RTC_IO, SENS, and RTC_I2C peripherals. Address of the the register, as seen from the ULP, - can be calculated from the address of the same register on the DPORT bus as follows:: + This instruction can access registers in RTC_CNTL, RTC_IO, SENS, and RTC_I2C peripherals. Address of the the register, as seen from the ULP, can be calculated from the address of the same register on the DPORT bus as follows:: addr_ulp = (addr_dport - DR_REG_RTCCNTL_BASE) / 4 **Examples**:: - 1: REG_RD 0x120, 2, 0 // load 4 bits: R0 = {12'b0, REG[0x120][7:4]} + 1: REG_RD 0x120, 7, 4 // load 4 bits: R0 = {12'b0, REG[0x120][7:4]} **REG_WR** – write to peripheral register @@ -878,19 +877,18 @@ Note that when accessing RTC memories and RTC registers, ULP coprocessor has low **REG_WR** *Addr, High, Low, Data* **Operands** - - *Addr* – register address, in 32-bit words. - - *High* – High part of R0 - - *Low* – Low part of R0 - - *Data* – value to write, 8 bits + - *Addr* – Register address, in 32-bit words. + - *High* – Register end bit number + - *Low* – Register start bit number + - *Data* – Value to write, 8 bits **Cycles** 8 cycles to execute, 4 cycles to fetch next instruction **Description** - The instruction writes up to 8 bits from a general purpose register into a peripheral register. ``REG[Addr][High:Low] = data`` + The instruction writes up to 8 bits from an immediate data value into a peripheral register: ``REG[Addr][High:Low] = data``. - This instruction can access registers in RTC_CNTL, RTC_IO, SENS, and RTC_I2C peripherals. Address of the the register, as seen from the ULP, - can be calculated from the address of the same register on the DPORT bus as follows:: + This instruction can access registers in RTC_CNTL, RTC_IO, SENS, and RTC_I2C peripherals. Address of the the register, as seen from the ULP, can be calculated from the address of the same register on the DPORT bus as follows:: addr_ulp = (addr_dport - DR_REG_RTCCNTL_BASE) / 4 diff --git a/docs/en/api-guides/ulps2_instruction_set.rst b/docs/en/api-guides/ulps2_instruction_set.rst index 061b41fca..654c2dbda 100644 --- a/docs/en/api-guides/ulps2_instruction_set.rst +++ b/docs/en/api-guides/ulps2_instruction_set.rst @@ -1077,24 +1077,23 @@ The detailed description of these commands please see below. **REG_RD** *Addr, High, Low* **Operands** - - *Addr* – register address, in 32-bit words - - *High* – High part of R0 - - *Low* – Low part of R0 + - *Addr* – Register address, in 32-bit words + - *High* – Register end bit number + - *Low* – Register start bit number **Cycles** 4 cycles to execute, 4 cycles to fetch next instruction **Description** - The instruction reads up to 16 bits from a peripheral register into a general purpose register: ``R0 = REG[Addr][High:Low]``. + The instruction reads up to 16 bits from a peripheral register into a general purpose register: ``R0 = REG[Addr][High:Low]``. - This instruction can access registers in RTC_CNTL, RTC_IO, SENS, and RTC_I2C peripherals. Address of the the register, as seen from the ULP, - can be calculated from the address of the same register on the DPORT bus as follows:: + This instruction can access registers in RTC_CNTL, RTC_IO, SENS, and RTC_I2C peripherals. Address of the the register, as seen from the ULP, can be calculated from the address of the same register on the PeriBUS1 as follows:: - addr_ulp = (addr_dport - DR_REG_RTCCNTL_BASE) / 4 + addr_ulp = (addr_peribus1 - DR_REG_RTCCNTL_BASE) / 4 **Examples**:: - 1: REG_RD 0x120, 2, 0 // load 4 bits: R0 = {12'b0, REG[0x120][7:4]} + 1: REG_RD 0x120, 7, 4 // load 4 bits: R0 = {12'b0, REG[0x120][7:4]} **REG_WR** – write to peripheral register @@ -1104,21 +1103,20 @@ The detailed description of these commands please see below. **REG_WR** *Addr, High, Low, Data* **Operands** - - *Addr* – register address, in 32-bit words. - - *High* – High part of R0 - - *Low* – Low part of R0 - - *Data* – value to write, 8 bits + - *Addr* – Register address, in 32-bit words. + - *High* – Register end bit number + - *Low* – Register start bit number + - *Data* – Value to write, 8 bits **Cycles** 8 cycles to execute, 4 cycles to fetch next instruction **Description** - The instruction writes up to 8 bits from a general purpose register into a peripheral register. ``REG[Addr][High:Low] = data`` + The instruction writes up to 8 bits from an immediate data value into a peripheral register: ``REG[Addr][High:Low] = data``. - This instruction can access registers in RTC_CNTL, RTC_IO, SENS, and RTC_I2C peripherals. Address of the the register, as seen from the ULP, - can be calculated from the address of the same register on the DPORT bus as follows:: + This instruction can access registers in RTC_CNTL, RTC_IO, SENS, and RTC_I2C peripherals. Address of the the register, as seen from the ULP, can be calculated from the address of the same register on the PeriBUS1 as follows:: - addr_ulp = (addr_dport - DR_REG_RTCCNTL_BASE) / 4 + addr_ulp = (addr_peribus1 - DR_REG_RTCCNTL_BASE) / 4 **Examples**::