//########################################################################### // // FILE: upp.h // // TITLE: C28x uPP driver. // //########################################################################### // // // $Copyright: // Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### #ifndef UPP_H #define UPP_H //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** #ifdef __cplusplus extern "C" { #endif //***************************************************************************** // //! \addtogroup upp_api UPP //! @{ // //***************************************************************************** #include "inc/hw_memmap.h" #include "inc/hw_types.h" #include "inc/hw_upp.h" #include "cpu.h" #include "debug.h" //***************************************************************************** // // Defines for the API. // //***************************************************************************** //***************************************************************************** // // Defines that can be passed as addr field of UPP_DMADescriptor to // UPP_setDMADescriptor(). Since the addresses for Tx & Rx MSG RAMs are // different for CPU & DMA views, these defines can be used as DMA descriptor // addresses. // //***************************************************************************** #define UPP_DMA_TX_MSGRAM_STARTADDR UPP_TX_MSG_RAM_BASE #define UPP_DMA_RX_MSGRAM_STARTADDR 0x00007000U //***************************************************************************** // // Defines that can be used in user program as start address for CPU/CLA write // to TX MSG RAM for transmitting data & for CPU/CLA read from RX MSG RAM for // receiving data. Since the addresses for Tx & Rx MSG RAMs are different for // CPU & DMA views, these defines can be used for CPU read/writes. // //***************************************************************************** #define UPP_CPU_TX_MSGRAM_STARTADDR UPP_TX_MSG_RAM_BASE #define UPP_CPU_RX_MSGRAM_STARTADDR UPP_RX_MSG_RAM_BASE //***************************************************************************** // // Defines to specify the size of the uPP Tx and Rx MSG RAMs. // //***************************************************************************** #define UPP_TX_MSGRAM_MAX_SIZE 0x200U #define UPP_RX_MSGRAM_MAX_SIZE 0x200U //***************************************************************************** // // Define to specify 32 cycle delay between software reset issue & release in // UPP_performSoftReset(). // //***************************************************************************** #ifndef UPP_32_CYCLE_NOP #define UPP_32_CYCLE_NOP __asm(" RPT #31 || NOP") #endif //***************************************************************************** // // Define to specify mask for setting emulation mode in UPP_setEmulationMode(). // //***************************************************************************** #define UPP_SOFT_FREE_M ((uint16_t)UPP_PERCTL_SOFT | \ (uint16_t)UPP_PERCTL_FREE) //***************************************************************************** // // Defines to specify masks for enabling/disabling uPP Tx/Rx control signals in // UPP_setTxControlSignalMode() & UPP_setRxControlSignalMode() respectively. // //***************************************************************************** #define UPP_TX_SIGNAL_MODE_M UPP_IFCFG_WAITA #define UPP_RX_SIGNAL_MODE_M ((uint16_t)UPP_IFCFG_STARTA | \ (uint16_t)UPP_IFCFG_ENAA) //***************************************************************************** // // Define to specify mask for configuring polarities for uPP control signals // in UPP_setControlSignalPolarity(). // //***************************************************************************** #define UPP_SIGNAL_POLARITY_M ((uint16_t)UPP_IFCFG_WAITPOLA | \ (uint16_t)UPP_IFCFG_ENAPOLA | \ (uint16_t)UPP_IFCFG_STARTPOLA) //***************************************************************************** // // Define to specify masks for returning interrupt status in // UPP_getInterruptStatus() & UPP_getRawInterruptStatus(). // //***************************************************************************** #define UPP_INT_M ((uint16_t)UPP_ENINTST_DPEI | (uint16_t)UPP_ENINTST_UOEI | \ (uint16_t)UPP_ENINTST_EOWI | (uint16_t)UPP_ENINTST_EOLI | \ (uint16_t)UPP_ENINTST_DPEQ | (uint16_t)UPP_ENINTST_UOEQ | \ (uint16_t)UPP_ENINTST_EOWQ | (uint16_t)UPP_ENINTST_EOLQ) //***************************************************************************** // // Values that can be passed to UPP_enableInterrupt(), // UPP_disableInterrupt() and UPP_clearInterruptStatus() as the // intFlags parameter and returned by UPP_getInterruptStatus() & // UPP_getRawInterruptStatus(). // //***************************************************************************** #define UPP_INT_CHI_DMA_PROG_ERR 0x0001U //!