fprime/Drv/BlockDriver/BlockDriverImpl.cpp
Joshua Anderson 3cccd731d9
Refactor FW_OBJECT_NAMES switches and fix building without object names
Instead of adding the name argument to a constructor when FW_OBJECT_NAMES
is enabled, always supply a name argument.

Add a marco that conditionally sets the name to "" if FW_OBJECT_NAMES is not set.
This cleans up a lot of the conditional compilation switches that weren't being tested
and would silently break, while still stripping the strings from the binary.
2020-10-07 17:19:05 -07:00

62 lines
1.6 KiB
C++

#include <Drv/BlockDriver/BlockDriverImpl.hpp>
#include <Fw/Types/BasicTypes.hpp>
#include <Fw/Types/Assert.hpp>
namespace Drv {
BlockDriverImpl::BlockDriverImpl(const char* compName) :
BlockDriverComponentBase(compName), m_cycles(0)
{
}
void BlockDriverImpl::init(NATIVE_INT_TYPE queueDepth) {
BlockDriverComponentBase::init(queueDepth);
}
BlockDriverImpl::~BlockDriverImpl(void) {
}
void BlockDriverImpl::InterruptReport_internalInterfaceHandler(U32 ip) {
// get time
Svc::TimerVal timer;
timer.take();
// call output timing signal
this->CycleOut_out(0,timer);
// increment cycles and write channel
this->tlmWrite_BD_Cycles(this->m_cycles);
this->m_cycles++;
}
void BlockDriverImpl::BufferIn_handler(NATIVE_INT_TYPE portNum, Drv::DataBuffer& buffer) {
// just a pass-through
this->BufferOut_out(0,buffer);
}
void BlockDriverImpl::Sched_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
}
void BlockDriverImpl::callIsr(void) {
s_driverISR(this);
}
void BlockDriverImpl::s_driverISR(void* arg) {
FW_ASSERT(arg);
// cast argument to component instance
BlockDriverImpl* compPtr = static_cast<BlockDriverImpl*>(arg);
compPtr->InterruptReport_internalInterfaceHandler(0);
}
void BlockDriverImpl::PingIn_handler(
const NATIVE_INT_TYPE portNum,
U32 key
)
{
// call ping output port
this->PingOut_out(0,key);
}
}