You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
2.1 KiB
C++
112 lines
2.1 KiB
C++
// Some comments about author
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
|
|
#include "DSP28x_Project.h" // Device Headerfile and Examples Include File
|
|
#include "DSP2833x_Examples.h"
|
|
#include "SysConfig/f2833x_pinmux.h"
|
|
#include "Protocol/CAN.h"
|
|
|
|
|
|
//Functions declarations
|
|
void idle_loop(void);
|
|
interrupt void cpu_timer0_isr(void);
|
|
//interrupt void adc_isr(void);
|
|
|
|
|
|
void main()
|
|
{
|
|
ServiceDog();
|
|
DisableDog();
|
|
|
|
InitSysCtrl();
|
|
|
|
DINT;
|
|
|
|
InitPieCtrl();
|
|
|
|
IER = 0x0000;
|
|
IFR = 0x0000;
|
|
|
|
InitPieVectTable();
|
|
|
|
EALLOW;
|
|
PieVectTable.TINT0 = &cpu_timer0_isr;
|
|
EDIS;
|
|
|
|
// memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (Uint32)&RamfuncsLoadSize);
|
|
|
|
// Call Flash Initialization to setup flash waitstates
|
|
// This function must reside in RAM
|
|
// InitFlash();
|
|
|
|
|
|
// flash.setup(SECTORD, (Uint16*)0x320000, (Uint16*)0x327FFF);
|
|
|
|
// configuration_parameters.setup(TIME_SAMPLE_CONTROL, TIME_SAMPLE_CONTROL_SLOW, TIME_SAMPLE_SERVICE, TPWM, FCPU, FPWM);
|
|
// configuration_parameters.load_flash();
|
|
//configuration_parameters.extract_configuration(system_config);
|
|
// configuration_parameters.extract_configuration(test_config);
|
|
|
|
InitCpuTimers();
|
|
ConfigCpuTimer(&CpuTimer0, 150, 800);
|
|
|
|
IER |= M_INT1; // Enable CPU Interrupt 1
|
|
// Enable ADCINT in PIE
|
|
// PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
|
|
PieCtrlRegs.PIEIER1.bit.INTx7 = 1;
|
|
|
|
|
|
//
|
|
// Enable global Interrupts and higher priority real-time debug events:
|
|
//
|
|
EINT; // Enable Global interrupt INTM
|
|
ERTM; // Enable Global realtime interrupt DBGM
|
|
|
|
|
|
//
|
|
// Start CPU Timer
|
|
//
|
|
// core.cpu_timers.start();
|
|
//
|
|
|
|
InitECanGpio();
|
|
InitECan();
|
|
|
|
CpuTimer0.RegsAddr->TCR.bit.TSS = 0;
|
|
|
|
idle_loop();
|
|
//
|
|
}//end main()
|
|
//
|
|
//
|
|
|
|
void idle_loop()
|
|
{
|
|
while (true)
|
|
{
|
|
/*
|
|
if (ECanaRegs.CANRMP.bit.RMP31)
|
|
{
|
|
GpioDataRegs.GPADAT.bit.GPIO14 = 1;}
|
|
else{
|
|
GpioDataRegs.GPADAT.bit.GPIO14 = 0;
|
|
}
|
|
*/
|
|
|
|
|
|
}//end while
|
|
//
|
|
}//end idle_loop()
|
|
//
|
|
|
|
interrupt void cpu_timer0_isr(void)
|
|
{
|
|
|
|
//
|
|
PieCtrlRegs.PIEACK.all |= PIEACK_GROUP1;
|
|
}//end
|