mirror of
https://github.com/nasa/fprime.git
synced 2025-12-15 14:05:24 -06:00
* Add Os::RawTime and preliminary rule-based tests * Implement Stubs and stub tests tests + misc improvements * Update delay functions to use Fw::TimeInterval instead of Fw::Time * Replace TimerVal with Os::RawTime FPP type, SERIALIZED_SIZE fixed to 2*sizeof(U32) * Fix spelling and legacy code * Fix test import * Remove TimerVal files and misc clean up * Add Fw/Time as dependency of Os module * Fix include guards * Fix default constructors and missing getHandle stub * Add Handle and Serialization size to FpConfig, refactor interface for less vtable calls, refactor IntervalTimer * Fixes for new OS CMake API * Add RawTime FPP Model * Rename getRawTime to now(), better error handling, added docs for all functions * Correct handle size, spelling, and more robust test IntervalTimer test * Peer review changes * Move `Os.RawTime` to `Os/Types.fpp` * Fix unused variable * Fix spelling and comments * spelling extravaganza * Update metadata check-spelling run (pull_request_target) for os-interval-timer Signed-off-by: check-spelling-bot <check-spelling-bot@users.noreply.github.com> on-behalf-of: @check-spelling <check-spelling-bot@check-spelling.dev> * Reference based approach to minuend and subtrahend --------- Signed-off-by: check-spelling-bot <check-spelling-bot@users.noreply.github.com> Co-authored-by: Thomas Boyer-Chammard <thomas-bc@users.noreply.github.com> Co-authored-by: M Starch <LeStarch@googlemail.com>
70 lines
2.4 KiB
C++
70 lines
2.4 KiB
C++
/*
|
|
* \author: Tim Canham
|
|
* \file:
|
|
* \brief
|
|
*
|
|
* This file implements the PassiveRateGroup component,
|
|
* which invokes a set of components the comprise the rate group.
|
|
*
|
|
* Copyright 2014-2015, by the California Institute of Technology.
|
|
* ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
* acknowledged.
|
|
*/
|
|
|
|
#include <FpConfig.hpp>
|
|
#include <Fw/Types/Assert.hpp>
|
|
#include <Os/Console.hpp>
|
|
#include <Svc/PassiveRateGroup/PassiveRateGroup.hpp>
|
|
|
|
namespace Svc {
|
|
PassiveRateGroup::PassiveRateGroup(const char* compName)
|
|
: PassiveRateGroupComponentBase(compName), m_cycles(0), m_maxTime(0), m_numContexts(0) {
|
|
}
|
|
|
|
PassiveRateGroup::~PassiveRateGroup() {}
|
|
|
|
void PassiveRateGroup::configure(NATIVE_INT_TYPE contexts[], NATIVE_INT_TYPE numContexts) {
|
|
FW_ASSERT(contexts);
|
|
FW_ASSERT(numContexts == this->getNum_RateGroupMemberOut_OutputPorts(),numContexts,this->getNum_RateGroupMemberOut_OutputPorts());
|
|
FW_ASSERT(FW_NUM_ARRAY_ELEMENTS(this->m_contexts) == this->getNum_RateGroupMemberOut_OutputPorts(),
|
|
FW_NUM_ARRAY_ELEMENTS(this->m_contexts),
|
|
this->getNum_RateGroupMemberOut_OutputPorts());
|
|
|
|
this->m_numContexts = numContexts;
|
|
// copy context values
|
|
for (NATIVE_INT_TYPE entry = 0; entry < this->m_numContexts; entry++) {
|
|
this->m_contexts[entry] = static_cast<U32>(contexts[entry]);
|
|
}
|
|
}
|
|
|
|
|
|
void PassiveRateGroup::CycleIn_handler(NATIVE_INT_TYPE portNum, Os::RawTime& cycleStart) {
|
|
Os::RawTime endTime;
|
|
FW_ASSERT(this->m_numContexts);
|
|
|
|
// invoke any members of the rate group
|
|
for (NATIVE_INT_TYPE port = 0; port < this->getNum_RateGroupMemberOut_OutputPorts(); port++) {
|
|
if (this->isConnected_RateGroupMemberOut_OutputPort(port)) {
|
|
this->RateGroupMemberOut_out(port, this->m_contexts[port]);
|
|
}
|
|
}
|
|
|
|
// grab timer for endTime of cycle
|
|
endTime.now();
|
|
|
|
// get rate group execution time
|
|
U32 cycleTime;
|
|
// Cast to void as the only possible error is overflow, which we can't handle other
|
|
// than capping cycleTime to max value of U32 (which is done in getDiffUsec anyways)
|
|
(void) endTime.getDiffUsec(cycleStart, cycleTime);
|
|
// check to see if the time has exceeded the previous maximum
|
|
if (cycleTime > this->m_maxTime) {
|
|
this->m_maxTime = cycleTime;
|
|
}
|
|
this->tlmWrite_MaxCycleTime(this->m_maxTime);
|
|
this->tlmWrite_CycleTime(cycleTime);
|
|
this->tlmWrite_CycleCount(++this->m_cycles);
|
|
}
|
|
|
|
} // namespace Svc
|