/******************************************************************************* * FILE NAME: cputimer.c * * * PURPOSE: This file contains cputimer driver functions * * FILE REFERENCES: * * * * Name I/O Description * * -----------------------------------------------------------------------------* * * * EXTERNAL VARIABLES: * * Source: < > * * * * Name Type I/O Description * * -----------------------------------------------------------------------------* * * * EXTERNAL REFERENCES: * * * * Name Description * * -----------------------------------------------------------------------------* * * * Error handling : * * * * -----------------------------------------------------------------------------* * * * ASSUMPTIONS, CONSTRAINTS, RESTRICTIONS: * * * * NOTES: * * * * REQUIREMENTS/FUNCTIONAL SPECIFICATIONS REFERENCES: * * ---- ------------------------------------------------------------------------* * * * DEVELOPMENT/CHANGE HISTORY * * -------------------------- * refer:- CR16010012 for more details * * * Date Author Change Id Release Description Of Change * * ----------- ------- ---------- -------- -----------------------------* * Apr 12, 2024 mj60574 * * * *******************************************************************************/ /******************************************************************************* * FILE NAME: cputimer.h * * * * * PURPOSE: Header file for cputimer.c * * * GLOBAL VARIABLES: * * * * Variable Type Description * * -----------------------------------------------------------------------------* * * * * * DEVELOPMENT / CHANGE HISTORY: * * * * Date Author Change Id Release Description Of Change * * ------------- ------- ---------- ------- -----------------------------* * 16-04-2024 mj60574 * * * * * * * * * * * *******************************************************************************/ /******************************************************************************* * FILE NAME: hw_memmap.h * * * * * PURPOSE: * * * GLOBAL VARIABLES: * * * * Variable Type Description * * -----------------------------------------------------------------------------* * * * * * DEVELOPMENT / CHANGE HISTORY: * * * * Date Author Change Id Release Description Of Change * * ------------- ------- ---------- ------- -----------------------------* * 16-04-2024 mj60574 * * * * * * * * * * * *******************************************************************************/ /***************************************************************************** The following are defines for the base address of the memories and peripherals. *****************************************************************************/ /******************************************************************************* * FILE NAME: hw_types.h * * * * * PURPOSE: * * * GLOBAL VARIABLES: * * * * Variable Type Description * * -----------------------------------------------------------------------------* * * * * * DEVELOPMENT / CHANGE HISTORY: * * * * Date Author Change Id Release Description Of Change * * ------------- ------- ---------- ------- -----------------------------* * 16-04-2024 mj60574 * * * * * * * * * * * *******************************************************************************/ /*************************************************************************** * FILE NAME: User_types.h * * * PURPOSE:In this file we typedef the datatypes to use accross all the file according to C coding standard * * * GLOBAL VARIABLES: Not Added * * * Variable Type Description * * -----------------------------------------------------------------------------* * * * * * DEVELOPMENT / CHANGE HISTORY: * * * * Date Author Change Id Release Description Of Change * * ---- ------ --------- ------- --------------------------------------------* * * mj60574 * * * * * * * * * * * * *******************************************************************************/ typedef signed char SC_16; typedef unsigned char UC_16; typedef unsigned int UI_16; typedef unsigned long int UI_32; typedef unsigned long long int UI_64; typedef signed int SI_16; typedef signed long int SI_32; typedef signed long long int SI_64; typedef float FL_32; typedef long double FL_64; typedef volatile unsigned int V_UI_16; typedef volatile unsigned long int V_UI_32; typedef volatile unsigned long long int V_UI_64; /***************************************************************************** Macros for hardware access *****************************************************************************/ /***************************************************************************** SUCCESS and FAILURE for API return value *****************************************************************************/ /**************************************************************************** For checking NULL pointers ****************************************************************************/ /***************************************************************************** 32-bit & 64-bit float type *****************************************************************************/ /***************************************************************************** Emulated Bitbanded write *****************************************************************************/ /***************************************************************************** Emulated Bitbanded read *****************************************************************************/ /***************************************************************************** Extern compiler intrinsic prototypes. See compiler User's Guide for details. These are provided to satisfy static analysis tools. The #ifndef is required because the '&' is for a C++-style reference, and although it is the correct prototype, it will not build in C code. *****************************************************************************/ /**************************************************************************** * FILE NAME: hw_cputimer.h * * * * * PURPOSE: Header file for cputimer.c * * * GLOBAL VARIABLES: * * * * Variable Type Description * * ---------------------------------------------------------------------------* * * * * * DEVELOPMENT / CHANGE HISTORY: * * * * Date Author Change Id Release Description Of Change * * ------------ ------- ---------- ------- ----------------------------* * 16-04-2024 mj60574 * * * * * * * * * * * ****************************************************************************/ /*************************************************************************** The following are defines for the CPUTIMER register offsets ***************************************************************************/ /************************************************************************** The following are defines for the bit fields in the TIM register ***************************************************************************/ /**************************************************************************** The following are defines for the bit fields in the PRD register ****************************************************************************/ /**************************************************************************** The following are defines for the bit fields in the TCR register *****************************************************************************/ /*********************************************************************** The following are defines for the bit fields in the TPR register *********************************************************************/ /********************************************************************* The following are defines for the bit fields in the TPRH register **********************************************************************/ /******************************************************************************* * FILE NAME: debug.h * * * * * PURPOSE: * * * GLOBAL VARIABLES: * * * * Variable Type Description * * -----------------------------------------------------------------------------* * * * * * DEVELOPMENT / CHANGE HISTORY: * * ---------------------------- * refer:-CR16010012 for more details * * * * Date Author Change Id Release Description Of Change * * ------------- ------- ---------- ------- -----------------------------* * 16-04-2024 mj60574 * * * * * * * * * * * *******************************************************************************/ /***************************************************************************** Prototype for the function that is called when an invalid argument is passed to an API. This is only used when doing a DEBUG build. It is the application's responsibility to define the __error__ function. *****************************************************************************/ extern void __error__(const char *filename, UI_32 line); /***************************************************************************** The ASSERT macro, which does the actual assertion checking. Typically, this will be for procedure arguments. *****************************************************************************/ /* When called from C28x application*/ /******************************************************************************* * FILE NAME: sysctl.h * * * * * PURPOSE: Header file for sysctl.c * * * GLOBAL VARIABLES: * * * * Variable Type Description * * -----------------------------------------------------------------------------* * * * * * DEVELOPMENT / CHANGE HISTORY: * * * * Date Author Change Id Release Description Of Change * * ------------- ------- ---------- ------- -----------------------------* * 16-04-2024 mj60574 * * * * * * * * * * * *******************************************************************************/ /***************************************************************************** If building with a C++ compiler, make all of the definitions in this header have a C binding ******************************************************************************/ /******************************************************************************* * FILE NAME: hw_sysctl.h * * * * * PURPOSE: * * * GLOBAL VARIABLES: * * * * Variable Type Description * * -----------------------------------------------------------------------------* * * * * * DEVELOPMENT / CHANGE HISTORY: * * * * Date Author Change Id Release Description Of Change * * ------------- ------- ---------- ------- -----------------------------* * 16-04-2024 mj60574 * * * * * * * * * * * *******************************************************************************/ /******************************************************************************* The following are defines for the SYSCTL register offsets *******************************************************************************/ /* Lock bit for CPUSELx registers */ /* Lower 32-bit of Device PART Identification Number */ /* Upper 32-bit of Device PART Identification Number */ /* Device Revision Number */ /* Device Capability: Device Information */ /* Device Capability: Processing Block Customization */ /* Device Capability: EMIF Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Peripheral Customization */ /* Device Capability: Analog Modules Customization */ /* Device Capability: Analog Modules Customization */ /* Device Capability: Analog Modules Customization */ /* Device Capability: CPU1 Lx SRAM Customization */ /* Device Capability: CPU2 Lx SRAM Customization */ /* Device Capability: GSx SRAM Customization */ /* Peripheral Configuration register */ /* e-Fuse error Status register */ /* Processing Block Software Reset register */ /* EMIF Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* Peripheral Software Reset register */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU Select register for common peripherals */ /* CPU2 Reset Control Register */ /* Reset Status register for secondary C28x CPUs */ /* LPM Status Register for secondary C28x CPUs */ /* System Debug Control register */ /* Clock Control Semaphore Register */ /* Lock bit for CLKCFG registers */ /* Clock Source Control register-1 */ /* Clock Source Control register-2 */ /* Clock Source Control register-3 */ /* SYSPLL Control register-1 */ /* SYSPLL Multiplier register */ /* SYSPLL Status register */ /* AUXPLL Control register-1 */ /* AUXPLL Multiplier register */ /* AUXPLL Status register */ /* System Clock Divider Select register */ /* Auxillary Clock Divider Select register */ /* Peripheral Clock Divider Selet register */ /* XCLKOUT Divider Select register */ /* Low Speed Clock Source Prescalar */ /* Missing Clock Detect Control Register */ /* 10-bit Counter on X1 Clock */ /* Lock bit for CPUSYS registers */ /* HIB Boot Mode Register */ /* IORestore() routine Address Register */ /* PIE Vector Fetch Error Address register */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Peripheral Clock Gating Registers */ /* Secondary Master Select register for common */ /* peripherals: Selects between CLA & DMA */ /* LPM Control Register */ /* Timer2 Clock Measurement functionality control register */ /******************************************************************************* * * The following are defines for the bit fields in the DEVCFGLOCK1 register * *******************************************************************************/ /* Lock bit for CPUSEL12 register */ /* Lock bit for CPUSEL13 register */ /* Lock bit for CPUSEL14 register */ /******************************************************************************* * * The following are defines for the bit fields in the PARTIDL register * *******************************************************************************/ /* Qualification Status */ /* Device Pin Count */ /* Motorware feature set */ /* Flash size in KB */ /* Revision of the PARTID format */ /******************************************************************************* * * The following are defines for the bit fields in the DC8 register * *******************************************************************************/ /******************************************************************************* * * The following are defines for the bit fields in the DC9 register * *******************************************************************************/ /******************************************************************************* * * The following are defines for the bit fields in the FUSEERR register * *******************************************************************************/ /******************************************************************************* * * The following are defines for the bit fields in the SOFTPRES7 register * *******************************************************************************/ /****************************************************************************** * * The following are defines for the bit fields in the SOFTPRES8 register * *******************************************************************************/ /******************************************************************************* * * The following are defines for the bit fields in the CPUSEL5 register * *******************************************************************************/ /******************************************************************************* * * The following are defines for the bit fields in the CPUSEL6 register * *******************************************************************************/ /******************************************************************************* * * The following are defines for the bit fields in the SYSDBGCTL register * *******************************************************************************/ /* Used in PLL startup. Only reset by POR*/ /******************************************************************************* * * The following are defines for the bit fields in the CLKSRCCTL1 register * *******************************************************************************/ /* OSCCLK Source Select Bit */ /* Internal Oscillator 2 Off Bit */ /* Crystal (External) Oscillator Off Bit */ /* Watchdog HALT Mode Ignore Bit */ /******************************************************************************* * * The following are defines for the bit fields in the CLKSRCCTL2 register * *******************************************************************************/ /* AUXOSCCLK Source Select Bit */ /******************************************************************************* * * The following are defines for the bit fields in the CLKSRCCTL3 register * *******************************************************************************/ /****************************************************************************** The following are defines for the bit fields in the SYSPLLCTL1 register *******************************************************************************/ /* SYSPLL bypassed or included in the PLLSYSCLK path */ /****************************************************************************** The following are defines for the bit fields in the SYSPLLMULT register *******************************************************************************/ /****************************************************************************** The following are defines for the bit fields in the SYSPLLSTS register *******************************************************************************/ /****************************************************************************** The following are defines for the bit fields in the AUXPLLCTL1 register *******************************************************************************/ /* AUXPLL bypassed or included in the AUXPLLCLK path */ /******************************************************************************* The following are defines for the bit fields in the AUXPLLMULT register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the AUXPLLSTS register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the SYSCLKDIVSEL register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the AUXCLKDIVSEL register *******************************************************************************/ /****************************************************************************** The following are defines for the bit fields in the XCLKOUTDIVSEL register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the LOSPCP register *******************************************************************************/ /***************************************************************************** The following are defines for the bit fields in the MCDCR register *******************************************************************************/ /****************************************************************************** The following are defines for the bit fields in the X1CNT register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the CPUSYSLOCK1 register *******************************************************************************/ /* Lock bit for HIBBOOTMODE register */ /* Lock bit for IORESTOREADDR Register */ /* Lock bit for PIEVERRADDR Register */ /* Lock bit for PCLKCR0 Register */ /* Lock bit for PCLKCR1 Register */ /* Lock bit for PCLKCR2 Register */ /* Lock bit for PCLKCR3 Register */ /* Lock bit for PCLKCR4 Register */ /* Lock bit for PCLKCR5 Register */ /* Lock bit for PCLKCR6 Register */ /* Lock bit for PCLKCR7 Register */ /* Lock bit for PCLKCR8 Register */ /* Lock bit for PCLKCR9 Register */ /* Lock bit for PCLKCR10 Register */ /* Lock bit for PCLKCR11 Register */ /* Lock bit for PCLKCR12 Register */ /* Lock bit for PCLKCR13 Register */ /* Lock bit for PCLKCR14 Register */ /* Lock bit for PCLKCR15 Register */ /* Lock bit for PCLKCR16 Register */ /* Lock bit for SECMSEL Register */ /* Lock bit for LPMCR Register */ /* Lock bit for GPIOLPMSEL0 Register */ /* Lock bit for GPIOLPMSEL1 Register */ /******************************************************************************* The following are defines for the bit fields in the IORESTOREADDR register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the PIEVERRADDR register *******************************************************************************/ /* PIE Vector Fetch Error Handler Routine Address */ /******************************************************************************* The following are defines for the bit fields in the PCLKCR4 register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the PCLKCR6 register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the PCLKCR7 register *******************************************************************************/ /****************************************************************************** The following are defines for the bit fields in the PCLKCR8 register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the SECMSEL register *******************************************************************************/ /* Secondary Master Select for VBUS32_1 Bridge */ /* Secondary Master Select for VBUS32_2 Bridge */ /******************************************************************************* The following are defines for the bit fields in the LPMCR register *******************************************************************************/ /* STANDBY Wakeup Pin Qualification Setting */ /* Enable for WDINT wakeup from STANDBY */ /* Configuration for M0 and M1 mode during HIB */ /******************************************************************************* The following are defines for the bit fields in the GPIOLPMSEL0 register *******************************************************************************/ /* GPIO0 Enable for LPM Wakeup */ /* GPIO1 Enable for LPM Wakeup */ /* GPIO2 Enable for LPM Wakeup */ /* GPIO3 Enable for LPM Wakeup */ /* GPIO4 Enable for LPM Wakeup */ /* GPIO5 Enable for LPM Wakeup */ /* GPIO6 Enable for LPM Wakeup */ /* GPIO7 Enable for LPM Wakeup */ /* GPIO8 Enable for LPM Wakeup */ /* GPIO9 Enable for LPM Wakeup */ /* GPIO10 Enable for LPM Wakeup */ /* GPIO11 Enable for LPM Wakeup */ /* GPIO12 Enable for LPM Wakeup */ /* GPIO13 Enable for LPM Wakeup */ /* GPIO14 Enable for LPM Wakeup */ /* GPIO15 Enable for LPM Wakeup */ /* GPIO16 Enable for LPM Wakeup */ /* GPIO17 Enable for LPM Wakeup */ /* GPIO18 Enable for LPM Wakeup */ /* GPIO19 Enable for LPM Wakeup */ /* GPIO20 Enable for LPM Wakeup */ /* GPIO21 Enable for LPM Wakeup */ /* GPIO22 Enable for LPM Wakeup */ /* GPIO23 Enable for LPM Wakeup */ /* GPIO24 Enable for LPM Wakeup */ /* GPIO25 Enable for LPM Wakeup */ /* GPIO26 Enable for LPM Wakeup */ /* GPIO27 Enable for LPM Wakeup */ /* GPIO28 Enable for LPM Wakeup */ /* GPIO29 Enable for LPM Wakeup */ /* GPIO30 Enable for LPM Wakeup */ /* GPIO31 Enable for LPM Wakeup */ /******************************************************************************* The following are defines for the bit fields in the GPIOLPMSEL1 register *******************************************************************************/ /* GPIO32 Enable for LPM Wakeup */ /* GPIO33 Enable for LPM Wakeup */ /* GPIO34 Enable for LPM Wakeup */ /* GPIO35 Enable for LPM Wakeup */ /* GPIO36 Enable for LPM Wakeup */ /* GPIO37 Enable for LPM Wakeup */ /* GPIO38 Enable for LPM Wakeup */ /* GPIO39 Enable for LPM Wakeup */ /* GPIO40 Enable for LPM Wakeup */ /* GPIO41 Enable for LPM Wakeup */ /* GPIO42 Enable for LPM Wakeup */ /* GPIO43 Enable for LPM Wakeup */ /* GPIO44 Enable for LPM Wakeup */ /* GPIO45 Enable for LPM Wakeup */ /* GPIO46 Enable for LPM Wakeup */ /* GPIO47 Enable for LPM Wakeup */ /* GPIO48 Enable for LPM Wakeup */ /* GPIO49 Enable for LPM Wakeup */ /* GPIO50 Enable for LPM Wakeup */ /* GPIO51 Enable for LPM Wakeup */ /* GPIO52 Enable for LPM Wakeup */ /* GPIO53 Enable for LPM Wakeup */ /* GPIO54 Enable for LPM Wakeup */ /* GPIO55 Enable for LPM Wakeup */ /* GPIO56 Enable for LPM Wakeup */ /* GPIO57 Enable for LPM Wakeup */ /* GPIO58 Enable for LPM Wakeup */ /* GPIO59 Enable for LPM Wakeup */ /* GPIO60 Enable for LPM Wakeup */ /* GPIO61 Enable for LPM Wakeup */ /* GPIO62 Enable for LPM Wakeup */ /* GPIO63 Enable for LPM Wakeup */ /******************************************************************************* The following are defines for the bit fields in the TMR2CLKCTL register ******************************************************************************/ /* CPU Timer 2 Clock Source Select Bit*/ /* CPU Timer 2 Clock Pre-Scale Value*/ /******************************************************************************* The following are defines for the bit fields in the RESC register *******************************************************************************/ /* POR Reset Cause Indication Bit*/ /* XRSn Reset Cause Indication Bit*/ /* WDRSn Reset Cause Indication Bit*/ /* NMIWDRSn Reset Cause Indication Bit*/ /* HWBISTn Reset Cause Indication Bit*/ /* HIBRESETn Reset Cause Indication Bit*/ /* SCCRESETn Reset Cause Indication Bit*/ /******************************************************************************* The following are defines for the bit fields in the SCSR register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the WDCNTR register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the WDKEY register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the WDCR register *******************************************************************************/ /******************************************************************************* The following are defines for the bit fields in the WDWCR register *******************************************************************************/ /* WD Min Threshold setting for Windowed Watchdog*/ /* functionality*/ /******************************************************************************* The following are defines for the bit fields in the SYNCSOCLOCK register *******************************************************************************/ /* SYNCSEL Register Lock bit */ /* ADCSOCOUTSELECT Register Lock bit*/ /******************************************************************************* * FILE NAME: cpu.h * * * * * PURPOSE: * * * GLOBAL VARIABLES: * * * * Variable Type Description * * -----------------------------------------------------------------------------* * * * * * DEVELOPMENT / CHANGE HISTORY: * * * * Date Author Change Id Release Description Of Change * * ------------- ------- ---------- ------- -----------------------------* * 16-04-2024 mj60574 * * * * * * * * * * * *******************************************************************************/ /***************************************************************************** If building with a C++ compiler, make all of the definitions in this header have a C binding. *****************************************************************************/ /*****************************************************************************/ /* STDINT.H */ /* */ /* Copyright (c) 2002 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. */ /* */ /*****************************************************************************/ /*****************************************************************************/ /* _ti_config.h */ /* */ /* Copyright (c) 2017 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. */ /* */ /*****************************************************************************/ /*Unsupported pragmas are omitted */ # pragma diag_push # pragma CHECK_MISRA("-19.7") # pragma CHECK_MISRA("-19.4") # pragma CHECK_MISRA("-19.1") # pragma CHECK_MISRA("-19.15") # pragma diag_pop _Pragma("diag_push") _Pragma("CHECK_MISRA(\"-19.4\")") _Pragma("CHECK_MISRA(\"-19.1\")") _Pragma("CHECK_MISRA(\"-19.6\")") /* Hide uses of the TI proprietary macros behind other macros. Implementations that don't implement these features should leave these macros undefined. */ /* Common definitions */ /* C */ /* C89/C99 */ /* _TI_NOEXCEPT_CPP14 is defined to noexcept only when compiling for C++14. It is intended to be used for functions like abort and atexit that are supposed to be declared noexcept only in C++14 mode. */ /* Target-specific definitions */ /*****************************************************************************/ /* linkage.h */ /* */ /* Copyright (c) 1998 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. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-19.4") /* macros required for implementation */ /* No modifiers needed to access code */ /*--------------------------------------------------------------------------*/ /* Define _DATA_ACCESS ==> how to access RTS global or static data */ /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ /* Define _OPTIMIZE_FOR_SPACE ==> Always optimize for space. */ /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ /* Define _IDECL ==> how inline functions are declared */ /*--------------------------------------------------------------------------*/ #pragma diag_pop _Pragma("diag_pop") _Pragma("diag_push") _Pragma("CHECK_MISRA(\"-19.1\")") /* no code before #include */ _Pragma("CHECK_MISRA(\"-19.7\")") /* prefer functions to macros */ /*****************************************************************************/ /* _STDINT40.H */ /* */ /* Copyright (c) 2018 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. */ /* */ /*****************************************************************************/ _Pragma("diag_push") _Pragma("CHECK_MISRA(\"-19.7\")") /* prefer functions to macros */ /* According to footnotes in the 1999 C standard, "C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined before is included." */ _Pragma("diag_pop") /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * 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 AUTHOR 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 AUTHOR 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. * * $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Berkeley Software Design, Inc. * * 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. * 3. Neither the name of the University 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 REGENTS 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 REGENTS 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. * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 * $FreeBSD$ */ _Pragma("diag_push") _Pragma("CHECK_MISRA(\"none\")") /* * Testing against Clang-specific extensions. */ /* * This code has been put in place to help reduce the addition of * compiler specific defines in FreeBSD code. It helps to aid in * having a compiler-agnostic source tree. */ /* * Macro to test if we're using a specific version of gcc or later. */ /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI * mode -- there must be no spaces between its arguments, and for nested * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also * concatenate double-quoted strings produced by the __STRING macro, but * this only works with ANSI C. * * __XSTRING is like __STRING, but it expands any macros in its argument * first. It is only available with ANSI C. */ /* * Compiler-dependent macros to help declare dead (non-returning) and * pure (no side effects) functions, and unused variables. They are * null except for versions of gcc that are known to support the features * properly (old versions of gcc-2 supported the dead and pure features * in a different (wrong) way). If we do not provide an implementation * for a given compiler, let the compile fail if it is told to use * a feature that we cannot live without. */ /* * TI ADD - check that __GNUC__ is defined before referencing it to avoid * generating an error when __GNUC__ treated as zero warning is * promoted to an error via -pdse195 option. */ /* * Keywords added in C11. */ /* * No native support for _Atomic(). Place object in structure to prevent * most forms of direct non-atomic access. */ /* * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode * without actually supporting the thread_local keyword. Don't check for * the presence of C++11 when defining _Thread_local. */ /* * Emulation of C11 _Generic(). Unlike the previously defined C11 * keywords, it is not possible to implement this using exactly the same * syntax. Therefore implement something similar under the name * __generic(). Unlike _Generic(), this macro can only distinguish * between a single type, so it requires nested invocations to * distinguish multiple cases. */ /* * C99 Static array indices in function parameter declarations. Syntax such as: * void bar(int myArray[static 10]); * is allowed in C99 but not in C++. Define __min_size appropriately so * headers using it can be compiled in either language. Use like this: * void bar(int myArray[__min_size(10)]); */ /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ /* C++11 exposes a load of C99 stuff */ /* * GCC 2.95 provides `__restrict' as an extension to C90 to support the * C99-specific `restrict' type qualifier. We happen to use `__restrict' as * a way to define the `restrict' type qualifier without disturbing older * software that is unaware of C99 keywords. * The TI compiler supports __restrict in all compilation modes. */ /* * GNU C version 2.96 adds explicit branch prediction so that * the CPU back-end can hint the processor and also so that * code blocks can be reordered such that the predicted path * sees a more linear flow, thus improving cache behavior, etc. * * The following two macros provide us with a way to utilize this * compiler feature. Use __predict_true() if you expect the expression * to evaluate to true, and __predict_false() if you expect the * expression to evaluate to false. * * A few notes about usage: * * * Generally, __predict_false() error condition checks (unless * you have some _strong_ reason to do otherwise, in which case * document it), and/or __predict_true() `no-error' condition * checks, assuming you want to optimize for the no-error case. * * * Other than that, if you don't know the likelihood of a test * succeeding from empirical or other `hard' evidence, don't * make predictions. * * * These are meant to be used in places that are run `a lot'. * It is wasteful to make predictions in code that is run * seldomly (e.g. at subsystem initialization time) as the * basic block reordering that this affects can often generate * larger code. */ /* * We define this here since , , and * require it. */ /* * Given the pointer x to the member m of the struct s, return * a pointer to the containing structure. When using GCC, we first * assign pointer x to a local variable, to check that its type is * compatible with member m. */ /* * Compiler-dependent macros to declare that functions take printf-like * or scanf-like arguments. They are null except for versions of gcc * that are known to support the features properly (old versions of gcc-2 * didn't permit keeping the keywords out of the application namespace). */ /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ /* * The following definition might not work well if used in header files, * but it should be better than nothing. If you want a "do nothing" * version, then it should generate some harmless declaration, such as: * #define __IDSTRING(name,string) struct __hack */ /* * Embed the rcs id of a source file in the resulting library. Note that in * more recent ELF binutils, we use .ident allowing the ID to be stripped. * Usage: * __FBSDID("$FreeBSD$"); */ /*- * The following definitions are an extension of the behavior originally * implemented in , but with a different level of granularity. * POSIX.1 requires that the macros we test be defined before any standard * header file is included. * * Here's a quick run-down of the versions: * defined(_POSIX_SOURCE) 1003.1-1988 * _POSIX_C_SOURCE == 1 1003.1-1990 * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option * _POSIX_C_SOURCE == 199309 1003.1b-1993 * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, * and the omnibus ISO/IEC 9945-1: 1996 * _POSIX_C_SOURCE == 200112 1003.1-2001 * _POSIX_C_SOURCE == 200809 1003.1-2008 * * In addition, the X/Open Portability Guide, which is now the Single UNIX * Specification, defines a feature-test macro which indicates the version of * that specification, and which subsumes _POSIX_C_SOURCE. * * Our macros begin with two underscores to avoid namespace screwage. */ /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ /* Deal with various X/Open Portability Guides and Single UNIX Spec. */ /* * Deal with all versions of POSIX. The ordering relative to the tests above is * important. */ /*- * Deal with _ANSI_SOURCE: * If it is defined, and no other compilation environment is explicitly * requested, then define our internal feature-test macros to zero. This * makes no difference to the preprocessor (undefined symbols in preprocessing * expressions are defined to have value zero), but makes it more convenient for * a test program to print out the values. * * If a program mistakenly defines _ANSI_SOURCE and some other macro such as * _POSIX_C_SOURCE, we will assume that it wants the broader compilation * environment (and in fact we will never get here). */ /* User override __EXT1_VISIBLE */ /* * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h * translates them to __ARM_ARCH and the modern feature symbols defined by ARM. */ /* * Nullability qualifiers: currently only supported by Clang. */ /* * Type Safety Checking * * Clang provides additional attributes to enable checking type safety * properties that cannot be enforced by the C type system. */ /* * Lock annotations. * * Clang provides support for doing basic thread-safety tests at * compile-time, by marking which locks will/should be held when * entering/leaving a functions. * * Furthermore, it is also possible to annotate variables and structure * members to enforce that they are only accessed when certain locks are * held. */ /* Structure implements a lock. */ /* Function acquires an exclusive or shared lock. */ /* Function attempts to acquire an exclusive or shared lock. */ /* Function releases a lock. */ /* Function asserts that an exclusive or shared lock is held. */ /* Function requires that an exclusive or shared lock is or is not held. */ /* Function should not be analyzed. */ /* Guard variables and structure members by lock. */ _Pragma("diag_pop") /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * 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 AUTHOR 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 AUTHOR 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. * * $FreeBSD$ */ /*****************************************************************************/ /* _TYPES.H */ /* */ /* Copyright (c) 2017 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. */ /* */ /*****************************************************************************/ #pragma diag_push /* This file is required to use base types */ #pragma CHECK_MISRA("-6.3") /* * Basic types upon which most other types are built. */ typedef int __int16_t; typedef unsigned int __uint16_t; typedef long __int32_t; typedef unsigned long __uint32_t; /* LONGLONG */ typedef long long __int64_t; /* LONGLONG */ typedef unsigned long long __uint64_t; /* * Standard type definitions. */ typedef __uint32_t __clock_t; /* clock()... */ typedef __int32_t __critical_t; typedef double __double_t; typedef float __float_t; typedef __int32_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int32_t __intptr_t; typedef __int16_t __int_fast8_t; typedef __int16_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; typedef __int16_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; typedef long __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int16_t __register_t; typedef __int32_t __segsz_t; /* segment size (in pages) */ typedef unsigned long __size_t; /* sizeof() */ typedef __int32_t __ssize_t; /* byte count or error */ typedef __int64_t __time_t; /* time()... */ typedef __uint32_t __uintfptr_t; typedef __uint64_t __uintmax_t; typedef __uint32_t __uintptr_t; typedef __uint16_t __uint_fast8_t; typedef __uint16_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; typedef __uint16_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __uint16_t __u_register_t; typedef __uint32_t __vm_offset_t; typedef __uint32_t __vm_paddr_t; typedef __uint32_t __vm_size_t; typedef unsigned long ___wchar_t; /* * POSIX target specific _off_t type definition */ typedef long int _off_t; /* * Unusual type definitions. */ typedef char* __va_list; #pragma diag_pop _Pragma("diag_push") /* This file is required to use types without size and signedness */ _Pragma("CHECK_MISRA(\"-6.3\")") /* * Standard type definitions. */ typedef __int32_t __blksize_t; /* file block size */ typedef __int64_t __blkcnt_t; /* file block count */ typedef __int32_t __clockid_t; /* clock_gettime()... */ typedef __uint32_t __fflags_t; /* file flags */ typedef __uint64_t __fsblkcnt_t; typedef __uint64_t __fsfilcnt_t; typedef __uint32_t __gid_t; typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */ typedef __uint64_t __ino_t; /* inode number */ typedef long __key_t; /* IPC key (for Sys V IPC) */ typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */ typedef __uint16_t __mode_t; /* permissions */ typedef int __accmode_t; /* access permissions */ typedef int __nl_item; typedef __uint64_t __nlink_t; /* link count */ typedef _off_t __off_t; /* file offset (target-specific) */ typedef __int64_t __off64_t; /* file offset (always 64-bit) */ typedef __int32_t __pid_t; /* process [group] */ typedef __int64_t __rlim_t; /* resource limit - intentionally */ /* signed, because of legacy code */ /* that uses -1 for RLIM_INFINITY */ typedef __uint16_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef struct __timer *__timer_t; /* timer_gettime()... */ typedef struct __mq *__mqd_t; /* mq_open()... */ typedef __uint32_t __uid_t; typedef unsigned int __useconds_t; /* microseconds (unsigned) */ typedef int __cpuwhich_t; /* which parameter for cpuset. */ typedef int __cpulevel_t; /* level parameter for cpuset. */ typedef int __cpusetid_t; /* cpuset identifier. */ /* * Unusual type definitions. */ /* * rune_t is declared to be an ``int'' instead of the more natural * ``unsigned long'' or ``long''. Two things are happening here. It is not * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, * it looks like 10646 will be a 31 bit standard. This means that if your * ints cannot hold 32 bits, you will be in trouble. The reason an int was * chosen over a long is that the is*() and to*() routines take ints (says * ANSI C), but they use __ct_rune_t instead of int. * * NOTE: rune_t is not covered by ANSI nor other standards, and should not * be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and * rune_t must be the same type. Also, wint_t should be able to hold all * members of the largest character set plus one extra value (WEOF), and * must be at least 16 bits. */ typedef unsigned long __ct_rune_t; /* arg type for ctype funcs */ typedef __ct_rune_t __rune_t; /* rune_t (see above) */ typedef __ct_rune_t __wint_t; /* wint_t (see above) */ /* Clang already provides these types as built-ins, but only in C++ mode. */ typedef __uint_least16_t __char16_t; typedef __uint_least32_t __char32_t; /* In C++11, char16_t and char32_t are built-in types. */ typedef struct { long long __max_align1 __attribute__((aligned(__alignof__(long long)))); long double __max_align2 __attribute__((aligned(__alignof__(long double)))); } __max_align_t; typedef __uint64_t __dev_t; /* device number */ typedef __uint32_t __fixpt_t; /* fixed point number */ /* * mbstate_t is an opaque object to keep conversion state during multibyte * stream conversions. */ typedef int _Mbstatet; typedef _Mbstatet __mbstate_t; typedef __uintmax_t __rman_res_t; /* * When the following macro is defined, the system uses 64-bit inode numbers. * Programs can use this to avoid including , with its associated * namespace pollution. */ _Pragma("diag_pop") /*****************************************************************************/ /* _STDINT.H */ /* */ /* Copyright (c) 2019 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. */ /* */ /*****************************************************************************/ /*- * SPDX-License-Identifier: BSD-2-Clause-NetBSD * * Copyright (c) 2001, 2002 Mike Barcroft * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Klaus Klein. * * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. * * $FreeBSD$ */ #pragma diag_push /* 19.4 is issued for macros that are defined in terms of other macros. */ #pragma CHECK_MISRA("-19.4") #pragma CHECK_MISRA("-19.7") #pragma CHECK_MISRA("-19.13") /* * ISO/IEC 9899:1999 * 7.18.2.1 Limits of exact-width integer types */ /* Minimum values of exact-width signed integer types. */ /* Maximum values of exact-width signed integer types. */ /* Maximum values of exact-width unsigned integer types. */ /* * ISO/IEC 9899:1999 * 7.18.2.2 Limits of minimum-width integer types */ /* Minimum values of minimum-width signed integer types. */ /* Maximum values of minimum-width signed integer types. */ /* Maximum values of minimum-width unsigned integer types. */ /* * ISO/IEC 9899:1999 * 7.18.2.3 Limits of fastest minimum-width integer types */ /* Minimum values of fastest minimum-width signed integer types. */ /* Maximum values of fastest minimum-width signed integer types. */ /* Maximum values of fastest minimum-width unsigned integer types. */ /* * ISO/IEC 9899:1999 * 7.18.2.4 Limits of integer types capable of holding object pointers */ /* * ISO/IEC 9899:1999 * 7.18.2.5 Limits of greatest-width integer types */ /* * ISO/IEC 9899:1999 * 7.18.3 Limits of other integer types */ /* Limits of ptrdiff_t. */ /* Limits of sig_atomic_t. */ /* Limit of size_t. */ /* Limits of wint_t. */ #pragma diag_pop /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 David E. O'Brien * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * 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 AUTHOR 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 AUTHOR 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. * * $FreeBSD$ */ typedef __int16_t int16_t; typedef __int32_t int32_t; typedef __int64_t int64_t; typedef __uint16_t uint16_t; typedef __uint32_t uint32_t; typedef __uint64_t uint64_t; typedef __intptr_t intptr_t; typedef __uintptr_t uintptr_t; typedef __intmax_t intmax_t; typedef __uintmax_t uintmax_t; typedef __int_least8_t int_least8_t; typedef __int_least16_t int_least16_t; typedef __int_least32_t int_least32_t; typedef __int_least64_t int_least64_t; typedef __uint_least8_t uint_least8_t; typedef __uint_least16_t uint_least16_t; typedef __uint_least32_t uint_least32_t; typedef __uint_least64_t uint_least64_t; typedef __int_fast8_t int_fast8_t; typedef __int_fast16_t int_fast16_t; typedef __int_fast32_t int_fast32_t; typedef __int_fast64_t int_fast64_t; typedef __uint_fast8_t uint_fast8_t; typedef __uint_fast16_t uint_fast16_t; typedef __uint_fast32_t uint_fast32_t; typedef __uint_fast64_t uint_fast64_t; _Pragma("diag_push") _Pragma("CHECK_MISRA(\"-10.1\")") /* GNU and Darwin define this and people seem to think it's portable */ _Pragma("diag_pop") _Pragma("diag_push") _Pragma("CHECK_MISRA(\"-19.4\")") /* Limits of wchar_t. */ _Pragma("diag_pop") /* ISO/IEC 9899:2011 K.3.4.4 */ _Pragma("diag_pop") /*External reference to the interrupt flag register (IFR) register*/ extern __cregister V_UI_16 IFR; /* External reference to the interrupt enable register (IER) register*/ extern __cregister V_UI_16 IER; /* Define to enable interrupts*/ /*Define to disable interrupts*/ /* Define to enable debug events*/ /* Define to disable debug events*/ /* Define to allow writes to protected registers*/ /*Define to disable writes to protected registers*/ /*Define for emulation stop*/ /*Define for emulation stop*/ /*Define for no operation*/ /* Define for putting processor into a low-power mode*/ /***************************************************************************** Extern compiler intrinsic prototypes. See compiler User's Guide for details. *****************************************************************************/ extern void __eallow(void); extern void __edis(void); /***************************************************************************** Defines for system control functions. Not intended for use by application code. *****************************************************************************/ /*Shifted pattern for WDCR register's WDCHK field*/ /* Keys for WDKEY field. The first enables resets and the second resets*/ /*Values to help decode peripheral parameter*/ /*Keys for the System control registers write protection*/ /* Values to help access shifting of bits */ /*LPM defines for LPMCR.LPM */ /* Bit shift for DAC to configure the CPUSEL register */ /* Default internal oscillator frequency, 10 MHz*/ /* Mask for SYNCSELECT.SYNCIN */ /* Boot ROM Booting and Reset Status*/ /* Device_cal function which is available in OTP memory This function is called in SysCtl_resetPeripheral after resetting analog peripherals */ /****************************************************************************** The following are values that can be passed to the SysCtl_setClock() API as the config parameter. ******************************************************************************/ /* System clock divider (SYSDIV)*/ /*! Macro to format system clock divider value. x must be 1 or even values up to 126.*/ /*Integer multiplier (IMULT)*/ /*! Macro to format integer multiplier value. x is a number from 1 to 127.*/ /* Fractional multiplier (FMULT)*/ /* Oscillator source * Also used with the SysCtl_selectOscSource(), SysCtl_turnOnOsc(),and * SysCtl_turnOffOsc() functions as the oscSource parameter. */ /*! Internal oscillator INTOSC2*/ /*! External oscillator (XTAL) in crystal mode*/ /*! Internal oscillator INTOSC1*/ /* * Enable/disable PLL */ /****************************************************************************** * * The following are values that can be passed to the SysCtl_setAuxClock() API * as the config parameter. * *******************************************************************************/ /* Auxiliary clock divider (AUXCLKDIV) */ /* Integer multiplier (IMULT) Macro to format integer multiplier value. x is a number from 1 to 127. */ /* Fractional multiplier (FMULT)*/ /* Oscillator source */ /*! Internal oscillator INTOSC2 as auxiliary clock input*/ /*! External oscillator (XTAL) as auxiliary clock input*/ /*! AUXCLKIN (from GPIO) as auxiliary clock input*/ /* Enable/disable PLL*/ /****************************************************************************** * *! The following are values that can be passed to SysCtl_enablePeripheral() *! and SysCtl_disablePeripheral() as the \e peripheral parameter. * *******************************************************************************/ typedef enum { SYSCTL_PERIPH_CLK_TIMER0 = 0x0300, /*!< CPUTIMER0 clock*/ SYSCTL_PERIPH_CLK_TIMER1 = 0x0400, /*!< CPUTIMER1 clock*/ SYSCTL_PERIPH_CLK_TIMER2 = 0x0500, /*!< CPUTIMER2 clock*/ SYSCTL_PERIPH_CLK_SCIB = 0x0107, /*!< SCI_B clock*/ SYSCTL_PERIPH_CLK_SPIB = 0x0108, /*!< SPI_B clock*/ } SysCtl_PeripheralPCLOCKCR; /****************************************************************************** * *! The following are values that can be passed to SysCtl_resetPeripheral() as *! the \e peripheral parameter. * *******************************************************************************/ typedef enum { SYSCTL_PERIPH_RES_SCIB = 0x0107, /*!< Reset SCI_B clock*/ SYSCTL_PERIPH_RES_SPIB = 0x0108, /*!< Reset SPI_B clock*/ } SysCtl_PeripheralSOFTPRES; /****************************************************************************** * *! The following are values that can be passed to *! SysCtl_lockCPUSelectRegs() as the \e peripheral parameter. * *******************************************************************************/ typedef enum { /*! Configure CPU Select for SCI*/ SYSCTL_CPUSEL5_SCI = 0x5U, /*! Configure CPU Select for SPI*/ SYSCTL_CPUSEL6_SPI = 0x6U, } SysCtl_CPUSelPeripheral; /****************************************************************************** * *! The following are values that can be passed to *! SysCtl_selectCPUForPeripheralInstance() as the \e peripheral parameter. * *******************************************************************************/ typedef enum { SYSCTL_CPUSEL_SCIB = 0x0105, SYSCTL_CPUSEL_SPIB = 0x0106, } SysCtl_CPUSelPeriphInstance; /****************************************************************************** * *! The following are values that can be passed to *! SysCtl_selectCPUForPeripheral() as \e cpuInst parameter. * *******************************************************************************/ typedef enum { /*! Connect the peripheral (indicated by SysCtl_CPUSelPeripheral) to CPU1*/ SYSCTL_CPUSEL_CPU1 = 0x0U, /*! Connect the peripheral (indicated by SysCtl_CPUSelPeripheral) to CPU2*/ SYSCTL_CPUSEL_CPU2 = 0x1U } SysCtl_CPUSel; /****************************************************************************** * *! The following are values that can be passed to *! SysCtl_setWatchdogPrescaler() as the \e prescaler parameter. * *******************************************************************************/ typedef enum { SYSCTL_WD_PRESCALE_1 = 1, /*!< WDCLK = PREDIVCLK / 1*/ SYSCTL_WD_PRESCALE_2 = 2, /*!< WDCLK = PREDIVCLK / 2*/ SYSCTL_WD_PRESCALE_4 = 3, /*!< WDCLK = PREDIVCLK / 4*/ SYSCTL_WD_PRESCALE_8 = 4, /*!< WDCLK = PREDIVCLK / 8*/ SYSCTL_WD_PRESCALE_16 = 5, /*!< WDCLK = PREDIVCLK / 16*/ SYSCTL_WD_PRESCALE_32 = 6, /*!< WDCLK = PREDIVCLK / 32*/ SYSCTL_WD_PRESCALE_64 = 7 /*!< WDCLK = PREDIVCLK / 64*/ } SysCtl_WDPrescaler; /****************************************************************************** * *! The following are values that can be passed to *! SysCtl_setWatchdogMode() as the \e prescaler parameter. * *******************************************************************************/ typedef enum { /*! Watchdog can generate a reset signal*/ SYSCTL_WD_MODE_RESET, /*! Watchdog can generate an interrupt signal; reset signal is disabled*/ SYSCTL_WD_MODE_INTERRUPT } SysCtl_WDMode; /****************************************************************************** * *! The following are values that can be passed to SysCtl_setLowSpeedClock() as *! the \e prescaler parameter. * *******************************************************************************/ typedef enum { SYSCTL_LSPCLK_PRESCALE_1 = 0, /*!< LSPCLK = SYSCLK / 1*/ SYSCTL_LSPCLK_PRESCALE_2 = 1, /*!< LSPCLK = SYSCLK / 2*/ SYSCTL_LSPCLK_PRESCALE_4 = 2, /*!< LSPCLK = SYSCLK / 4 (default)*/ SYSCTL_LSPCLK_PRESCALE_6 = 3, /*!< LSPCLK = SYSCLK / 6*/ SYSCTL_LSPCLK_PRESCALE_8 = 4, /*!< LSPCLK = SYSCLK / 8*/ SYSCTL_LSPCLK_PRESCALE_10 = 5, /*!< LSPCLK = SYSCLK / 10*/ SYSCTL_LSPCLK_PRESCALE_12 = 6, /*!< LSPCLK = SYSCLK / 12*/ SYSCTL_LSPCLK_PRESCALE_14 = 7 /*!< LSPCLK = SYSCLK / 14*/ } SysCtl_LSPCLKPrescaler; /****************************************************************************** * *! The following values define the \e parametric parameter for *! SysCtl_getDeviceParametric(). * ******************************************************************************/ typedef enum { SYSCTL_DEVICE_QUAL, /*!< Device Qualification Status*/ SYSCTL_DEVICE_PINCOUNT, /*!< Device Pin Count*/ SYSCTL_DEVICE_INSTASPIN, /*!< Device InstaSPIN Feature Set*/ SYSCTL_DEVICE_FLASH, /*!< Device Flash size (KB)*/ SYSCTL_DEVICE_PARTID, /*!< Device Part ID Format Revision*/ SYSCTL_DEVICE_FAMILY, /*!< Device Family*/ SYSCTL_DEVICE_PARTNO, /*!< Device Part Number*/ SYSCTL_DEVICE_CLASSID /*!< Device Class ID*/ } SysCtl_DeviceParametric; /****************************************************************************** * *! The following are values that can be passed to *! SysCtl_setXClk() as \e divider parameter. * *******************************************************************************/ typedef enum { SYSCTL_XCLKOUT_DIV_1 = 0, /*!< XCLKOUT = XCLKOUT / 1*/ SYSCTL_XCLKOUT_DIV_2 = 1, /*!< XCLKOUT = XCLKOUT / 2*/ SYSCTL_XCLKOUT_DIV_4 = 2, /*!< XCLKOUT = XCLKOUT / 4*/ SYSCTL_XCLKOUT_DIV_8 = 3 /*!< XCLKOUT = XCLKOUT / 8*/ }SysCtl_XClkDivider; /****************************************************************************** * *! The following are values that can be passed to *! SysCtl_setAuxPLLClk() as \e divider parameter. * *******************************************************************************/ typedef enum { SYSCTL_AUXPLLCLK_DIV_1, /*!< AUXPLL clock = AUXPLL clock / 1*/ SYSCTL_AUXPLLCLK_DIV_2, /*!< AUXPLL clock = AUXPLL clock / 2*/ SYSCTL_AUXPLLCLK_DIV_4, /*!< AUXPLL clock = AUXPLL clock / 4*/ SYSCTL_AUXPLLCLK_DIV_8, /*!< AUXPLL clock = AUXPLL clock / 8*/ SYSCTL_AUXPLLCLK_DIV_3, /*!< AUXPLL clock = AUXPLL clock / 3*/ SYSCTL_AUXPLLCLK_DIV_5, /*!< AUXPLL clock = AUXPLL clock / 5*/ SYSCTL_AUXPLLCLK_DIV_6, /*!< AUXPLL clock = AUXPLL clock / 6*/ SYSCTL_AUXPLLCLK_DIV_7 /*!< AUXPLL clock = AUXPLL clock / 7*/ }SysCtl_AuxPLLClkDivider; /****************************************************************************** * * Prototypes for the APIs. * *******************************************************************************/ /******************************************************************************* * *! Delays for a fixed number of cycles. *! *! \param count is the number of delay loop iterations to perform. *! *! This function generates a constant length delay using assembly code. The *! loop takes 5 cycles per iteration plus 9 cycles of overhead. *! *! \note If count is equal to zero, the loop will underflow and run for a ! very long time. *! *! \note Refer to the macro DEVICE_DELAY_US(x) in device.h which can be used to *! insert a delay in microseconds. *! *! \return None. * *******************************************************************************/ extern void SysCtl_delay(UI_32 count); /****************************************************************************** * *! Configures the clocking of the device. *! *! \param config is the required configuration of the device clocking. *! *! This function configures the clocking of the device. The input crystal *! frequency, oscillator to be used, use of the PLL, and the system clock *! divider are all configured with this function. *! *! The \e config parameter is the OR of several different values, many of ! which are grouped into sets where only one can be chosen. *! *! - The system clock divider is chosen with the macro \b SYSCTL_SYSDIV(x) *! where x is either 1 or an even value up to 126. *! *! - The use of the PLL is chosen with either \b SYSCTL_PLL_ENABLE or ! \b SYSCTL_PLL_DISABLE. *! *! - The integer multiplier is chosen \b SYSCTL_IMULT(x) where x is a value *! from 1 to 127. *! ! - The fractional multiplier is chosen with either \b SYSCTL_FMULT_0, *! \b SYSCTL_FMULT_1_4, \b SYSCTL_FMULT_1_2, or \b SYSCTL_FMULT_3_4. *! *! - The oscillator source chosen with \b SYSCTL_OSCSRC_OSC2, *! \b SYSCTL_OSCSRC_XTAL, or \b SYSCTL_OSCSRC_OSC1. *! *! This function uses the watchdog as a monitor for the PLL. The user *! watchdog settings will be modified and restored upon completion. Make sure *! that the WDOVERRIDE bit isn't set before calling this function. Re-lock *! attempt is carried out if either SLIP condition occurs or SYSCLK to input *! clock ratio is off by 10%. *! *! This function uses the following resources to support PLL initialization: *! - Watchdog *! - CPU Timer 1 *! - CPU Timer 2 *! *! *! \note See your device errata for more details about locking the PLL. *! *! \return Returns \b false if a missing clock error is detected. This needs *! to be cleared (see SysCtl_resetMCD()) before trying to call this function *! again. Otherwise, returns \b true. * *******************************************************************************/ extern _Bool SysCtl_setClock(UI_32 config); /****************************************************************************** * * Configures the external oscillator for the clocking of the device. *******************************************************************************/ extern void SysCtl_selectXTAL(void); /****************************************************************************** * * Selects the oscillator to be used for the clocking of the device. ******************************************************************************/ extern void SysCtl_selectOscSource(UI_32 oscSource); /****************************************************************************** * *! Get the missing clock detection Failure Status *! *! \note A failure means the oscillator clock is missing *! *! \return Returns \b true if a failure is detected or \b false if a *! failure isn't detected * *******************************************************************************/ extern _Bool SysCtl_isMCDClockFailureDetected(void); /****************************************************************************** * *! Set the minimum threshold value for windowed watchdog *! *! \param value is the value to set the window threshold *! *! This function sets the minimum threshold value used to define the lower *! limit of the windowed watchdog functionality. *! *! \return None. * *******************************************************************************/ extern void SysCtl_setWatchdogWindowValue(UI_16 loc_value); /****************************************************************************** * *! Sets up watchdog clock (WDCLK) prescaler. *! *! \param prescaler is the value that configures the watchdog clock relative *! to the value from the pre-divider. *! *! This function sets up the watchdog clock (WDCLK) prescaler. The *! \e prescaler parameter divides INTOSC1 down to WDCLK. *! *! \return None. * *******************************************************************************/ extern void SysCtl_setWatchdogPrescaler(SysCtl_WDPrescaler loc_prescaler); /****************************************************************************** * *! Services the watchdog. *! *! This function resets the watchdog. *! *! \return None. * *******************************************************************************/ extern void SysCtl_serviceWatchdog(void); /****************************************************************************** * *! Enables the watchdog. *! *! This function enables the watchdog timer. Note that the watchdog timer is *! enabled on reset. *! *! \return None. * *******************************************************************************/ extern void SysCtl_enableWatchdog(void); /****************************************************************************** * *! Disables the watchdog. *! *! This function disables the watchdog timer. Note that the watchdog timer is *! enabled on reset. *! *! \return None. * *******************************************************************************/ extern void SysCtl_disableWatchdog(void); /****************************************************************************** * *! Configures whether the watchdog generates a reset or an interrupt signal. *! *! \param mode is a flag to select the watchdog mode. *! *! This function configures the action taken when the watchdog counter reaches *! its maximum value. When the \e mode parameter is *! \b SYSCTL_WD_MODE_INTERRUPT, the watchdog is enabled to generate a watchdog *! interrupt signal and disables the generation of a reset signal. This will *! allow the watchdog module to wake up the device from IDLE *! or STANDBY if desired (see SysCtl_enableWatchdogStandbyWakeup()). *! *! When the \e mode parameter is \b SYSCTL_WD_MODE_RESET, the watchdog will *! be put into reset mode and generation of a watchdog interrupt signal will *! be disabled. This is how the watchdog is configured by default. *! *! \note Check the status of the watchdog interrupt using *! SysCtl_isWatchdogInterruptActive() before calling this function. If the *! interrupt is still active, switching from interrupt mode to reset mode will *! immediately reset the device. *! *! \return None. * *******************************************************************************/ extern void SysCtl_setWatchdogMode(SysCtl_WDMode loc_mode); /****************************************************************************** * *! Sets the low speed peripheral clock rate prescaler. *! *! \param prescaler is the LSPCLK rate relative to SYSCLK *! *! This function configures the clock rate of the low speed peripherals. The *! \e prescaler parameter is the value by which the SYSCLK rate is divided to *! get the LSPCLK rate. For example, a \e prescaler of *! \b SYSCTL_LSPCLK_PRESCALE_4 will result in a LSPCLK rate that is a quarter *! of the SYSCLK rate. *! *! \return None. * *******************************************************************************/ extern void SysCtl_setLowSpeedClock(SysCtl_LSPCLKPrescaler loc_prescaler); /****************************************************************************** * *! Enables a peripheral. *! *! \param peripheral is the peripheral to enable. *! *! Peripherals are enabled with this function. At power-up, all peripherals *! are disabled; they must be enabled in order to operate or respond to *! register reads/writes. *! *! \note Note that there should be atleast 5 cycles delay between enabling the *! peripheral clock and accessing the peripheral registers. The delay should be *! added by the user if the peripheral is accessed immediately after this *! function call. *! Use asm(" RPT #5 || NOP"); to add 5 cycle delay post this function call. *! *! \return None. * *******************************************************************************/ extern void SysCtl_enablePeripheral(SysCtl_PeripheralPCLOCKCR loc_peripheral); /****************************************************************************** Mark the end of the C bindings section for C++ compilers. *****************************************************************************/ /***************************************************************************** Defines for the API. *****************************************************************************/ /***************************************************************************** Values that can be passed to CPUTimer_setEmulationMode() as the \e mode parameter. ****************************************************************************/ typedef enum { /*Denotes that the timer will stop after the next decrement*/ CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT = 0x0000, /* Denotes that the timer will stop when it reaches zero*/ CPUTIMER_EMULATIONMODE_STOPATZERO = 0x0400, /* Denotes that the timer will run free*/ CPUTIMER_EMULATIONMODE_RUNFREE = 0x0800 }CPUTimer_EmulationMode; /***************************************************************************** The following are values that can be passed to CPUTimer_selectClockSource() as the \e source parameter. *****************************************************************************/ typedef enum { /* System Clock Source*/ CPUTIMER_CLOCK_SOURCE_SYS = 0x0, /* Internal Oscillator 1 Clock Source*/ CPUTIMER_CLOCK_SOURCE_INTOSC1 = 0x1, /* Internal Oscillator 2 Clock Source*/ CPUTIMER_CLOCK_SOURCE_INTOSC2 = 0x2, /*External Clock Source*/ CPUTIMER_CLOCK_SOURCE_XTAL = 0x3, /* Auxiliary PLL Clock Source*/ CPUTIMER_CLOCK_SOURCE_AUX = 0x6 } CPUTimer_ClockSource; /***************************************************************************** The following are values that can be passed to CPUTimer_selectClockSource() as the \e prescaler parameter. *****************************************************************************/ typedef enum { CPUTIMER_CLOCK_PRESCALER_1 = 0, /* < Prescaler value of / 1*/ CPUTIMER_CLOCK_PRESCALER_2 = 1, /* < Prescaler value of / 2*/ CPUTIMER_CLOCK_PRESCALER_4 = 2, /* < Prescaler value of / 4*/ CPUTIMER_CLOCK_PRESCALER_8 = 3, /* < Prescaler value of / 8*/ CPUTIMER_CLOCK_PRESCALER_16 = 4 /* < Prescaler value of / 16*/ } CPUTimer_Prescaler; /***************************************************************************** function declarations *****************************************************************************/ //***************************************************************************** // //! Set CPU timer pre-scaler value. //! //! \param base is the base address of the timer module. //! \param prescaler is the CPU timer pre-scaler value. //! //! This function sets the pre-scaler value for the CPU timer. For every value //! of (prescaler + 1), the CPU timer counter decrements by 1. //! //! \return None. // //***************************************************************************** extern void CPUTimer_setPreScaler(UI_32 base, UI_16 prescaler); //***************************************************************************** // //! Reloads CPU timer counter. //! //! \param base is the base address of the timer module. //! //! This function reloads the CPU timer counter with the values contained in //! the CPU timer period register. //! //! \return None. // //***************************************************************************** extern void CPUTimer_reloadTimerCounter(UI_32 base); //***************************************************************************** // //! Enables CPU timer interrupt. //! //! \param base is the base address of the timer module. //! //! This function enables the CPU timer interrupt. //! //! \return None. // //***************************************************************************** extern void CPUTimer_enableInterrupt(UI_32 base); /***************************************************************************** \internal Checks CPU timer base address. \param base specifies the Timer module base address. This function determines if a CPU timer module base address is valid. \return Returns \b true if the base address is valid and \b false otherwise. *****************************************************************************/ extern _Bool CPUTimer_isBaseValid(UI_32 loc_base); /***************************************************************************** Clears CPU timer overflow flag. \param base is the base address of the timer module. This function clears the CPU timer overflow flag. \return None. *****************************************************************************/ extern void CPUTimer_clearOverflowFlag(UI_32 loc_base); /***************************************************************************** Disables CPU timer interrupt. \param base is the base address of the timer module. This function disables the CPU timer interrupt. \return None. *****************************************************************************/ extern void CPUTimer_disableInterrupt(UI_32 loc_base); /***************************************************************************** Stops CPU timer. \param base is the base address of the timer module. This function stops the CPU timer. \return None. *****************************************************************************/ extern void CPUTimer_stopTimer(UI_32 loc_base); /***************************************************************************** Starts(restarts) CPU timer. \param base is the base address of the timer module. This function starts (restarts) the CPU timer. \b Note: This function reloads the timer counter. \return None. *****************************************************************************/ extern void CPUTimer_startTimer(UI_32 loc_base); /***************************************************************************** Sets CPU timer period. \param base is the base address of the timer module. \param periodCount is the CPU timer period count. This function sets the CPU timer period count. \return None. *****************************************************************************/ extern void CPUTimer_setPeriod(UI_32 loc_base, UI_32 loc_periodCount); /***************************************************************************** Return the CPU timer overflow status. \param base is the base address of the timer module. This function returns the CPU timer overflow status. \return Returns true if the CPU timer has overflowed, false if not. *****************************************************************************/ extern _Bool CPUTimer_getTimerOverflowStatus(UI_32 loc_base); /***************************************************************************** Select CPU Timer 2 Clock Source and Prescaler \param base is the base address of the timer module. \param source is the clock source to use for CPU Timer 2 \param prescaler is the value that configures the selected clock source relative to the system clock This function selects the specified clock source and prescaler value for the CPU timer (CPU timer 2 only). The \e source parameter can be any one of the following: - \b CPUTIMER_CLOCK_SOURCE_SYS - System Clock - \b CPUTIMER_CLOCK_SOURCE_INTOSC1 - Internal Oscillator 1 Clock - \b CPUTIMER_CLOCK_SOURCE_INTOSC2 - Internal Oscillator 2 Clock - \b CPUTIMER_CLOCK_SOURCE_XTAL - External Clock - \b CPUTIMER_CLOCK_SOURCE_AUX - Auxiliary PLL Clock The \e prescaler parameter can be any one of the following: - \b CPUTIMER_CLOCK_PRESCALER_1 - Prescaler value of / 1 - \b CPUTIMER_CLOCK_PRESCALER_2 - Prescaler value of / 2 - \b CPUTIMER_CLOCK_PRESCALER_4 - Prescaler value of / 4 - \b CPUTIMER_CLOCK_PRESCALER_8 - Prescaler value of / 8 - \b CPUTIMER_CLOCK_PRESCALER_16 - Prescaler value of / 16 \return None. *****************************************************************************/ extern void CPUTimer_selectClockSource(UI_32 loc_base, CPUTimer_ClockSource loc_source, CPUTimer_Prescaler loc_prescaler); extern void CPUTimer_setEmulationMode(UI_32 base, CPUTimer_EmulationMode mode); /****************************************************************************** * NAME: CPUTimer_isBaseValid * * * PURPOSE:This function determines if a CPU timer module loc_base address is valid. * * * Parameters: * * Variable Type Description * ----------------------------------------------------------------------------* * loc_base UI_32 loc_base specifies the Timer module base address. * * * Function Return: * ----------------------------------------------------------------------------* * bool * * Algorithm * * Checks CPU timer loc_base address. \return Returns \b true if the loc_base address is valid and \b false otherwise. *****************************************************************************/ _Bool CPUTimer_isBaseValid(UI_32 loc_base) { return((loc_base == 0x00000C00U) || (loc_base == 0x00000C08U) || (loc_base == 0x00000C10U)); } /******************************************************************************* * NAME: CPUTimer_clearOverflowFlag * * * PURPOSE: This function determines if a CPU timer module loc_base address is valid. * * * Parameters: * * Variable Type Description * ----------------------------------------------------------------------------* * loc_base UI_32 loc_base is the base address of the timer module. * * * Function Return: * ----------------------------------------------------------------------------* * void * * Algorithm * * This function clears the CPU timer overflow flag. \return None. *****************************************************************************/ void CPUTimer_clearOverflowFlag(UI_32 loc_base) { do { if(!(CPUTimer_isBaseValid(loc_base))) { __error__("../device/driverlib/cputimer.c", 101); } } while((_Bool)0); /* Set TIF bit of TCR register*/ (*((V_UI_16*)(loc_base + 0x4U))) |= 0x8000U; } /****************************************************************************** * NAME: CPUTimer_disableInterrupt * * * PURPOSE:This function disables the CPU timer interrupt. * * * Parameters: * * Variable Type Description * ----------------------------------------------------------------------------* * loc_base UI_32 loc_base is the base address of the timer module. * * * Function Return: * ----------------------------------------------------------------------------* * void * * Algorithm * * Disables CPU timer interrupt. *****************************************************************************/ void CPUTimer_disableInterrupt(UI_32 loc_base) { do { if(!(CPUTimer_isBaseValid(loc_base))) { __error__("../device/driverlib/cputimer.c", 132); } } while((_Bool)0); /*Clear TIE bit of TCR register*/ (*((V_UI_16*)(loc_base + 0x4U))) &= ~0x4000U; } /******************************************************************************* * NAME: CPUTimer_stopTimer * * * PURPOSE:This function stops the CPU timer. * * * Parameters: * * Variable Type Description * ----------------------------------------------------------------------------* * loc_base UI_32 loc_base is the base address of the timer module. * * * Function Return: * ----------------------------------------------------------------------------* * void * * Algorithm * * Stops CPU timer. *****************************************************************************/ void CPUTimer_stopTimer(UI_32 loc_base) { UI_16 loc_tcrValue = 0; do { if(!(CPUTimer_isBaseValid(loc_base))) { __error__("../device/driverlib/cputimer.c", 164); } } while((_Bool)0); /*Set TSS bit of register TCR*/ loc_tcrValue = (*((V_UI_16*)(loc_base + 0x4U))) & (~0x8000U); (*((V_UI_16*)(loc_base + 0x4U))) = loc_tcrValue | 0x10U; } /******************************************************************************* * NAME: CPUTimer_startTimer * * * PURPOSE:This function starts (restarts) the CPU timer and reloads the timer counter. * * * Parameters: * * Variable Type Description * ---------------------------------------------------------------------------- * * loc_base UI_32 loc_base is the base address of the timer module. * * * Function Return: * ----------------------------------------------------------------------------* * void * * Algorithm * Starts(restarts) CPU timer. *******************************************************************************/ void CPUTimer_startTimer(UI_32 loc_base) { UI_16 loc_tcrValue = 0; do { if(!(CPUTimer_isBaseValid(loc_base))) { __error__("../device/driverlib/cputimer.c", 199); } } while((_Bool)0); /*Reload the timer counter*/ loc_tcrValue = (*((V_UI_16*)(loc_base + 0x4U))) & (~0x8000U); (*((V_UI_16*)(loc_base + 0x4U))) = loc_tcrValue | 0x20U; /* Clear TSS bit of register TCR*/ (*((V_UI_16*)(loc_base + 0x4U))) &= ~0x10U; } /******************************************************************************* * NAME: CPUTimer_setPeriod * * * PURPOSE:This function sets the CPU timer period count. * * * Parameters: * * Variable Type Description * ----------------------------------------------------------------------------* * loc_base UI_32 loc_base is the base address of the timer module. * loc_periodCount UI_32 periodCount is the CPU timer period count. * * * Function Return: * ----------------------------------------------------------------------------* * void * * Algorithm * Sets CPU timer period. *****************************************************************************/ void CPUTimer_setPeriod(UI_32 loc_base, UI_32 loc_periodCount) { do { if(!(CPUTimer_isBaseValid(loc_base))) { __error__("../device/driverlib/cputimer.c", 238); } } while((_Bool)0); /*Load the MSB period Count*/ (*((V_UI_32*)(loc_base + 0x2U))) = loc_periodCount; } /******************************************************************************* * NAME: CPUTimer_getTimerOverflowStatus * * * PURPOSE:This function returns the CPU timer overflow status. * * * Parameters: * * Variable Type Description * ----------------------------------------------------------------------------* * loc_base UI_32 loc_base is the base address of the timer module. * * * Function Return: * ----------------------------------------------------------------------------* * bool * * Algorithm * Return the CPU timer overflow status. *****************************************************************************/ _Bool CPUTimer_getTimerOverflowStatus(UI_32 loc_base) { do { if(!(CPUTimer_isBaseValid(loc_base))) { __error__("../device/driverlib/cputimer.c", 270); } } while((_Bool)0); /* Check if TIF bits of register TCR are set*/ return((((*((V_UI_16*)(loc_base + 0x4U))) & 0x8000U) == 0x8000U) ? 1 : 0); } /******************************************************************************* * NAME: CPUTimer_selectClockSource * * * PURPOSE: This function selects the specified clock source and prescaler value for the CPU timer (CPU timer 2 only). * * * Parameters: * * Variable Type Description * ----------------------------------------------------------------------------* * loc_base UI_32 loc_base is the base address of the timer module. * loc_source CPUTimer_ClockSource source is the clock source to use for CPU Timer 2 * loc_prescaler CPUTimer_Prescaler prescaler is the value that configures the selected clock source * * * Function Return: * ----------------------------------------------------------------------------* * void * * Algorithm * Select CPU Timer 2 Clock Source and Prescaler relative to the system clock The \e source parameter can be any one of the following: - \b CPUTIMER_CLOCK_SOURCE_SYS - System Clock - \b CPUTIMER_CLOCK_SOURCE_INTOSC1 - Internal Oscillator 1 Clock - \b CPUTIMER_CLOCK_SOURCE_INTOSC2 - Internal Oscillator 2 Clock - \b CPUTIMER_CLOCK_SOURCE_XTAL - External Clock - \b CPUTIMER_CLOCK_SOURCE_AUX - Auxiliary PLL Clock The \e prescaler parameter can be any one of the following: - \b CPUTIMER_CLOCK_PRESCALER_1 - Prescaler value of / 1 - \b CPUTIMER_CLOCK_PRESCALER_2 - Prescaler value of / 2 - \b CPUTIMER_CLOCK_PRESCALER_4 - Prescaler value of / 4 - \b CPUTIMER_CLOCK_PRESCALER_8 - Prescaler value of / 8 - \b CPUTIMER_CLOCK_PRESCALER_16 - Prescaler value of / 16 \return None. *****************************************************************************/ void CPUTimer_selectClockSource(UI_32 loc_base, CPUTimer_ClockSource loc_source, CPUTimer_Prescaler loc_prescaler) { do { if(!(loc_base == 0x00000C10U)) { __error__("../device/driverlib/cputimer.c", 325); } } while((_Bool)0); /*Set source and prescaler for CPU Timer 2*/ if(loc_base == 0x00000C10U) { __eallow(); /* Set Clock Source*/ (*((V_UI_16*)(0x0005D300U + 0x7CU))) &= ~0x7U; (*((V_UI_16*)(0x0005D300U + 0x7CU))) |= (UI_16)loc_source; /* Set Clock Prescaler*/ (*((V_UI_16*)(0x0005D300U + 0x7CU))) &= ~0x38U; (*((V_UI_16*)(0x0005D300U + 0x7CU))) |= ((UI_16)loc_prescaler << 3U); __edis(); } } void CPUTimer_setPreScaler(uint32_t base, uint16_t prescaler) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("../device/driverlib/cputimer.c", 356); } } while((_Bool)0); // // Writes to TPR.TDDR and TPRH.TDDRH bits // (*((V_UI_16*)(base + 0x7U))) = prescaler >> 8U; (*((V_UI_16*)(base + 0x6U))) = (prescaler & 0xFFU) ; } //***************************************************************************** // //! Reloads CPU timer counter. //! //! \param base is the base address of the timer module. //! //! This function reloads the CPU timer counter with the values contained in //! the CPU timer period register. //! //! \return None. // //***************************************************************************** void CPUTimer_reloadTimerCounter(uint32_t base) { uint16_t tcrValue = 0; do { if(!(CPUTimer_isBaseValid(base))) { __error__("../device/driverlib/cputimer.c", 379); } } while((_Bool)0); // // Set TRB bit of register TCR // tcrValue = (*((V_UI_16*)(base + 0x4U))) & (~0x8000U); (*((V_UI_16*)(base + 0x4U))) = tcrValue | 0x20U; } //***************************************************************************** // //! Enables CPU timer interrupt. //! //! \param base is the base address of the timer module. //! //! This function enables the CPU timer interrupt. //! //! \return None. // //***************************************************************************** void CPUTimer_enableInterrupt(uint32_t base) { uint16_t tcrValue = 0; do { if(!(CPUTimer_isBaseValid(base))) { __error__("../device/driverlib/cputimer.c", 401); } } while((_Bool)0); // // Set TIE bit of TCR register // tcrValue = (*((V_UI_16*)(base + 0x4U))) & (~0x8000U); (*((V_UI_16*)(base + 0x4U))) = tcrValue | 0x4000U; } //***************************************************************************** // // CPUTimer_setEmulationMode // //***************************************************************************** void CPUTimer_setEmulationMode(UI_32 base, CPUTimer_EmulationMode mode) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("../device/driverlib/cputimer.c", 416); } } while((_Bool)0); // // Write to FREE_SOFT bits of register TCR // (*((V_UI_16*)(base + 0x4U))) = ((*((V_UI_16*)(base + 0x4U))) & ~(0x800U | 0x400U)) | (uint16_t)mode; }