diff options
Diffstat (limited to 'bsps/arm/tms570/include')
54 files changed, 1154 insertions, 331 deletions
diff --git a/bsps/arm/tms570/include/bsp.h b/bsps/arm/tms570/include/bsp.h index c5ac0cc59a..287750295f 100644 --- a/bsps/arm/tms570/include/bsp.h +++ b/bsps/arm/tms570/include/bsp.h @@ -1,13 +1,15 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief Global BSP definitions. + * @brief This header file provides BSP-specific interfaces. */ /* - * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com> + * Copyright (C) 2014 Premysl Houdek <kom541000@gmail.com> * * Google Summer of Code 2014 at * Czech Technical University in Prague @@ -15,11 +17,26 @@ * 166 36 Praha 6 * Czech Republic * - * Based on LPC24xx and LPC1768 BSP + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef LIBBSP_ARM_TMS570_BSP_H @@ -44,8 +61,13 @@ #include <rtems.h> #include <bsp/default-initial-extension.h> -#define BSP_OSCILATOR_CLOCK 8000000 +#if TMS570_VARIANT == 4357 +#define BSP_PLL_OUT_CLOCK 150000000 +#else #define BSP_PLL_OUT_CLOCK 160000000 +#endif + +RTEMS_NO_RETURN void bsp_restart(const void *addr); #endif /* ASM */ diff --git a/bsps/arm/tms570/include/bsp/irq.h b/bsps/arm/tms570/include/bsp/irq.h index 872bebd908..d0eb130a92 100644 --- a/bsps/arm/tms570/include/bsp/irq.h +++ b/bsps/arm/tms570/include/bsp/irq.h @@ -1,13 +1,15 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief TMS570 interrupt definitions. + * @brief This header file provides TMS570 interrupt definitions. */ /* - * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com> + * Copyright (C) 2014 Premysl Houdek <kom541000@gmail.com> * * Google Summer of Code 2014 at * Czech Technical University in Prague @@ -15,12 +17,26 @@ * 166 36 Praha 6 * Czech Republic * - * Based on LPC24xx and LPC1768 BSP - * by embedded brains GmbH and others + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef LIBBSP_ARM_TMS570_IRQ_H @@ -106,8 +122,8 @@ #define TMS570_IRQ_EMAC_TX 77 #define TMS570_IRQ_EMAC_THRESH 78 #define TMS570_IRQ_EMAC_RX 79 -#define TMS570_IRQ_HWA_INT_REQ_H 80 -#define TMS570_IRQ_HWA_INT_REQ_H 81 +#define TMS570_IRQ_HWAG1_INT_REQ_H 80 +#define TMS570_IRQ_HWAG2_INT_REQ_H 81 #define TMS570_IRQ_DCC_DONE_INTERRUPT 82 #define TMS570_IRQ_DCC2_DONE_INTERRUPT 83 #define TMS570_IRQ_HWAG1_INT_REQ_L 88 @@ -124,33 +140,56 @@ #ifndef ASM /** - * @brief Set priority of the interrupt vector. - * - * This function is here because of compability. It should set - * priority of the interrupt vector. - * @warning It does not set any priority at HW layer. It is nearly imposible to - * @warning set priority of the interrupt on TMS570 in a nice way. - * @param[in] vector vector of isr - * @param[in] priority new priority assigned to the vector - * @return Void + * @brief Sets the priority of the interrupt vector. + * + * The priority is defined by the VIM interrupt channel. Firstly, the VIM + * Interrupt Control (CHANCTRL) registers are searched to get the current + * channel associated with the interrupt vector. The interrupt vector of the + * channel associated with the priority is assigned to this channel. The + * specified interrupt vector is assigned to the channel associated with the + * priority. So, this function swaps the channels of two interrupt vectors. + * + * @param vector is the number of the interrupt vector to set the priority. + * + * @param priority is the priority to set. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ID There was no interrupt vector associated with the + * number specified by ``vector``. + * + * @retval ::RTEMS_INVALID_PRIORITY The interrupt priority specified in + * ``priority`` was invalid. */ -void tms570_irq_set_priority( +rtems_status_code tms570_irq_set_priority( rtems_vector_number vector, - unsigned priority + uint32_t priority ); /** - * @brief Gets priority of the interrupt vector. + * @brief Gets the priority of the interrupt vector. * - * This function is here because of compability. It returns priority - * of the isr vector last set by tms570_irq_set_priority function. + * The priority is defined by the VIM interrupt channel. The VIM Interrupt + * Control (CHANCTRL) registers are searched to get the channel associated with + * the interrupt vector. * - * @warning It does not return any real priority of the HW layer. - * @param[in] vector vector of isr - * @retval 0 vector is invalid. - * @retval priority priority of the interrupt + * @param vector is the number of the interrupt vector to set the priority. + * + * @param priority is the priority to set. + * + * @retval ::RTEMS_SUCCESSFUL The requested operation was successful. + * + * @retval ::RTEMS_INVALID_ADDRESS The ``priority`` parameter was NULL. + * + * @retval ::RTEMS_INVALID_ID There was no interrupt vector associated with the + * number specified by ``vector``. + * + * @retval ::RTEMS_NOT_DEFINED The interrupt has no associated priority. */ -unsigned tms570_irq_get_priority( rtems_vector_number vector ); +rtems_status_code tms570_irq_get_priority( + rtems_vector_number vector, + uint32_t *priority +); #endif /* ASM */ diff --git a/bsps/arm/tms570/include/bsp/system-clocks.h b/bsps/arm/tms570/include/bsp/system-clocks.h index 9c819fef74..1fe30eecc4 100644 --- a/bsps/arm/tms570/include/bsp/system-clocks.h +++ b/bsps/arm/tms570/include/bsp/system-clocks.h @@ -1,31 +1,47 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief System clocks. + * @brief This header file provides a free-running timer interface. */ /* - * Copyright (c) 2014 Pavel Pisa <pisa@cmp.felk.cvut.cz> + * Copyright (C) 2014 Pavel Pisa <pisa@cmp.felk.cvut.cz> * * Czech Technical University in Prague * Zikova 1903/4 * 166 36 Praha 6 * Czech Republic * - * Based on LPC24xx and LPC1768 BSP - * by embedded brains GmbH and others + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef LIBBSP_ARM_TMS570_SYSTEM_CLOCKS_H #define LIBBSP_ARM_TMS570_SYSTEM_CLOCKS_H -#include <bsp/tms570-rti.h> +#include <bsp/tms570.h> #ifdef __cplusplus extern "C" { diff --git a/bsps/arm/tms570/include/bsp/ti_herc/errata_SSWF021_45.h b/bsps/arm/tms570/include/bsp/ti_herc/errata_SSWF021_45.h new file mode 100755 index 0000000000..e1821f8e6e --- /dev/null +++ b/bsps/arm/tms570/include/bsp/ti_herc/errata_SSWF021_45.h @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides errata SSWF021#45 interfaces. + * + * Pulled in from Halcogen v4.7.1. This is a rare but high-severity errata + * that should always be checked for at system start. + */ + +/* +* Copyright (C) 2009-2018 Texas Instruments Incorporated - www.ti.com +* +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* +* Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the +* distribution. +* +* Neither the name of Texas Instruments Incorporated nor the names of +* its contributors may be used to endorse or promote products derived +* from this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +*/ +#ifndef INCLUDE_ERRATA_SSWF021_45_H_ +#define INCLUDE_ERRATA_SSWF021_45_H_ +#include <stdint.h> + +uint32_t _errata_SSWF021_45_both_plls(uint32_t count); +uint32_t _errata_SSWF021_45_pll1(uint32_t count); +uint32_t _errata_SSWF021_45_pll2(uint32_t count); + + +#endif /* INCLUDE_HL_ERRATA_SSWF021_45_H_ */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_adc.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_adc.h index 1649fbeb4b..fd1965ab8b 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_adc.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_adc.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides ADC interfaces. + */ + /* The header file is generated by make_header.py from ADC.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_ccmsr.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_ccmsr.h index 941ed54753..c5520058c0 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_ccmsr.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_ccmsr.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides CCMSR interfaces. + */ + /* The header file is generated by make_header.py from CCMSR.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_crc.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_crc.h index f1352f67b6..8dfffb73b1 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_crc.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_crc.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides CRC interfaces. + */ + /* The header file is generated by make_header.py from CRC.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_dcan.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_dcan.h index c278f554ff..5da8355928 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_dcan.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_dcan.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides DCAN interfaces. + */ + /* The header file is generated by make_header.py from DCAN.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_dcc.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_dcc.h index 4c90276523..12edca3eb1 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_dcc.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_dcc.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides DCC interfaces. + */ + /* The header file is generated by make_header.py from DCC.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ @@ -41,6 +51,12 @@ #include <bsp/utility.h> +enum tms570_dcc1_cnt0_clksrc { + DCC1_CNT0_HF_LPO = 0x5U, /**< Alias for DCC1 CNT 0 CLOCK SOURCE 0*/ + DCC1_CNT0_TCK = 0xAU, /**< Alias for DCC1 CNT 0 CLOCK SOURCE 1*/ + DCC1_CNT0_OSCIN = 0xFU, /**< Alias for DCC1 CNT 0 CLOCK SOURCE 2*/ +}; + typedef struct{ uint32_t GCTRL; /*DCC Global Control Register*/ uint32_t REV; /*DCC Revision Id Register*/ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_dma.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_dma.h index 717f05b010..4535aa6986 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_dma.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_dma.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides DMA interfaces. + */ + /* The header file is generated by make_header.py from DMA.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_dmm.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_dmm.h index 55d656ef86..ff35475c41 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_dmm.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_dmm.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides DMM interfaces. + */ + /* The header file is generated by make_header.py from DMM.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_efuse.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_efuse.h index decf5bbeff..af0bafd171 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_efuse.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_efuse.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides EFUSE interfaces. + */ + /* The header file is generated by make_header.py from EFUSE.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_emacc.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_emacc.h index c7c564cf49..e06f946509 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_emacc.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_emacc.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides EMACC interfaces. + */ + /* The header file is generated by make_header.py from EMACC.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_emacm.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_emacm.h index c6e63210aa..10ae5b5d32 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_emacm.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_emacm.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides EMACM interfaces. + */ + /* The header file is generated by make_header.py from EMACM.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_emif.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_emif.h index 0810fd097f..69f13b73a2 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_emif.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_emif.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides EMIF interfaces. + */ + /* The header file is generated by make_header.py from EMIF.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_esm.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_esm.h index 3ea4b6b43c..6c57486e8d 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_esm.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_esm.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides ESM interfaces. + */ + /* The header file is generated by make_header.py from ESM.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_flash.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_flash.h index 6c5a127d0b..8ee20080ba 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_flash.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_flash.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides flash interfaces. + */ + /* The header file is generated by make_header.py from FLASH.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_flex_ray.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_flex_ray.h index e077ab65fd..9f72fc8f48 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_flex_ray.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_flex_ray.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides FlexRay interfaces. + */ + /* The header file is generated by make_header.py from FLEX_RAY.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_gio.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_gio.h index 3cb7851754..0cc14dcd17 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_gio.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_gio.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides GIO interfaces. + */ + /* The header file is generated by make_header.py from GIO.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_htu.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_htu.h index 3df27be461..5241da737b 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_htu.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_htu.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides HTU interfaces. + */ + /* The header file is generated by make_header.py from HTU.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_i2c.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_i2c.h index 63ed3f8d95..4e51455b1e 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_i2c.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_i2c.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides I2C interfaces. + */ + /* The header file is generated by make_header.py from I2C.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_iomm.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_iomm.h index f6197e811c..414110ff60 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_iomm.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_iomm.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides IOMM interfaces. + */ + /* The header file is generated by make_header.py from IOMM.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ @@ -40,40 +50,7 @@ #define LIBBSP_ARM_TMS570_IOMM #include <bsp/utility.h> - -typedef struct{ - uint32_t PINMMR0; /*Pin Multiplexing Control Register 0*/ - uint32_t PINMMR1; /*Pin Multiplexing Control Register 1*/ - uint32_t PINMMR2; /*Pin Multiplexing Control Register 2*/ - uint32_t PINMMR3; /*Pin Multiplexing Control Register 3*/ - uint32_t PINMMR4; /*Pin Multiplexing Control Register 4*/ - uint32_t PINMMR5; /*Pin Multiplexing Control Register 5*/ - uint32_t PINMMR6; /*Pin Multiplexing Control Register 6*/ - uint32_t PINMMR7; /*Pin Multiplexing Control Register 7*/ - uint32_t PINMMR8; /*Pin Multiplexing Control Register 8*/ - uint32_t PINMMR9; /*Pin Multiplexing Control Register 9*/ - uint32_t PINMMR10; /*Pin Multiplexing Control Register 10*/ - uint32_t PINMMR11; /*Pin Multiplexing Control Register 11*/ - uint32_t PINMMR12; /*Pin Multiplexing Control Register 12*/ - uint32_t PINMMR13; /*Pin Multiplexing Control Register 13*/ - uint32_t PINMMR14; /*Pin Multiplexing Control Register 14*/ - uint32_t PINMMR15; /*Pin Multiplexing Control Register 15*/ - uint32_t PINMMR16; /*Pin Multiplexing Control Register 16*/ - uint32_t PINMMR17; /*Pin Multiplexing Control Register 17*/ - uint32_t PINMMR18; /*Pin Multiplexing Control Register 18*/ - uint32_t PINMMR19; /*Pin Multiplexing Control Register 19*/ - uint32_t PINMMR20; /*Pin Multiplexing Control Register 20*/ - uint32_t PINMMR21; /*Pin Multiplexing Control Register 21*/ - uint32_t PINMMR22; /*Pin Multiplexing Control Register 22*/ - uint32_t PINMMR23; /*Pin Multiplexing Control Register 23*/ - uint32_t PINMMR24; /*Pin Multiplexing Control Register 24*/ - uint32_t PINMMR25; /*Pin Multiplexing Control Register 25*/ - uint32_t PINMMR26; /*Pin Multiplexing Control Register 26*/ - uint32_t PINMMR27; /*Pin Multiplexing Control Register 27*/ - uint32_t PINMMR28; /*Pin Multiplexing Control Register 28*/ - uint32_t PINMMR29; /*Pin Multiplexing Control Register 29*/ - uint32_t PINMMR30; /*Pin Multiplexing Control Register 30*/ -} tms570_pinmux_t; +#include <bspopts.h> typedef struct{ uint32_t REVISION_REG; /*Revision Register*/ @@ -92,7 +69,14 @@ typedef struct{ uint32_t FAULT_STATUS_REG; /*Fault Status Register*/ uint32_t FAULT_CLEAR_REG; /*Fault Clear Register*/ uint8_t reserved5 [16]; - tms570_pinmux_t PINMUX; /*Pin Multiplexing Control Registers*/ +#if TMS570_VARIANT == 4357 + uint32_t PINMMR[180]; /* 0x110 - 1A4 : Output Pin Multiplexing Control + Registers (38 registers); 0x250 - 0x29C : Input Pin + Multiplexing Control Registers (20); 0X390 - 3DC : + Special Functionality Control Registers (20) */ +#else + uint32_t PINMMR[30]; /*Pin Multiplexing Control Register 0-30*/ +#endif } tms570_iomm_t; diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_lin.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_lin.h index d2c3a3bfe8..2735072240 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_lin.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_lin.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides LIN interfaces. + */ + /* The header file is generated by make_header.py from LIN.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_mdio.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_mdio.h index 704a0bc8a4..800a069353 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_mdio.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_mdio.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides MDIO interfaces. + */ + /* The header file is generated by make_header.py from MDIO.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_n2het.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_n2het.h index 06b8bbeb0a..e2feb2e64d 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_n2het.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_n2het.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides N2HET interfaces. + */ + /* The header file is generated by make_header.py from N2HET.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_pbist.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_pbist.h index 2c5ed29760..1f788512de 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_pbist.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_pbist.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides PBIST interfaces. + */ + /* The header file is generated by make_header.py from PBIST.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_pcr.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_pcr.h index 4d5613aa9f..21ea62d747 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_pcr.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_pcr.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides PCR interfaces. + */ + /* The header file is generated by make_header.py from PCR.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_pll.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_pll.h index 1cb8b03308..bd783a2689 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_pll.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_pll.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides PLL interfaces. + */ + /* The header file is generated by make_header.py from PLL.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_pmm.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_pmm.h index c834b83999..be2185d5c2 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_pmm.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_pmm.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides PMM interfaces. + */ + /* The header file is generated by make_header.py from PMM.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_pom.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_pom.h index 1a4df19f8a..89be0179a6 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_pom.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_pom.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides POM interfaces. + */ + /* The header file is generated by make_header.py from POM.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_rti.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_rti.h index 029b3b5721..946ce643bc 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_rti.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_rti.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides RTI interfaces. + */ + /* The header file is generated by make_header.py from RTI.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_rtp.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_rtp.h index cd54b29050..2974e5e561 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_rtp.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_rtp.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides RTP interfaces. + */ + /* The header file is generated by make_header.py from RTP.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_sci.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_sci.h index 6b954f7fcf..0a9056d701 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_sci.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_sci.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides SCI interfaces. + */ + /* The header file is generated by make_header.py from SCI.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_spi.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_spi.h index 35335c61e0..76edf8a86c 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_spi.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_spi.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides SPI interfaces. + */ + /* The header file is generated by make_header.py from SPI.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_stc.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_stc.h index e935f450b8..5ad1f9aaac 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_stc.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_stc.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides STC interfaces. + */ + /* The header file is generated by make_header.py from STC.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_sys.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_sys.h index 433e9e8fb6..d5583a1cca 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_sys.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_sys.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides SYS interfaces. + */ + /* The header file is generated by make_header.py from SYS.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ @@ -619,6 +629,16 @@ typedef struct{ /* field: WDRST - Watchdog reset flag. */ #define TMS570_SYS1_SYSESR_WDRST BSP_BIT32(13) +#if TMS570_VARIANT == 4357 + +/* field: DBGRST - Debug reset flag. */ +#define TMS570_SYS1_SYSESR_DBGRST BSP_BIT32(11) + +/* field: ICSTRST - Interconnect reset flag. */ +#define TMS570_SYS1_SYSESR_ICSTRST BSP_BIT32(7) + +#endif + /* field: CPURST - CPU reset flag. This bit is set when the CPU is reset. */ #define TMS570_SYS1_SYSESR_CPURST BSP_BIT32(5) diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_sys2.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_sys2.h index 29ec5a141c..47808d8483 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_sys2.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_sys2.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides SYS2 interfaces. + */ + /* The header file is generated by make_header.py from SYS2.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ @@ -50,9 +60,11 @@ typedef struct{ uint8_t reserved3 [20]; uint32_t CLK2CNTRL; /*Clock 2 Control Register*/ uint32_t VCLKACON1; /*Peripheral Asynchronous Clock Configuration 1 Register*/ - uint8_t reserved4 [44]; + uint8_t reserved4 [16]; + uint32_t HCLKCNTL; /* 0x0054 */ + uint8_t reserved5 [24]; uint32_t CLKSLIP; /*Clock Slip Register*/ - uint8_t reserved5 [120]; + uint8_t reserved6 [120]; uint32_t EFC_CTLREG; /*EFUSE Controller Control Register*/ uint32_t DIEDL_REG0; /*Die Identification Register*/ uint32_t DIEDH_REG1; /*Die Identification Register*/ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_tcr.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_tcr.h index 5304504afc..7f14808805 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_tcr.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_tcr.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides TCR interfaces. + */ + /* The header file is generated by make_header.py from TCR.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_tcram.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_tcram.h index 1a48848e76..710cc2e5a7 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_tcram.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_tcram.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides TCRAM interfaces. + */ + /* The header file is generated by make_header.py from TCRAM.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/ti_herc/reg_vim.h b/bsps/arm/tms570/include/bsp/ti_herc/reg_vim.h index d0347a4509..2d3776527d 100644 --- a/bsps/arm/tms570/include/bsp/ti_herc/reg_vim.h +++ b/bsps/arm/tms570/include/bsp/ti_herc/reg_vim.h @@ -1,3 +1,13 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides VIM interfaces. + */ + /* The header file is generated by make_header.py from VIM.json */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ diff --git a/bsps/arm/tms570/include/bsp/tms570-pinmux.h b/bsps/arm/tms570/include/bsp/tms570-pinmux.h index f744b92737..3224636951 100644 --- a/bsps/arm/tms570/include/bsp/tms570-pinmux.h +++ b/bsps/arm/tms570/include/bsp/tms570-pinmux.h @@ -1,13 +1,16 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief I/O Multiplexing Module (IOMM) basic support + * @brief This header file provides interfaces of the I/O Multiplexing Module + * (IOMM) support. */ /* - * Copyright (c) 2015 Premysl Houdek <kom541000@gmail.com> + * Copyright (C) 2015 Premysl Houdek <kom541000@gmail.com> * * Google Summer of Code 2014 at * Czech Technical University in Prague @@ -15,16 +18,33 @@ * 166 36 Praha 6 * Czech Republic * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef LIBBSP_ARM_TMS570_PINMUX_H #define LIBBSP_ARM_TMS570_PINMUX_H -#ifndef ASM -#include <bsp/tms570.h> +#include <stddef.h> +#include <stdint.h> #ifdef __cplusplus extern "C" { @@ -40,10 +60,18 @@ extern "C" { * connection is not enabled in parallel to other one. * Mask is ored with pin number in such list. */ -#define TMS570_PIN_CLEAR_RQ_MASK 0x00000800 +#define TMS570_PIN_CLEAR_RQ_MASK 0x00008000 -#define TMS570_PIN_FNC_SHIFT 12 -#define TMS570_PIN_FNC_MASK 0x0000f000 +#define TMS570_PIN_FNC_SHIFT 11 +#define TMS570_PIN_FNC_MASK 0x00007800 + +/** + * @brief This constant indicates that all eight function bits associated with + * the pin shall be cleared. + * + * Use it as a special value for the pin function in TMS570_PIN_AND_FNC(). + */ +#define TMS570_PIN_FNC_CLEAR 0x10U #define TMS570_PIN_NUM_FNC_MASK 0x0000ffff @@ -52,6 +80,15 @@ extern "C" { #define TMS570_PIN_FNC_AUTO (-1) +/** + * @brief Defines the function of the pin. + * + * @param pin is the pin identifier. Use TMS570_BALL_WITH_MMR() to define the + * pin identifier. + * + * param fnc is the pin function. The pin function shall be the function bit + * index or TMS570_PIN_FNC_CLEAR. + */ #define TMS570_PIN_AND_FNC(pin, fnc) \ ((pin) | ((fnc) << TMS570_PIN_FNC_SHIFT)) @@ -61,6 +98,43 @@ extern "C" { #define TMS570_BALL_WITH_MMR(mmrx, pos) \ ((pos) | ((mmrx) << 2)) +/** + * @brief Prepares a pin configuration sequence. + * + * Use tms570_pin_config_apply() to apply pin configurations. Use + * tms570_pin_config_complete() to complete the pin configuration sequence. + */ +void tms570_pin_config_prepare(void); + +/** + * @brief Applies a pin configuration. + * + * This function can only be used if the pin configuration was prepared by + * tms570_pin_config_prepare(). + * + * @param config is the pin configuration defined by TMS570_PIN_AND_FNC() or + * TMS570_PIN_WITH_IN_ALT(). + */ +void tms570_pin_config_apply(uint32_t config); + +/** + * @brief Applies a pin configuration array. + * + * This function can only be used if the pin configuration was prepared by + * tms570_pin_config_prepare(). + * + * @param config is the pin configuration array. Calls + * tms570_pin_config_apply() for each pin configuration in the array. + * + * @param count is the element count of the pin configuration array. + */ +void tms570_pin_config_array_apply(const uint32_t *config, size_t count); + +/** + * @brief Completes a pin configuration sequence. + */ +void tms570_pin_config_complete(void); + /* Generic functions select pin to peripheral connection */ void tms570_bsp_pin_set_function(int pin_num, int pin_fnc); @@ -71,15 +145,6 @@ void tms570_bsp_pin_config_one(uint32_t pin_num_and_fnc); void tms570_bsp_pinmmr_config(const uint32_t *pinmmr_values, int reg_start, int reg_count); -static inline void -tms570_bsp_pin_to_pinmmrx(volatile uint32_t **pinmmrx, unsigned int *pin_shift, - int pin_num) -{ - pin_num = (pin_num & TMS570_PIN_NUM_MASK) >> TMS570_PIN_NUM_SHIFT; - *pinmmrx = &TMS570_IOMM.PINMUX.PINMMR0 + (pin_num >> 2); - *pin_shift = (pin_num & 0x3)*8; -} - #define TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, pin) \ (((((pin) & TMS570_PIN_NUM_MASK) >> 2 != (reg)) || ((pin) & TMS570_PIN_CLEAR_RQ_MASK))? 0: \ 1 << ((((pin) & TMS570_PIN_FNC_MASK) >> TMS570_PIN_FNC_SHIFT) + \ @@ -125,9 +190,6 @@ tms570_bsp_pin_to_pinmmrx(volatile uint32_t **pinmmrx, unsigned int *pin_shift, #define TMS570_PINMMR_COMA_LIST(pin_list) \ pin_list(TMS570_PINMMR_COMA_LIST_ACTION, 0) - -#endif - /** @} */ #ifdef __cplusplus diff --git a/bsps/arm/tms570/include/bsp/tms570-pins.h b/bsps/arm/tms570/include/bsp/tms570-pins.h index 32839138d0..606b7e243e 100644 --- a/bsps/arm/tms570/include/bsp/tms570-pins.h +++ b/bsps/arm/tms570/include/bsp/tms570-pins.h @@ -1,10 +1,54 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief Select pin mapping according to selected chip. - * Defaults to TMS570LS3137ZWT for now. + * @brief This header file selects the pin mapping according to the selected + * chip. */ +/* + * Copyright (C) 2014 Premysl Houdek <kom541000@gmail.com> + * + * Google Summer of Code 2014 at + * Czech Technical University in Prague + * Zikova 1903/4 + * 166 36 Praha 6 + * Czech Republic + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LIBBSP_ARM_TMS570_PINS_H +#define LIBBSP_ARM_TMS570_PINS_H + +#include <bspopts.h> + +#if TMS570_VARIANT == 4357 +#include <bsp/tms570lc4357-pins.h> +#else #include <bsp/tms570ls3137zwt-pins.h> +#endif + +#endif /* LIBBSP_ARM_TMS570_PINS_H */ diff --git a/bsps/arm/tms570/include/bsp/tms570-pom.h b/bsps/arm/tms570/include/bsp/tms570-pom.h index 7e89ea2b96..aaf95ae8d0 100644 --- a/bsps/arm/tms570/include/bsp/tms570-pom.h +++ b/bsps/arm/tms570/include/bsp/tms570-pom.h @@ -1,20 +1,42 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file + * * @ingroup RTEMSBSPsARMTMS570 - * @brief Parameter Overlay Module (POM) header file + * + * @brief This header file provides interfaces of the Parameter Overlay Module + * (POM) support. */ /* - * Copyright (c) 2014 Pavel Pisa <pisa@cmp.felk.cvut.cz> + * Copyright (C) 2014 Pavel Pisa <pisa@cmp.felk.cvut.cz> * * Czech Technical University in Prague * Zikova 1903/4 * 166 36 Praha 6 * Czech Republic * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef LIBBSP_ARM_TMS570_POM_H @@ -48,7 +70,7 @@ extern "C" { #define TMS570_POM_REGADDRMASK ((1<<23)-1) -void tms570_initialize_and_clear(void); +void tms570_pom_initialize_and_clear(void); void tms570_pom_remap(void); /** @} */ diff --git a/bsps/arm/tms570/include/bsp/tms570-rti.h b/bsps/arm/tms570/include/bsp/tms570-rti.h deleted file mode 100644 index fdfdc1578a..0000000000 --- a/bsps/arm/tms570/include/bsp/tms570-rti.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file - * - * @ingroup RTEMSBSPsARMTMS570 - * - * @brief Real Time Interrupt module (RTI) header file. - */ - -/* - * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com> - * - * Google Summer of Code 2014 at - * Czech Technical University in Prague - * Zikova 1903/4 - * 166 36 Praha 6 - * Czech Republic - * - * Based on LPC24xx and LPC1768 BSP - * by embedded brains GmbH and others - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef LIBBSP_ARM_TMS570_RTI_H -#define LIBBSP_ARM_TMS570_RTI_H - -#ifndef ASM - -#include <stdint.h> -#include <bsp/tms570.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* ASM */ - -#endif /* LIBBSP_ARM_TMS570_IRQ_H */ diff --git a/bsps/arm/tms570/include/bsp/tms570-sci-driver.h b/bsps/arm/tms570/include/bsp/tms570-sci-driver.h index 995e18ffbe..14ee762433 100644 --- a/bsps/arm/tms570/include/bsp/tms570-sci-driver.h +++ b/bsps/arm/tms570/include/bsp/tms570-sci-driver.h @@ -1,13 +1,15 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief Declaration of serial's driver inner structure. + * @brief This header file provides interfaces of the SCI support. */ /* - * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com> + * Copyright (C) 2014 Premysl Houdek <kom541000@gmail.com> * * Google Summer of Code 2014 at * Czech Technical University in Prague @@ -15,12 +17,26 @@ * 166 36 Praha 6 * Czech Republic * - * Based on LPC24xx and LPC1768 BSP - * by embedded brains GmbH and others + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef TMS570_SCI_DRIVER @@ -28,7 +44,7 @@ #include <rtems/termiostypes.h> #include <rtems/irq.h> -#include <bsp/tms570-sci.h> +#include <bsp/tms570.h> #ifdef __cplusplus extern "C" { diff --git a/bsps/arm/tms570/include/bsp/tms570-sci.h b/bsps/arm/tms570/include/bsp/tms570-sci.h deleted file mode 100644 index cc92a514cb..0000000000 --- a/bsps/arm/tms570/include/bsp/tms570-sci.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file - * - * @ingroup RTEMSBSPsARMTMS570 - * - * @brief Serial Communication Interface (SCI) header file. - */ - -/* - * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com> - * - * Google Summer of Code 2014 at - * Czech Technical University in Prague - * Zikova 1903/4 - * 166 36 Praha 6 - * Czech Republic - * - * Based on LPC24xx and LPC1768 BSP - * by embedded brains GmbH and others - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef LIBBSP_ARM_TMS570_SCI_H -#define LIBBSP_ARM_TMS570_SCI_H - -#include <libchip/serial.h> - -#include <rtems.h> -#include <stdint.h> -#include <bsp/tms570.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif diff --git a/bsps/arm/tms570/include/bsp/tms570-vim.h b/bsps/arm/tms570/include/bsp/tms570-vim.h deleted file mode 100644 index 9903d31960..0000000000 --- a/bsps/arm/tms570/include/bsp/tms570-vim.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file - * - * @ingroup RTEMSBSPsARMTMS570 - * - * @brief Vectored Interrupt Module (VIM) header file. - */ - -/* - * Copyright (c) 2014 Premysl Houdek <kom541000@gmail.com> - * - * Google Summer of Code 2014 at - * Czech Technical University in Prague - * Zikova 1903/4 - * 166 36 Praha 6 - * Czech Republic - * - * Based on LPC24xx and LPC1768 BSP - * by embedded brains GmbH and others - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef LIBBSP_ARM_TMS570_VIM_H -#define LIBBSP_ARM_TMS570_VIM_H - -#ifndef ASM -#include <rtems.h> -#include <stdint.h> -#include <bsp/tms570.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - - - -#endif - -/** @} */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* LIBBSP_ARM_TMS570_IRQ_H */ diff --git a/bsps/arm/tms570/include/bsp/tms570.h b/bsps/arm/tms570/include/bsp/tms570.h index f278a93606..b5b8a176c1 100644 --- a/bsps/arm/tms570/include/bsp/tms570.h +++ b/bsps/arm/tms570/include/bsp/tms570.h @@ -1,8 +1,19 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides TMS570 interfaces. + */ + /* This file is generated by make_central_header.py */ /* Current script's version can be found at: */ /* https://github.com/AoLaD/rtems-tms570-utils/tree/headers/headers/python */ /* + * Copyright (C) 2022 Airbus U.S. Space & Defense, Inc * Copyright (c) 2014-2015, Premysl Houdek <kom541000@gmail.com> * * Czech Technical University in Prague @@ -78,23 +89,31 @@ #include <bsp/ti_herc/reg_sys2.h> #include <bsp/ti_herc/reg_pcr.h> +#include <bspopts.h> + #define TMS570_ADC1 (*(volatile tms570_adc_t*)0xFFF7C000) #define TMS570_ADC2 (*(volatile tms570_adc_t*)0xFFF7C200) -#define TMS570_CCMSR (*(volatile tms570_ccmsr_t*)0XFFFFF600) +#define TMS570_CCMSR (*(volatile tms570_ccmsr_t*)0xFFFFF600) #define TMS570_CRC (*(volatile tms570_crc_t*)0xFE000000) +#if TMS570_VARIANT == 4357 +#define TMS570_CRC2 (*(volatile tms570_crc_t*)0xFB000000) +#endif #define TMS570_DCAN1 (*(volatile tms570_dcan_t*)0xFFF7DC00) #define TMS570_DCAN2 (*(volatile tms570_dcan_t*)0xFFF7DE00) #define TMS570_DCAN3 (*(volatile tms570_dcan_t*)0xFFF7E000) +#if TMS570_VARIANT == 4357 +#define TMS570_DCAN4 (*(volatile tms570_dcan_t*)0xFFF7E200) +#endif #define TMS570_DCC1 (*(volatile tms570_dcc_t*)0xFFFFEC00) #define TMS570_DCC2 (*(volatile tms570_dcc_t*)0xFFFFF400) #define TMS570_DMA (*(volatile tms570_dma_t*)0xFFFFF000) #define TMS570_DMM (*(volatile tms570_dmm_t*)0xFFFFF700) -#define TMS570_EFUSE (*(volatile tms570_efuse_t*)0XFFF8C01C) +#define TMS570_EFUSE (*(volatile tms570_efuse_t*)0xFFF8C01C) #define TMS570_EMACC (*(volatile tms570_emacc_t*)0xFCF78800) #define TMS570_EMACM (*(volatile tms570_emacm_t*)0xFCF78000) #define TMS570_EMIF (*(volatile tms570_emif_t*)0xFCFFE800) -#define TMS570_ESM (*(volatile tms570_esm_t*)0XFFFFF500) -#define TMS570_FLASH (*(volatile tms570_flash_t*)0XFFF87000) +#define TMS570_ESM (*(volatile tms570_esm_t*)0xFFFFF500) +#define TMS570_FLASH (*(volatile tms570_flash_t*)0xFFF87000) #define TMS570_FLEX_RAY (*(volatile tms570_flex_ray_t*)0xFFF7C800) #define TMS570_GIO (*(volatile tms570_gio_t*)0xFFF7BC00) #define TMS570_GIO_PORTA (*(volatile tms570_gio_port_t*)0xFFF7BC34) @@ -108,23 +127,36 @@ #define TMS570_HTU1 (*(volatile tms570_htu_t*)0xFFF7A400) #define TMS570_HTU2 (*(volatile tms570_htu_t*)0xFFF7A500) #define TMS570_I2C (*(volatile tms570_i2c_t*)0xFFF7D400) -#define TMS570_IOMM (*(volatile tms570_iomm_t*)0XFFFFEA00) -#define TMS570_PINMUX (*(volatile tms570_pinmux_t*)0xFFFFEB10) +#if TMS570_VARIANT == 4357 +#define TMS570_I2C2 (*(volatile tms570_i2c_t*)0xFFF7D500) +#endif +#if TMS570_VARIANT == 4357 +#define TMS570_IOMM (*(volatile tms570_iomm_t*)0xFFFF1C00) +#else +#define TMS570_IOMM (*(volatile tms570_iomm_t*)0xFFFFEA00) +#endif +#define TMS570_PINMUX ((volatile uint32_t*)TMS570_IOMM.PINMMR) #define TMS570_LIN (*(volatile tms570_lin_t*)0xFFF7E400) +#if TMS570_VARIANT == 4357 +#define TMS570_LIN2 (*(volatile tms570_lin_t*)0xFFF7E600) +#endif #define TMS570_MDIO (*(volatile tms570_mdio_t*)0xFCF78900) #define TMS570_NHET1 (*(volatile tms570_nhet_t*)0xFFF7B800) #define TMS570_NHET2 (*(volatile tms570_nhet_t*)0xFFF7B900) #define TMS570_PBIST (*(volatile tms570_pbist_t*)0xFFFFE400) -#define TMS570_PLL (*(volatile tms570_pll_t*)0XFFFFE100) +#define TMS570_PLL (*(volatile tms570_pll_t*)0xFFFFE100) #define TMS570_PMM (*(volatile tms570_pmm_t*)0xFFFF0000) #define TMS570_RTI (*(volatile tms570_rti_t*)0xFFFFFC00) #define TMS570_RTP (*(volatile tms570_rtp_t*)0xFFFFFA00) #define TMS570_SCI (*(volatile tms570_sci_t*)0xFFF7E500) +#if TMS570_VARIANT == 4357 +#define TMS570_SCI2 (*(volatile tms570_sci_t*)0xFFF7E700) +#endif #define TMS570_TCR (*(volatile tms570_tcr_t*)0xFFF7C800) #define TMS570_TCRAM1 (*(volatile tms570_tcram_t*)0xFFFFF800) #define TMS570_TCRAM2 (*(volatile tms570_tcram_t*)0xFFFFF900) -#define TMS570_VIM (*(volatile tms570_vim_t*)0XFFFFFDEC) -#define TMS570_POM (*(volatile tms570_pom_t*)0XFFA04000) +#define TMS570_VIM (*(volatile tms570_vim_t*)0xFFFFFDEC) +#define TMS570_POM (*(volatile tms570_pom_t*)0xFFA04000) #define TMS570_SPI1 (*(volatile tms570_spi_t*)0xFFF7F400) #define TMS570_SPI2 (*(volatile tms570_spi_t*)0xFFF7F600) #define TMS570_SPI3 (*(volatile tms570_spi_t*)0xFFF7F800) @@ -133,5 +165,11 @@ #define TMS570_STC (*(volatile tms570_stc_t*)0xFFFFE600) #define TMS570_SYS1 (*(volatile tms570_sys1_t*)0xFFFFFF00) #define TMS570_SYS2 (*(volatile tms570_sys2_t*)0xFFFFE100) -#define TMS570_PCR (*(volatile tms570_pcr_t*)0xFFFFE000) +#if TMS570_VARIANT == 4357 +#define TMS570_PCR1 (*(volatile tms570_pcr_t*)0xFFFF1000) +#define TMS570_PCR2 (*(volatile tms570_pcr_t*)0xFCFF1000) +#define TMS570_PCR3 (*(volatile tms570_pcr_t*)0xFFF78000) +#else +#define TMS570_PCR1 (*(volatile tms570_pcr_t*)0xFFFFE000) +#endif #endif /* LIBBSP_ARM_TMS570 */ diff --git a/bsps/arm/tms570/include/bsp/tms570_hwinit.h b/bsps/arm/tms570/include/bsp/tms570_hwinit.h index 2c84b6e5fa..2af2f3d48a 100644 --- a/bsps/arm/tms570/include/bsp/tms570_hwinit.h +++ b/bsps/arm/tms570/include/bsp/tms570_hwinit.h @@ -1,11 +1,64 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides interfaces of the hardware initialization + * support. + */ + +/* + * Copyright (C) 2022 Airbus U.S. Space & Defense, Inc + * Copyright (C) 2014 Premysl Houdek <kom541000@gmail.com> + * + * Google Summer of Code 2014 at + * Czech Technical University in Prague + * Zikova 1903/4 + * 166 36 Praha 6 + * Czech Republic + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + #ifndef LIBBSP_ARM_TMS570_HWINIT_H #define LIBBSP_ARM_TMS570_HWINIT_H -#define TMS570_TCRAM_START_PTR ( (void *) ( 0x08000000U ) ) -#define TMS570_TCRAM_WINDOW_END_PTR ( (void *) ( 0x08080000U ) ) +#include <bspopts.h> +#include <stdint.h> +#include <bsp/start.h> -#define TMS570_SDRAM_START_PTR ( (void *) ( 0x80000000U ) ) -#define TMS570_SDRAM_WINDOW_END_PTR ( (void *) ( 0xA0000000U ) ) +static inline bool tms570_running_from_tcram( void ) +{ + uintptr_t fncptr = (uintptr_t)bsp_start_hook_0; + return (fncptr - TMS570_MEMORY_SRAM_ORIGIN) < TMS570_MEMORY_SRAM_SIZE; +} + +static inline bool tms570_running_from_sdram( void ) +{ + uintptr_t fncptr = (uintptr_t)bsp_start_hook_0; + return (fncptr - TMS570_MEMORY_SDRAM_ORIGIN) < TMS570_MEMORY_SDRAM_SIZE; +} /* Ti TMS570 core setup implemented in assembly */ void _esmCcmErrorsClear_( void ); @@ -16,16 +69,40 @@ void _coreEnableRamEcc_( void ); void _coreDisableRamEcc_( void ); void _mpuInit_( void ); -void tms570_emif_sdram_init( void ); void tms570_memory_init( uint32_t ram ); -void tms570_system_hw_init( void ); -void tms570_pinmux_init( void ); -void tms570_pll_init( void ); void tms570_trim_lpo_init( void ); void tms570_flash_init( void ); void tms570_periph_init( void ); -void tms570_map_clock_init( void ); void tms570_system_hw_init( void ); void tms570_esm_init( void ); +/* + * The following functions that must be implemented on a per-board basis for + * any BSP variant with hardware initialization. These configure MCU + * peripherals that are specific to a particular board. + */ + +/** + * @brief Initialize the External Memory InterFace (EMIF) peripheral. + */ +void tms570_emif_sdram_init(void); + +/** + * @brief Initialize PLLs source divider/multipliers. + */ +void tms570_pll_init(void); + +/** + * @brief Initialize the tms570 Global Clock Manager (GCM) registers which + * sub-divide the input clock source (generally PLL) into the various + * peripheral clocks (VCLK1-3, etc). + */ +void tms570_map_clock_init(void); + +/** + * @brief Initialize the tms570 PINMUX peripheral. This maps signals to pin + * terminals. + */ +void tms570_pinmux_init(void); + #endif /* LIBBSP_ARM_TMS570_HWINIT_H */ diff --git a/bsps/arm/tms570/include/bsp/tms570_selftest.h b/bsps/arm/tms570/include/bsp/tms570_selftest.h index c7e01a36cd..fdad4de64c 100644 --- a/bsps/arm/tms570/include/bsp/tms570_selftest.h +++ b/bsps/arm/tms570/include/bsp/tms570_selftest.h @@ -1,26 +1,25 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief Definition of TMS570 selftest error codes, addresses and functions. + * @brief This header file provides TMS570 selftest error codes, addresses and + * functions. */ + /* - * Copyright (c) 2016 Pavel Pisa <pisa@cmp.felk.cvut.cz> + * Copyright (C) 2016 Pavel Pisa <pisa@cmp.felk.cvut.cz> * * Czech Technical University in Prague * Zikova 1903/4 * 166 36 Praha 6 * Czech Republic * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - * * Algorithms are based on Ti manuals and Ti HalCoGen generated * code available under following copyright. - */ -/* + * * Copyright (C) 2009-2015 Texas Instruments Incorporated - www.ti.com * * @@ -199,6 +198,8 @@ void tms570_pbist_fail( void ); void tms570_pbist_stop( void ); +void tms570_pbist_run_and_check( uint32_t raminfoL, uint32_t algomask ); + void tms570_enable_parity( void ); void tms570_disable_parity( void ); diff --git a/bsps/arm/tms570/include/bsp/tms570_selftest_parity.h b/bsps/arm/tms570/include/bsp/tms570_selftest_parity.h index 404a414beb..db95cdb041 100644 --- a/bsps/arm/tms570/include/bsp/tms570_selftest_parity.h +++ b/bsps/arm/tms570/include/bsp/tms570_selftest_parity.h @@ -1,21 +1,41 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief Check of module parity based protection logic to work. + * @brief This header file provides interfaces of the parity selftest support. */ + /* - * Copyright (c) 2016 Pavel Pisa <pisa@cmp.felk.cvut.cz> + * Copyright (C) 2016 Pavel Pisa <pisa@cmp.felk.cvut.cz> * * Czech Technical University in Prague * Zikova 1903/4 * 166 36 Praha 6 * Czech Republic * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef LIBBSP_ARM_TMS570_SELFTEST_PARITY_H @@ -81,13 +101,13 @@ extern const tms570_selftest_par_desc_t tms570_selftest_par_can3_desc; extern const tms570_selftest_par_desc_t tms570_selftest_par_vim_desc; -const tms570_selftest_par_desc_t +extern const tms570_selftest_par_desc_t tms570_selftest_par_dma_desc; -const tms570_selftest_par_desc_t +extern const tms570_selftest_par_desc_t tms570_selftest_par_spi1_desc; -const tms570_selftest_par_desc_t +extern const tms570_selftest_par_desc_t tms570_selftest_par_spi3_desc; -const tms570_selftest_par_desc_t +extern const tms570_selftest_par_desc_t tms570_selftest_par_spi5_desc; extern const tms570_selftest_par_desc_t *const diff --git a/bsps/arm/tms570/include/bsp/tms570lc4357-pins.h b/bsps/arm/tms570/include/bsp/tms570lc4357-pins.h index a7912d1547..a78c9222f2 100644 --- a/bsps/arm/tms570/include/bsp/tms570lc4357-pins.h +++ b/bsps/arm/tms570/include/bsp/tms570lc4357-pins.h @@ -1,22 +1,41 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief Specification of individual pins mapping to the package + * @brief This header file provides pin mappings for the TMS570LC4357. */ /* - * Copyright (c) 2015-2017 Pavel Pisa <pisa@cmp.felk.cvut.cz> + * Copyright (C) 2015-2017 Pavel Pisa <pisa@cmp.felk.cvut.cz> * * Czech Technical University in Prague * Zikova 1903/4 * 166 36 Praha 6 * Czech Republic * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef LIBBSP_ARM_TMS570_TMS570LC4357_PINS_H @@ -909,6 +928,11 @@ TMS570_PIN_AND_FNC(TMS570_BALL_B11, 5), \ TMS570_PIN_AND_FNC(TMS570_PIN_MMR_ALT_eQEP2S, 1)) +/// (TM) TODO: is this correct? LS3137ZWT uses TMS570_PIN_AND_FNC(TMS570_BALL_WITH_MMR(29, 3), 0) +/// Per the schematic, this pin (called MII_RX_DV / RX_DV) attaches to pad B11 and can select +/// between MII and RMII mode for the PHY. A pin like this is required for the lwip tms570 rtems port +#define TMS570_MMR_SELECT_GMII_SEL TMS570_BALL_B11_MII_RX_DV + #define TMS570_BALL_D8 TMS570_BALL_WITH_MMR(34, 3) #define TMS570_BALL_D8_HET2_01 TMS570_PIN_WITH_IN_ALT( \ TMS570_PIN_AND_FNC(TMS570_BALL_D8, 0), \ @@ -972,10 +996,14 @@ TMS570_PIN_AND_FNC(TMS570_PIN_MMR_ALT_HET2_07, 0)) #define TMS570_BALL_N3_MIBSPI2NCS_0 TMS570_PIN_AND_FNC(TMS570_BALL_N3, 4) +#define TMS570_MMR_SELECT_MII_MODE \ + TMS570_PIN_AND_FNC(TMS570_BALL_WITH_MMR(160, 3), TMS570_PIN_FNC_CLEAR) +#define TMS570_MMR_SELECT_RMII_MODE \ + TMS570_PIN_AND_FNC(TMS570_BALL_WITH_MMR(160, 3), 0) + /* Default pinmux select */ -#define TMS570_PINMMR_DEFAULT_INIT_LIST(per_pin_action, common_arg) \ - per_pin_action(common_arg, TMS570_BALL_N19_AD1EVT) \ +#define TMS570LC4357_PINMMR_DEFAULT_INIT_LIST(per_pin_action, common_arg) \ per_pin_action(common_arg, TMS570_BALL_D4_EMIF_ADDR_00) \ per_pin_action(common_arg, TMS570_BALL_D5_EMIF_ADDR_01) \ per_pin_action(common_arg, TMS570_BALL_C4_EMIF_ADDR_06) \ @@ -1003,30 +1031,30 @@ per_pin_action(common_arg, TMS570_BALL_R3_EMIF_nRAS) \ per_pin_action(common_arg, TMS570_BALL_P3_EMIF_nWAIT) \ per_pin_action(common_arg, TMS570_BALL_D17_EMIF_nWE) \ - per_pin_action(common_arg, TMS570_BALL_E9_ETMDATA_08) \ - per_pin_action(common_arg, TMS570_BALL_E8_ETMDATA_09) \ - per_pin_action(common_arg, TMS570_BALL_E7_ETMDATA_10) \ - per_pin_action(common_arg, TMS570_BALL_E6_ETMDATA_11) \ - per_pin_action(common_arg, TMS570_BALL_E13_ETMDATA_12) \ - per_pin_action(common_arg, TMS570_BALL_E12_ETMDATA_13) \ - per_pin_action(common_arg, TMS570_BALL_E11_ETMDATA_14) \ - per_pin_action(common_arg, TMS570_BALL_E10_ETMDATA_15) \ - per_pin_action(common_arg, TMS570_BALL_K15_ETMDATA_16) \ - per_pin_action(common_arg, TMS570_BALL_L15_ETMDATA_17) \ - per_pin_action(common_arg, TMS570_BALL_M15_ETMDATA_18) \ - per_pin_action(common_arg, TMS570_BALL_N15_ETMDATA_19) \ - per_pin_action(common_arg, TMS570_BALL_E5_ETMDATA_20) \ - per_pin_action(common_arg, TMS570_BALL_F5_ETMDATA_21) \ - per_pin_action(common_arg, TMS570_BALL_G5_ETMDATA_22) \ - per_pin_action(common_arg, TMS570_BALL_K5_ETMDATA_23) \ - per_pin_action(common_arg, TMS570_BALL_L5_ETMDATA_24) \ - per_pin_action(common_arg, TMS570_BALL_M5_ETMDATA_25) \ - per_pin_action(common_arg, TMS570_BALL_N5_ETMDATA_26) \ - per_pin_action(common_arg, TMS570_BALL_P5_ETMDATA_27) \ - per_pin_action(common_arg, TMS570_BALL_R5_ETMDATA_28) \ - per_pin_action(common_arg, TMS570_BALL_R6_ETMDATA_29) \ - per_pin_action(common_arg, TMS570_BALL_R7_ETMDATA_30) \ - per_pin_action(common_arg, TMS570_BALL_R8_ETMDATA_31) \ + per_pin_action(common_arg, TMS570_BALL_E9_EMIF_ADDR_05) \ + per_pin_action(common_arg, TMS570_BALL_E8_EMIF_ADDR_04) \ + per_pin_action(common_arg, TMS570_BALL_E7_EMIF_ADDR_03) \ + per_pin_action(common_arg, TMS570_BALL_E6_EMIF_ADDR_02) \ + per_pin_action(common_arg, TMS570_BALL_E13_EMIF_BA_0) \ + per_pin_action(common_arg, TMS570_BALL_E12_EMIF_nOE) \ + per_pin_action(common_arg, TMS570_BALL_E11_EMIF_nDQM_1) \ + per_pin_action(common_arg, TMS570_BALL_E10_EMIF_nDQM_0) \ + per_pin_action(common_arg, TMS570_BALL_K15_EMIF_DATA_00) \ + per_pin_action(common_arg, TMS570_BALL_L15_EMIF_DATA_01) \ + per_pin_action(common_arg, TMS570_BALL_M15_EMIF_DATA_02) \ + per_pin_action(common_arg, TMS570_BALL_N15_EMIF_DATA_03) \ + per_pin_action(common_arg, TMS570_BALL_E5_EMIF_DATA_04) \ + per_pin_action(common_arg, TMS570_BALL_F5_EMIF_DATA_05) \ + per_pin_action(common_arg, TMS570_BALL_G5_EMIF_DATA_06) \ + per_pin_action(common_arg, TMS570_BALL_K5_EMIF_DATA_07) \ + per_pin_action(common_arg, TMS570_BALL_L5_EMIF_DATA_08) \ + per_pin_action(common_arg, TMS570_BALL_M5_EMIF_DATA_09) \ + per_pin_action(common_arg, TMS570_BALL_N5_EMIF_DATA_10) \ + per_pin_action(common_arg, TMS570_BALL_P5_EMIF_DATA_11) \ + per_pin_action(common_arg, TMS570_BALL_R5_EMIF_DATA_12) \ + per_pin_action(common_arg, TMS570_BALL_R6_EMIF_DATA_13) \ + per_pin_action(common_arg, TMS570_BALL_R7_EMIF_DATA_14) \ + per_pin_action(common_arg, TMS570_BALL_R8_EMIF_DATA_15) \ per_pin_action(common_arg, TMS570_BALL_R9_ETMTRACECLKIN) \ per_pin_action(common_arg, TMS570_BALL_R10_ETMTRACECLKOUT) \ per_pin_action(common_arg, TMS570_BALL_R11_ETMTRACECTL) \ @@ -1108,7 +1136,27 @@ per_pin_action(common_arg, TMS570_BALL_U7_MII_TX_CLK) \ per_pin_action(common_arg, TMS570_BALL_E2_HET2_03) \ per_pin_action(common_arg, TMS570_BALL_N3_HET2_07) \ + per_pin_action(common_arg, TMS570_BALL_K3_EMIF_CLK) \ + per_pin_action(common_arg, TMS570_BALL_N19_MII_RX_ER) \ + per_pin_action(common_arg, TMS570_BALL_F3_MII_COL) \ + per_pin_action(common_arg, TMS570_BALL_E18_MII_TXD_3) \ + per_pin_action(common_arg, TMS570_BALL_R2_MII_TXD_2) \ + per_pin_action(common_arg, TMS570_BALL_J19_MII_TXD_1) \ + per_pin_action(common_arg, TMS570_BALL_J18_MII_TXD_0) \ + per_pin_action(common_arg, TMS570_BALL_H19_MII_TXEN) \ + per_pin_action(common_arg, TMS570_BALL_D19_MII_TX_CLK) \ + per_pin_action(common_arg, TMS570_BALL_B4_MII_CRS) \ + per_pin_action(common_arg, TMS570_BALL_K19_MII_RXCLK) \ + per_pin_action(common_arg, TMS570_BALL_H18_MII_RXD_3) \ + per_pin_action(common_arg, TMS570_BALL_G19_MII_RXD_2) \ + per_pin_action(common_arg, TMS570_BALL_A14_MII_RXD_1) \ + per_pin_action(common_arg, TMS570_BALL_P1_MII_RXD_0) \ + per_pin_action(common_arg, TMS570_BALL_B11_MII_RX_DV) \ + per_pin_action(common_arg, TMS570_BALL_G3_MDIO) \ + per_pin_action(common_arg, TMS570_BALL_V5_MDCLK) /* End of default PINMMR list */ +// Note EMIF Clock enable (EMIF_CKE) on Ball L3 has no alternate functions and is enabled by default + #endif /*LIBBSP_ARM_TMS570_TMS570LC4357_PINS_H*/ diff --git a/bsps/arm/tms570/include/bsp/tms570ls3137zwt-pins.h b/bsps/arm/tms570/include/bsp/tms570ls3137zwt-pins.h index 089f0d4248..2f1895569b 100644 --- a/bsps/arm/tms570/include/bsp/tms570ls3137zwt-pins.h +++ b/bsps/arm/tms570/include/bsp/tms570ls3137zwt-pins.h @@ -1,22 +1,41 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * * @ingroup RTEMSBSPsARMTMS570 * - * @brief Specification of individual pins mapping to the package + * @brief This header file provides pin mappings for the TMS570LS3137ZWT. */ /* - * Copyright (c) 2015 Pavel Pisa <pisa@cmp.felk.cvut.cz> + * Copyright (C) 2015 Pavel Pisa <pisa@cmp.felk.cvut.cz> * * Czech Technical University in Prague * Zikova 1903/4 * 166 36 Praha 6 * Czech Republic * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef LIBBSP_ARM_TMS570_TMS570LS3137ZWT_PINS_H @@ -555,7 +574,10 @@ #define TMS570_BALL_F2 TMS570_BALL_WITH_MMR(29, 2) #define TMS570_BALL_F2_GIOB_2 TMS570_PIN_AND_FNC(TMS570_BALL_F2, 0) -#define TMS570_MMR_SELECT_GMII_SEL TMS570_PIN_AND_FNC(TMS570_BALL_WITH_MMR(29, 3), 0) +#define TMS570_MMR_SELECT_MII_MODE \ + TMS570_PIN_AND_FNC(TMS570_BALL_WITH_MMR(29, 3), 0) +#define TMS570_MMR_SELECT_RMII_MODE \ + TMS570_PIN_AND_FNC(TMS570_BALL_WITH_MMR(29, 3), TMS570_PIN_FNC_CLEAR) #define TMS570_MMR_SELECT_ADC_TRG1 TMS570_PIN_AND_FNC(TMS570_BALL_WITH_MMR(30, 0), 0) #define TMS570_MMR_SELECT_ADC_TRG2 TMS570_PIN_AND_FNC(TMS570_BALL_WITH_MMR(30, 0), 1) diff --git a/bsps/arm/tms570/include/tm27.h b/bsps/arm/tms570/include/tm27.h index 0dfa7bf628..a8ca08a0dd 100644 --- a/bsps/arm/tms570/include/tm27.h +++ b/bsps/arm/tms570/include/tm27.h @@ -1 +1,128 @@ -#include <rtems/tm27-default.h> +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsARMTMS570 + * + * @brief This header file provides a TM27 support implementation. + */ + +/* + * Copyright (c) 2023 embedded brains GmbH & Co. KG + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTEMS_TMTEST27 +#error "This is an RTEMS internal file you must not include directly." +#endif + +#ifndef __tm27_h +#define __tm27_h + +#include <rtems.h> + +#include <bsp/irq.h> +#include <bsp/tms570.h> +#include <rtems/score/armv4.h> + +#define MUST_WAIT_FOR_INTERRUPT 1 + +#define TM27_INTERRUPT_VECTOR_DEFAULT TMS570_IRQ_TIMER_3 + +#define TM27_INTERRUPT_VECTOR_ALTERNATIVE TMS570_IRQ_TIMER_1 + +static inline void Install_tm27_vector( rtems_interrupt_handler handler ) +{ + static rtems_interrupt_entry entry_2; + static rtems_interrupt_entry entry_3; + + TMS570_RTI.CNT[1].CPUCx = 1; + TMS570_RTI.CNT[1].UCx = 0; + TMS570_RTI.CNT[1].FRCx = 0; + TMS570_RTI.CMP[1].COMPx = 1; + TMS570_RTI.CMP[1].UDCPx = 1; + TMS570_RTI.CMP[2].COMPx = 1; + TMS570_RTI.CMP[2].UDCPx = 1; + TMS570_RTI.CMP[3].COMPx = 1; + TMS570_RTI.CMP[3].UDCPx = 1; + TMS570_RTI.COMPCTRL |= TMS570_RTI_COMPCTRL_COMPSEL1 | + TMS570_RTI_COMPCTRL_COMPSEL2 | + TMS570_RTI_COMPCTRL_COMPSEL3; + TMS570_RTI.GCTRL |= TMS570_RTI_GCTRL_CNT1EN; + + rtems_interrupt_entry_initialize( + &entry_2, + handler, + NULL, + "tm27" + ); + (void) rtems_interrupt_entry_install( + TMS570_IRQ_TIMER_2, + RTEMS_INTERRUPT_SHARED, + &entry_2 + ); + + rtems_interrupt_entry_initialize( + &entry_3, + handler, + NULL, + "tm27" + ); + (void) rtems_interrupt_entry_install( + TMS570_IRQ_TIMER_3, + RTEMS_INTERRUPT_SHARED, + &entry_3 + ); +} + +static inline void Cause_tm27_intr(void) +{ + TMS570_RTI.SETINTENA = TMS570_RTI_SETINTENA_SETINT3; +} + +static inline void Clear_tm27_intr(void) +{ + TMS570_RTI.CLEARINTENA = TMS570_RTI_CLEARINTENA_CLEARINT2 | + TMS570_RTI_CLEARINTENA_CLEARINT3; +} + +static inline void Lower_tm27_intr(void) +{ + TMS570_RTI.SETINTENA = TMS570_RTI_SETINTENA_SETINT2; + (void) _ARMV4_Status_irq_enable(); +} + +static inline rtems_status_code _TM27_Raise_alternative(void) +{ + TMS570_RTI.SETINTENA = TMS570_RTI_SETINTENA_SETINT1; + return RTEMS_SUCCESSFUL; +} + +static inline rtems_status_code _TM27_Clear_alternative(void) +{ + TMS570_RTI.CLEARINTENA = TMS570_RTI_CLEARINTENA_CLEARINT1; + return RTEMS_SUCCESSFUL; +} + +#endif /* __tm27_h */ |