|
|
|
/*
|
|
|
|
* CPUCore.cpp
|
|
|
|
*
|
|
|
|
* Author: Aleksey Gerasimenko
|
|
|
|
* gerasimenko.aleksey.n@gmail.com
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "DSP28335/CPU.h"
|
|
|
|
|
|
|
|
namespace DSP28335
|
|
|
|
{
|
|
|
|
//CONSTRUCTOR
|
|
|
|
CPU::CPU():
|
|
|
|
DSP28335::CPUBase(),
|
|
|
|
scib(ScibRegs),
|
|
|
|
// scic(ScicRegs),
|
|
|
|
// cpu_timers(CpuTimer0),
|
|
|
|
// epwm(),
|
|
|
|
// ecana(),
|
|
|
|
// ecanb(),
|
|
|
|
// eqep1(),
|
|
|
|
// period_measure(DSP28335::MeasureTimePeriod(CpuTimer2)),
|
|
|
|
interval_measure(DSP28335::MeasureTimeInterval(CpuTimer1)),
|
|
|
|
// xintf(),
|
|
|
|
// dout(),
|
|
|
|
// m_counter_startup(0),
|
|
|
|
// m_counter_sync(0),
|
|
|
|
_execute(&CPU::_execute_undef)
|
|
|
|
//
|
|
|
|
{}//end CONSTRUCTOR
|
|
|
|
|
|
|
|
void CPU::setup(DSP28335::CPUSetup& setup)
|
|
|
|
{
|
|
|
|
// adc.setup();
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
scib.setup(setup.scib);
|
|
|
|
//
|
|
|
|
// scic.setup(setup.scic);
|
|
|
|
InitCpuTimers();
|
|
|
|
// cpu_timers.setup(setup.timers);
|
|
|
|
|
|
|
|
// epwm.setup(setup.epwm);
|
|
|
|
|
|
|
|
// xintf.setup(setup.xintf);
|
|
|
|
|
|
|
|
// period_measure.set_magic((Uint32)0);
|
|
|
|
// period_measure.reset();
|
|
|
|
//
|
|
|
|
interval_measure.set_magic((Uint32)0);
|
|
|
|
interval_measure.reset();
|
|
|
|
//
|
|
|
|
// ecana.setup(setup.ecana);
|
|
|
|
// //
|
|
|
|
// ecanb.setup(setup.ecanb);
|
|
|
|
|
|
|
|
// eqep1.setup(setup.eqep1);
|
|
|
|
|
|
|
|
// dout.setup(setup.dout);
|
|
|
|
|
|
|
|
// m_counter_startup = setup.startup_period;
|
|
|
|
// m_counter_sync = setup.period_sync;
|
|
|
|
|
|
|
|
if(//adc.compare(DSP28335::ADC::OPERATIONAL) &&
|
|
|
|
//scib.compare(DSP28335::SCIB::OPERATIONAL) &&
|
|
|
|
//scic.compare(DSP28335::SCIC::OPERATIONAL) &&
|
|
|
|
// cpu_timers.compare(DSP28335::CPUTimers::OPERATIONAL) // &&
|
|
|
|
// epwm.compare(DSP28335::EPWM::OPERATIONAL) &&
|
|
|
|
// xintf.compare(DSP28335::XINTF::OPERATIONAL) &&
|
|
|
|
// ecana.compare(DSP28335::ECANA::OPERATIONAL) &&
|
|
|
|
// ecanb.compare(DSP28335::ECANB::OPERATIONAL) &&
|
|
|
|
// eqep1.compare(DSP28335::EQEP1::OPERATIONAL) &&
|
|
|
|
// dout.compare(DSP28335::DiscreteOutputs::OPERATIONAL)
|
|
|
|
true)
|
|
|
|
{
|
|
|
|
m_mode = DSP28335::CPUBase::OPERATIONAL;
|
|
|
|
//_execute = &CPUCore::_execute_mode_i;
|
|
|
|
//_execute = &CPUCore::_execute_mode_500HZ;
|
|
|
|
_execute = &CPU::_execute_undef;
|
|
|
|
// epwm.set_actions();
|
|
|
|
//
|
|
|
|
}//if
|
|
|
|
//
|
|
|
|
}//end
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
// #pragma CODE_SECTION("ramfuncs");
|
|
|
|
void CPU::execute()
|
|
|
|
{
|
|
|
|
(this->*_execute)();
|
|
|
|
//
|
|
|
|
}//
|
|
|
|
//
|
|
|
|
void CPU::_execute_undef()
|
|
|
|
{}//
|
|
|
|
//
|
|
|
|
// #pragma CODE_SECTION("ramfuncs");
|
|
|
|
void CPU::_execute_mode_i()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}//
|
|
|
|
//
|
|
|
|
// #pragma CODE_SECTION("ramfuncs");
|
|
|
|
void CPU::_execute_mode_ii()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}//
|
|
|
|
//
|
|
|
|
// #pragma CODE_SECTION("ramfuncs");
|
|
|
|
void CPU::_execute_mode_iii()
|
|
|
|
{}//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
} /* namespace DSP28335 */
|