Merge branch 'bugfix/mcpwm_ll_missing_type_conversion_v4.4' into 'release/v4.4'

mcpwm: fix implicit conversion in LL function (v4.4)

See merge request espressif/esp-idf!16407
This commit is contained in:
Jiang Jiang Jian 2021-12-16 10:16:03 +00:00
commit 161d7ee25a
3 changed files with 15 additions and 37 deletions

View File

@ -1,16 +1,8 @@
// Copyright 2015-2021 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/******************************************************************************* /*******************************************************************************
* NOTICE * NOTICE
@ -339,17 +331,15 @@ static inline void mcpwm_ll_timer_set_count_mode(mcpwm_dev_t *mcpwm, int timer_i
static inline mcpwm_timer_count_mode_t mcpwm_ll_timer_get_count_mode(mcpwm_dev_t *mcpwm, int timer_id) static inline mcpwm_timer_count_mode_t mcpwm_ll_timer_get_count_mode(mcpwm_dev_t *mcpwm, int timer_id)
{ {
switch (mcpwm->timer[timer_id].timer_cfg1.timer_mod) { switch (mcpwm->timer[timer_id].timer_cfg1.timer_mod) {
case 0:
return MCPWM_TIMER_COUNT_MODE_PAUSE;
case 1: case 1:
return MCPWM_TIMER_COUNT_MODE_UP; return MCPWM_TIMER_COUNT_MODE_UP;
case 2: case 2:
return MCPWM_TIMER_COUNT_MODE_DOWN; return MCPWM_TIMER_COUNT_MODE_DOWN;
case 3: case 3:
return MCPWM_TIMER_COUNT_MODE_UP_DOWN; return MCPWM_TIMER_COUNT_MODE_UP_DOWN;
case 0:
default: default:
HAL_ASSERT(false && "unknown count mode"); return MCPWM_TIMER_COUNT_MODE_PAUSE;
return mcpwm->timer[timer_id].timer_cfg1.timer_mod;
} }
} }

View File

@ -1,16 +1,8 @@
// Copyright 2015-2021 Espressif Systems (Shanghai) PTE LTD /*
// * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
// Licensed under the Apache License, Version 2.0 (the "License"); *
// you may not use this file except in compliance with the License. * SPDX-License-Identifier: Apache-2.0
// You may obtain a copy of the License at */
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/******************************************************************************* /*******************************************************************************
* NOTICE * NOTICE
@ -349,17 +341,15 @@ static inline void mcpwm_ll_timer_set_count_mode(mcpwm_dev_t *mcpwm, int timer_i
static inline mcpwm_timer_count_mode_t mcpwm_ll_timer_get_count_mode(mcpwm_dev_t *mcpwm, int timer_id) static inline mcpwm_timer_count_mode_t mcpwm_ll_timer_get_count_mode(mcpwm_dev_t *mcpwm, int timer_id)
{ {
switch (mcpwm->timer[timer_id].timer_cfg1.timer_mod) { switch (mcpwm->timer[timer_id].timer_cfg1.timer_mod) {
case 0:
return MCPWM_TIMER_COUNT_MODE_PAUSE;
case 1: case 1:
return MCPWM_TIMER_COUNT_MODE_UP; return MCPWM_TIMER_COUNT_MODE_UP;
case 2: case 2:
return MCPWM_TIMER_COUNT_MODE_DOWN; return MCPWM_TIMER_COUNT_MODE_DOWN;
case 3: case 3:
return MCPWM_TIMER_COUNT_MODE_UP_DOWN; return MCPWM_TIMER_COUNT_MODE_UP_DOWN;
case 0:
default: default:
HAL_ASSERT(false && "unknown count mode"); return MCPWM_TIMER_COUNT_MODE_PAUSE;
return mcpwm->timer[timer_id].timer_cfg1.timer_mod;
} }
} }
@ -397,7 +387,7 @@ static inline uint32_t mcpwm_ll_timer_get_count_value(mcpwm_dev_t *mcpwm, int ti
} }
// up direction // up direction
return (HAL_FORCE_READ_U32_REG_FIELD(mcpwm->timer[timer_id].timer_status, timer_value) + return (HAL_FORCE_READ_U32_REG_FIELD(mcpwm->timer[timer_id].timer_status, timer_value) +
HAL_FORCE_READ_U32_REG_FIELD(mcpwm->timer[timer_id].timer_cfg0, timer_period)) % HAL_FORCE_READ_U32_REG_FIELD(mcpwm->timer[timer_id].timer_cfg0, timer_period)) %
(HAL_FORCE_READ_U32_REG_FIELD(mcpwm->timer[timer_id].timer_cfg0, timer_period) + 1); (HAL_FORCE_READ_U32_REG_FIELD(mcpwm->timer[timer_id].timer_cfg0, timer_period) + 1);
} }

View File

@ -1137,7 +1137,6 @@ components/hal/esp32/include/hal/emac_ll.h
components/hal/esp32/include/hal/i2c_ll.h components/hal/esp32/include/hal/i2c_ll.h
components/hal/esp32/include/hal/i2s_ll.h components/hal/esp32/include/hal/i2s_ll.h
components/hal/esp32/include/hal/interrupt_controller_ll.h components/hal/esp32/include/hal/interrupt_controller_ll.h
components/hal/esp32/include/hal/mcpwm_ll.h
components/hal/esp32/include/hal/mpu_ll.h components/hal/esp32/include/hal/mpu_ll.h
components/hal/esp32/include/hal/pcnt_ll.h components/hal/esp32/include/hal/pcnt_ll.h
components/hal/esp32/include/hal/rmt_ll.h components/hal/esp32/include/hal/rmt_ll.h
@ -1271,7 +1270,6 @@ components/hal/esp32s3/include/hal/cpu_ll.h
components/hal/esp32s3/include/hal/gpspi_flash_ll.h components/hal/esp32s3/include/hal/gpspi_flash_ll.h
components/hal/esp32s3/include/hal/i2c_ll.h components/hal/esp32s3/include/hal/i2c_ll.h
components/hal/esp32s3/include/hal/interrupt_controller_ll.h components/hal/esp32s3/include/hal/interrupt_controller_ll.h
components/hal/esp32s3/include/hal/mcpwm_ll.h
components/hal/esp32s3/include/hal/memprot_ll.h components/hal/esp32s3/include/hal/memprot_ll.h
components/hal/esp32s3/include/hal/mpu_ll.h components/hal/esp32s3/include/hal/mpu_ll.h
components/hal/esp32s3/include/hal/pcnt_ll.h components/hal/esp32s3/include/hal/pcnt_ll.h