//########################################################################### // // FILE: sysctl.h // // TITLE: CM system control driver. // //########################################################################### // $Copyright: // Copyright (C) 2022 Texas Instruments Incorporated - http://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 SYSCTL_H #define SYSCTL_H //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // //! \addtogroup sysctl_api SysCtl //! \brief The System Control module is used for miscellaneous system //! configurations. //! @{ // //***************************************************************************** #include #include #include "inc/hw_memmap.h" #include "inc/hw_nmi.h" #include "inc/hw_sysctl.h" #include "inc/hw_types.h" #include "inc/hw_wwd.h" #include "debug.h" #include "cpu.h" //***************************************************************************** // // Defines for system control functions. Not intended for use by application // code. // //***************************************************************************** // // Shifted pattern for WDCR register's WDCHK field. // #define SYSCTL_WD_CHKBITS 0x0028U // // Keys for WDKEY field. The first enables resets and the second resets. // #define SYSCTL_WD_ENRSTKEY 0x0055U #define SYSCTL_WD_RSTKEY 0x00AAU // // Values to help decode peripheral parameter // #define SYSCTL_PERIPH_REG_M 0x001FU #define SYSCTL_PERIPH_REG_S 0x0000U #define SYSCTL_PERIPH_BIT_M 0x1F00U #define SYSCTL_PERIPH_BIT_S 0x0008U // //Keys for the NMI registers write protection // #define SYSCTL_CMNMIFLGCLR_KEY 0x5674U #define SYSCTL_CMNMIFLGFRC_KEY 0x2732U #define SYSCTL_CMNMICFG_KEY 0x6789U #define SYSCTL_CMNMIWDPRD_KEY 0x9238U // //Keys for the CPU Sysctrl registers write protection // #define SYSCTL_CMSYSCTL_KEY 0x5634U // //Keys for the WD registers write protection // #define SYSCTL_WWD_KEY 0x1234U // //Enable / disable the ETHERCAT I2C Loopback // #define SYSCTL_ETHERCAT_I2C_LOOPBACK 0x1U // //Enable / disable the Global NMI // #define SYSCTL_NMI_GLOBAL 0x1U //***************************************************************************** // // Values that can be passed to SysCtl_clearNMIStatus(), // SysCtl_forceNMIFlags(), SysCtl_isNMIFlagSet(), and // SysCtl_isNMIShadowFlagSet() as the nmiFlags parameter and returned by // SysCtl_getNMIFlagStatus() and SysCtl_getNMIShadowFlagStatus(). // //***************************************************************************** #define SYSCTL_NMI_NMIINT 0x0001U //!< Non-maskable interrupt #define SYSCTL_NMI_CLOCKFAIL 0x0002U //!< Clock Failure #define SYSCTL_NMI_MEMUNCERR 0x0004U //!< RAM/ROM Uncorrectable error #define SYSCTL_NMI_FLUNCERR 0x0008U //!< Uncorrectable Flash error #define SYSCTL_NMI_MCANUNCERR 0x0010U //!< MCAN Uncorrectable Error #define SYSCTL_NMI_WWDNMI 0x0020U //!< CM Windowed Watchdog #define SYSCTL_NMI_ECATNMI 0x0040U //!< EtherCAT reset out //***************************************************************************** // // The following are values that can be passed to the SysCtl_clearResetCause() // API as rstCauses or returned by the SysCtl_getResetCause() API. // //***************************************************************************** #define SYSCTL_CAUSE_PORESETN 0x00000001U //!< Power-on reset #define SYSCTL_CAUSE_XRSN 0x00000002U //!< External reset pin #define SYSCTL_CAUSE_CPU1WDRSN 0x00000004U //!< CPU1 Watchdog reset #define SYSCTL_CAUSE_CPU1NMIWDRSN 0x00000008U //!< CPU1 NMI WD reset #define SYSCTL_CAUSE_CPU1SYSRSN 0x00000010U //!< CPU1 System reset #define SYSCTL_CAUSE_CPU1SCCRESETN 0x00000020U //!< CPU1 SCCRESETn reset #define SYSCTL_CAUSE_ECAT_RESET_OUT 0x00000040U //!< ECAT Reset #define SYSCTL_CAUSE_CPU1SIMRESET_CPURSN 0x00000080U //!< SIMRESET_CPURSn-CPU1 #define SYSCTL_CAUSE_CMRSTCTLRESETREQ 0x00000100U //!< Reset req from CM #define SYSCTL_CAUSE_CMVECTRESETN 0x00010000U //!< CM Vector Reset #define SYSCTL_CAUSE_CMSYSRESETREQ 0x00020000U //!< CM System reset #define SYSCTL_CAUSE_CMNMIWDRSTN 0x00040000U //!< CM NMI WD Reset #define SYSCTL_CAUSE_CMEOLRESETN 0x00080000U //!< CM Execute Override //!< Logic reset //***************************************************************************** // // The following are values that can be passed to the // SysCtl_lockAccessControlRegs() API as access protection of // which control Registers. // //***************************************************************************** #define SYSCTL_CMECATCTL_LOCK 0x1U //!