//########################################################################### // // FILE: DSP281x_Device.h // // TITLE: DSP281x Device Definitions. // //########################################################################### // // Ver | dd mmm yyyy | Who | Description of changes // =====|=============|======|=============================================== // 1.00| 11 Sep 2003 | L.H. | Changes since previous version (v.58 Alpha) // | | | Added symbols created by the linker // | | | cmd file for relocating code. // | | | Added float to the datatype typedefs // | | | Added #if DSP28_DATA_TYPES wrapper around the // | | | typedefs // | | | Added DSP28_BIOS and DSP28_NONBIOS switches // | | | to include or not include the default ISR's // | | | Moved files and info specific to the DSP28 examples // | | | to DSP28_common\include\DSP28_Examples.h // | | | Changed F2812 -> DSP28_F2812 // | | | Changed F2810 -> DSP28_F2810 //########################################################################### #ifndef DSP281x_DEVICE_H #define DSP281x_DEVICE_H #ifdef __cplusplus extern "C" { #endif #define TARGET 1 //--------------------------------------------------------------------------- // User To Select Target Device: #define DSP28_F2812 TARGET #define DSP28_F2810 0 //--------------------------------------------------------------------------- // Used for calculating delays in micro-seconds: // //#define CPU_CLOCK_SPEED 8.333L // for a 120MHz CPU clock speed (SYSCLKOUT) #define CPU_CLOCK_SPEED 6.6667L // for a 150MHz CPU clock speed //#define CPU_CLOCK_SPEED 10.000L // for a 100MHz CPU clock speed (SYSCLKOUT) //#define CPU_CLOCK_SPEED 13.330L // for a 75MHz CPU clock speed (SYSCLKOUT) //#define CPU_CLOCK_SPEED 20.000L // for a 50MHz CPU clock speed (SYSCLKOUT) //#define CPU_CLOCK_SPEED 33.333L // for a 30MHz CPU clock speed (SYSCLKOUT) //#define CPU_CLOCK_SPEED 41.667L // for a 24MHz CPU clock speed (SYSCLKOUT) //#define CPU_CLOCK_SPEED 50.000L // for a 20MHz CPU clock speed (SYSCLKOUT) //#define CPU_CLOCK_SPEED 66.667L // for a 15MHz CPU clock speed (SYSCLKOUT) //#define CPU_CLOCK_SPEED 100.000L // for a 10MHz CPU clock speed (SYSCLKOUT) #define CPU_FREQ 150E6 #define PWM_FREQ 4E3 // samplingrate des ADC #define PWM_PRD CPU_FREQ/PWM_FREQ // for HSPCP = 0, TPS = 0 hiermit wird die samplinrate der ADC eingestellt #define TRUE 1 #define FALSE 0 #define DELAY_US(A) DSP28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_CLOCK_SPEED) - 9.0L) / 5.0L) //---------------------------------------------------------------------------- // BRR = (LSPCLK/(SCI ABUD*8))-1 if BRR =0 LBAUDRATE=LSPCKL/16 // for 9600 BRR =487 wird weiter BAUDRATE gennant //#define BRR_BAUDRATE 1952// Baudrate 2400 (2400)for LSPCLK 37.5 (SYSCLKOUT/4) //#define BRR_BAUDRATE 976 // Baudrate 4800 (4798)for LSPCLK 37.5 (SYSCLKOUT/4) //#define BRR_BAUDRATE 487 //324 Baudrate 9600 (9606)for LSPCLK 37.5 (SYSCLKOUT/4) //#define BRR_BAUDRATE 243 // Baudrate 19200 (19211)for LSPCLK 37.5 (SYSCLKOUT/4) //#define BRR_BAUDRATE 121 // Baudrate 38400 (38422) for LSPCLK 37.5 (SYSCLKOUT/4) //#define BRR_BAUDRATE 80 // Baudrate 57600 (57870) for LSPCLK 37.5 (SYSCLKOUT/4) #define BRR_BAUDRATE 40 // Baudrate 115200 (114329) for LSPCLK 37.5 (SYSCLKOUT/4) //#define BRR_BAUDRATE 19 // Baudrate 230400 (234375) for LSPCLK 37.5 (SYSCLKOUT/4) //#define BRR_BAUDRATE 9 // Baudrate 460800 (468750) for LSPCLK 37.5 (SYSCLKOUT/4) //--------------------------------------------------------------------------- // Common CPU Definitions: // extern cregister volatile unsigned int IFR; extern cregister volatile unsigned int IER; #define EINT asm(" clrc INTM") #define DINT asm(" setc INTM") #define ERTM asm(" clrc DBGM") #define DRTM asm(" setc DBGM") #define EALLOW asm(" EALLOW") #define EDIS asm(" EDIS") #define ESTOP0 asm(" ESTOP0") #define M_INT1 0x0001 #define M_INT2 0x0002 #define M_INT3 0x0004 #define M_INT4 0x0008 #define M_INT5 0x0010 #define M_INT6 0x0020 #define M_INT7 0x0040 #define M_INT8 0x0080 #define M_INT9 0x0100 #define M_INT10 0x0200 #define M_INT11 0x0400 #define M_INT12 0x0800 #define M_INT13 0x1000 #define M_INT14 0x2000 #define M_DLOG 0x4000 #define M_RTOS 0x8000 #define BIT0 0x0001 #define BIT1 0x0002 #define BIT2 0x0004 #define BIT3 0x0008 #define BIT4 0x0010 #define BIT5 0x0020 #define BIT6 0x0040 #define BIT7 0x0080 #define BIT8 0x0100 #define BIT9 0x0200 #define BIT10 0x0400 #define BIT11 0x0800 #define BIT12 0x1000 #define BIT13 0x2000 #define BIT14 0x4000 #define BIT15 0x8000 //=========================================================================== // Select SPI Device to communicate with //=========================================================================== // For Duenne Schichten Projekt //********* Channel 1 ************** #define Sensor11 0 #define Sensor12 1 #define Sensor13 2 #define TempSens1 3 #define ITempSens1 4 #define ISensor1 5 //********* Channel 2 ************** #define Sensor21 6 #define Sensor22 7 #define Sensor23 8 #define TempSens2 9 #define ITempSens2 10 #define ISensor2 11 //********* Analog Channels ********** #define AnalogSensor1 12 #define AnalogSenosr2 13 #define AnalogSensor3 14 //********* Channel 3 ************** #define Sensor31 15 #define Sensor32 16 #define Sensor33 17 #define TempSens3 18 #define ITempSens3 19 #define ISensor3 20 //-------------------------------------------------------------------------- //--------------------------------------------------------------------------- // For Portability, User Is Recommended To Use Following Data Type Size // Definitions For 16-bit and 32-Bit Signed/Unsigned Integers: // #ifndef DSP28_DATA_TYPES #define DSP28_DATA_TYPES typedef int int16; typedef long int32; typedef unsigned int Uint16; typedef unsigned long Uint32; typedef float float32; typedef long double float64; #endif #ifndef BYTE #define WORD unsigned int #define BYTE unsigned char #endif #define True 1 #define False 0 //--------------------------------------------------------------------------- // Include All Peripheral Header Files: // #include #include "DSP281x_GlobalPrototypes.h" // Prototypes for global functions within the // .c files. #include "DSP281x_SysCtrl.h" // System Control/Power Modes #include "DSP281x_DevEmu.h" // Device Emulation Registers #include "DSP281x_Xintf.h" // External Interface Registers #include "DSP281x_CpuTimers.h" // 32-bit CPU Timers #include "DSP281x_PieCtrl.h" // PIE Control Registers #include "DSP281x_PieVect.h" // PIE Vector Table #include "DSP281x_DefaultIsr.h" // Software Prioritization for PIE Interrupts #include "DSP281x_SWPrioritizedIsrLevels.h" // Used for Software Prioritization of ISR's #include "DSP281x_Sci.h" // SCI Registers #include "DSP281x_Spi.h" // SPI Registers #include "DSP281x_Mcbsp.h" // McBSP Registers #include "DSP281x_ECan.h" // Enhanced eCAN Registers #include "DSP281x_Gpio.h" // General Purpose I/O Registers #include "DSP281x_Ev.h" // Event Manager Registers #include "DSP281x_Adc.h" // ADC Registers #include "ADCcalibrationDriver.h" #include "DSP281x_XIntrupt.h" // External Interrupts #include "Tools_Modul.h" #ifdef __cplusplus } #endif /* extern "C" */ typedef enum { enStop, enStart // enRunAD } enRUN_MODES ; typedef struct { Uint16 DA_Values[21]; Uint16 AD_Einstellen[12]; Uint16 AD_Arbeitspunkt[12]; enRUN_MODES enRunMode; Uint16 MaxConversion; WORD wCRC; Uint16 ChannelNumber; Uint16 MeanAnzahlAD; Uint16 MeanMaxAnzahlAD; Uint16 MeanOld[3]; Uint16 KoefRegler[3]; // Flags Uint16 KompensationFlag; Uint16 MeanFlag1; Uint16 MeanFlag2; Uint16 MeanFlag3; Uint16 ConvFlag; Uint16 SaveDataFlag; float MeanCurrent[3]; float SensorKoeff[3]; } ST_SystemParameter; extern ST_SystemParameter gSYS; #endif // end of DSP281x_DEVICE_H definition //=========================================================================== // No more. //===========================================================================