first commit
This commit is contained in:
99
Lib/Src/DSP2833x_Adc.c
Normal file
99
Lib/Src/DSP2833x_Adc.c
Normal file
@@ -0,0 +1,99 @@
|
||||
// TI File $Revision: /main/5 $
|
||||
// Checkin $Date: October 23, 2007 13:34:09 $
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: DSP2833x_Adc.c
|
||||
//
|
||||
// TITLE: DSP2833x ADC Initialization & Support Functions.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: 2833x/2823x Header Files V1.32 $
|
||||
// $Release Date: June 28, 2010 $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2009-2024 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.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
|
||||
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define ADC_usDELAY 5000L
|
||||
|
||||
//
|
||||
// InitAdc - This function initializes ADC to a known state.
|
||||
//
|
||||
void
|
||||
InitAdc(void)
|
||||
{
|
||||
extern void DSP28x_usDelay(Uint32 Count);
|
||||
|
||||
//
|
||||
// *IMPORTANT*
|
||||
// The ADC_cal function, which copies the ADC calibration values from
|
||||
// TI reserved OTP into the ADCREFSEL and ADCOFFTRIM registers, occurs
|
||||
// automatically in the Boot ROM. If the boot ROM code is bypassed during
|
||||
// the debug process, the following function MUST be called for the ADC to
|
||||
// function according to specification. The clocks to the ADC MUST be
|
||||
// enabled before calling this function. See the device data manual and/or
|
||||
// the ADC Reference Manual for more information.
|
||||
//
|
||||
EALLOW;
|
||||
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1;
|
||||
ADC_cal();
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// To powerup the ADC the ADCENCLK bit should be set first to enable
|
||||
// clocks, followed by powering up the bandgap, reference circuitry, and
|
||||
// ADC core. Before the first conversion is performed a 5ms delay must be
|
||||
// observed after power up to give all analog circuits time to power up
|
||||
// and settle
|
||||
//
|
||||
|
||||
//
|
||||
// Please note that for the delay function below to operate correctly the
|
||||
// CPU_RATE define statement in the DSP2833x_Examples.h file must
|
||||
// contain the correct CPU clock period in nanoseconds.
|
||||
//
|
||||
AdcRegs.ADCTRL3.all = 0x00E0; // Power up bandgap/reference/ADC circuits
|
||||
DELAY_US(ADC_usDELAY); // Delay before converting ADC channels
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
|
||||
199
Lib/Src/DSP2833x_CpuTimers.c
Normal file
199
Lib/Src/DSP2833x_CpuTimers.c
Normal file
@@ -0,0 +1,199 @@
|
||||
// TI File $Revision: /main/4 $
|
||||
// Checkin $Date: July 9, 2009 10:51:59 $
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: DSP2833x_CpuTimers.c
|
||||
//
|
||||
// TITLE: CPU 32-bit Timers Initialization & Support Functions.
|
||||
//
|
||||
// NOTES: CpuTimer2 is reserved for use with DSP BIOS and
|
||||
// other realtime operating systems.
|
||||
//
|
||||
// Do not use these this timer in your application if you ever plan
|
||||
// on integrating DSP-BIOS or another realtime OS.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: 2833x/2823x Header Files V1.32 $
|
||||
// $Release Date: June 28, 2010 $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2009-2024 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.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "DSP2833x_Device.h" // Headerfile Include File
|
||||
#include "DSP2833x_Examples.h" // Examples Include File
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
struct CPUTIMER_VARS CpuTimer0;
|
||||
|
||||
//
|
||||
// When using DSP BIOS & other RTOS, comment out CPU Timer 2 code.
|
||||
//
|
||||
struct CPUTIMER_VARS CpuTimer1;
|
||||
struct CPUTIMER_VARS CpuTimer2;
|
||||
|
||||
//
|
||||
// InitCpuTimers - This function initializes all three CPU timers to a known
|
||||
// state.
|
||||
//
|
||||
void
|
||||
InitCpuTimers(void)
|
||||
{
|
||||
//
|
||||
// CPU Timer 0 - Initialize address pointers to respective timer registers
|
||||
//
|
||||
CpuTimer0.RegsAddr = &CpuTimer0Regs;
|
||||
|
||||
//
|
||||
// Initialize timer period to maximum
|
||||
//
|
||||
CpuTimer0Regs.PRD.all = 0xFFFFFFFF;
|
||||
|
||||
//
|
||||
// Initialize pre-scale counter to divide by 1 (SYSCLKOUT)
|
||||
//
|
||||
CpuTimer0Regs.TPR.all = 0;
|
||||
CpuTimer0Regs.TPRH.all = 0;
|
||||
|
||||
//
|
||||
// Make sure timer is stopped
|
||||
//
|
||||
CpuTimer0Regs.TCR.bit.TSS = 1;
|
||||
|
||||
//
|
||||
// Reload all counter register with period value
|
||||
//
|
||||
CpuTimer0Regs.TCR.bit.TRB = 1;
|
||||
|
||||
//
|
||||
// Reset interrupt counters
|
||||
//
|
||||
CpuTimer0.InterruptCount = 0;
|
||||
|
||||
//
|
||||
// CpuTimer2 is reserved for DSP BIOS & other RTOS
|
||||
// Do not use this timer if you ever plan on integrating
|
||||
// DSP-BIOS or another realtime OS.
|
||||
//
|
||||
|
||||
//
|
||||
// Initialize address pointers to respective timer registers
|
||||
//
|
||||
CpuTimer1.RegsAddr = &CpuTimer1Regs;
|
||||
CpuTimer2.RegsAddr = &CpuTimer2Regs;
|
||||
|
||||
//
|
||||
// Initialize timer period to maximum
|
||||
//
|
||||
CpuTimer1Regs.PRD.all = 0xFFFFFFFF;
|
||||
CpuTimer2Regs.PRD.all = 0xFFFFFFFF;
|
||||
|
||||
//
|
||||
// Make sure timers are stopped
|
||||
//
|
||||
CpuTimer1Regs.TCR.bit.TSS = 1;
|
||||
CpuTimer2Regs.TCR.bit.TSS = 1;
|
||||
|
||||
//
|
||||
// Reload all counter register with period value
|
||||
//
|
||||
CpuTimer1Regs.TCR.bit.TRB = 1;
|
||||
CpuTimer2Regs.TCR.bit.TRB = 1;
|
||||
|
||||
//
|
||||
// Reset interrupt counters
|
||||
//
|
||||
CpuTimer1.InterruptCount = 0;
|
||||
CpuTimer2.InterruptCount = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// ConfigCpuTimer - This function initializes the selected timer to the period
|
||||
// specified by the "Freq" and "Period" parameters. The "Freq" is entered as
|
||||
// "MHz" and the period in "uSeconds". The timer is held in the stopped state
|
||||
// after configuration.
|
||||
//
|
||||
void
|
||||
ConfigCpuTimer(struct CPUTIMER_VARS *Timer, float Freq, float Period)
|
||||
{
|
||||
Uint32 temp;
|
||||
|
||||
//
|
||||
// Initialize timer period
|
||||
//
|
||||
Timer->CPUFreqInMHz = Freq;
|
||||
Timer->PeriodInUSec = Period;
|
||||
temp = (long) (Freq * Period);
|
||||
|
||||
//
|
||||
// Counter decrements PRD+1 times each period
|
||||
//
|
||||
Timer->RegsAddr->PRD.all = temp - 1;
|
||||
|
||||
//
|
||||
// Set pre-scale counter to divide by 1 (SYSCLKOUT)
|
||||
//
|
||||
Timer->RegsAddr->TPR.all = 0;
|
||||
Timer->RegsAddr->TPRH.all = 0;
|
||||
|
||||
//
|
||||
// Initialize timer control register
|
||||
//
|
||||
|
||||
//
|
||||
// 1 = Stop timer, 0 = Start/Restart Timer
|
||||
//
|
||||
Timer->RegsAddr->TCR.bit.TSS = 1;
|
||||
|
||||
Timer->RegsAddr->TCR.bit.TRB = 1; // 1 = reload timer
|
||||
Timer->RegsAddr->TCR.bit.SOFT = 1;
|
||||
Timer->RegsAddr->TCR.bit.FREE = 1; // Timer Free Run
|
||||
|
||||
//
|
||||
// 0 = Disable/ 1 = Enable Timer Interrupt
|
||||
//
|
||||
Timer->RegsAddr->TCR.bit.TIE = 1;
|
||||
|
||||
//
|
||||
// Reset interrupt counter
|
||||
//
|
||||
Timer->InterruptCount = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// End of File
|
||||
//
|
||||
|
||||
2024
Lib/Src/DSP2833x_DefaultIsr.c
Normal file
2024
Lib/Src/DSP2833x_DefaultIsr.c
Normal file
File diff suppressed because it is too large
Load Diff
407
Lib/Src/DSP2833x_GlobalVariableDefs.c
Normal file
407
Lib/Src/DSP2833x_GlobalVariableDefs.c
Normal file
@@ -0,0 +1,407 @@
|
||||
// TI File $Revision: /main/4 $
|
||||
// Checkin $Date: June 2, 2008 11:12:33 $
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: DSP2833x_GlobalVariableDefs.c
|
||||
//
|
||||
// TITLE: DSP2833x Global Variables and Data Section Pragmas.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: 2833x/2823x Header Files V1.32 $
|
||||
// $Release Date: June 28, 2010 $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2009-2024 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.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
|
||||
|
||||
//
|
||||
// Define Global Peripheral Variables
|
||||
//
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("AdcRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(AdcRegs,"AdcRegsFile");
|
||||
#endif
|
||||
volatile struct ADC_REGS AdcRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("AdcMirrorFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(AdcMirror,"AdcMirrorFile");
|
||||
#endif
|
||||
volatile struct ADC_RESULT_MIRROR_REGS AdcMirror;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("CpuTimer0RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(CpuTimer0Regs,"CpuTimer0RegsFile");
|
||||
#endif
|
||||
volatile struct CPUTIMER_REGS CpuTimer0Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("CpuTimer1RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(CpuTimer1Regs,"CpuTimer1RegsFile");
|
||||
#endif
|
||||
volatile struct CPUTIMER_REGS CpuTimer1Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("CpuTimer2RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(CpuTimer2Regs,"CpuTimer2RegsFile");
|
||||
#endif
|
||||
volatile struct CPUTIMER_REGS CpuTimer2Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("CsmPwlFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(CsmPwl,"CsmPwlFile");
|
||||
#endif
|
||||
volatile struct CSM_PWL CsmPwl;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("CsmRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(CsmRegs,"CsmRegsFile");
|
||||
#endif
|
||||
volatile struct CSM_REGS CsmRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("DevEmuRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(DevEmuRegs,"DevEmuRegsFile");
|
||||
#endif
|
||||
volatile struct DEV_EMU_REGS DevEmuRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("DmaRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(DmaRegs,"DmaRegsFile");
|
||||
#endif
|
||||
volatile struct DMA_REGS DmaRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanaRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanaRegs,"ECanaRegsFile");
|
||||
#endif
|
||||
volatile struct ECAN_REGS ECanaRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanaMboxesFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanaMboxes,"ECanaMboxesFile");
|
||||
#endif
|
||||
volatile struct ECAN_MBOXES ECanaMboxes;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanaLAMRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanaLAMRegs,"ECanaLAMRegsFile");
|
||||
#endif
|
||||
volatile struct LAM_REGS ECanaLAMRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanaMOTSRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanaMOTSRegs,"ECanaMOTSRegsFile");
|
||||
#endif
|
||||
volatile struct MOTS_REGS ECanaMOTSRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanaMOTORegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanaMOTORegs,"ECanaMOTORegsFile");
|
||||
#endif
|
||||
volatile struct MOTO_REGS ECanaMOTORegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanbRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanbRegs,"ECanbRegsFile");
|
||||
#endif
|
||||
volatile struct ECAN_REGS ECanbRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanbMboxesFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanbMboxes,"ECanbMboxesFile");
|
||||
#endif
|
||||
volatile struct ECAN_MBOXES ECanbMboxes;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanbLAMRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanbLAMRegs,"ECanbLAMRegsFile");
|
||||
#endif
|
||||
volatile struct LAM_REGS ECanbLAMRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanbMOTSRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanbMOTSRegs,"ECanbMOTSRegsFile");
|
||||
#endif
|
||||
volatile struct MOTS_REGS ECanbMOTSRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECanbMOTORegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECanbMOTORegs,"ECanbMOTORegsFile");
|
||||
#endif
|
||||
volatile struct MOTO_REGS ECanbMOTORegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("EPwm1RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(EPwm1Regs,"EPwm1RegsFile");
|
||||
#endif
|
||||
volatile struct EPWM_REGS EPwm1Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("EPwm2RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(EPwm2Regs,"EPwm2RegsFile");
|
||||
#endif
|
||||
volatile struct EPWM_REGS EPwm2Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("EPwm3RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(EPwm3Regs,"EPwm3RegsFile");
|
||||
#endif
|
||||
volatile struct EPWM_REGS EPwm3Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("EPwm4RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(EPwm4Regs,"EPwm4RegsFile");
|
||||
#endif
|
||||
volatile struct EPWM_REGS EPwm4Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("EPwm5RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(EPwm5Regs,"EPwm5RegsFile");
|
||||
#endif
|
||||
volatile struct EPWM_REGS EPwm5Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("EPwm6RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(EPwm6Regs,"EPwm6RegsFile");
|
||||
#endif
|
||||
volatile struct EPWM_REGS EPwm6Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECap1RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECap1Regs,"ECap1RegsFile");
|
||||
#endif
|
||||
volatile struct ECAP_REGS ECap1Regs;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECap2RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECap2Regs,"ECap2RegsFile");
|
||||
#endif
|
||||
volatile struct ECAP_REGS ECap2Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECap3RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECap3Regs,"ECap3RegsFile");
|
||||
#endif
|
||||
volatile struct ECAP_REGS ECap3Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECap4RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECap4Regs,"ECap4RegsFile");
|
||||
#endif
|
||||
volatile struct ECAP_REGS ECap4Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECap5RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECap5Regs,"ECap5RegsFile");
|
||||
#endif
|
||||
volatile struct ECAP_REGS ECap5Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ECap6RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ECap6Regs,"ECap6RegsFile");
|
||||
#endif
|
||||
volatile struct ECAP_REGS ECap6Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("EQep1RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(EQep1Regs,"EQep1RegsFile");
|
||||
#endif
|
||||
volatile struct EQEP_REGS EQep1Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("EQep2RegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(EQep2Regs,"EQep2RegsFile");
|
||||
#endif
|
||||
volatile struct EQEP_REGS EQep2Regs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("GpioCtrlRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(GpioCtrlRegs,"GpioCtrlRegsFile");
|
||||
#endif
|
||||
volatile struct GPIO_CTRL_REGS GpioCtrlRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("GpioDataRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(GpioDataRegs,"GpioDataRegsFile");
|
||||
#endif
|
||||
volatile struct GPIO_DATA_REGS GpioDataRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("GpioIntRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(GpioIntRegs,"GpioIntRegsFile");
|
||||
#endif
|
||||
volatile struct GPIO_INT_REGS GpioIntRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("I2caRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(I2caRegs,"I2caRegsFile");
|
||||
#endif
|
||||
volatile struct I2C_REGS I2caRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("McbspaRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(McbspaRegs,"McbspaRegsFile");
|
||||
#endif
|
||||
volatile struct MCBSP_REGS McbspaRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("McbspbRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(McbspbRegs,"McbspbRegsFile");
|
||||
#endif
|
||||
volatile struct MCBSP_REGS McbspbRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("PartIdRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(PartIdRegs,"PartIdRegsFile");
|
||||
#endif
|
||||
volatile struct PARTID_REGS PartIdRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("PieCtrlRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(PieCtrlRegs,"PieCtrlRegsFile");
|
||||
#endif
|
||||
volatile struct PIE_CTRL_REGS PieCtrlRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("PieVectTableFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(PieVectTable,"PieVectTableFile");
|
||||
#endif
|
||||
volatile struct PIE_VECT_TABLE PieVectTable;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("SciaRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(SciaRegs,"SciaRegsFile");
|
||||
#endif
|
||||
volatile struct SCI_REGS SciaRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ScibRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ScibRegs,"ScibRegsFile");
|
||||
#endif
|
||||
volatile struct SCI_REGS ScibRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("ScicRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(ScicRegs,"ScicRegsFile");
|
||||
#endif
|
||||
volatile struct SCI_REGS ScicRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("SpiaRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(SpiaRegs,"SpiaRegsFile");
|
||||
#endif
|
||||
volatile struct SPI_REGS SpiaRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("SysCtrlRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(SysCtrlRegs,"SysCtrlRegsFile");
|
||||
#endif
|
||||
volatile struct SYS_CTRL_REGS SysCtrlRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("FlashRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(FlashRegs,"FlashRegsFile");
|
||||
#endif
|
||||
volatile struct FLASH_REGS FlashRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("XIntruptRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(XIntruptRegs,"XIntruptRegsFile");
|
||||
#endif
|
||||
volatile struct XINTRUPT_REGS XIntruptRegs;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#pragma DATA_SECTION("XintfRegsFile")
|
||||
#else
|
||||
#pragma DATA_SECTION(XintfRegs,"XintfRegsFile");
|
||||
#endif
|
||||
volatile struct XINTF_REGS XintfRegs;
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
|
||||
126
Lib/Src/DSP2833x_PieCtrl.c
Normal file
126
Lib/Src/DSP2833x_PieCtrl.c
Normal file
@@ -0,0 +1,126 @@
|
||||
// TI File $Revision: /main/1 $
|
||||
// Checkin $Date: August 18, 2006 13:46:35 $
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: DSP2833x_PieCtrl.c
|
||||
//
|
||||
// TITLE: DSP2833x Device PIE Control Register Initialization Functions.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: 2833x/2823x Header Files V1.32 $
|
||||
// $Release Date: June 28, 2010 $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2009-2024 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.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
|
||||
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
|
||||
|
||||
//
|
||||
// InitPieCtrl - This function initializes the PIE control registers to a known
|
||||
// state.
|
||||
//
|
||||
void
|
||||
InitPieCtrl(void)
|
||||
{
|
||||
//
|
||||
// Disable Interrupts at the CPU level
|
||||
//
|
||||
DINT;
|
||||
|
||||
//
|
||||
// Disable the PIE
|
||||
//
|
||||
PieCtrlRegs.PIECTRL.bit.ENPIE = 0;
|
||||
|
||||
//
|
||||
// Clear all PIEIER registers
|
||||
//
|
||||
PieCtrlRegs.PIEIER1.all = 0;
|
||||
PieCtrlRegs.PIEIER2.all = 0;
|
||||
PieCtrlRegs.PIEIER3.all = 0;
|
||||
PieCtrlRegs.PIEIER4.all = 0;
|
||||
PieCtrlRegs.PIEIER5.all = 0;
|
||||
PieCtrlRegs.PIEIER6.all = 0;
|
||||
PieCtrlRegs.PIEIER7.all = 0;
|
||||
PieCtrlRegs.PIEIER8.all = 0;
|
||||
PieCtrlRegs.PIEIER9.all = 0;
|
||||
PieCtrlRegs.PIEIER10.all = 0;
|
||||
PieCtrlRegs.PIEIER11.all = 0;
|
||||
PieCtrlRegs.PIEIER12.all = 0;
|
||||
|
||||
//
|
||||
// Clear all PIEIFR registers
|
||||
//
|
||||
PieCtrlRegs.PIEIFR1.all = 0;
|
||||
PieCtrlRegs.PIEIFR2.all = 0;
|
||||
PieCtrlRegs.PIEIFR3.all = 0;
|
||||
PieCtrlRegs.PIEIFR4.all = 0;
|
||||
PieCtrlRegs.PIEIFR5.all = 0;
|
||||
PieCtrlRegs.PIEIFR6.all = 0;
|
||||
PieCtrlRegs.PIEIFR7.all = 0;
|
||||
PieCtrlRegs.PIEIFR8.all = 0;
|
||||
PieCtrlRegs.PIEIFR9.all = 0;
|
||||
PieCtrlRegs.PIEIFR10.all = 0;
|
||||
PieCtrlRegs.PIEIFR11.all = 0;
|
||||
PieCtrlRegs.PIEIFR12.all = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// EnableInterrupts - This function enables the PIE module and CPU interrupts
|
||||
//
|
||||
void
|
||||
EnableInterrupts()
|
||||
{
|
||||
//
|
||||
// Enable the PIE
|
||||
//
|
||||
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
|
||||
|
||||
//
|
||||
// Enables PIE to drive a pulse into the CPU
|
||||
//
|
||||
PieCtrlRegs.PIEACK.all = 0xFFFF;
|
||||
|
||||
//
|
||||
// Enable Interrupts at the CPU level
|
||||
//
|
||||
EINT;
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
|
||||
262
Lib/Src/DSP2833x_PieVect.c
Normal file
262
Lib/Src/DSP2833x_PieVect.c
Normal file
@@ -0,0 +1,262 @@
|
||||
// TI File $Revision: /main/1 $
|
||||
// Checkin $Date: August 18, 2006 13:46:38 $
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: DSP2833x_PieVect.c
|
||||
//
|
||||
// TITLE: DSP2833x Devices PIE Vector Table Initialization Functions.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: 2833x/2823x Header Files V1.32 $
|
||||
// $Release Date: June 28, 2010 $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2009-2024 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.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "DSP2833x_Device.h" // DSP2833x Headerfile Include File
|
||||
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
|
||||
|
||||
const struct PIE_VECT_TABLE PieVectTableInit =
|
||||
{
|
||||
PIE_RESERVED, // 0 Reserved space
|
||||
PIE_RESERVED, // 1 Reserved space
|
||||
PIE_RESERVED, // 2 Reserved space
|
||||
PIE_RESERVED, // 3 Reserved space
|
||||
PIE_RESERVED, // 4 Reserved space
|
||||
PIE_RESERVED, // 5 Reserved space
|
||||
PIE_RESERVED, // 6 Reserved space
|
||||
PIE_RESERVED, // 7 Reserved space
|
||||
PIE_RESERVED, // 8 Reserved space
|
||||
PIE_RESERVED, // 9 Reserved space
|
||||
PIE_RESERVED, // 10 Reserved space
|
||||
PIE_RESERVED, // 11 Reserved space
|
||||
PIE_RESERVED, // 12 Reserved space
|
||||
|
||||
//
|
||||
// Non-Peripheral Interrupts
|
||||
//
|
||||
INT13_ISR, // XINT13 or CPU-Timer 1
|
||||
INT14_ISR, // CPU-Timer2
|
||||
DATALOG_ISR, // Datalogging interrupt
|
||||
RTOSINT_ISR, // RTOS interrupt
|
||||
EMUINT_ISR, // Emulation interrupt
|
||||
NMI_ISR, // Non-maskable interrupt
|
||||
ILLEGAL_ISR, // Illegal operation TRAP
|
||||
USER1_ISR, // User Defined trap 1
|
||||
USER2_ISR, // User Defined trap 2
|
||||
USER3_ISR, // User Defined trap 3
|
||||
USER4_ISR, // User Defined trap 4
|
||||
USER5_ISR, // User Defined trap 5
|
||||
USER6_ISR, // User Defined trap 6
|
||||
USER7_ISR, // User Defined trap 7
|
||||
USER8_ISR, // User Defined trap 8
|
||||
USER9_ISR, // User Defined trap 9
|
||||
USER10_ISR, // User Defined trap 10
|
||||
USER11_ISR, // User Defined trap 11
|
||||
USER12_ISR, // User Defined trap 12
|
||||
|
||||
//
|
||||
// Group 1 PIE Vectors
|
||||
//
|
||||
SEQ1INT_ISR, // 1.1 ADC
|
||||
SEQ2INT_ISR, // 1.2 ADC
|
||||
rsvd_ISR, // 1.3
|
||||
XINT1_ISR, // 1.4
|
||||
XINT2_ISR, // 1.5
|
||||
ADCINT_ISR, // 1.6 ADC
|
||||
TINT0_ISR, // 1.7 Timer 0
|
||||
WAKEINT_ISR, // 1.8 WD, Low Power
|
||||
|
||||
//
|
||||
// Group 2 PIE Vectors
|
||||
//
|
||||
EPWM1_TZINT_ISR, // 2.1 EPWM-1 Trip Zone
|
||||
EPWM2_TZINT_ISR, // 2.2 EPWM-2 Trip Zone
|
||||
EPWM3_TZINT_ISR, // 2.3 EPWM-3 Trip Zone
|
||||
EPWM4_TZINT_ISR, // 2.4 EPWM-4 Trip Zone
|
||||
EPWM5_TZINT_ISR, // 2.5 EPWM-5 Trip Zone
|
||||
EPWM6_TZINT_ISR, // 2.6 EPWM-6 Trip Zone
|
||||
rsvd_ISR, // 2.7
|
||||
rsvd_ISR, // 2.8
|
||||
|
||||
//
|
||||
// Group 3 PIE Vectors
|
||||
//
|
||||
EPWM1_INT_ISR, // 3.1 EPWM-1 Interrupt
|
||||
EPWM2_INT_ISR, // 3.2 EPWM-2 Interrupt
|
||||
EPWM3_INT_ISR, // 3.3 EPWM-3 Interrupt
|
||||
EPWM4_INT_ISR, // 3.4 EPWM-4 Interrupt
|
||||
EPWM5_INT_ISR, // 3.5 EPWM-5 Interrupt
|
||||
EPWM6_INT_ISR, // 3.6 EPWM-6 Interrupt
|
||||
rsvd_ISR, // 3.7
|
||||
rsvd_ISR, // 3.8
|
||||
|
||||
//
|
||||
// Group 4 PIE Vectors
|
||||
//
|
||||
ECAP1_INT_ISR, // 4.1 ECAP-1
|
||||
ECAP2_INT_ISR, // 4.2 ECAP-2
|
||||
ECAP3_INT_ISR, // 4.3 ECAP-3
|
||||
ECAP4_INT_ISR, // 4.4 ECAP-4
|
||||
ECAP5_INT_ISR, // 4.5 ECAP-5
|
||||
ECAP6_INT_ISR, // 4.6 ECAP-6
|
||||
rsvd_ISR, // 4.7
|
||||
rsvd_ISR, // 4.8
|
||||
|
||||
//
|
||||
// Group 5 PIE Vectors
|
||||
//
|
||||
EQEP1_INT_ISR, // 5.1 EQEP-1
|
||||
EQEP2_INT_ISR, // 5.2 EQEP-2
|
||||
rsvd_ISR, // 5.3
|
||||
rsvd_ISR, // 5.4
|
||||
rsvd_ISR, // 5.5
|
||||
rsvd_ISR, // 5.6
|
||||
rsvd_ISR, // 5.7
|
||||
rsvd_ISR, // 5.8
|
||||
|
||||
//
|
||||
// Group 6 PIE Vectors
|
||||
//
|
||||
SPIRXINTA_ISR, // 6.1 SPI-A
|
||||
SPITXINTA_ISR, // 6.2 SPI-A
|
||||
MRINTA_ISR, // 6.3 McBSP-A
|
||||
MXINTA_ISR, // 6.4 McBSP-A
|
||||
MRINTB_ISR, // 6.5 McBSP-B
|
||||
MXINTB_ISR, // 6.6 McBSP-B
|
||||
rsvd_ISR, // 6.7
|
||||
rsvd_ISR, // 6.8
|
||||
|
||||
//
|
||||
// Group 7 PIE Vectors
|
||||
//
|
||||
DINTCH1_ISR, // 7.1 DMA channel 1
|
||||
DINTCH2_ISR, // 7.2 DMA channel 2
|
||||
DINTCH3_ISR, // 7.3 DMA channel 3
|
||||
DINTCH4_ISR, // 7.4 DMA channel 4
|
||||
DINTCH5_ISR, // 7.5 DMA channel 5
|
||||
DINTCH6_ISR, // 7.6 DMA channel 6
|
||||
rsvd_ISR, // 7.7
|
||||
rsvd_ISR, // 7.8
|
||||
|
||||
//
|
||||
// Group 8 PIE Vectors
|
||||
//
|
||||
I2CINT1A_ISR, // 8.1 I2C
|
||||
I2CINT2A_ISR, // 8.2 I2C
|
||||
rsvd_ISR, // 8.3
|
||||
rsvd_ISR, // 8.4
|
||||
SCIRXINTC_ISR, // 8.5 SCI-C
|
||||
SCITXINTC_ISR, // 8.6 SCI-C
|
||||
rsvd_ISR, // 8.7
|
||||
rsvd_ISR, // 8.8
|
||||
|
||||
//
|
||||
// Group 9 PIE Vectors
|
||||
//
|
||||
SCIRXINTA_ISR, // 9.1 SCI-A
|
||||
SCITXINTA_ISR, // 9.2 SCI-A
|
||||
SCIRXINTB_ISR, // 9.3 SCI-B
|
||||
SCITXINTB_ISR, // 9.4 SCI-B
|
||||
ECAN0INTA_ISR, // 9.5 eCAN-A
|
||||
ECAN1INTA_ISR, // 9.6 eCAN-A
|
||||
ECAN0INTB_ISR, // 9.7 eCAN-B
|
||||
ECAN1INTB_ISR, // 9.8 eCAN-B
|
||||
|
||||
//
|
||||
// Group 10 PIE Vectors
|
||||
//
|
||||
rsvd_ISR, // 10.1
|
||||
rsvd_ISR, // 10.2
|
||||
rsvd_ISR, // 10.3
|
||||
rsvd_ISR, // 10.4
|
||||
rsvd_ISR, // 10.5
|
||||
rsvd_ISR, // 10.6
|
||||
rsvd_ISR, // 10.7
|
||||
rsvd_ISR, // 10.8
|
||||
|
||||
//
|
||||
// Group 11 PIE Vectors
|
||||
//
|
||||
rsvd_ISR, // 11.1
|
||||
rsvd_ISR, // 11.2
|
||||
rsvd_ISR, // 11.3
|
||||
rsvd_ISR, // 11.4
|
||||
rsvd_ISR, // 11.5
|
||||
rsvd_ISR, // 11.6
|
||||
rsvd_ISR, // 11.7
|
||||
rsvd_ISR, // 11.8
|
||||
|
||||
//
|
||||
// Group 12 PIE Vectors
|
||||
//
|
||||
XINT3_ISR, // 12.1
|
||||
XINT4_ISR, // 12.2
|
||||
XINT5_ISR, // 12.3
|
||||
XINT6_ISR, // 12.4
|
||||
XINT7_ISR, // 12.5
|
||||
rsvd_ISR, // 12.6
|
||||
LVF_ISR, // 12.7
|
||||
LUF_ISR, // 12.8
|
||||
};
|
||||
|
||||
//
|
||||
// InitPieVectTable - This function initializes the PIE vector table to a known
|
||||
// state. This function must be executed after boot time.
|
||||
//
|
||||
void
|
||||
InitPieVectTable(void)
|
||||
{
|
||||
int16 i;
|
||||
Uint32 *Source = (void *) &PieVectTableInit;
|
||||
volatile Uint32 *Dest = (void *) &PieVectTable;
|
||||
|
||||
EALLOW;
|
||||
for(i=0; i < 128; i++)
|
||||
{
|
||||
*Dest++ = *Source++;
|
||||
}
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Enable the PIE Vector Table
|
||||
//
|
||||
PieCtrlRegs.PIECTRL.bit.ENPIE = 1;
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
|
||||
459
Lib/Src/DSP2833x_SysCtrl.c
Normal file
459
Lib/Src/DSP2833x_SysCtrl.c
Normal file
@@ -0,0 +1,459 @@
|
||||
// TI File $Revision: /main/8 $
|
||||
// Checkin $Date: April 15, 2009 09:54:05 $
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: DSP2833x_SysCtrl.c
|
||||
//
|
||||
// TITLE: DSP2833x Device System Control Initialization & Support Functions.
|
||||
//
|
||||
// DESCRIPTION: Example initialization of system resources.
|
||||
//
|
||||
//###########################################################################
|
||||
// $TI Release: $
|
||||
// $Release Date: $
|
||||
// $Copyright:
|
||||
// Copyright (C) 2009-2024 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.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include "DSP2833x_Device.h" // Headerfile Include File
|
||||
#include "DSP2833x_Examples.h" // Examples Include File
|
||||
|
||||
//
|
||||
// Functions that will be run from RAM need to be assigned to
|
||||
// a different section. This section will then be mapped to a load and
|
||||
// run address using the linker cmd file.
|
||||
//
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 15009000
|
||||
#pragma CODE_SECTION(InitFlash, ".TI.ramfunc");
|
||||
#else
|
||||
#pragma CODE_SECTION(InitFlash, "ramfuncs");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// InitSysCtrl - This function initializes the System Control registers to a
|
||||
// known state.
|
||||
// - Disables the watchdog
|
||||
// - Set the PLLCR for proper SYSCLKOUT frequency
|
||||
// - Set the pre-scaler for the high and low frequency peripheral clocks
|
||||
// - Enable the clocks to the peripherals
|
||||
//
|
||||
void
|
||||
InitSysCtrl(void)
|
||||
{
|
||||
//
|
||||
// Disable the watchdog
|
||||
//
|
||||
DisableDog();
|
||||
|
||||
//
|
||||
// Initialize the PLL control: PLLCR and DIVSEL
|
||||
// DSP28_PLLCR and DSP28_DIVSEL are defined in DSP2833x_Examples.h
|
||||
//
|
||||
InitPll(DSP28_PLLCR,DSP28_DIVSEL);
|
||||
|
||||
//
|
||||
// Initialize the peripheral clocks
|
||||
//
|
||||
InitPeripheralClocks();
|
||||
}
|
||||
|
||||
//
|
||||
// InitFlash - This function initializes the Flash Control registers
|
||||
// CAUTION
|
||||
// This function MUST be executed out of RAM. Executing it
|
||||
// out of OTP/Flash will yield unpredictable results
|
||||
//
|
||||
void
|
||||
InitFlash(void)
|
||||
{
|
||||
EALLOW;
|
||||
|
||||
//
|
||||
// Enable Flash Pipeline mode to improve performance
|
||||
// of code executed from Flash.
|
||||
//
|
||||
FlashRegs.FOPT.bit.ENPIPE = 1;
|
||||
|
||||
//
|
||||
// CAUTION
|
||||
// Minimum waitstates required for the flash operating
|
||||
// at a given CPU rate must be characterized by TI.
|
||||
// Refer to the datasheet for the latest information.
|
||||
//
|
||||
#if CPU_FRQ_150MHZ
|
||||
//
|
||||
// Set the Paged Waitstate for the Flash
|
||||
//
|
||||
FlashRegs.FBANKWAIT.bit.PAGEWAIT = 5;
|
||||
|
||||
//
|
||||
// Set the Random Waitstate for the Flash
|
||||
//
|
||||
FlashRegs.FBANKWAIT.bit.RANDWAIT = 5;
|
||||
|
||||
//
|
||||
// Set the Waitstate for the OTP
|
||||
//
|
||||
FlashRegs.FOTPWAIT.bit.OTPWAIT = 8;
|
||||
#endif
|
||||
|
||||
#if CPU_FRQ_100MHZ
|
||||
//
|
||||
// Set the Paged Waitstate for the Flash
|
||||
//
|
||||
FlashRegs.FBANKWAIT.bit.PAGEWAIT = 3;
|
||||
|
||||
//
|
||||
// Set the Random Waitstate for the Flash
|
||||
//
|
||||
FlashRegs.FBANKWAIT.bit.RANDWAIT = 3;
|
||||
|
||||
//
|
||||
// Set the Waitstate for the OTP
|
||||
//
|
||||
FlashRegs.FOTPWAIT.bit.OTPWAIT = 5;
|
||||
#endif
|
||||
//
|
||||
// CAUTION
|
||||
// ONLY THE DEFAULT VALUE FOR THESE 2 REGISTERS SHOULD BE USED
|
||||
//
|
||||
FlashRegs.FSTDBYWAIT.bit.STDBYWAIT = 0x01FF;
|
||||
FlashRegs.FACTIVEWAIT.bit.ACTIVEWAIT = 0x01FF;
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Force a pipeline flush to ensure that the write to
|
||||
// the last register configured occurs before returning.
|
||||
//
|
||||
asm(" RPT #7 || NOP");
|
||||
}
|
||||
|
||||
//
|
||||
// ServiceDog - This function resets the watchdog timer.
|
||||
// Enable this function for using ServiceDog in the application
|
||||
//
|
||||
void
|
||||
ServiceDog(void)
|
||||
{
|
||||
EALLOW;
|
||||
SysCtrlRegs.WDKEY = 0x0055;
|
||||
SysCtrlRegs.WDKEY = 0x00AA;
|
||||
EDIS;
|
||||
}
|
||||
|
||||
//
|
||||
// DisableDog - This function disables the watchdog timer.
|
||||
//
|
||||
void
|
||||
DisableDog(void)
|
||||
{
|
||||
EALLOW;
|
||||
SysCtrlRegs.WDCR= 0x0068;
|
||||
EDIS;
|
||||
}
|
||||
|
||||
//
|
||||
// InitPll - This function initializes the PLLCR register.
|
||||
//
|
||||
void
|
||||
InitPll(Uint16 val, Uint16 divsel)
|
||||
{
|
||||
//
|
||||
// Make sure the PLL is not running in limp mode
|
||||
//
|
||||
if (SysCtrlRegs.PLLSTS.bit.MCLKSTS != 0)
|
||||
{
|
||||
//
|
||||
// Missing external clock has been detected
|
||||
// Replace this line with a call to an appropriate
|
||||
// SystemShutdown(); function.
|
||||
//
|
||||
asm(" ESTOP0");
|
||||
}
|
||||
|
||||
//
|
||||
// DIVSEL MUST be 0 before PLLCR can be changed from
|
||||
// 0x0000. It is set to 0 by an external reset XRSn
|
||||
// This puts us in 1/4
|
||||
//
|
||||
if (SysCtrlRegs.PLLSTS.bit.DIVSEL != 0)
|
||||
{
|
||||
EALLOW;
|
||||
SysCtrlRegs.PLLSTS.bit.DIVSEL = 0;
|
||||
EDIS;
|
||||
}
|
||||
|
||||
//
|
||||
// Change the PLLCR
|
||||
//
|
||||
if (SysCtrlRegs.PLLCR.bit.DIV != val)
|
||||
{
|
||||
EALLOW;
|
||||
|
||||
//
|
||||
// Before setting PLLCR turn off missing clock detect logic
|
||||
//
|
||||
SysCtrlRegs.PLLSTS.bit.MCLKOFF = 1;
|
||||
SysCtrlRegs.PLLCR.bit.DIV = val;
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Optional: Wait for PLL to lock.
|
||||
// During this time the CPU will switch to OSCCLK/2 until
|
||||
// the PLL is stable. Once the PLL is stable the CPU will
|
||||
// switch to the new PLL value.
|
||||
//
|
||||
// This time-to-lock is monitored by a PLL lock counter.
|
||||
//
|
||||
// Code is not required to sit and wait for the PLL to lock.
|
||||
// However, if the code does anything that is timing critical,
|
||||
// and requires the correct clock be locked, then it is best to
|
||||
// wait until this switching has completed.
|
||||
//
|
||||
|
||||
//
|
||||
// Wait for the PLL lock bit to be set.
|
||||
//
|
||||
|
||||
//
|
||||
// The watchdog should be disabled before this loop, or fed within
|
||||
// the loop via ServiceDog().
|
||||
//
|
||||
|
||||
//
|
||||
// Uncomment to disable the watchdog
|
||||
//
|
||||
DisableDog();
|
||||
|
||||
while(SysCtrlRegs.PLLSTS.bit.PLLLOCKS != 1)
|
||||
{
|
||||
//
|
||||
// Uncomment to service the watchdog
|
||||
//
|
||||
//ServiceDog();
|
||||
}
|
||||
|
||||
EALLOW;
|
||||
SysCtrlRegs.PLLSTS.bit.MCLKOFF = 0;
|
||||
EDIS;
|
||||
}
|
||||
|
||||
//
|
||||
// If switching to 1/2
|
||||
//
|
||||
if((divsel == 1)||(divsel == 2))
|
||||
{
|
||||
EALLOW;
|
||||
SysCtrlRegs.PLLSTS.bit.DIVSEL = divsel;
|
||||
EDIS;
|
||||
}
|
||||
|
||||
//
|
||||
// NOTE: ONLY USE THIS SETTING IF PLL IS BYPASSED (I.E. PLLCR = 0) OR OFF
|
||||
// If switching to 1/1
|
||||
// * First go to 1/2 and let the power settle
|
||||
// The time required will depend on the system, this is only an example
|
||||
// * Then switch to 1/1
|
||||
//
|
||||
if(divsel == 3)
|
||||
{
|
||||
EALLOW;
|
||||
SysCtrlRegs.PLLSTS.bit.DIVSEL = 2;
|
||||
DELAY_US(50L);
|
||||
SysCtrlRegs.PLLSTS.bit.DIVSEL = 3;
|
||||
EDIS;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// InitPeripheralClocks - This function initializes the clocks to the
|
||||
// peripheral modules. First the high and low clock prescalers are set
|
||||
// Second the clocks are enabled to each peripheral. To reduce power, leave
|
||||
// clocks to unused peripherals disabled
|
||||
//
|
||||
// Note: If a peripherals clock is not enabled then you cannot
|
||||
// read or write to the registers for that peripheral
|
||||
//
|
||||
void
|
||||
InitPeripheralClocks(void)
|
||||
{
|
||||
EALLOW;
|
||||
|
||||
//
|
||||
// HISPCP/LOSPCP prescale register settings, normally it will be set to
|
||||
// default values
|
||||
//
|
||||
SysCtrlRegs.HISPCP.all = 0x0001;
|
||||
SysCtrlRegs.LOSPCP.all = 0x0002;
|
||||
|
||||
//
|
||||
// XCLKOUT to SYSCLKOUT ratio. By default XCLKOUT = 1/4 SYSCLKOUT
|
||||
// XTIMCLK = SYSCLKOUT/2
|
||||
//
|
||||
XintfRegs.XINTCNF2.bit.XTIMCLK = 1;
|
||||
|
||||
//
|
||||
// XCLKOUT = XTIMCLK/2
|
||||
//
|
||||
XintfRegs.XINTCNF2.bit.CLKMODE = 1;
|
||||
|
||||
//
|
||||
// Enable XCLKOUT
|
||||
//
|
||||
XintfRegs.XINTCNF2.bit.CLKOFF = 0;
|
||||
|
||||
//
|
||||
// Peripheral clock enables set for the selected peripherals.
|
||||
// If you are not using a peripheral leave the clock off
|
||||
// to save on power.
|
||||
//
|
||||
// Note: not all peripherals are available on all 2833x derivates.
|
||||
// Refer to the datasheet for your particular device.
|
||||
//
|
||||
// This function is not written to be an example of efficient code.
|
||||
//
|
||||
SysCtrlRegs.PCLKCR0.bit.ADCENCLK = 1; // ADC
|
||||
|
||||
//
|
||||
// *IMPORTANT*
|
||||
// The ADC_cal function, which copies the ADC calibration values from TI
|
||||
// reserved OTP into the ADCREFSEL and ADCOFFTRIM registers, occurs
|
||||
// automatically in the Boot ROM. If the boot ROM code is bypassed during
|
||||
// the debug process, the following function MUST be called for the ADC to
|
||||
// function according to specification. The clocks to the ADC MUST be
|
||||
// enabled before calling this function.
|
||||
// See the device data manual and/or the ADC Reference
|
||||
// Manual for more information.
|
||||
//
|
||||
ADC_cal();
|
||||
|
||||
SysCtrlRegs.PCLKCR0.bit.I2CAENCLK = 1; // I2C
|
||||
SysCtrlRegs.PCLKCR0.bit.SCIAENCLK = 1; // SCI-A
|
||||
SysCtrlRegs.PCLKCR0.bit.SCIBENCLK = 1; // SCI-B
|
||||
SysCtrlRegs.PCLKCR0.bit.SCICENCLK = 1; // SCI-C
|
||||
SysCtrlRegs.PCLKCR0.bit.SPIAENCLK = 1; // SPI-A
|
||||
SysCtrlRegs.PCLKCR0.bit.MCBSPAENCLK = 1; // McBSP-A
|
||||
SysCtrlRegs.PCLKCR0.bit.MCBSPBENCLK = 1; // McBSP-B
|
||||
SysCtrlRegs.PCLKCR0.bit.ECANAENCLK=1; // eCAN-A
|
||||
SysCtrlRegs.PCLKCR0.bit.ECANBENCLK=1; // eCAN-B
|
||||
|
||||
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 0; // Disable TBCLK within the ePWM
|
||||
SysCtrlRegs.PCLKCR1.bit.EPWM1ENCLK = 1; // ePWM1
|
||||
SysCtrlRegs.PCLKCR1.bit.EPWM2ENCLK = 1; // ePWM2
|
||||
SysCtrlRegs.PCLKCR1.bit.EPWM3ENCLK = 1; // ePWM3
|
||||
SysCtrlRegs.PCLKCR1.bit.EPWM4ENCLK = 1; // ePWM4
|
||||
SysCtrlRegs.PCLKCR1.bit.EPWM5ENCLK = 1; // ePWM5
|
||||
SysCtrlRegs.PCLKCR1.bit.EPWM6ENCLK = 1; // ePWM6
|
||||
SysCtrlRegs.PCLKCR0.bit.TBCLKSYNC = 1; // Enable TBCLK within the ePWM
|
||||
|
||||
SysCtrlRegs.PCLKCR1.bit.ECAP3ENCLK = 1; // eCAP3
|
||||
SysCtrlRegs.PCLKCR1.bit.ECAP4ENCLK = 1; // eCAP4
|
||||
SysCtrlRegs.PCLKCR1.bit.ECAP5ENCLK = 1; // eCAP5
|
||||
SysCtrlRegs.PCLKCR1.bit.ECAP6ENCLK = 1; // eCAP6
|
||||
SysCtrlRegs.PCLKCR1.bit.ECAP1ENCLK = 1; // eCAP1
|
||||
SysCtrlRegs.PCLKCR1.bit.ECAP2ENCLK = 1; // eCAP2
|
||||
SysCtrlRegs.PCLKCR1.bit.EQEP1ENCLK = 1; // eQEP1
|
||||
SysCtrlRegs.PCLKCR1.bit.EQEP2ENCLK = 1; // eQEP2
|
||||
|
||||
SysCtrlRegs.PCLKCR3.bit.CPUTIMER0ENCLK = 1; // CPU Timer 0
|
||||
SysCtrlRegs.PCLKCR3.bit.CPUTIMER1ENCLK = 1; // CPU Timer 1
|
||||
SysCtrlRegs.PCLKCR3.bit.CPUTIMER2ENCLK = 1; // CPU Timer 2
|
||||
|
||||
SysCtrlRegs.PCLKCR3.bit.DMAENCLK = 1; // DMA Clock
|
||||
SysCtrlRegs.PCLKCR3.bit.XINTFENCLK = 1; // XTIMCLK
|
||||
SysCtrlRegs.PCLKCR3.bit.GPIOINENCLK = 1; // GPIO input clock
|
||||
|
||||
EDIS;
|
||||
}
|
||||
|
||||
//
|
||||
// CsmUnlock - This function unlocks the CSM. User must replace 0xFFFF's with
|
||||
// current password for the DSP. Returns 1 if unlock is successful.
|
||||
//
|
||||
#define STATUS_FAIL 0
|
||||
#define STATUS_SUCCESS 1
|
||||
Uint16
|
||||
CsmUnlock()
|
||||
{
|
||||
volatile Uint16 temp;
|
||||
|
||||
//
|
||||
// Load the key registers with the current password. The 0xFFFF's are dummy
|
||||
// passwords. User should replace them with the correct password for the
|
||||
// DSP.
|
||||
//
|
||||
EALLOW;
|
||||
CsmRegs.KEY0 = 0xFFFF;
|
||||
CsmRegs.KEY1 = 0xFFFF;
|
||||
CsmRegs.KEY2 = 0xFFFF;
|
||||
CsmRegs.KEY3 = 0xFFFF;
|
||||
CsmRegs.KEY4 = 0xFFFF;
|
||||
CsmRegs.KEY5 = 0xFFFF;
|
||||
CsmRegs.KEY6 = 0xFFFF;
|
||||
CsmRegs.KEY7 = 0xFFFF;
|
||||
EDIS;
|
||||
|
||||
//
|
||||
// Perform a dummy read of the password locations if they match the key
|
||||
// values, the CSM will unlock
|
||||
//
|
||||
temp = CsmPwl.PSWD0;
|
||||
temp = CsmPwl.PSWD1;
|
||||
temp = CsmPwl.PSWD2;
|
||||
temp = CsmPwl.PSWD3;
|
||||
temp = CsmPwl.PSWD4;
|
||||
temp = CsmPwl.PSWD5;
|
||||
temp = CsmPwl.PSWD6;
|
||||
temp = CsmPwl.PSWD7;
|
||||
|
||||
//
|
||||
// If the CSM unlocked, return succes, otherwise return failure.
|
||||
//
|
||||
if (CsmRegs.CSMSCR.bit.SECURE == 0)
|
||||
{
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
return STATUS_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
|
||||
74
Lib/asm/DSP2833x_ADC_cal.asm
Normal file
74
Lib/asm/DSP2833x_ADC_cal.asm
Normal file
@@ -0,0 +1,74 @@
|
||||
;; TI File $Revision: /main/1 $
|
||||
;; Checkin $Date: July 30, 2007 10:29:23 $
|
||||
;;###########################################################################
|
||||
;;
|
||||
;; FILE: ADC_cal.asm
|
||||
;;
|
||||
;; TITLE: 2833x Boot Rom ADC Cal routine.
|
||||
;;
|
||||
;; Functions:
|
||||
;;
|
||||
;; _ADC_cal - Copies device specific calibration data into ADCREFSEL and
|
||||
;; ADCOFFTRIM registers
|
||||
;; Notes:
|
||||
;;
|
||||
;;###########################################################################
|
||||
;; $TI Release: 2833x/2823x Header Files V1.32 $
|
||||
;; $Release Date: June 28, 2010 $
|
||||
;; $Copyright:
|
||||
;// Copyright (C) 2009-2024 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.
|
||||
;// $
|
||||
;;###########################################################################
|
||||
|
||||
.def _ADC_cal
|
||||
.asg "0x711C", ADCREFSEL_LOC
|
||||
|
||||
;-----------------------------------------------
|
||||
; _ADC_cal
|
||||
;-----------------------------------------------
|
||||
;-----------------------------------------------
|
||||
; This is the ADC cal routine.This routine is programmed into
|
||||
; reserved memory by the factory. 0xAAAA and 0xBBBB are place-
|
||||
; holders for calibration data.
|
||||
;The actual values programmed by TI are device specific.
|
||||
;
|
||||
; This function assumes that the clocks have been
|
||||
; enabled to the ADC module.
|
||||
;-----------------------------------------------
|
||||
|
||||
.sect ".adc_cal"
|
||||
|
||||
_ADC_cal
|
||||
MOVW DP, #ADCREFSEL_LOC >> 6
|
||||
MOV @28, #0xAAAA ; actual value may not be 0xAAAA
|
||||
MOV @29, #0xBBBB ; actual value may not be 0xBBBB
|
||||
LRETR
|
||||
;eof ----------
|
||||
76
Lib/asm/DSP2833x_usDelay.asm
Normal file
76
Lib/asm/DSP2833x_usDelay.asm
Normal file
@@ -0,0 +1,76 @@
|
||||
;// TI File $Revision: /main/4 $
|
||||
;// Checkin $Date: July 30, 2007 10:28:57 $
|
||||
;//###########################################################################
|
||||
;//
|
||||
;// FILE: DSP2833x_usDelay.asm
|
||||
;//
|
||||
;// TITLE: Simple delay function
|
||||
;//
|
||||
;// DESCRIPTION:
|
||||
;//
|
||||
;// This is a simple delay function that can be used to insert a specified
|
||||
;// delay into code.
|
||||
;//
|
||||
;// This function is only accurate if executed from internal zero-waitstate
|
||||
;// SARAM. If it is executed from waitstate memory then the delay will be
|
||||
;// longer then specified.
|
||||
;//
|
||||
;// To use this function:
|
||||
;//
|
||||
;// 1 - update the CPU clock speed in the DSP2833x_Examples.h
|
||||
;// file. For example:
|
||||
;// #define CPU_RATE 6.667L // for a 150MHz CPU clock speed
|
||||
;// or #define CPU_RATE 10.000L // for a 100MHz CPU clock speed
|
||||
;//
|
||||
;// 2 - Call this function by using the DELAY_US(A) macro
|
||||
;// that is defined in the DSP2833x_Examples.h file. This macro
|
||||
;// will convert the number of microseconds specified
|
||||
;// into a loop count for use with this function.
|
||||
;// This count will be based on the CPU frequency you specify.
|
||||
;//
|
||||
;// 3 - For the most accurate delay
|
||||
;// - Execute this function in 0 waitstate RAM.
|
||||
;// - Disable interrupts before calling the function
|
||||
;// If you do not disable interrupts, then think of
|
||||
;// this as an "at least" delay function as the actual
|
||||
;// delay may be longer.
|
||||
;//
|
||||
;// The C assembly call from the DELAY_US(time) macro will
|
||||
;// look as follows:
|
||||
;//
|
||||
;// extern void Delay(long LoopCount);
|
||||
;//
|
||||
;// MOV AL,#LowLoopCount
|
||||
;// MOV AH,#HighLoopCount
|
||||
;// LCR _Delay
|
||||
;//
|
||||
;// Or as follows (if count is less then 16-bits):
|
||||
;//
|
||||
;// MOV ACC,#LoopCount
|
||||
;// LCR _Delay
|
||||
;//
|
||||
;//
|
||||
;//###########################################################################
|
||||
;// $TI Release: DSP2833x Header Files V1.00 $
|
||||
;// $Release Date: September 7, 2007 $
|
||||
;//###########################################################################
|
||||
|
||||
.def _DSP28x_usDelay
|
||||
.text
|
||||
|
||||
.global __DSP28x_usDelay
|
||||
_DSP28x_usDelay:
|
||||
SUB ACC,#1
|
||||
BF _DSP28x_usDelay,GEQ ;; Loop if ACC >= 0
|
||||
LRETR
|
||||
|
||||
;There is a 9/10 cycle overhead and each loop
|
||||
;takes five cycles. The LoopCount is given by
|
||||
;the following formula:
|
||||
; DELAY_CPU_CYCLES = 9 + 5*LoopCount
|
||||
; LoopCount = (DELAY_CPU_CYCLES - 9) / 5
|
||||
; The macro DELAY_US(A) performs this calculation for you
|
||||
;
|
||||
;//===========================================================================
|
||||
;// End of file.
|
||||
;//===========================================================================
|
||||
88
Lib/asm/DSP28xxx_CodeStartBranch.asm
Normal file
88
Lib/asm/DSP28xxx_CodeStartBranch.asm
Normal file
@@ -0,0 +1,88 @@
|
||||
;// TI File $Revision: /main/1 $
|
||||
;// Checkin $Date: December 1, 2004 11:11:32 $
|
||||
;//###########################################################################
|
||||
;//
|
||||
;// FILE: DSP28xxx_CodeStartBranch.asm
|
||||
;//
|
||||
;// TITLE: Branch for redirecting code execution after boot.
|
||||
;//
|
||||
;// For these examples, code_start is the first code that is executed after
|
||||
;// exiting the boot ROM code.
|
||||
;//
|
||||
;// The codestart section in the linker cmd file is used to physically place
|
||||
;// this code at the correct memory location. This section should be placed
|
||||
;// at the location the BOOT ROM will re-direct the code to. For example,
|
||||
;// for boot to FLASH this code will be located at 0x3f7ff6.
|
||||
;//
|
||||
;// From this code the watchdog will be disabled followed by calling the
|
||||
;// copy_section function to copy sections from flash to ram.
|
||||
;//
|
||||
;// In addition, the example DSP28xxx projects are setup such that the codegen
|
||||
;// entry point is also set to the code_start label. This is done by linker
|
||||
;// option -e in the project build options. When the debugger loads the code,
|
||||
;// it will automatically set the PC to the "entry point" address indicated by
|
||||
;// the -e linker option. In this case the debugger is simply assigning the PC,
|
||||
;// it is not the same as a full reset of the device.
|
||||
;//
|
||||
;// The compiler may warn that the entry point for the project is other then
|
||||
;// _c_init00. _c_init00 is the C environment setup and is run before
|
||||
;// main() is entered. The copy_sections code will re-direct the execution
|
||||
;// to _c_init00 and thus there is no worry and this warning can be ignored.
|
||||
;//
|
||||
;//###########################################################################
|
||||
;// $TI Release: DSP280x, DSP2801x Header Files V1.41 $
|
||||
;// $Release Date: August 7th, 2006 $
|
||||
;// Modified by: Tim Love
|
||||
;// Modified Date: March 2008
|
||||
;//###########################################################################
|
||||
|
||||
|
||||
***********************************************************************
|
||||
|
||||
WD_DISABLE .set 1 ;set to 1 to disable WD, else set to 0
|
||||
|
||||
.ref copy_sections
|
||||
.global code_start
|
||||
|
||||
***********************************************************************
|
||||
* Function: codestart section
|
||||
*
|
||||
* Description: Branch to code starting point
|
||||
***********************************************************************
|
||||
|
||||
.sect "codestart"
|
||||
|
||||
code_start:
|
||||
.if WD_DISABLE == 1
|
||||
LB wd_disable ;Branch to watchdog disable code
|
||||
.else
|
||||
LB copy_sections ;Branch to copy_sections
|
||||
.endif
|
||||
|
||||
;end codestart section
|
||||
|
||||
***********************************************************************
|
||||
* Function: wd_disable
|
||||
*
|
||||
* Description: Disables the watchdog timer
|
||||
***********************************************************************
|
||||
.if WD_DISABLE == 1
|
||||
|
||||
.sect "wddisable"
|
||||
wd_disable:
|
||||
SETC OBJMODE ;Set OBJMODE for 28x object code
|
||||
EALLOW ;Enable EALLOW protected register access
|
||||
MOVZ DP, #7029h>>6 ;Set data page for WDCR register
|
||||
MOV @7029h, #0068h ;Set WDDIS bit in WDCR to disable WD
|
||||
EDIS ;Disable EALLOW protected register access
|
||||
LB copy_sections ;Branch to copy_sections
|
||||
|
||||
.endif
|
||||
|
||||
;end wd_disable
|
||||
|
||||
.end
|
||||
|
||||
;//===========================================================================
|
||||
;// End of file.
|
||||
;//===========================================================================
|
||||
88
Lib/asm/DSP28xxx_SectionCopy_nonBIOS.asm
Normal file
88
Lib/asm/DSP28xxx_SectionCopy_nonBIOS.asm
Normal file
@@ -0,0 +1,88 @@
|
||||
;############################################################################
|
||||
;
|
||||
; FILE: DSP28xxx_SectionCopy_nonBIOS.asm
|
||||
;
|
||||
; DESCRIPTION: Provides functionality for copying intialized sections from
|
||||
; flash to ram at runtime before entering the _c_int00 startup
|
||||
; routine
|
||||
;############################################################################
|
||||
; Author: Tim Love
|
||||
; Release Date: March 2008
|
||||
;############################################################################
|
||||
|
||||
|
||||
.ref _c_int00
|
||||
.global copy_sections
|
||||
.global _cinit_loadstart, _cinit_runstart, _cinit_size
|
||||
.global _const_loadstart, _const_runstart, _const_size
|
||||
.global _econst_loadstart, _econst_runstart, _econst_size
|
||||
.global _pinit_loadstart, _pinit_runstart, _pinit_size
|
||||
.global _switch_loadstart, _switch_runstart, _switch_size
|
||||
.global _text_loadstart, _text_runstart, _text_size
|
||||
|
||||
***********************************************************************
|
||||
* Function: copy_sections
|
||||
*
|
||||
* Description: Copies initialized sections from flash to ram
|
||||
***********************************************************************
|
||||
|
||||
.sect "copysections"
|
||||
|
||||
copy_sections:
|
||||
|
||||
|
||||
MOVL XAR5,#_cinit_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_cinit_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_cinit_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_const_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_const_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_const_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_econst_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_econst_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_econst_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_pinit_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_pinit_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_pinit_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_switch_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_switch_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_switch_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
MOVL XAR5,#_text_size ; Store Section Size in XAR5
|
||||
MOVL ACC,@XAR5 ; Move Section Size to ACC
|
||||
MOVL XAR6,#_text_loadstart ; Store Load Starting Address in XAR6
|
||||
MOVL XAR7,#_text_runstart ; Store Run Address in XAR7
|
||||
LCR copy ; Branch to Copy
|
||||
|
||||
|
||||
LB _c_int00 ; Branch to start of boot.asm in RTS library
|
||||
|
||||
copy:
|
||||
B return,EQ ; Return if ACC is Zero (No section to copy)
|
||||
|
||||
SUBB ACC,#1
|
||||
|
||||
RPT AL ; Copy Section From Load Address to
|
||||
|| PWRITE *XAR7, *XAR6++ ; Run Address
|
||||
|
||||
return:
|
||||
LRETR ; Return
|
||||
|
||||
.end
|
||||
|
||||
;//===========================================================================
|
||||
;// End of file.
|
||||
;//===========================================================================
|
||||
Reference in New Issue
Block a user