mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
Remove FPP dependencies on native int types (#2548)
* Remove FPP dependencies on native int types * Revise FpConfig * Fix errors in FpConfig * Revise types Add size type alias to Serializable Remove type aliases for generated code
This commit is contained in:
parent
bdfe2419b5
commit
c02f35145e
@ -34,7 +34,7 @@ namespace Drv {
|
||||
this->BufferOut_out(0,buffer);
|
||||
}
|
||||
|
||||
void BlockDriverImpl::Sched_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
void BlockDriverImpl::Sched_handler(NATIVE_INT_TYPE portNum, U32 context) {
|
||||
}
|
||||
|
||||
void BlockDriverImpl::callIsr() {
|
||||
|
||||
@ -22,7 +22,7 @@ namespace Drv {
|
||||
// downcalls for input ports
|
||||
void InterruptReport_internalInterfaceHandler(U32 ip);
|
||||
void BufferIn_handler(NATIVE_INT_TYPE portNum, Drv::DataBuffer& buffer);
|
||||
void Sched_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
void Sched_handler(NATIVE_INT_TYPE portNum, U32 context);
|
||||
//! Handler implementation for PingIn
|
||||
//!
|
||||
void PingIn_handler(
|
||||
|
||||
@ -25,9 +25,9 @@ SocketReadTask::~SocketReadTask() {}
|
||||
|
||||
void SocketReadTask::startSocketTask(const Fw::StringBase &name,
|
||||
const bool reconnect,
|
||||
const NATIVE_UINT_TYPE priority,
|
||||
const NATIVE_UINT_TYPE stack,
|
||||
const NATIVE_UINT_TYPE cpuAffinity) {
|
||||
const Os::Task::ParamType priority,
|
||||
const Os::Task::ParamType stack,
|
||||
const Os::Task::ParamType cpuAffinity) {
|
||||
FW_ASSERT(not m_task.isStarted()); // It is a coding error to start this task multiple times
|
||||
FW_ASSERT(not this->m_stop); // It is a coding error to stop the thread before it is started
|
||||
m_reconnect = reconnect;
|
||||
|
||||
@ -51,9 +51,9 @@ class SocketReadTask {
|
||||
*/
|
||||
void startSocketTask(const Fw::StringBase &name,
|
||||
const bool reconnect = true,
|
||||
const NATIVE_UINT_TYPE priority = Os::Task::TASK_DEFAULT,
|
||||
const NATIVE_UINT_TYPE stack = Os::Task::TASK_DEFAULT,
|
||||
const NATIVE_UINT_TYPE cpuAffinity = Os::Task::TASK_DEFAULT);
|
||||
const Os::Task::ParamType priority = Os::Task::TASK_DEFAULT,
|
||||
const Os::Task::ParamType stack = Os::Task::TASK_DEFAULT,
|
||||
const Os::Task::ParamType cpuAffinity = Os::Task::TASK_DEFAULT);
|
||||
|
||||
/**
|
||||
* \brief startup the socket for communications
|
||||
|
||||
@ -39,7 +39,7 @@ DpTest ::~DpTest() {}
|
||||
// Handler implementations for user-defined typed input ports
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void DpTest::schedIn_handler(const NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
void DpTest::schedIn_handler(const NATIVE_INT_TYPE portNum, U32 context) {
|
||||
// Request a buffer for Container 1
|
||||
this->dpRequest_Container1(CONTAINER_1_DATA_SIZE);
|
||||
// Request a buffer for Container 2
|
||||
|
||||
@ -76,7 +76,7 @@ class DpTest : public DpTestComponentBase {
|
||||
|
||||
//! Handler implementation for schedIn
|
||||
void schedIn_handler(const NATIVE_INT_TYPE portNum, //!< The port number
|
||||
NATIVE_UINT_TYPE context //!< The call order
|
||||
U32 context //!< The call order
|
||||
) override;
|
||||
|
||||
PRIVATE:
|
||||
|
||||
@ -53,13 +53,7 @@ namespace Fw {
|
||||
}
|
||||
#endif
|
||||
|
||||
void ActiveComponentBase::start(NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, NATIVE_INT_TYPE cpuAffinity) {
|
||||
this->start(static_cast<NATIVE_UINT_TYPE>(priority), static_cast<NATIVE_UINT_TYPE>(stackSize),
|
||||
((cpuAffinity == -1) ? Os::Task::TASK_DEFAULT : static_cast<NATIVE_UINT_TYPE>(cpuAffinity)),
|
||||
static_cast<NATIVE_UINT_TYPE>(identifier));
|
||||
}
|
||||
|
||||
void ActiveComponentBase::start(NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity, NATIVE_UINT_TYPE identifier) {
|
||||
void ActiveComponentBase::start(Os::Task::ParamType priority, Os::Task::ParamType stackSize, Os::Task::ParamType cpuAffinity, Os::Task::ParamType identifier) {
|
||||
Os::TaskString taskName;
|
||||
|
||||
#if FW_OBJECT_NAMES == 1
|
||||
|
||||
@ -11,40 +11,41 @@
|
||||
#ifndef FW_ACTIVE_COMPONENT_BASE_HPP
|
||||
#define FW_ACTIVE_COMPONENT_BASE_HPP
|
||||
|
||||
#include <Fw/Comp/QueuedComponentBase.hpp>
|
||||
#include <Os/Task.hpp>
|
||||
#include <FpConfig.hpp>
|
||||
#include <Fw/Comp/QueuedComponentBase.hpp>
|
||||
#include <Fw/Deprecate.hpp>
|
||||
#include <Os/Task.hpp>
|
||||
|
||||
namespace Fw {
|
||||
class ActiveComponentBase : public QueuedComponentBase {
|
||||
public:
|
||||
void start(NATIVE_UINT_TYPE priority = Os::Task::TASK_DEFAULT, NATIVE_UINT_TYPE stackSize = Os::Task::TASK_DEFAULT, NATIVE_UINT_TYPE cpuAffinity = Os::Task::TASK_DEFAULT, NATIVE_UINT_TYPE identifier = Os::Task::TASK_DEFAULT); //!< called by instantiator when task is to be started
|
||||
class ActiveComponentBase : public QueuedComponentBase {
|
||||
public:
|
||||
void start(Os::Task::ParamType priority = Os::Task::TASK_DEFAULT,
|
||||
Os::Task::ParamType stackSize = Os::Task::TASK_DEFAULT,
|
||||
Os::Task::ParamType cpuAffinity = Os::Task::TASK_DEFAULT,
|
||||
Os::Task::ParamType identifier =
|
||||
Os::Task::TASK_DEFAULT); //!< called by instantiator when task is to be started
|
||||
void exit(); //!< exit task in active component
|
||||
Os::Task::TaskStatus join(void** value_ptr); //!< provide return value of thread if value_ptr is not NULL
|
||||
|
||||
DEPRECATED(void start(NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, NATIVE_INT_TYPE cpuAffinity = -1),
|
||||
"Please switch to start(NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity, NATIVE_UINT_TYPE identifier)"); //!< called by instantiator when task is to be started
|
||||
void exit(); //!< exit task in active component
|
||||
Os::Task::TaskStatus join(void **value_ptr); //!< provide return value of thread if value_ptr is not NULL
|
||||
|
||||
enum {
|
||||
ACTIVE_COMPONENT_EXIT //!< message to exit active component task
|
||||
};
|
||||
|
||||
PROTECTED:
|
||||
ActiveComponentBase(const char* name); //!< Constructor
|
||||
virtual ~ActiveComponentBase(); //!< Destructor
|
||||
void init(NATIVE_INT_TYPE instance); //!< initialization code
|
||||
virtual void preamble(); //!< A function that will be called before the event loop is entered
|
||||
virtual void loop(); //!< The function that will loop dispatching messages
|
||||
virtual void finalizer(); //!< A function that will be called after exiting the loop
|
||||
Os::Task m_task; //!< task object for active component
|
||||
#if FW_OBJECT_TO_STRING == 1
|
||||
virtual void toString(char* str, NATIVE_INT_TYPE size); //!< create string description of component
|
||||
#endif
|
||||
PRIVATE:
|
||||
static void s_baseTask(void*); //!< function provided to task class for new thread.
|
||||
static void s_baseBareTask(void*); //!< function provided to task class for new thread.
|
||||
enum {
|
||||
ACTIVE_COMPONENT_EXIT //!< message to exit active component task
|
||||
};
|
||||
|
||||
}
|
||||
PROTECTED:
|
||||
explicit ActiveComponentBase(const char* name); //!< Constructor
|
||||
virtual ~ActiveComponentBase(); //!< Destructor
|
||||
void init(NATIVE_INT_TYPE instance); //!< initialization code
|
||||
virtual void preamble(); //!< A function that will be called before the event loop is entered
|
||||
virtual void loop(); //!< The function that will loop dispatching messages
|
||||
virtual void finalizer(); //!< A function that will be called after exiting the loop
|
||||
Os::Task m_task; //!< task object for active component
|
||||
#if FW_OBJECT_TO_STRING == 1
|
||||
virtual void toString(char* str, NATIVE_INT_TYPE size); //!< create string description of component
|
||||
#endif
|
||||
PRIVATE:
|
||||
static void s_baseTask(void*); //!< function provided to task class for new thread.
|
||||
static void s_baseBareTask(void*); //!< function provided to task class for new thread.
|
||||
};
|
||||
|
||||
} // namespace Fw
|
||||
#endif
|
||||
|
||||
@ -65,7 +65,7 @@ namespace Fw {
|
||||
// serialization routines
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(U8 val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
FW_ASSERT(this->getBuffAddr());
|
||||
@ -77,7 +77,7 @@ namespace Fw {
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(I8 val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
FW_ASSERT(this->getBuffAddr());
|
||||
@ -89,7 +89,7 @@ namespace Fw {
|
||||
|
||||
#if FW_HAS_16_BIT==1
|
||||
SerializeStatus SerializeBufferBase::serialize(U16 val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
FW_ASSERT(this->getBuffAddr());
|
||||
@ -102,7 +102,7 @@ namespace Fw {
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(I16 val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
FW_ASSERT(this->getBuffAddr());
|
||||
@ -116,7 +116,7 @@ namespace Fw {
|
||||
#endif
|
||||
#if FW_HAS_32_BIT==1
|
||||
SerializeStatus SerializeBufferBase::serialize(U32 val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
FW_ASSERT(this->getBuffAddr());
|
||||
@ -131,7 +131,7 @@ namespace Fw {
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(I32 val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
FW_ASSERT(this->getBuffAddr());
|
||||
@ -148,7 +148,7 @@ namespace Fw {
|
||||
|
||||
#if FW_HAS_64_BIT==1
|
||||
SerializeStatus SerializeBufferBase::serialize(U64 val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
FW_ASSERT(this->getBuffAddr());
|
||||
@ -167,7 +167,7 @@ namespace Fw {
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(I64 val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(val)) - 1 >= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
FW_ASSERT(this->getBuffAddr());
|
||||
@ -208,7 +208,7 @@ namespace Fw {
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(bool val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(U8)) - 1 >= this->getBuffCapacity()) {
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(U8)) - 1 >= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ namespace Fw {
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(const void* val) {
|
||||
if (this->m_serLoc + static_cast<NATIVE_UINT_TYPE>(sizeof(void*)) - 1
|
||||
if (this->m_serLoc + static_cast<Serializable::SizeType>(sizeof(void*)) - 1
|
||||
>= this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
@ -234,11 +234,11 @@ namespace Fw {
|
||||
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(const U8* buff, NATIVE_UINT_TYPE length) {
|
||||
SerializeStatus SerializeBufferBase::serialize(const U8* buff, Serializable::SizeType length) {
|
||||
return this->serialize(buff, static_cast<FwSizeType>(length), Serialization::INCLUDE_LENGTH);
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(const U8* buff, NATIVE_UINT_TYPE length, bool noLength) {
|
||||
SerializeStatus SerializeBufferBase::serialize(const U8* buff, Serializable::SizeType length, bool noLength) {
|
||||
return this->serialize(buff, static_cast<FwSizeType>(length), noLength ? Serialization::OMIT_LENGTH : Serialization::INCLUDE_LENGTH);
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ namespace Fw {
|
||||
// First serialize length
|
||||
SerializeStatus stat;
|
||||
if (mode == Serialization::INCLUDE_LENGTH) {
|
||||
stat = this->serialize(static_cast<FwBuffSizeType>(length));
|
||||
stat = this->serialize(static_cast<FwSizeStoreType>(length));
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
@ -271,14 +271,14 @@ namespace Fw {
|
||||
|
||||
SerializeStatus SerializeBufferBase::serialize(
|
||||
const SerializeBufferBase& val) {
|
||||
NATIVE_UINT_TYPE size = val.getBuffLength();
|
||||
if (this->m_serLoc + size + static_cast<NATIVE_UINT_TYPE>(sizeof(FwBuffSizeType))
|
||||
Serializable::SizeType size = val.getBuffLength();
|
||||
if (this->m_serLoc + size + static_cast<Serializable::SizeType>(sizeof(FwSizeStoreType))
|
||||
> this->getBuffCapacity()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
}
|
||||
|
||||
// First, serialize size
|
||||
SerializeStatus stat = this->serialize(static_cast<FwBuffSizeType>(size));
|
||||
SerializeStatus stat = this->serialize(static_cast<FwSizeStoreType>(size));
|
||||
if (stat != FW_SERIALIZE_OK) {
|
||||
return stat;
|
||||
}
|
||||
@ -310,7 +310,7 @@ namespace Fw {
|
||||
// check for room
|
||||
if (this->getBuffLength() == this->m_deserLoc) {
|
||||
return FW_DESERIALIZE_BUFFER_EMPTY;
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<NATIVE_UINT_TYPE>(sizeof(val))) {
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
|
||||
return FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
}
|
||||
// read from current location
|
||||
@ -324,7 +324,7 @@ namespace Fw {
|
||||
// check for room
|
||||
if (this->getBuffLength() == this->m_deserLoc) {
|
||||
return FW_DESERIALIZE_BUFFER_EMPTY;
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<NATIVE_UINT_TYPE>(sizeof(val))) {
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
|
||||
return FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
}
|
||||
// read from current location
|
||||
@ -339,7 +339,7 @@ namespace Fw {
|
||||
// check for room
|
||||
if (this->getBuffLength() == this->m_deserLoc) {
|
||||
return FW_DESERIALIZE_BUFFER_EMPTY;
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<NATIVE_UINT_TYPE>(sizeof(val))) {
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
|
||||
return FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
}
|
||||
// read from current location
|
||||
@ -357,7 +357,7 @@ namespace Fw {
|
||||
// check for room
|
||||
if (this->getBuffLength() == this->m_deserLoc) {
|
||||
return FW_DESERIALIZE_BUFFER_EMPTY;
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<NATIVE_UINT_TYPE>(sizeof(val))) {
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
|
||||
return FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
}
|
||||
// read from current location
|
||||
@ -376,7 +376,7 @@ namespace Fw {
|
||||
// check for room
|
||||
if (this->getBuffLength() == this->m_deserLoc) {
|
||||
return FW_DESERIALIZE_BUFFER_EMPTY;
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<NATIVE_UINT_TYPE>(sizeof(val))) {
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
|
||||
return FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
}
|
||||
// read from current location
|
||||
@ -394,7 +394,7 @@ namespace Fw {
|
||||
// check for room
|
||||
if (this->getBuffLength() == this->m_deserLoc) {
|
||||
return FW_DESERIALIZE_BUFFER_EMPTY;
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<NATIVE_UINT_TYPE>(sizeof(val))) {
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
|
||||
return FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
}
|
||||
// read from current location
|
||||
@ -415,7 +415,7 @@ namespace Fw {
|
||||
// check for room
|
||||
if (this->getBuffLength() == this->m_deserLoc) {
|
||||
return FW_DESERIALIZE_BUFFER_EMPTY;
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<NATIVE_UINT_TYPE>(sizeof(val))) {
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
|
||||
return FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
}
|
||||
// read from current location
|
||||
@ -438,7 +438,7 @@ namespace Fw {
|
||||
// check for room
|
||||
if (this->getBuffLength() == this->m_deserLoc) {
|
||||
return FW_DESERIALIZE_BUFFER_EMPTY;
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<NATIVE_UINT_TYPE>(sizeof(val))) {
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(val))) {
|
||||
return FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
}
|
||||
// read from current location
|
||||
@ -479,7 +479,7 @@ namespace Fw {
|
||||
// check for room
|
||||
if (this->getBuffLength() == this->m_deserLoc) {
|
||||
return FW_DESERIALIZE_BUFFER_EMPTY;
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<NATIVE_UINT_TYPE>(sizeof(U8))) {
|
||||
} else if (this->getBuffLength() - this->m_deserLoc < static_cast<Serializable::SizeType>(sizeof(U8))) {
|
||||
return FW_DESERIALIZE_SIZE_MISMATCH;
|
||||
}
|
||||
// read from current location
|
||||
@ -518,17 +518,17 @@ namespace Fw {
|
||||
return FW_SERIALIZE_OK;
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::deserialize(U8* buff, NATIVE_UINT_TYPE& length) {
|
||||
SerializeStatus SerializeBufferBase::deserialize(U8* buff, Serializable::SizeType& length) {
|
||||
FwSizeType length_in_out = static_cast<FwSizeType>(length);
|
||||
SerializeStatus status = this->deserialize(buff, length_in_out, Serialization::INCLUDE_LENGTH);
|
||||
length = static_cast<NATIVE_UINT_TYPE>(length_in_out);
|
||||
length = static_cast<Serializable::SizeType>(length_in_out);
|
||||
return status;
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::deserialize(U8* buff, NATIVE_UINT_TYPE& length, bool noLength) {
|
||||
SerializeStatus SerializeBufferBase::deserialize(U8* buff, Serializable::SizeType& length, bool noLength) {
|
||||
FwSizeType length_in_out = static_cast<FwSizeType>(length);
|
||||
SerializeStatus status = this->deserialize(buff, length_in_out, noLength ? Serialization::OMIT_LENGTH : Serialization::INCLUDE_LENGTH);
|
||||
length = static_cast<NATIVE_UINT_TYPE>(length_in_out);
|
||||
length = static_cast<Serializable::SizeType>(length_in_out);
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@ namespace Fw {
|
||||
FW_ASSERT(this->getBuffAddr());
|
||||
|
||||
if (mode == Serialization::INCLUDE_LENGTH) {
|
||||
FwBuffSizeType storedLength;
|
||||
FwSizeStoreType storedLength;
|
||||
|
||||
SerializeStatus stat = this->deserialize(storedLength);
|
||||
|
||||
@ -576,7 +576,7 @@ namespace Fw {
|
||||
FW_ASSERT(val.getBuffAddr());
|
||||
SerializeStatus stat = FW_SERIALIZE_OK;
|
||||
|
||||
FwBuffSizeType storedLength;
|
||||
FwSizeStoreType storedLength;
|
||||
|
||||
stat = this->deserialize(storedLength);
|
||||
|
||||
@ -665,11 +665,11 @@ namespace Fw {
|
||||
return this->deserializeSkip(offset);
|
||||
}
|
||||
|
||||
NATIVE_UINT_TYPE SerializeBufferBase::getBuffLength() const {
|
||||
Serializable::SizeType SerializeBufferBase::getBuffLength() const {
|
||||
return this->m_serLoc;
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::setBuff(const U8* src, NATIVE_UINT_TYPE length) {
|
||||
SerializeStatus SerializeBufferBase::setBuff(const U8* src, Serializable::SizeType length) {
|
||||
if (this->getBuffCapacity() < length) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
} else {
|
||||
@ -682,7 +682,7 @@ namespace Fw {
|
||||
}
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::setBuffLen(NATIVE_UINT_TYPE length) {
|
||||
SerializeStatus SerializeBufferBase::setBuffLen(Serializable::SizeType length) {
|
||||
if (this->getBuffCapacity() < length) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
} else {
|
||||
@ -692,11 +692,11 @@ namespace Fw {
|
||||
}
|
||||
}
|
||||
|
||||
NATIVE_UINT_TYPE SerializeBufferBase::getBuffLeft() const {
|
||||
Serializable::SizeType SerializeBufferBase::getBuffLeft() const {
|
||||
return this->m_serLoc - this->m_deserLoc;
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::copyRaw(SerializeBufferBase& dest, NATIVE_UINT_TYPE size) {
|
||||
SerializeStatus SerializeBufferBase::copyRaw(SerializeBufferBase& dest, Serializable::SizeType size) {
|
||||
// make sure there is sufficient size in destination
|
||||
if (dest.getBuffCapacity() < size) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
@ -710,7 +710,7 @@ namespace Fw {
|
||||
|
||||
}
|
||||
|
||||
SerializeStatus SerializeBufferBase::copyRawOffset(SerializeBufferBase& dest, NATIVE_UINT_TYPE size) {
|
||||
SerializeStatus SerializeBufferBase::copyRawOffset(SerializeBufferBase& dest, Serializable::SizeType size) {
|
||||
// make sure there is sufficient size in destination
|
||||
if (dest.getBuffCapacity() < size + dest.getBuffLength()) {
|
||||
return FW_SERIALIZE_NO_ROOM_LEFT;
|
||||
@ -752,7 +752,7 @@ namespace Fw {
|
||||
FW_ASSERT(us);
|
||||
FW_ASSERT(them);
|
||||
|
||||
for (NATIVE_UINT_TYPE byte = 0; byte < this->getBuffLength(); byte++) {
|
||||
for (Serializable::SizeType byte = 0; byte < this->getBuffLength(); byte++) {
|
||||
if (us[byte] != them[byte]) {
|
||||
return false;
|
||||
}
|
||||
@ -767,7 +767,7 @@ namespace Fw {
|
||||
|
||||
FW_ASSERT(us);
|
||||
|
||||
for (NATIVE_UINT_TYPE byte = 0; byte < buff.getBuffLength(); byte++) {
|
||||
for (Serializable::SizeType byte = 0; byte < buff.getBuffLength(); byte++) {
|
||||
os << "[" << std::setw(2) << std::hex << std::setfill('0') << us[byte] << "]" << std::dec;
|
||||
}
|
||||
|
||||
@ -775,7 +775,7 @@ namespace Fw {
|
||||
}
|
||||
#endif
|
||||
|
||||
ExternalSerializeBuffer::ExternalSerializeBuffer(U8* buffPtr, NATIVE_UINT_TYPE size) {
|
||||
ExternalSerializeBuffer::ExternalSerializeBuffer(U8* buffPtr, Serializable::SizeType size) {
|
||||
this->setExtBuffer(buffPtr,size);
|
||||
}
|
||||
|
||||
@ -783,7 +783,7 @@ namespace Fw {
|
||||
this->clear();
|
||||
}
|
||||
|
||||
void ExternalSerializeBuffer::setExtBuffer(U8* buffPtr, NATIVE_UINT_TYPE size) {
|
||||
void ExternalSerializeBuffer::setExtBuffer(U8* buffPtr, Serializable::SizeType size) {
|
||||
FW_ASSERT(buffPtr != nullptr);
|
||||
this->m_buff = buffPtr;
|
||||
this->m_buffSize = size;
|
||||
@ -794,7 +794,7 @@ namespace Fw {
|
||||
this->m_buffSize = 0;
|
||||
}
|
||||
|
||||
NATIVE_UINT_TYPE ExternalSerializeBuffer::getBuffCapacity() const {
|
||||
Serializable::SizeType ExternalSerializeBuffer::getBuffCapacity() const {
|
||||
return this->m_buffSize;
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,9 @@ namespace Fw {
|
||||
class SerializeBufferBase; //!< forward declaration
|
||||
|
||||
class Serializable {
|
||||
public:
|
||||
// Size type for backwards compatibility
|
||||
using SizeType = NATIVE_UINT_TYPE;
|
||||
public:
|
||||
virtual SerializeStatus serialize(SerializeBufferBase& buffer) const = 0; //!< serialize contents
|
||||
virtual SerializeStatus deserialize(SerializeBufferBase& buffer) = 0; //!< deserialize to contents
|
||||
@ -159,18 +162,18 @@ namespace Fw {
|
||||
|
||||
SerializeStatus serializeSkip(FwSizeType numBytesToSkip); //!< Skips the number of specified bytes for serialization
|
||||
SerializeStatus deserializeSkip(FwSizeType numBytesToSkip); //!< Skips the number of specified bytes for deserialization
|
||||
virtual NATIVE_UINT_TYPE getBuffCapacity() const = 0; //!< returns capacity, not current size, of buffer
|
||||
NATIVE_UINT_TYPE getBuffLength() const; //!< returns current buffer size
|
||||
NATIVE_UINT_TYPE getBuffLeft() const; //!< returns how much deserialization buffer is left
|
||||
virtual Serializable::SizeType getBuffCapacity() const = 0; //!< returns capacity, not current size, of buffer
|
||||
Serializable::SizeType getBuffLength() const; //!< returns current buffer size
|
||||
Serializable::SizeType getBuffLeft() const; //!< returns how much deserialization buffer is left
|
||||
virtual U8* getBuffAddr() = 0; //!< gets buffer address for data filling
|
||||
virtual const U8* getBuffAddr() const = 0; //!< gets buffer address for data reading, const version
|
||||
const U8* getBuffAddrLeft() const; //!< gets address of remaining non-deserialized data.
|
||||
U8* getBuffAddrSer(); //!< gets address of end of serialization. DANGEROUS! Need to know max buffer size and adjust when done
|
||||
SerializeStatus setBuff(const U8* src, NATIVE_UINT_TYPE length); //!< sets buffer contents and size
|
||||
SerializeStatus setBuffLen(NATIVE_UINT_TYPE length); //!< sets buffer length manually after filling with data
|
||||
SerializeStatus copyRaw(SerializeBufferBase& dest, NATIVE_UINT_TYPE size); //!< directly copies buffer without looking for a size in the stream.
|
||||
SerializeStatus setBuff(const U8* src, Serializable::SizeType length); //!< sets buffer contents and size
|
||||
SerializeStatus setBuffLen(Serializable::SizeType length); //!< sets buffer length manually after filling with data
|
||||
SerializeStatus copyRaw(SerializeBufferBase& dest, Serializable::SizeType size); //!< directly copies buffer without looking for a size in the stream.
|
||||
// Will increment deserialization pointer
|
||||
SerializeStatus copyRawOffset(SerializeBufferBase& dest, NATIVE_UINT_TYPE size); //!< directly copies buffer without looking for a size in the stream.
|
||||
SerializeStatus copyRawOffset(SerializeBufferBase& dest, Serializable::SizeType size); //!< directly copies buffer without looking for a size in the stream.
|
||||
// Will increment deserialization pointer
|
||||
|
||||
|
||||
@ -188,21 +191,21 @@ namespace Fw {
|
||||
SerializeBufferBase(const SerializeBufferBase &src); //!< constructor with buffer as source
|
||||
|
||||
void copyFrom(const SerializeBufferBase& src); //!< copy data from source buffer
|
||||
NATIVE_UINT_TYPE m_serLoc; //!< current offset in buffer of serialized data
|
||||
NATIVE_UINT_TYPE m_deserLoc; //!< current offset for deserialization
|
||||
Serializable::SizeType m_serLoc; //!< current offset in buffer of serialized data
|
||||
Serializable::SizeType m_deserLoc; //!< current offset for deserialization
|
||||
};
|
||||
|
||||
// Helper class for building buffers with external storage
|
||||
|
||||
class ExternalSerializeBuffer : public SerializeBufferBase {
|
||||
public:
|
||||
ExternalSerializeBuffer(U8* buffPtr, NATIVE_UINT_TYPE size); //!< construct with external buffer
|
||||
ExternalSerializeBuffer(U8* buffPtr, Serializable::SizeType size); //!< construct with external buffer
|
||||
ExternalSerializeBuffer(); //!< default constructor
|
||||
void setExtBuffer(U8* buffPtr, NATIVE_UINT_TYPE size); //!< Set the external buffer
|
||||
void setExtBuffer(U8* buffPtr, Serializable::SizeType size); //!< Set the external buffer
|
||||
void clear(); //!< clear external buffer
|
||||
|
||||
// pure virtual functions
|
||||
NATIVE_UINT_TYPE getBuffCapacity() const;
|
||||
Serializable::SizeType getBuffCapacity() const;
|
||||
U8* getBuffAddr();
|
||||
const U8* getBuffAddr() const ;
|
||||
|
||||
@ -214,7 +217,7 @@ namespace Fw {
|
||||
|
||||
// private data
|
||||
U8* m_buff; //!< pointer to external buffer
|
||||
NATIVE_UINT_TYPE m_buffSize; //!< size of external buffer
|
||||
Serializable::SizeType m_buffSize; //!< size of external buffer
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ namespace Fw {
|
||||
}
|
||||
|
||||
bool StringBase::operator==(const StringBase& other) const {
|
||||
NATIVE_UINT_TYPE len = this->length();
|
||||
SizeType len = this->length();
|
||||
if (len != other.length()) {
|
||||
return false;
|
||||
} else {
|
||||
@ -51,7 +51,7 @@ namespace Fw {
|
||||
return false;
|
||||
}
|
||||
|
||||
const NATIVE_UINT_TYPE capacity = this->getCapacity();
|
||||
const SizeType capacity = this->getCapacity();
|
||||
const size_t result = strncmp(us, other, capacity);
|
||||
return (result == 0);
|
||||
|
||||
@ -59,7 +59,7 @@ namespace Fw {
|
||||
|
||||
void StringBase::format(const CHAR* formatString, ...) {
|
||||
CHAR* us = const_cast<CHAR*>(this->toChar());
|
||||
NATIVE_UINT_TYPE cap = this->getCapacity();
|
||||
SizeType cap = this->getCapacity();
|
||||
FW_ASSERT(us);
|
||||
va_list args;
|
||||
va_start(args, formatString);
|
||||
@ -107,12 +107,12 @@ namespace Fw {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void StringBase::appendBuff(const CHAR* buff, NATIVE_UINT_TYPE size) {
|
||||
const U32 capacity = this->getCapacity();
|
||||
const U32 length = this->length();
|
||||
void StringBase::appendBuff(const CHAR* buff, SizeType size) {
|
||||
const SizeType capacity = this->getCapacity();
|
||||
const SizeType length = this->length();
|
||||
FW_ASSERT(capacity > length, capacity, length);
|
||||
// Subtract 1 to leave space for null terminator
|
||||
U32 remaining = capacity - length - 1;
|
||||
SizeType remaining = capacity - length - 1;
|
||||
if(size < remaining) {
|
||||
remaining = size;
|
||||
}
|
||||
@ -120,21 +120,21 @@ namespace Fw {
|
||||
(void) strncat(const_cast<CHAR*>(this->toChar()), buff, remaining);
|
||||
}
|
||||
|
||||
NATIVE_UINT_TYPE StringBase::length() const {
|
||||
return static_cast<NATIVE_UINT_TYPE>(StringUtils::string_length(this->toChar(),this->getCapacity()));
|
||||
StringBase::SizeType StringBase::length() const {
|
||||
return static_cast<SizeType>(StringUtils::string_length(this->toChar(),this->getCapacity()));
|
||||
}
|
||||
|
||||
SerializeStatus StringBase::serialize(SerializeBufferBase& buffer) const {
|
||||
return buffer.serialize(reinterpret_cast<const U8*>(this->toChar()),this->length());
|
||||
}
|
||||
|
||||
SerializeStatus StringBase::serialize(SerializeBufferBase& buffer, NATIVE_UINT_TYPE maxLength) const {
|
||||
NATIVE_INT_TYPE len = FW_MIN(maxLength,this->length());
|
||||
SerializeStatus StringBase::serialize(SerializeBufferBase& buffer, SizeType maxLength) const {
|
||||
SizeType len = FW_MIN(maxLength,this->length());
|
||||
return buffer.serialize(reinterpret_cast<const U8*>(this->toChar()), len);
|
||||
}
|
||||
|
||||
SerializeStatus StringBase::deserialize(SerializeBufferBase& buffer) {
|
||||
NATIVE_UINT_TYPE maxSize = this->getCapacity() - 1;
|
||||
SizeType maxSize = this->getCapacity() - 1;
|
||||
CHAR* raw = const_cast<CHAR*>(this->toChar());
|
||||
SerializeStatus stat = buffer.deserialize(reinterpret_cast<U8*>(raw),maxSize);
|
||||
// Null terminate deserialized string
|
||||
|
||||
@ -22,9 +22,10 @@
|
||||
namespace Fw {
|
||||
class StringBase : public Serializable {
|
||||
public:
|
||||
using SizeType = NATIVE_UINT_TYPE;
|
||||
virtual const CHAR* toChar() const = 0; //<! Convert to a C-style char*
|
||||
virtual NATIVE_UINT_TYPE getCapacity() const = 0; //!< return size of buffer
|
||||
NATIVE_UINT_TYPE length() const; //!< Get length of string
|
||||
virtual SizeType getCapacity() const = 0; //!< return size of buffer
|
||||
SizeType length() const; //!< Get length of string
|
||||
|
||||
const CHAR* operator+=(const CHAR* src); //!< Concatenate a CHAR*
|
||||
const StringBase& operator+=(const StringBase& src); //!< Concatenate a StringBase
|
||||
@ -38,7 +39,7 @@ namespace Fw {
|
||||
void format(const CHAR* formatString, ...); //!< write formatted string to buffer
|
||||
|
||||
virtual SerializeStatus serialize(SerializeBufferBase& buffer) const; //!< serialization function
|
||||
virtual SerializeStatus serialize(SerializeBufferBase& buffer, NATIVE_UINT_TYPE maxLen) const; //!< serialization function
|
||||
virtual SerializeStatus serialize(SerializeBufferBase& buffer, SizeType maxLen) const; //!< serialization function
|
||||
virtual SerializeStatus deserialize(SerializeBufferBase& buffer); //!< deserialization function
|
||||
|
||||
#ifdef BUILD_UT
|
||||
@ -53,7 +54,7 @@ namespace Fw {
|
||||
StringBase();
|
||||
virtual ~StringBase();
|
||||
|
||||
void appendBuff(const CHAR* buff, NATIVE_UINT_TYPE size);
|
||||
void appendBuff(const CHAR* buff, SizeType size);
|
||||
|
||||
private:
|
||||
// A no-implementation copy constructor here will prevent the default copy constructor from being called
|
||||
|
||||
@ -15,7 +15,7 @@ Task::Task() :
|
||||
m_suspendedOnPurpose(false)
|
||||
{}
|
||||
|
||||
Task::TaskStatus Task::start(const Fw::StringBase &name, taskRoutine routine, void* arg, NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity, NATIVE_UINT_TYPE identifier) {
|
||||
Task::TaskStatus Task::start(const Fw::StringBase &name, taskRoutine routine, void* arg, ParamType priority, ParamType stackSize, ParamType cpuAffinity, ParamType identifier) {
|
||||
//Get a task handle, and set it up
|
||||
BareTaskHandle* handle = new(std::nothrow) BareTaskHandle();
|
||||
if (handle == nullptr) {
|
||||
|
||||
@ -42,11 +42,11 @@ namespace Os {
|
||||
Fw::Logger::logMsg("[WARNING] Task priority set and permissions unavailable. Discarding priority.\n");
|
||||
priority = Task::TASK_DEFAULT; //Action: use constant
|
||||
}
|
||||
if (priority != Task::TASK_DEFAULT and priority < static_cast<NATIVE_UINT_TYPE>(min_priority)) {
|
||||
if (priority != Task::TASK_DEFAULT and priority < static_cast<Task::ParamType>(min_priority)) {
|
||||
Fw::Logger::logMsg("[WARNING] Low task priority of %d being clamped to %d\n", priority, min_priority);
|
||||
priority = min_priority;
|
||||
}
|
||||
if (priority != Task::TASK_DEFAULT and priority > static_cast<NATIVE_UINT_TYPE>(max_priority)) {
|
||||
if (priority != Task::TASK_DEFAULT and priority > static_cast<Task::ParamType>(max_priority)) {
|
||||
Fw::Logger::logMsg("[WARNING] High task priority of %d being clamped to %d\n", priority, max_priority);
|
||||
priority = max_priority;
|
||||
}
|
||||
@ -193,7 +193,7 @@ namespace Os {
|
||||
Task::Task() : m_handle(reinterpret_cast<POINTER_CAST>(nullptr)), m_identifier(0), m_affinity(-1), m_started(false), m_suspendedOnPurpose(false), m_routineWrapper() {
|
||||
}
|
||||
|
||||
Task::TaskStatus Task::start(const Fw::StringBase &name, taskRoutine routine, void* arg, NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity, NATIVE_UINT_TYPE identifier) {
|
||||
Task::TaskStatus Task::start(const Fw::StringBase &name, taskRoutine routine, void* arg, ParamType priority, ParamType stackSize, ParamType cpuAffinity, ParamType identifier) {
|
||||
FW_ASSERT(routine);
|
||||
|
||||
this->m_name = "TP_";
|
||||
|
||||
148
Os/Task.hpp
148
Os/Task.hpp
@ -5,89 +5,89 @@
|
||||
#include <Fw/Types/Serializable.hpp>
|
||||
#include <Os/TaskString.hpp>
|
||||
|
||||
#include <Os/TaskId.hpp>
|
||||
#include <Fw/Deprecate.hpp>
|
||||
#include <Os/TaskId.hpp>
|
||||
#include <limits>
|
||||
|
||||
namespace Os {
|
||||
|
||||
class TaskRegistry; //!< forward declaration
|
||||
class Task {
|
||||
public:
|
||||
static const NATIVE_UINT_TYPE TASK_DEFAULT;
|
||||
typedef enum {
|
||||
TASK_OK, //!< message sent/received okay
|
||||
TASK_INVALID_PARAMS, //!< started task with invalid parameters
|
||||
TASK_INVALID_STACK, //!< started with invalid stack size
|
||||
TASK_UNKNOWN_ERROR, //!< unexpected error return value
|
||||
TASK_INVALID_AFFINITY, //!< unable to set the task affinity
|
||||
TASK_DELAY_ERROR, //!< error trying to delay the task
|
||||
TASK_JOIN_ERROR, //!< error trying to join the task
|
||||
TASK_ERROR_RESOURCES, //!< unable to allocate more tasks
|
||||
TASK_ERROR_PERMISSION, //!< permissions error setting-up tasks
|
||||
} TaskStatus ;
|
||||
class TaskRegistry; //!< forward declaration
|
||||
class Task {
|
||||
public:
|
||||
using ParamType = NATIVE_UINT_TYPE;
|
||||
static const ParamType TASK_DEFAULT;
|
||||
typedef enum {
|
||||
TASK_OK, //!< message sent/received okay
|
||||
TASK_INVALID_PARAMS, //!< started task with invalid parameters
|
||||
TASK_INVALID_STACK, //!< started with invalid stack size
|
||||
TASK_UNKNOWN_ERROR, //!< unexpected error return value
|
||||
TASK_INVALID_AFFINITY, //!< unable to set the task affinity
|
||||
TASK_DELAY_ERROR, //!< error trying to delay the task
|
||||
TASK_JOIN_ERROR, //!< error trying to join the task
|
||||
TASK_ERROR_RESOURCES, //!< unable to allocate more tasks
|
||||
TASK_ERROR_PERMISSION, //!< permissions error setting-up tasks
|
||||
} TaskStatus;
|
||||
|
||||
typedef void (*taskRoutine)(void* ptr); //!< prototype for task routine started in task context
|
||||
|
||||
struct TaskRoutineWrapper {
|
||||
taskRoutine routine; //!< contains the task entrypoint
|
||||
void* arg; //!< contains the task entrypoint pointer
|
||||
};
|
||||
|
||||
Task(); //!< constructor
|
||||
virtual ~Task(); //!< destructor
|
||||
|
||||
TaskStatus start(const Fw::StringBase &name, taskRoutine routine, void* arg, NATIVE_UINT_TYPE priority = TASK_DEFAULT, NATIVE_UINT_TYPE stackSize = TASK_DEFAULT, NATIVE_UINT_TYPE cpuAffinity = TASK_DEFAULT, NATIVE_UINT_TYPE identifier = TASK_DEFAULT); //!< start the task
|
||||
|
||||
// Deprecated: only the name, routine, and argument are **required** parameters. This ordering of parameters is therefore inappropriate and will be removed in the future
|
||||
DEPRECATED(TaskStatus start(const Fw::StringBase &name, NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, taskRoutine routine, void* arg, NATIVE_INT_TYPE cpuAffinity = static_cast<NATIVE_INT_TYPE>(TASK_DEFAULT)),
|
||||
"Please switch to start(Fw::StringBase &name, taskRoutine routine, void* arg, NATIVE_UINT_TYPE priority, NATIVE_UINT_TYPE stackSize, NATIVE_UINT_TYPE cpuAffinity, NATIVE_UINT_TYPE identifier)"); //!< start the task
|
||||
I32 getIdentifier(); //!< get the identifier for the task
|
||||
static TaskId getOsIdentifier(); //Gets the Os Task ID. Useful for passive components.
|
||||
|
||||
static TaskStatus delay(NATIVE_UINT_TYPE msecs); //!< delay the task
|
||||
static NATIVE_INT_TYPE getNumTasks();
|
||||
|
||||
TaskStatus join(void **value_ptr); //!< Wait for task to finish
|
||||
void suspend(bool onPurpose = false); //!< suspend task
|
||||
void resume(); //!< resume execution of task
|
||||
bool wasSuspended(); //!< returns whether or not task was suspended on purpose
|
||||
bool isSuspended(); //!< check with OS to see if it is suspended already
|
||||
bool isStarted(); //!< check to see if task is started
|
||||
void setStarted(bool started); //!< set task to started when thread is fully up. Avoids a VxWorks race condition.
|
||||
/**
|
||||
* Returns the task-handle owned by this task
|
||||
*/
|
||||
POINTER_CAST getRawHandle();
|
||||
|
||||
static void registerTaskRegistry(TaskRegistry* registry);
|
||||
|
||||
private:
|
||||
|
||||
POINTER_CAST m_handle; //!< handle for implementation specific task
|
||||
NATIVE_INT_TYPE m_identifier; //!< thread independent identifier
|
||||
TaskString m_name; //!< object name
|
||||
NATIVE_INT_TYPE m_affinity; //!< CPU affinity for SMP targets
|
||||
|
||||
void toString(char* buf, NATIVE_INT_TYPE buffSize); //!< print a string of the state of the task
|
||||
bool m_started; //!< set when task has reached entry point
|
||||
bool m_suspendedOnPurpose; //!< set when task was suspended in purpose (i.e. simulation)
|
||||
TaskRoutineWrapper m_routineWrapper; //! Contains task entrypoint and argument for task wrapper
|
||||
|
||||
static TaskRegistry* s_taskRegistry; //!< pointer to registered task
|
||||
static NATIVE_INT_TYPE s_numTasks; //!< stores the number of tasks created.
|
||||
typedef void (*taskRoutine)(void* ptr); //!< prototype for task routine started in task context
|
||||
|
||||
struct TaskRoutineWrapper {
|
||||
taskRoutine routine; //!< contains the task entrypoint
|
||||
void* arg; //!< contains the task entrypoint pointer
|
||||
};
|
||||
|
||||
class TaskRegistry {
|
||||
public:
|
||||
TaskRegistry(); //!< constructor for task registry
|
||||
virtual ~TaskRegistry(); //!< destructor for task registry
|
||||
virtual void addTask(Task* task) = 0; //!< Add a task to the registry
|
||||
virtual void removeTask(Task* task) = 0; //!< remove a task from the registry
|
||||
Task(); //!< constructor
|
||||
virtual ~Task(); //!< destructor
|
||||
|
||||
private:
|
||||
};
|
||||
}
|
||||
TaskStatus start(const Fw::StringBase& name,
|
||||
taskRoutine routine,
|
||||
void* arg,
|
||||
ParamType priority = TASK_DEFAULT,
|
||||
ParamType stackSize = TASK_DEFAULT,
|
||||
ParamType cpuAffinity = TASK_DEFAULT,
|
||||
ParamType identifier = TASK_DEFAULT); //!< start the task
|
||||
|
||||
I32 getIdentifier(); //!< get the identifier for the task
|
||||
static TaskId getOsIdentifier(); // Gets the Os Task ID. Useful for passive components.
|
||||
|
||||
static TaskStatus delay(ParamType msecs); //!< delay the task
|
||||
static NATIVE_INT_TYPE getNumTasks();
|
||||
|
||||
TaskStatus join(void** value_ptr); //!< Wait for task to finish
|
||||
void suspend(bool onPurpose = false); //!< suspend task
|
||||
void resume(); //!< resume execution of task
|
||||
bool wasSuspended(); //!< returns whether or not task was suspended on purpose
|
||||
bool isSuspended(); //!< check with OS to see if it is suspended already
|
||||
bool isStarted(); //!< check to see if task is started
|
||||
void setStarted(bool started); //!< set task to started when thread is fully up. Avoids a VxWorks race condition.
|
||||
/**
|
||||
* Returns the task-handle owned by this task
|
||||
*/
|
||||
POINTER_CAST getRawHandle();
|
||||
|
||||
static void registerTaskRegistry(TaskRegistry* registry);
|
||||
|
||||
private:
|
||||
POINTER_CAST m_handle; //!< handle for implementation specific task
|
||||
NATIVE_INT_TYPE m_identifier; //!< thread independent identifier
|
||||
TaskString m_name; //!< object name
|
||||
NATIVE_INT_TYPE m_affinity; //!< CPU affinity for SMP targets
|
||||
|
||||
void toString(char* buf, NATIVE_INT_TYPE buffSize); //!< print a string of the state of the task
|
||||
bool m_started; //!< set when task has reached entry point
|
||||
bool m_suspendedOnPurpose; //!< set when task was suspended in purpose (i.e. simulation)
|
||||
TaskRoutineWrapper m_routineWrapper; //! Contains task entrypoint and argument for task wrapper
|
||||
|
||||
static TaskRegistry* s_taskRegistry; //!< pointer to registered task
|
||||
static NATIVE_INT_TYPE s_numTasks; //!< stores the number of tasks created.
|
||||
};
|
||||
|
||||
class TaskRegistry {
|
||||
public:
|
||||
TaskRegistry(); //!< constructor for task registry
|
||||
virtual ~TaskRegistry(); //!< destructor for task registry
|
||||
virtual void addTask(Task* task) = 0; //!< Add a task to the registry
|
||||
virtual void removeTask(Task* task) = 0; //!< remove a task from the registry
|
||||
};
|
||||
} // namespace Os
|
||||
|
||||
#endif
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
namespace Os {
|
||||
const NATIVE_UINT_TYPE Task::TASK_DEFAULT = std::numeric_limits<PlatformUIntType>::max();
|
||||
const Task::ParamType Task::TASK_DEFAULT = std::numeric_limits<Task::ParamType>::max();
|
||||
|
||||
TaskRegistry* Task::s_taskRegistry = nullptr;
|
||||
NATIVE_INT_TYPE Task::s_numTasks = 0;
|
||||
@ -43,10 +43,6 @@ namespace Os {
|
||||
|
||||
}
|
||||
|
||||
Task::TaskStatus Task::start(const Fw::StringBase &name, NATIVE_INT_TYPE identifier, NATIVE_INT_TYPE priority, NATIVE_INT_TYPE stackSize, taskRoutine routine, void* arg, NATIVE_INT_TYPE cpuAffinity) {
|
||||
return this->start(name, routine, arg, priority, stackSize, cpuAffinity, identifier);
|
||||
}
|
||||
|
||||
TaskRegistry::~TaskRegistry() {
|
||||
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ namespace RPI {
|
||||
void RpiDemoComponentImpl ::
|
||||
Run_handler(
|
||||
const NATIVE_INT_TYPE portNum,
|
||||
NATIVE_UINT_TYPE context
|
||||
U32 context
|
||||
)
|
||||
{
|
||||
// check which rate group call it is
|
||||
|
||||
@ -67,7 +67,7 @@ namespace RPI {
|
||||
//!
|
||||
void Run_handler(
|
||||
const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
) override;
|
||||
|
||||
//! Handler implementation for UartRead
|
||||
|
||||
@ -31,7 +31,7 @@ namespace Ref {
|
||||
SendBuffComponentBase::init(queueDepth,instance);
|
||||
}
|
||||
|
||||
void SendBuffImpl::SchedIn_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
void SendBuffImpl::SchedIn_handler(NATIVE_INT_TYPE portNum, U32 context) {
|
||||
|
||||
// first, dequeue any messages
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ namespace Ref {
|
||||
|
||||
private:
|
||||
|
||||
void SchedIn_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context); //!< downcall for input port
|
||||
void SchedIn_handler(NATIVE_INT_TYPE portNum, U32 context); //!< downcall for input port
|
||||
void SB_START_PKTS_cmdHandler(FwOpcodeType opcode, U32 cmdSeq); //!< START_PKTS command handler
|
||||
void SB_INJECT_PKT_ERROR_cmdHandler(FwOpcodeType opcode, U32 cmdSeq); //!< START_PKTS command handler
|
||||
void SB_GEN_FATAL_cmdHandler(
|
||||
|
||||
@ -97,7 +97,7 @@ namespace Ref {
|
||||
|
||||
void SignalGen :: schedIn_handler(
|
||||
NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
)
|
||||
{
|
||||
F32 value = 0.0f;
|
||||
|
||||
@ -30,7 +30,7 @@ namespace Ref {
|
||||
|
||||
void schedIn_handler(
|
||||
NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
);
|
||||
|
||||
void SignalGen_Settings_cmdHandler(
|
||||
|
||||
@ -45,7 +45,7 @@ The `Svc::ActiveRateGroup` component has one input port that is called to wake u
|
||||
A set of context values are passed in as an array to the configure function:
|
||||
|
||||
```
|
||||
void configure(NATIVE_UINT_TYPE contexts[], NATIVE_UINT_TYPE numContexts);
|
||||
void configure(NATIVE_INT_TYPE contexts[], NATIVE_INT_TYPE numContexts);
|
||||
```
|
||||
|
||||
A context value can be used by a component to discriminate between more than one call in the rate group.
|
||||
|
||||
@ -42,7 +42,7 @@ namespace Svc {
|
||||
ActiveRateGroupImplTester::~ActiveRateGroupImplTester() {
|
||||
}
|
||||
|
||||
void ActiveRateGroupImplTester::from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
void ActiveRateGroupImplTester::from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, U32 context) {
|
||||
ASSERT_TRUE(portNum < static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(m_impl.m_RateGroupMemberOut_OutputPort)));
|
||||
this->m_callLog[portNum].portCalled = true;
|
||||
this->m_callLog[portNum].contextVal = context;
|
||||
|
||||
@ -34,7 +34,7 @@ namespace Svc {
|
||||
|
||||
private:
|
||||
|
||||
void from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
void from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, U32 context);
|
||||
|
||||
//! Handler for from_PingOut
|
||||
//!
|
||||
@ -49,7 +49,7 @@ namespace Svc {
|
||||
|
||||
struct {
|
||||
bool portCalled;
|
||||
NATIVE_UINT_TYPE contextVal;
|
||||
U32 contextVal;
|
||||
NATIVE_UINT_TYPE order;
|
||||
} m_callLog[Svc::ActiveRateGroupComponentBase::NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS];
|
||||
|
||||
|
||||
@ -94,7 +94,7 @@ namespace Svc {
|
||||
void BufferLogger ::
|
||||
schedIn_handler(
|
||||
const NATIVE_INT_TYPE portNum,
|
||||
NATIVE_UINT_TYPE context
|
||||
U32 context
|
||||
)
|
||||
{
|
||||
// TODO
|
||||
|
||||
@ -211,7 +211,7 @@ namespace Svc {
|
||||
//!
|
||||
void schedIn_handler(
|
||||
const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
);
|
||||
|
||||
PRIVATE:
|
||||
|
||||
@ -219,7 +219,7 @@ namespace Svc {
|
||||
void BufferManagerComponentImpl ::
|
||||
schedIn_handler(
|
||||
const NATIVE_INT_TYPE portNum,
|
||||
NATIVE_UINT_TYPE context
|
||||
U32 context
|
||||
)
|
||||
{
|
||||
// write telemetry values
|
||||
|
||||
@ -127,7 +127,7 @@ namespace Svc
|
||||
//!
|
||||
void schedIn_handler(
|
||||
const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ void ComQueue::comStatusIn_handler(const NATIVE_INT_TYPE portNum, Fw::Success& c
|
||||
}
|
||||
}
|
||||
|
||||
void ComQueue::run_handler(const NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
void ComQueue::run_handler(const NATIVE_INT_TYPE portNum, U32 context) {
|
||||
// Downlink the high-water marks for the Fw::ComBuffer array types
|
||||
ComQueueDepth comQueueDepth;
|
||||
for (FwSizeType i = 0; i < comQueueDepth.SIZE; i++) {
|
||||
|
||||
@ -148,7 +148,7 @@ class ComQueue : public ComQueueComponentBase {
|
||||
//! Schedules the transmission of telemetry
|
||||
//!
|
||||
void run_handler(const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!<The call order*/
|
||||
U32 context /*!<The call order*/
|
||||
);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@ -90,7 +90,7 @@ void Deframer ::framedIn_handler(
|
||||
|
||||
void Deframer ::schedIn_handler(
|
||||
const NATIVE_INT_TYPE portNum,
|
||||
NATIVE_UINT_TYPE context
|
||||
U32 context
|
||||
) {
|
||||
// Check for data
|
||||
Fw::Buffer buffer(m_pollBuffer, sizeof(m_pollBuffer));
|
||||
|
||||
@ -86,7 +86,7 @@ class Deframer :
|
||||
//! Handler implementation for schedIn
|
||||
void schedIn_handler(
|
||||
const NATIVE_INT_TYPE portNum, //!< The port number
|
||||
NATIVE_UINT_TYPE context //!< The call order
|
||||
U32 context //!< The call order
|
||||
);
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@ -92,7 +92,7 @@ namespace Svc {
|
||||
void FileDownlink ::
|
||||
Run_handler(
|
||||
const NATIVE_INT_TYPE portNum,
|
||||
NATIVE_UINT_TYPE context
|
||||
U32 context
|
||||
)
|
||||
{
|
||||
switch(this->m_mode.get())
|
||||
|
||||
@ -304,7 +304,7 @@ namespace Svc {
|
||||
//!
|
||||
void Run_handler(
|
||||
const NATIVE_INT_TYPE portNum, //!< The port number
|
||||
NATIVE_UINT_TYPE context //!< The call order
|
||||
U32 context //!< The call order
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ namespace Svc {
|
||||
void GroundInterfaceComponentImpl ::
|
||||
schedIn_handler(
|
||||
const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
)
|
||||
{
|
||||
// TODO: replace with a call to a buffer manager
|
||||
|
||||
@ -74,7 +74,7 @@ namespace Svc {
|
||||
//!
|
||||
void schedIn_handler(
|
||||
const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
);
|
||||
//! Frame and send some data
|
||||
//!
|
||||
|
||||
@ -82,7 +82,7 @@ namespace Svc {
|
||||
|
||||
}
|
||||
|
||||
void HealthImpl::Run_handler(const NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
void HealthImpl::Run_handler(const NATIVE_INT_TYPE portNum, U32 context) {
|
||||
//dispatch messages
|
||||
for (NATIVE_UINT_TYPE i = 0; i < this->queue_depth; i++) {
|
||||
MsgDispatchStatus stat = this->doDispatch();
|
||||
|
||||
@ -100,7 +100,7 @@ namespace Svc {
|
||||
//!
|
||||
//! \param portNum Port number
|
||||
//! \param context Port Context
|
||||
void Run_handler(const NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
void Run_handler(const NATIVE_INT_TYPE portNum, U32 context);
|
||||
|
||||
//! \brief HLTH_ENABLE handler
|
||||
//!
|
||||
|
||||
@ -67,7 +67,7 @@ class PassiveRateGroup : public PassiveRateGroupComponentBase {
|
||||
U32 m_cycles; //!< cycles executed
|
||||
U32 m_maxTime; //!< maximum execution time in microseconds
|
||||
NATIVE_INT_TYPE m_numContexts; //!< number of contexts
|
||||
NATIVE_INT_TYPE m_contexts[NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS]; //!< Must match number of output ports
|
||||
U32 m_contexts[NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS]; //!< Must match number of output ports
|
||||
};
|
||||
|
||||
} // namespace Svc
|
||||
|
||||
@ -38,7 +38,7 @@ void PassiveRateGroupTester::clearPortCalls() {
|
||||
|
||||
PassiveRateGroupTester::~PassiveRateGroupTester() {}
|
||||
|
||||
void PassiveRateGroupTester::from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
void PassiveRateGroupTester::from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, U32 context) {
|
||||
ASSERT_TRUE(portNum < static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(m_impl.m_RateGroupMemberOut_OutputPort)));
|
||||
this->m_callLog[portNum].portCalled = true;
|
||||
this->m_callLog[portNum].contextVal = context;
|
||||
|
||||
@ -27,11 +27,11 @@ namespace Svc {
|
||||
|
||||
void init(NATIVE_INT_TYPE instance = 0);
|
||||
|
||||
void runNominal(NATIVE_UINT_TYPE contexts[], NATIVE_UINT_TYPE numContexts, NATIVE_INT_TYPE instance);
|
||||
void runNominal(U32 contexts[], U32 numContexts, NATIVE_INT_TYPE instance);
|
||||
|
||||
private:
|
||||
|
||||
void from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
void from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, U32 context);
|
||||
|
||||
Svc::PassiveRateGroup& m_impl;
|
||||
|
||||
@ -39,7 +39,7 @@ namespace Svc {
|
||||
|
||||
struct {
|
||||
bool portCalled;
|
||||
NATIVE_UINT_TYPE contextVal;
|
||||
U32 contextVal;
|
||||
NATIVE_UINT_TYPE order;
|
||||
} m_callLog[Svc::PassiveRateGroupComponentBase::NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS];
|
||||
|
||||
|
||||
@ -27,11 +27,11 @@ namespace Svc {
|
||||
|
||||
void init(NATIVE_INT_TYPE instance = 0);
|
||||
|
||||
void runNominal(NATIVE_INT_TYPE contexts[], NATIVE_UINT_TYPE numContexts, NATIVE_INT_TYPE instance);
|
||||
void runNominal(NATIVE_INT_TYPE contexts[], U32 numContexts, NATIVE_INT_TYPE instance);
|
||||
|
||||
private:
|
||||
|
||||
void from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
void from_RateGroupMemberOut_handler(NATIVE_INT_TYPE portNum, U32 context);
|
||||
|
||||
Svc::PassiveRateGroup& m_impl;
|
||||
|
||||
@ -39,11 +39,11 @@ namespace Svc {
|
||||
|
||||
struct {
|
||||
bool portCalled;
|
||||
NATIVE_UINT_TYPE contextVal;
|
||||
U32 contextVal;
|
||||
NATIVE_UINT_TYPE order;
|
||||
} m_callLog[Svc::PassiveRateGroupComponentBase::NUM_RATEGROUPMEMBEROUT_OUTPUT_PORTS];
|
||||
|
||||
NATIVE_UINT_TYPE m_callOrder; //!< tracks order of port call.
|
||||
U32 m_callOrder; //!< tracks order of port call.
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ module Svc {
|
||||
|
||||
@ Scheduler Port with order argument
|
||||
port Sched(
|
||||
context: NATIVE_UINT_TYPE @< The call order
|
||||
context: U32 @< The call order
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ SystemResources ::~SystemResources() {}
|
||||
// Handler implementations for user-defined typed input ports
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void SystemResources ::run_handler(const NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE tick_time_hz) {
|
||||
void SystemResources ::run_handler(const NATIVE_INT_TYPE portNum, U32 tick_time_hz) {
|
||||
if (m_enable) {
|
||||
Cpu();
|
||||
Mem();
|
||||
|
||||
@ -51,7 +51,7 @@ class SystemResources : public SystemResourcesComponentBase {
|
||||
//!
|
||||
void
|
||||
run_handler(const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
);
|
||||
|
||||
private:
|
||||
|
||||
@ -134,7 +134,7 @@ void TlmChan::TlmRecv_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time
|
||||
entryToUse->buffer = val;
|
||||
}
|
||||
|
||||
void TlmChan::Run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
void TlmChan::Run_handler(NATIVE_INT_TYPE portNum, U32 context) {
|
||||
// Only write packets if connected
|
||||
if (not this->isConnected_PktSend_OutputPort(0)) {
|
||||
return;
|
||||
|
||||
@ -35,7 +35,7 @@ class TlmChan : public TlmChanComponentBase {
|
||||
// Port functions
|
||||
void TlmRecv_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time& timeTag, Fw::TlmBuffer& val);
|
||||
void TlmGet_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time& timeTag, Fw::TlmBuffer& val);
|
||||
void Run_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
void Run_handler(NATIVE_INT_TYPE portNum, U32 context);
|
||||
//! Handler implementation for pingIn
|
||||
//!
|
||||
void pingIn_handler(const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
|
||||
@ -236,7 +236,7 @@ void TlmPacketizer ::TlmRecv_handler(const NATIVE_INT_TYPE portNum,
|
||||
}
|
||||
}
|
||||
|
||||
void TlmPacketizer ::Run_handler(const NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {
|
||||
void TlmPacketizer ::Run_handler(const NATIVE_INT_TYPE portNum, U32 context) {
|
||||
FW_ASSERT(this->m_configured);
|
||||
|
||||
// Only write packets if connected
|
||||
|
||||
@ -60,7 +60,7 @@ class TlmPacketizer : public TlmPacketizerComponentBase {
|
||||
//! Handler implementation for Run
|
||||
//!
|
||||
void Run_handler(const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
);
|
||||
|
||||
//! Handler implementation for pingIn
|
||||
|
||||
@ -118,7 +118,7 @@ namespace Svc {
|
||||
void UdpReceiverComponentImpl ::
|
||||
Sched_handler(
|
||||
const NATIVE_INT_TYPE portNum,
|
||||
NATIVE_UINT_TYPE context
|
||||
U32 context
|
||||
)
|
||||
{
|
||||
this->tlmWrite_UR_BytesReceived(this->m_bytesReceived);
|
||||
|
||||
@ -67,7 +67,7 @@ namespace Svc {
|
||||
//!
|
||||
void Sched_handler(
|
||||
const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
);
|
||||
|
||||
static void workerTask(void* ptr); //!< worker task entry point
|
||||
|
||||
@ -93,7 +93,7 @@ namespace Svc {
|
||||
void UdpSenderComponentImpl ::
|
||||
Sched_handler(
|
||||
const NATIVE_INT_TYPE portNum,
|
||||
NATIVE_UINT_TYPE context
|
||||
U32 context
|
||||
)
|
||||
{
|
||||
this->tlmWrite_US_BytesSent(this->m_bytesSent);
|
||||
|
||||
@ -67,7 +67,7 @@ namespace Svc {
|
||||
//!
|
||||
void Sched_handler(
|
||||
const NATIVE_INT_TYPE portNum, /*!< The port number*/
|
||||
NATIVE_UINT_TYPE context /*!< The call order*/
|
||||
U32 context /*!< The call order*/
|
||||
);
|
||||
|
||||
PRIVATE:
|
||||
|
||||
@ -12,5 +12,5 @@ void TestComponent ::init(const NATIVE_INT_TYPE instance) {
|
||||
|
||||
TestComponent ::~TestComponent() {}
|
||||
|
||||
void TestComponent ::schedIn_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {}
|
||||
void TestComponent ::schedIn_handler(NATIVE_INT_TYPE portNum, U32 context) {}
|
||||
};
|
||||
|
||||
@ -12,7 +12,7 @@ class TestComponent : public TestComponentComponentBase
|
||||
void init(const NATIVE_INT_TYPE instance);
|
||||
~TestComponent();
|
||||
private:
|
||||
void schedIn_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
void schedIn_handler(NATIVE_INT_TYPE portNum, U32 context);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@ -12,5 +12,5 @@ void TestComponent ::init(const NATIVE_INT_TYPE instance) {
|
||||
|
||||
TestComponent ::~TestComponent() {}
|
||||
|
||||
void TestComponent ::schedIn_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context) {}
|
||||
void TestComponent ::schedIn_handler(NATIVE_INT_TYPE portNum, U32 context) {}
|
||||
};
|
||||
|
||||
@ -12,7 +12,7 @@ class TestComponent : public TestComponentComponentBase
|
||||
void init(const NATIVE_INT_TYPE instance);
|
||||
~TestComponent();
|
||||
private:
|
||||
void schedIn_handler(NATIVE_INT_TYPE portNum, NATIVE_UINT_TYPE context);
|
||||
void schedIn_handler(NATIVE_INT_TYPE portNum, U32 context);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@ -12,6 +12,3 @@ type FwSizeType
|
||||
type FwTimeBaseStoreType
|
||||
type FwTimeContextStoreType
|
||||
type FwTlmPacketizeIdType
|
||||
type NATIVE_INT_TYPE
|
||||
type NATIVE_UINT_TYPE
|
||||
type POINTER_CAST
|
||||
|
||||
@ -12,27 +12,42 @@
|
||||
#ifndef FPCONFIG_H_
|
||||
#define FPCONFIG_H_
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Type aliases
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// The type of port indices and smaller sizes internal to the software
|
||||
typedef PlatformIndexType FwIndexType;
|
||||
#define PRI_FwIndexType PRI_PlatformIndexType
|
||||
|
||||
// The signed type of larger sizes internal to the software, e.g., memory buffer sizes,
|
||||
// file sizes
|
||||
typedef PlatformSignedSizeType FwSignedSizeType;
|
||||
#define PRI_FwSignedSizeType PRI_PlatformSignedSizeType
|
||||
|
||||
// The unsigned type of larger sizes internal to the software, e.g., memory buffer sizes,
|
||||
// file sizes
|
||||
typedef PlatformSizeType FwSizeType;
|
||||
#define PRI_FwSizeType PRI_PlatformSizeType
|
||||
|
||||
// The type of an assertion argument
|
||||
typedef PlatformAssertArgType FwAssertArgType;
|
||||
#define PRI_FwAssertArgType PRI_PlatformAssertArgType
|
||||
|
||||
// The type of a machine integer. Ordinarily this should be int.
|
||||
typedef PlatformIntType FwNativeIntType;
|
||||
#define PRI_FwNativeIntType PRI_PlatformIntType
|
||||
|
||||
// The type of a machine unsigned integer. Ordinarily this should be unsigned int.
|
||||
typedef PlatformUIntType FwNativeUIntType;
|
||||
#define PRI_FwNativeUIntType PRI_PlatformUIntType
|
||||
|
||||
// The type used to serialize a size value
|
||||
typedef U16 FwSizeStoreType;
|
||||
#define PRI_FwSizeStoreType PRIu16
|
||||
|
||||
// The type used to serialize a C++ enumeration constant
|
||||
// FPP enumerations are serialized according to their representation types
|
||||
typedef I32 FwEnumStoreType;
|
||||
#define PRI_FwEnumStoreType PRId32
|
||||
|
||||
@ -47,36 +62,65 @@ typedef enum {
|
||||
} TimeBase;
|
||||
#define FW_CONTEXT_DONT_CARE 0xFF //!< Don't care value for time contexts in sequences
|
||||
|
||||
// The type used to serialize a time base value
|
||||
typedef U16 FwTimeBaseStoreType;
|
||||
#define PRI_FwTimeBaseStoreType PRIu16
|
||||
|
||||
// The type used to serialize a time context value
|
||||
typedef U8 FwTimeContextStoreType;
|
||||
#define PRI_FwTimeContextStoreType PRIu8
|
||||
|
||||
// The type of a com packet descriptor
|
||||
typedef U32 FwPacketDescriptorType;
|
||||
#define PRI_FwPacketDescriptorType PRIu32
|
||||
|
||||
// The type of a command opcode
|
||||
typedef U32 FwOpcodeType;
|
||||
#define PRI_FwOpcodeType PRIu32
|
||||
|
||||
// The type of a telemetry channel identifier
|
||||
typedef U32 FwChanIdType;
|
||||
#define PRI_FwChanIdType PRIu32
|
||||
|
||||
// The type of an event identifier
|
||||
typedef U32 FwEventIdType;
|
||||
#define PRI_FwEventIdType PRIu32
|
||||
|
||||
// The type of a parameter identifier
|
||||
typedef U32 FwPrmIdType;
|
||||
#define PRI_FwPrmIdType PRIu32
|
||||
|
||||
// The type of a telemetry packet identifier
|
||||
typedef U16 FwTlmPacketizeIdType;
|
||||
#define PRI_FwTlmPacketizeIdType PRIu16
|
||||
|
||||
// The type of a queue priority
|
||||
typedef I32 FwQueuePriorityType;
|
||||
#define PRI_FwQueuePriorityType PRId32
|
||||
|
||||
// The type of a data product identifier
|
||||
typedef U32 FwDpIdType;
|
||||
#define PRI_FwDpIdType PRIu32
|
||||
|
||||
// The type of a data product priority
|
||||
typedef U32 FwDpPriorityType;
|
||||
#define PRI_FwDpPriorityType PRIu32
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Derived type aliases
|
||||
// By default, these types are aliases of types defined above
|
||||
// If necessary, you can change these definitions
|
||||
// In most cases, the defaults should work
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// The type of a queue size
|
||||
typedef FwIndexType FwQueueSizeType;
|
||||
#define PRI_FwQueueSizeType PRI_FwIndexType
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Configuration switches
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Boolean values for serialization
|
||||
#ifndef FW_SERIALIZE_TRUE_VALUE
|
||||
#define FW_SERIALIZE_TRUE_VALUE (0xFF) //!< Value encoded during serialization for boolean true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user