Skip to content

Commit

Permalink
Remove FPP dependencies on native int types (#2548)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
bocchino authored Mar 5, 2024
1 parent bdfe241 commit c02f351
Show file tree
Hide file tree
Showing 60 changed files with 288 additions and 252 deletions.
2 changes: 1 addition & 1 deletion Drv/BlockDriver/BlockDriverImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion Drv/BlockDriver/BlockDriverImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions Drv/Ip/SocketReadTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions Drv/Ip/SocketReadTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion FppTest/dp/DpTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion FppTest/dp/DpTest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 1 addition & 7 deletions Fw/Comp/ActiveComponentBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
55 changes: 28 additions & 27 deletions Fw/Comp/ActiveComponentBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
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
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
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.
};
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
Loading

0 comments on commit c02f351

Please sign in to comment.