diff --git a/soc/wch/ch32v/ch32v00x/CMakeLists.txt b/soc/wch/ch32v/ch32v00x/CMakeLists.txt index a7e9de643d69..b75306e920fa 100644 --- a/soc/wch/ch32v/ch32v00x/CMakeLists.txt +++ b/soc/wch/ch32v/ch32v00x/CMakeLists.txt @@ -3,8 +3,8 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_sources( - soc_irq.S - vector.S + ../common/soc_irq.S + ../common/qingke_v2x/vector.S ) zephyr_include_directories(.) diff --git a/soc/wch/ch32v/ch32v00x/soc_irq.S b/soc/wch/ch32v/ch32v00x/soc_irq.S deleted file mode 100644 index 04f1407e2ad3..000000000000 --- a/soc/wch/ch32v/ch32v00x/soc_irq.S +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2024 Michael Hope - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -/* Exports */ -GTEXT(__soc_is_irq) -GTEXT(__soc_handle_irq) - -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - -SECTION_FUNC(exception.other, __soc_handle_irq) - ret diff --git a/soc/wch/ch32v/ch32v00x/vector.S b/soc/wch/ch32v/common/qingke_v2x/vector.S similarity index 100% rename from soc/wch/ch32v/ch32v00x/vector.S rename to soc/wch/ch32v/common/qingke_v2x/vector.S diff --git a/soc/wch/ch32v/qingke_v4c/vector.S b/soc/wch/ch32v/common/qingke_v4/vector.S similarity index 100% rename from soc/wch/ch32v/qingke_v4c/vector.S rename to soc/wch/ch32v/common/qingke_v4/vector.S diff --git a/soc/wch/ch32v/qingke_v2a/soc_irq.S b/soc/wch/ch32v/common/soc_irq.S similarity index 100% rename from soc/wch/ch32v/qingke_v2a/soc_irq.S rename to soc/wch/ch32v/common/soc_irq.S diff --git a/soc/wch/ch32v/qingke_v2a/CMakeLists.txt b/soc/wch/ch32v/qingke_v2a/CMakeLists.txt index a7e9de643d69..b75306e920fa 100644 --- a/soc/wch/ch32v/qingke_v2a/CMakeLists.txt +++ b/soc/wch/ch32v/qingke_v2a/CMakeLists.txt @@ -3,8 +3,8 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_sources( - soc_irq.S - vector.S + ../common/soc_irq.S + ../common/qingke_v2x/vector.S ) zephyr_include_directories(.) diff --git a/soc/wch/ch32v/qingke_v2a/vector.S b/soc/wch/ch32v/qingke_v2a/vector.S deleted file mode 100644 index d078444d85e1..000000000000 --- a/soc/wch/ch32v/qingke_v2a/vector.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2024 Michael Hope - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#ifndef CONFIG_VECTOR_TABLE_SIZE -#error "VECTOR_TABLE_SIZE must be defined" -#endif - -/* Exports */ -GTEXT(__start) - -/* Imports */ -GTEXT(__initialize) - -SECTION_FUNC(vectors, ivt) - .option norvc - j __start - .rept CONFIG_VECTOR_TABLE_SIZE - .word _isr_wrapper - .endr - -SECTION_FUNC(vectors, __start) - li a0, 3 - csrw mtvec, a0 - j __initialize diff --git a/soc/wch/ch32v/qingke_v4b/CMakeLists.txt b/soc/wch/ch32v/qingke_v4b/CMakeLists.txt index a7e9de643d69..ff02c32fd5e2 100644 --- a/soc/wch/ch32v/qingke_v4b/CMakeLists.txt +++ b/soc/wch/ch32v/qingke_v4b/CMakeLists.txt @@ -3,8 +3,8 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_sources( - soc_irq.S - vector.S + ../common/soc_irq.S + ../common/qingke_v4/vector.S ) zephyr_include_directories(.) diff --git a/soc/wch/ch32v/qingke_v4b/soc_irq.S b/soc/wch/ch32v/qingke_v4b/soc_irq.S deleted file mode 100644 index fcb0daea51d0..000000000000 --- a/soc/wch/ch32v/qingke_v4b/soc_irq.S +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (c) 2024 Michael Hope - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -/* Exports */ -GTEXT(__soc_is_irq) -GTEXT(__soc_handle_irq) - -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - -SECTION_FUNC(exception.other, __soc_handle_irq) - ret diff --git a/soc/wch/ch32v/qingke_v4b/vector.S b/soc/wch/ch32v/qingke_v4b/vector.S deleted file mode 100644 index 97766e820fdd..000000000000 --- a/soc/wch/ch32v/qingke_v4b/vector.S +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2024 Michael Hope - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#ifndef CONFIG_VECTOR_TABLE_SIZE -#error "VECTOR_TABLE_SIZE must be defined" -#endif - -/* Exports */ -GTEXT(__start) - -/* Imports */ -GTEXT(__initialize) - -SECTION_FUNC(vectors, ivt) - .option norvc - /* Jump to 0x08000008, into the main flash zone where j __start is */ - lui x5, 0x8000 - jr 0x8(x5) - j __start - .rept CONFIG_VECTOR_TABLE_SIZE - .word _isr_wrapper - .endr - -SECTION_FUNC(vectors, __start) - li a0, 0xf - csrw mtvec, a0 - j __initialize diff --git a/soc/wch/ch32v/qingke_v4c/CMakeLists.txt b/soc/wch/ch32v/qingke_v4c/CMakeLists.txt index a7e9de643d69..ff02c32fd5e2 100644 --- a/soc/wch/ch32v/qingke_v4c/CMakeLists.txt +++ b/soc/wch/ch32v/qingke_v4c/CMakeLists.txt @@ -3,8 +3,8 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_sources( - soc_irq.S - vector.S + ../common/soc_irq.S + ../common/qingke_v4/vector.S ) zephyr_include_directories(.) diff --git a/soc/wch/ch32v/qingke_v4c/soc_irq.S b/soc/wch/ch32v/qingke_v4c/soc_irq.S deleted file mode 100644 index fcb0daea51d0..000000000000 --- a/soc/wch/ch32v/qingke_v4c/soc_irq.S +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (c) 2024 Michael Hope - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -/* Exports */ -GTEXT(__soc_is_irq) -GTEXT(__soc_handle_irq) - -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - -SECTION_FUNC(exception.other, __soc_handle_irq) - ret diff --git a/soc/wch/ch32v/qingke_v4f/CMakeLists.txt b/soc/wch/ch32v/qingke_v4f/CMakeLists.txt index a7e9de643d69..ff02c32fd5e2 100644 --- a/soc/wch/ch32v/qingke_v4f/CMakeLists.txt +++ b/soc/wch/ch32v/qingke_v4f/CMakeLists.txt @@ -3,8 +3,8 @@ # SPDX-License-Identifier: Apache-2.0 zephyr_sources( - soc_irq.S - vector.S + ../common/soc_irq.S + ../common/qingke_v4/vector.S ) zephyr_include_directories(.) diff --git a/soc/wch/ch32v/qingke_v4f/pinctrl_soc.h b/soc/wch/ch32v/qingke_v4f/pinctrl_soc.h index 527e9b5197c8..d6c7590749fc 100644 --- a/soc/wch/ch32v/qingke_v4f/pinctrl_soc.h +++ b/soc/wch/ch32v/qingke_v4f/pinctrl_soc.h @@ -10,7 +10,7 @@ /** * @brief Type to hold a pin's pinctrl configuration. */ -struct ch32v303_pinctrl_soc_pin { +struct ch32v30x_pinctrl_soc_pin { uint32_t config: 22; bool bias_pull_up: 1; bool bias_pull_down: 1; @@ -21,7 +21,7 @@ struct ch32v303_pinctrl_soc_pin { uint8_t slew_rate: 2; }; -typedef struct ch32v303_pinctrl_soc_pin pinctrl_soc_pin_t; +typedef struct ch32v30x_pinctrl_soc_pin pinctrl_soc_pin_t; #define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx) \ { \ diff --git a/soc/wch/ch32v/qingke_v4f/soc_irq.S b/soc/wch/ch32v/qingke_v4f/soc_irq.S deleted file mode 100644 index fcb0daea51d0..000000000000 --- a/soc/wch/ch32v/qingke_v4f/soc_irq.S +++ /dev/null @@ -1,19 +0,0 @@ -/* Copyright (c) 2024 Michael Hope - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include - -/* Exports */ -GTEXT(__soc_is_irq) -GTEXT(__soc_handle_irq) - -SECTION_FUNC(exception.other, __soc_is_irq) - csrr a0, mcause - srli a0, a0, 31 - ret - -SECTION_FUNC(exception.other, __soc_handle_irq) - ret diff --git a/soc/wch/ch32v/qingke_v4f/vector.S b/soc/wch/ch32v/qingke_v4f/vector.S deleted file mode 100644 index 97766e820fdd..000000000000 --- a/soc/wch/ch32v/qingke_v4f/vector.S +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2024 Michael Hope - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include - -#ifndef CONFIG_VECTOR_TABLE_SIZE -#error "VECTOR_TABLE_SIZE must be defined" -#endif - -/* Exports */ -GTEXT(__start) - -/* Imports */ -GTEXT(__initialize) - -SECTION_FUNC(vectors, ivt) - .option norvc - /* Jump to 0x08000008, into the main flash zone where j __start is */ - lui x5, 0x8000 - jr 0x8(x5) - j __start - .rept CONFIG_VECTOR_TABLE_SIZE - .word _isr_wrapper - .endr - -SECTION_FUNC(vectors, __start) - li a0, 0xf - csrw mtvec, a0 - j __initialize