Skip to content

Commit

Permalink
Add the new FP Manager component
Browse files Browse the repository at this point in the history
  • Loading branch information
watney committed Apr 5, 2024
1 parent 3166546 commit 4982e36
Show file tree
Hide file tree
Showing 78 changed files with 15,915 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Svc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/StaticMemory/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmChan/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TlmPacketizer/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/SystemResources/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FPManager/")
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FP/")

# Text logger components included by default,
# but can be disabled if FW_ENABLE_TEXT_LOGGING=0 is desired.
Expand Down
5 changes: 5 additions & 0 deletions Svc/FP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
set(
SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/FP.fpp"
)
register_fprime_module()
8 changes: 8 additions & 0 deletions Svc/FP/FP.fpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module Svc {


port FP (
fault: U32
)

}
29 changes: 29 additions & 0 deletions Svc/FPManager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# F prime CMakeLists.txt:
# SOURCE_FILES: combined list of source and autocoding diles
# MOD_DEPS: (optional) module dependencies
# Note: using PROJECT_NAME as EXECUTABLE_NAME
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/FPManager.fpp"
"${CMAKE_CURRENT_LIST_DIR}/TlmDict.fppi"
"${CMAKE_CURRENT_LIST_DIR}/FPManagerImpl.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Response.cpp"
"${CMAKE_CURRENT_LIST_DIR}/CommandSerializer.cpp"
"${CMAKE_CURRENT_LIST_DIR}/FPResponseTable.cpp"

"${CMAKE_CURRENT_LIST_DIR}/RESP_1.cpp"
"${CMAKE_CURRENT_LIST_DIR}/RESP_2.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SAFING.cpp"

)

register_fprime_module()
#
set(UT_SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/FPManager.fpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/Tester.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/TestMain.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/ResponseExecutionRules.cpp"
"${CMAKE_CURRENT_LIST_DIR}/test/ut/TestRules.cpp"
)
set (UT_MOD_DEPS STest)
register_fprime_ut()
33 changes: 33 additions & 0 deletions Svc/FPManager/CMakeLists.txt.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
####
# F prime CMakeLists.txt:
#
# SOURCE_FILES: combined list of source and autocoding diles
# MOD_DEPS: (optional) module dependencies
#
# Note: using PROJECT_NAME as EXECUTABLE_NAME
####
set(SOURCE_FILES
"\${CMAKE_CURRENT_LIST_DIR}/FPManager.fpp"
"\${CMAKE_CURRENT_LIST_DIR}/TlmDict.fppi"
"\${CMAKE_CURRENT_LIST_DIR}/FPManagerImpl.cpp"
"\${CMAKE_CURRENT_LIST_DIR}/Response.cpp"
"\${CMAKE_CURRENT_LIST_DIR}/CommandSerializer.cpp"
"\${CMAKE_CURRENT_LIST_DIR}/FPResponseTable.cpp"

#for $response in $responses:
"\${CMAKE_CURRENT_LIST_DIR}/$(response).cpp"
#end for

)

register_fprime_module()
# ### UTs ###
set(UT_SOURCE_FILES
"\${CMAKE_CURRENT_LIST_DIR}/FPManager.fpp"
"\${CMAKE_CURRENT_LIST_DIR}/test/ut/Tester.cpp"
"\${CMAKE_CURRENT_LIST_DIR}/test/ut/TestMain.cpp"
"\${CMAKE_CURRENT_LIST_DIR}/test/ut/ResponseExecutionRules.cpp"
"\${CMAKE_CURRENT_LIST_DIR}/test/ut/TestRules.cpp"
)
set (UT_MOD_DEPS STest)
register_fprime_ut()
40 changes: 40 additions & 0 deletions Svc/FPManager/CommandOpcodes.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* \file CommandOpcodes.hpp
* \author Auto-coded
* \brief Enumeration list containing command opcodes
* This is generated by running the testcmd.sh script.
*
*
* \copyright
* Copyright 2009-2015, by the California Institute of Technology.
* ALL RIGHTS RESERVED. United States Government Sponsorship
* acknowledged. Any commercial use must be negotiated with the Office
* of Technology Transfer at the California Institute of Technology.
* <br /><br />
* This software may be subject to U.S. export control laws and
* regulations. By accepting this document, the user agrees to comply
* with all U.S. export laws and regulations. User has the
* responsibility to obtain export licenses, or other export authority
* as may be required before exporting such information to foreign
* countries or providing access to foreign persons.
*/

#ifndef __COMMAND_OPCODES_HPP_
#define __COMMAND_OPCODES_HPP_

namespace Svc {

namespace OPCODES {

enum Opcodes {
CMD_CLEAR_TRACKING = 0x503,
CMD_NO_OP = 0x500,
CMD_TEST_CMD_1 = 0x502,
};

}

}

#endif

40 changes: 40 additions & 0 deletions Svc/FPManager/CommandOpcodes.hpp.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* \file CommandOpcodes.hpp
* \author Auto-coded
* \brief Enumeration list containing command opcodes
* This is generated by running the testcmd.sh script.
*
*
* \copyright
* Copyright 2009-2015, by the California Institute of Technology.
* ALL RIGHTS RESERVED. United States Government Sponsorship
* acknowledged. Any commercial use must be negotiated with the Office
* of Technology Transfer at the California Institute of Technology.
* <br /><br />
* This software may be subject to U.S. export control laws and
* regulations. By accepting this document, the user agrees to comply
* with all U.S. export laws and regulations. User has the
* responsibility to obtain export licenses, or other export authority
* as may be required before exporting such information to foreign
* countries or providing access to foreign persons.
*/

#ifndef __COMMAND_OPCODES_HPP_
#define __COMMAND_OPCODES_HPP_

namespace Svc {

namespace OPCODES {

enum Opcodes {
#for $cmd in $cmds:
$cmd.command = $cmd.opcode,
#end for
};

}

}

#endif

107 changes: 107 additions & 0 deletions Svc/FPManager/CommandSerializer.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/**
* \file CommandSerializer.cpp
* \author Auto-coded
* \brief Command Serializer implementation
* This is generated by running the testcmd.sh script.
*
*
* \copyright
* Copyright 2009-2015, by the California Institute of Technology.
* ALL RIGHTS RESERVED. United States Government Sponsorship
* acknowledged. Any commercial use must be negotiated with the Office
* of Technology Transfer at the California Institute of Technology.
* <br /><br />
* This software may be subject to U.S. export control laws and
* regulations. By accepting this document, the user agrees to comply
* with all U.S. export laws and regulations. User has the
* responsibility to obtain export licenses, or other export authority
* as may be required before exporting such information to foreign
* countries or providing access to foreign persons.
*/

#include "CommandSerializer.hpp"
#include "CommandOpcodes.hpp"
#include "Fw/Com/ComPacket.hpp"

namespace Svc {

namespace CommandSerializer {


Fw::SerializeStatus
CMD_CLEAR_TRACKING(
Fw::ComBuffer& comBuffer
)
{
Fw::SerializeStatus status;
// Reset the buffer
comBuffer.resetSer();
// Serialize the command packet type
FwPacketDescriptorType descriptor = Fw::ComPacket::FW_PACKET_COMMAND;
status = comBuffer.serialize(descriptor);
// Serialize the opcode
if (status == Fw::FW_SERIALIZE_OK) {
FwOpcodeType opcode = OPCODES::CMD_CLEAR_TRACKING;
status = comBuffer.serialize(opcode);
}
// Serialize arguments
return status;
}


Fw::SerializeStatus
CMD_NO_OP(
Fw::ComBuffer& comBuffer
)
{
Fw::SerializeStatus status;
// Reset the buffer
comBuffer.resetSer();
// Serialize the command packet type
FwPacketDescriptorType descriptor = Fw::ComPacket::FW_PACKET_COMMAND;
status = comBuffer.serialize(descriptor);
// Serialize the opcode
if (status == Fw::FW_SERIALIZE_OK) {
FwOpcodeType opcode = OPCODES::CMD_NO_OP;
status = comBuffer.serialize(opcode);
}
// Serialize arguments
return status;
}


Fw::SerializeStatus
CMD_TEST_CMD_1(
I32 arg1,
F32 arg2,
U8 arg3,
Fw::ComBuffer& comBuffer
)
{
Fw::SerializeStatus status;
// Reset the buffer
comBuffer.resetSer();
// Serialize the command packet type
FwPacketDescriptorType descriptor = Fw::ComPacket::FW_PACKET_COMMAND;
status = comBuffer.serialize(descriptor);
// Serialize the opcode
if (status == Fw::FW_SERIALIZE_OK) {
FwOpcodeType opcode = OPCODES::CMD_TEST_CMD_1;
status = comBuffer.serialize(opcode);
}
// Serialize arguments
if (status == Fw::FW_SERIALIZE_OK) {
status = comBuffer.serialize(arg1);
}
if (status == Fw::FW_SERIALIZE_OK) {
status = comBuffer.serialize(arg2);
}
if (status == Fw::FW_SERIALIZE_OK) {
status = comBuffer.serialize(arg3);
}
return status;
}

}
}

63 changes: 63 additions & 0 deletions Svc/FPManager/CommandSerializer.cpp.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* \file CommandSerializer.cpp
* \author Auto-coded
* \brief Command Serializer implementation
* This is generated by running the testcmd.sh script.
*
*
* \copyright
* Copyright 2009-2015, by the California Institute of Technology.
* ALL RIGHTS RESERVED. United States Government Sponsorship
* acknowledged. Any commercial use must be negotiated with the Office
* of Technology Transfer at the California Institute of Technology.
* <br /><br />
* This software may be subject to U.S. export control laws and
* regulations. By accepting this document, the user agrees to comply
* with all U.S. export laws and regulations. User has the
* responsibility to obtain export licenses, or other export authority
* as may be required before exporting such information to foreign
* countries or providing access to foreign persons.
*/

\#include "CommandSerializer.hpp"
\#include "CommandOpcodes.hpp"
\#include "Fw/Com/ComPacket.hpp"

namespace Svc {

namespace CommandSerializer {

#for $cmd in $cmds:

Fw::SerializeStatus
$(cmd.command)(
#for $arg in $cmd.argList:
$arg[1] $arg[0],
#end for
Fw::ComBuffer& comBuffer
)
{
Fw::SerializeStatus status;
// Reset the buffer
comBuffer.resetSer();
// Serialize the command packet type
FwPacketDescriptorType descriptor = Fw::ComPacket::FW_PACKET_COMMAND;
status = comBuffer.serialize(descriptor);
// Serialize the opcode
if (status == Fw::FW_SERIALIZE_OK) {
FwOpcodeType opcode = OPCODES::$cmd.command;
status = comBuffer.serialize(opcode);
}
// Serialize arguments
#for $arg in $cmd.argList:
if (status == Fw::FW_SERIALIZE_OK) {
status = comBuffer.serialize($arg[0]);
}
#end for
return status;
}

#end for
}
}

Loading

0 comments on commit 4982e36

Please sign in to comment.