/******************************************************************************* * KACO new energy GmbH * (c) Gottfried-Leibniz-Str. 1, D-74172 Neckarsulm, Germany ******************************************************************************** * Project Powador xxTL1 controller ****************************************************************************//** * \brief CLA task file * * This file contains the tasks for the CLA coprocessor. ******************************************************************************** * \file cla_tasks.c ******************************************************************************** * \todo *******************************************************************************/ /*********** * Pragmas * ***********/ /*********** * Includes * ***********/ // Include shared variables (with types supported by CLA) //########################################################################### // // FILE: F2837xD_Cla_defines.h // // TITLE: #defines used in CLA examples // //########################################################################### // $TI Release: F2837xD Support Library v170 $ // $Release Date: Mon Sep 21 16:52:10 CDT 2015 $ // $Copyright: Copyright (C) 2013-2015 Texas Instruments Incorporated - // http://www.ti.com/ ALL RIGHTS RESERVED $ //########################################################################### // MCTL Register //========================== // MMEMCFG Register //========================== // MIER Interrupt Enable Register //========================== // Peripheral Interrupt Source Select define for DMAnCLASourceSelect Register //=========================================================================== //--------------------------------------------------------------------------- // Useful CLA Operation Macros: //================================ //=========================================================================== // End of file. //=========================================================================== //########################################################################### // // FILE: F2837xD_Cla_typedefs.h // // TITLE: Variable type definitions // //########################################################################### // $TI Release: F2837xD Support Library v170 $ // $Release Date: Mon Sep 21 16:52:10 CDT 2015 $ // $Copyright: Copyright (C) 2013-2015 Texas Instruments Incorporated - // http://www.ti.com/ ALL RIGHTS RESERVED $ //########################################################################### // Macros to manipulate pre-processor to generate a header file name // at compile time that is based on the test name and can be used as // an argument to #include // Suppress warnings casting CLA pointers #pragma diag_suppress 70,770,232 //--------------------------------------------------------------------------- // For Portability, User Is Recommended To Use Following Data Type Size // Definitions For 16-bit and 32-Bit Signed/Unsigned Integers: // // CLA does not support 64-bit types // This definition is only to allow inclusion of the standard header files // which do use 64-bit types // typedef short int16; typedef long int32; typedef unsigned char Uint8; typedef unsigned short Uint16; typedef unsigned long Uint32; typedef float float32; typedef long double float64; typedef struct { Uint32 low32; Uint32 high32; } Uint64; typedef struct { int32 low32; int32 high32; } int64; /* * These types are also defined in DSP/BIOS 5.x's and the * SYS/BIOS 6.x's files. We need to protect their * definition with the #ifndef/#define guard to avoid the duplicate * definition warning. * * SYS/BIOS requires that the file be included before * any other .h files. */ struct MSTF_SHADOW_BITS { // bits description Uint16 LVF:1; // 0 Latched Overflow Flag Uint16 LUF:1; // 1 Latched Underflow Flag Uint16 NF:1; // 2 Negative Float Flag Uint16 ZF:1; // 3 Zero Float Flag Uint16 rsvd1:2; // 5:4 Reserved Uint16 TF:1; // 6 Test Flag Uint16 rsvd2:2; // 8:7 Reserved Uint16 RNDF32:1; // 9 Rounding Mode Uint16 rsvd3:1; // 10 Reserved Uint16 MEALLOW:1; // 11 MEALLOW Status Uint16 RPCL:4; // 15:12 Return PC: Low Portion Uint16 RPCH:8; // 23:16 Return PC: High Portion Uint16 rsvd4:8; // 31:24 Reserved }; extern __cregister volatile unsigned int MSTF; //############################################################################# // // FILE: CLAmath.h // // DESCRIPTION: CLA Math Library Prototypes // // Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ // ALL RIGHTS RESERVED //############################################################################# //$TI Release: CLA Math Library V4.02.00.00 $ //$Release Date: Oct 3, 2016 $ //############################################################################# //########################################################################### // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //########################################################################### //########################################################################### // // Macro Definitions // //########################################################################### //########################################################################### // // Structures, variables and typedefs. // //########################################################################### //CLASinCosTable Variables extern float CLAsincosTable[]; extern float CLAsinTable[]; extern float *CLAsincosTable_Sin0; extern float CLAcosTable[]; extern float *CLAsincosTable_Cos0; extern float *CLAsinTableEnd; extern float *CLAcosTableEnd; extern float *CLAsincosTableEnd; extern float CLAsincosTable_TABLE_SIZE; extern float CLAsincosTable_TABLE_SIZEDivTwoPi; extern float CLAsincosTable_TwoPiDivTABLE_SIZE; extern float CLAsincosTable_TABLE_MASK; extern float CLAsincosTable_Coef0; extern float CLAsincosTable_Coef1; extern float CLAsincosTable_Coef1_pos; extern float CLAsincosTable_Coef2; extern float CLAsincosTable_Coef3; extern float CLAsincosTable_Coef3_neg; //CLAatanTable Variables extern float CLAatan2HalfPITable[]; extern float CLAatan2Table[]; extern float *CLAatan2TableEnd; extern float *CLAINV2PI; //CLAacosineTable Variables extern float CLAacosinHalfPITable[]; extern float CLAacosinTable[]; extern float *CLAacosinTableEnd; //CLAasineTable Variables extern float CLAasinHalfPITable[]; extern float CLAasinTable[]; extern float *CLAasinTableEnd; //CLAexpTable Variables extern float CLAINV1,CLAINV2,CLAINV3,CLAINV4; extern float CLAINV5,CLAINV6,CLAINV7,CLALOG10; extern float CLAExpTable[]; extern float *CLAExpTableEnd; //CLAlnTable Variables extern float CLALNV2,CLALNVe,CLALNV10,CLABIAS; extern long CLALN_TABLE_MASK1,CLALN_TABLE_MASK2; extern float CLALnTable[]; extern float *CLALnTableEnd; //Linker Defined variables extern unsigned int _cla_scratchpad_start; extern unsigned int _cla_scratchpad_end; //########################################################################### // // Function Prototypes // //########################################################################### extern float CLAacos( float fVal ); extern float CLAacos_spc( float fVal ); extern float CLAasin( float fVal ); extern float CLAatan( float fVal ); extern float CLAatan2( float fVal1, float fVal2 ); extern float CLAatan2PU( float fVal1, float fVal2 ); extern float CLAcos( float fAngleRad); extern float CLAcosPU( float fAngleRadPU ); extern float CLAdiv( float fNum, float fDen); extern float CLAexp( float fVal); extern float CLAexp10( float fVal); extern float CLAexp2( float fNum, float fDen ); extern float CLAisqrt( float fVal ); extern float CLAln( float fVal); extern float CLAlog10( float fVal); extern float CLAsin( float fAngleRad ); extern float CLAsinPU( float fAngleRadPU ); extern float CLAsqrt( float fVal); extern void CLAsincos(float fAngleRad, float *y_sin, float *y_cos); extern float CLAexpN(float fVal, float N); extern float CLAlogN(float fVal, float N); //########################################################################### // //End of the C bindings section for C++ compilers. // //########################################################################### static float Phi; static float sin; static float cos; interrupt void Cla1Task1(void) { Phi += 0.1; if (Phi >= (2*3.14)) { Phi = 0; } CLAsincos(Phi, &sin, &cos); } /** * \fn interrupt void Cla1Task2(void) * * \brief Function for CLA task 2 - Control task * */ interrupt void Cla1Task2(void) { } /** * \fn interrupt void Cla1Task3(void) * * \brief Function for CLA task 3. */ interrupt void Cla1Task3(void) { // __mdebugstop(); } /** * \fn interrupt void Cla1Task4(void) * * \brief Function for CLA task 4. */ interrupt void Cla1Task4(void) { // Nothing to do } /** * \fn interrupt void Cla1Task5(void) * * \brief Function for CLA task 5. */ interrupt void Cla1Task5(void) { // Nothing to do } /** * \fn interrupt void Cla1Task6(void) * * \brief Function for CLA task 6. */ interrupt void Cla1Task6(void) { } /** * \fn interrupt void Cla1Task7(void) * * \brief Function for CLA task 7. */ interrupt void Cla1Task7(void) { } /** * \fn interrupt void Cla1Task8(void) * * \brief Function for CLA task 8. * initialize all cla vars */ interrupt void Cla1Task8(void) { //__mdebugstop(); // Das Ist Breakpoint für Debugger // Set rounding mode (spruge6b page 30) //the MMPYF32, MADDF32 and MSUBF32 instructions will round to the nearest even value __asm(" MSETFLG RNDF32=1") ; //__mdebugstop(); // Das Ist Breakpoint für Debugger } /* * EOF */