From 30e89c4a1d760fead49726477e8b1a34bd528db7 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Wed, 3 Apr 2024 17:32:53 +0900 Subject: [PATCH 01/13] move ctcp sp impl from mobc to core --- .../common_packet/space_packet}/common_cmd_packet.c | 0 .../common_packet/space_packet}/common_tlm_cmd_packet.c | 0 .../common_packet/space_packet}/common_tlm_packet.c | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {examples/mobc/src/src_user/tlm_cmd => tlm_cmd/common_packet/space_packet}/common_cmd_packet.c (100%) rename {examples/mobc/src/src_user/tlm_cmd => tlm_cmd/common_packet/space_packet}/common_tlm_cmd_packet.c (100%) rename {examples/mobc/src/src_user/tlm_cmd => tlm_cmd/common_packet/space_packet}/common_tlm_packet.c (100%) diff --git a/examples/mobc/src/src_user/tlm_cmd/common_cmd_packet.c b/tlm_cmd/common_packet/space_packet/common_cmd_packet.c similarity index 100% rename from examples/mobc/src/src_user/tlm_cmd/common_cmd_packet.c rename to tlm_cmd/common_packet/space_packet/common_cmd_packet.c diff --git a/examples/mobc/src/src_user/tlm_cmd/common_tlm_cmd_packet.c b/tlm_cmd/common_packet/space_packet/common_tlm_cmd_packet.c similarity index 100% rename from examples/mobc/src/src_user/tlm_cmd/common_tlm_cmd_packet.c rename to tlm_cmd/common_packet/space_packet/common_tlm_cmd_packet.c diff --git a/examples/mobc/src/src_user/tlm_cmd/common_tlm_packet.c b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c similarity index 100% rename from examples/mobc/src/src_user/tlm_cmd/common_tlm_packet.c rename to tlm_cmd/common_packet/space_packet/common_tlm_packet.c From 4c16991643661e125a45f6a9be403fd3fdfa865e Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Wed, 3 Apr 2024 17:35:33 +0900 Subject: [PATCH 02/13] add subobc impl --- .../src/src_user/tlm_cmd/common_cmd_packet.c | 105 ------------------ .../src_user/tlm_cmd/common_tlm_cmd_packet.c | 80 ------------- .../src/src_user/tlm_cmd/common_tlm_packet.c | 89 --------------- .../space_packet/common_tlm_packet.c | 4 + 4 files changed, 4 insertions(+), 274 deletions(-) delete mode 100644 examples/subobc/src/src_user/tlm_cmd/common_cmd_packet.c delete mode 100644 examples/subobc/src/src_user/tlm_cmd/common_tlm_cmd_packet.c delete mode 100644 examples/subobc/src/src_user/tlm_cmd/common_tlm_packet.c diff --git a/examples/subobc/src/src_user/tlm_cmd/common_cmd_packet.c b/examples/subobc/src/src_user/tlm_cmd/common_cmd_packet.c deleted file mode 100644 index 851227d07..000000000 --- a/examples/subobc/src/src_user/tlm_cmd/common_cmd_packet.c +++ /dev/null @@ -1,105 +0,0 @@ -#pragma section REPRO -/** - * @file - * @brief CTP 関連基本関数の定義 - * @note CCP: CommonCmdPacket - */ -#include -#include -#include - - -int CCP_is_valid_packet(const CommonCmdPacket* packet) -{ - if (packet == NULL) return 0; - if ( CCP_get_packet_len(packet) > CCP_MAX_LEN ) return 0; - - return 1; -} - -cycle_t CCP_get_ti(const CommonCmdPacket* packet) -{ - return (cycle_t)CSP_get_ti(packet); -} - -void CCP_set_ti(CommonCmdPacket* packet, cycle_t ti) -{ - CSP_set_ti(packet, (uint32_t)ti); -} - -APID CCP_get_apid(const CommonCmdPacket* packet) -{ - return CSP_get_apid(packet); -} - -void CCP_set_apid(CommonCmdPacket* packet, APID apid) -{ - CSP_set_apid(packet, apid); -} - -CCP_EXEC_TYPE CCP_get_exec_type(const CommonCmdPacket* packet) -{ - return CSP_get_exec_type(packet); -} - -void CCP_set_exec_type(CommonCmdPacket* packet, CCP_EXEC_TYPE type) -{ - CSP_set_exec_type(packet, type); -} - -CCP_DEST_TYPE CCP_get_dest_type(const CommonCmdPacket* packet) -{ - return CSP_get_dest_type(packet); -} - -void CCP_set_dest_type(CommonCmdPacket* packet, CCP_DEST_TYPE type) -{ - CSP_set_dest_type(packet, type); -} - -CMD_CODE CCP_get_id(const CommonCmdPacket* packet) -{ - return CSP_get_cmd_id(packet); -} - -void CCP_set_id(CommonCmdPacket* packet, CMD_CODE id) -{ - CSP_set_cmd_id(packet, id); -} - -uint16_t CCP_get_packet_len(const CommonCmdPacket* packet) -{ - return CSP_get_packet_len(packet); -} - -uint16_t CCP_get_param_len(const CommonCmdPacket* packet) -{ - return CSP_get_param_len(packet); -} - -uint16_t CCP_get_max_param_len(void) -{ - return (uint16_t)(CSP_MAX_LEN - SP_PRM_HDR_LEN - CSP_SND_HDR_LEN); -} - -const uint8_t* CCP_get_param_head(const CommonCmdPacket* packet) -{ - return CSP_get_param_head(packet); -} - -void CCP_set_param(CommonCmdPacket* packet, const uint8_t* param, uint16_t len) -{ - CSP_set_param(packet, param, len); -} - -void CCP_set_common_hdr(CommonCmdPacket* packet) -{ - CSP_set_common_hdr(packet); -} - -void CCP_copy_packet(CommonCmdPacket* dest, const CommonCmdPacket* src) -{ - CSP_copy_packet(dest, src); -} - -#pragma section diff --git a/examples/subobc/src/src_user/tlm_cmd/common_tlm_cmd_packet.c b/examples/subobc/src/src_user/tlm_cmd/common_tlm_cmd_packet.c deleted file mode 100644 index 0ab4f01f9..000000000 --- a/examples/subobc/src/src_user/tlm_cmd/common_tlm_cmd_packet.c +++ /dev/null @@ -1,80 +0,0 @@ -#pragma section REPRO -/** - * @file - * @brief CTCP 関連基本関数の定義 - * @note CTCP: CommonTlmCmdPacket - * @note CTP: CommonTlmPacket - * @note CCP: CommonCmdPacket - */ -#include -#include -#include - - -int CTCP_is_valid_packet(const CommonTlmCmdPacket* packet) -{ - if (packet == NULL) return 0; - if ( CTCP_get_packet_len(packet) > CTCP_MAX_LEN ) return 0; - - return 1; -} - -CTCP_PACKET_TYPE CTCP_get_packet_type(const CommonTlmCmdPacket* packet) -{ - switch (SP_get_type(packet)) - { - case SP_TYPE_TLM: - return CTCP_PACKET_TYPE_TLM; - - case SP_TYPE_CMD: - return CTCP_PACKET_TYPE_CMD; - - default: - return CTCP_PACKET_TYPE_UNKNOWN; - } -} - -uint16_t CTCP_get_packet_len(const CommonTlmCmdPacket* packet) -{ - return SP_get_packet_len(packet); -} - -APID CTCP_get_apid(const CommonTlmCmdPacket* packet) -{ - return SP_get_apid(packet); -} - -void CTCP_set_apid(CommonTlmCmdPacket* packet, APID apid) -{ - SP_set_apid(packet, apid); -} - -void CTCP_copy_packet(CommonTlmCmdPacket* dest, const CommonTlmCmdPacket* src) -{ - SP_copy_packet(dest, src); -} - -// FIXME: 以下4関数について, Space Packet が整備されたら, `if len(ctcp) > CCP_MAX_LEN return NULL;` のようなアサーションをいれる! -const CommonTlmPacket* CTCP_convert_to_ctp(const CommonTlmCmdPacket* ctcp) -{ - if (CTCP_get_packet_type(ctcp) != CTCP_PACKET_TYPE_TLM) return NULL; - return (const CommonTlmPacket*)ctcp; -} - -const CommonTlmCmdPacket* CTCP_convert_from_ctp(const CommonTlmPacket* ctp) -{ - return (const CommonTlmCmdPacket*)ctp; -} - -const CommonCmdPacket* CTCP_convert_to_ccp(const CommonTlmCmdPacket* ctcp) -{ - if (CTCP_get_packet_type(ctcp) != CTCP_PACKET_TYPE_CMD) return NULL; - return (const CommonCmdPacket*)ctcp; -} - -const CommonTlmCmdPacket* CTCP_convert_from_ccp(const CommonCmdPacket* ccp) -{ - return (const CommonTlmCmdPacket*)ccp; -} - -#pragma section diff --git a/examples/subobc/src/src_user/tlm_cmd/common_tlm_packet.c b/examples/subobc/src/src_user/tlm_cmd/common_tlm_packet.c deleted file mode 100644 index 0bab0a732..000000000 --- a/examples/subobc/src/src_user/tlm_cmd/common_tlm_packet.c +++ /dev/null @@ -1,89 +0,0 @@ -#pragma section REPRO -/** - * @file - * @brief CTP 関連基本関数の定義 - * @note CTP: CommonTlmPacket - */ -#include -#include -#include - - -int CTP_is_valid_packet(const CommonTlmPacket* packet) -{ - if (packet == NULL) return 0; - if ( CTP_get_packet_len(packet) > CTP_MAX_LEN ) return 0; - - return 1; -} - -APID CTP_get_apid(const CommonTlmPacket* packet) -{ - return TSP_get_apid(packet); -} - -void CTP_set_apid(CommonTlmPacket* packet, APID apid) -{ - TSP_set_apid(packet, apid); -} - -double CTP_get_global_time(const CommonTlmPacket* packet) -{ - return TSP_get_global_time(packet); -} - -void CTP_set_global_time(CommonTlmPacket* packet) -{ - // 何を設定するかはユーザー定義 - // TMGR_get_curret_unixtime() で現在の unixtime を入れたり, gps 時刻 を入れたり, など - TSP_set_global_time(packet, 0.0); -} - -uint32_t CTP_get_on_board_subnet_time(const CommonTlmPacket* packet) -{ - return TSP_get_on_board_subnet_time(packet); -} - -void CTP_set_on_board_subnet_time(CommonTlmPacket* packet) -{ - // 何を設定するかはユーザー定義 - // MOBC では主に TI を,sub OBC では主に 0xffffffff を - TSP_set_on_board_subnet_time(packet, 0xffffffff); -} - -ctp_dest_flags_t CTP_get_dest_flags(const CommonTlmPacket* packet) -{ - return TSP_get_dest_flags(packet); -} - -void CTP_set_dest_flags(CommonTlmPacket* packet, ctp_dest_flags_t flags) -{ - TSP_set_dest_flags(packet, flags); -} - -TLM_CODE CTP_get_id(const CommonTlmPacket* packet) -{ - return TSP_get_tlm_id(packet); -} - -void CTP_set_id(CommonTlmPacket* packet, TLM_CODE id) -{ - TSP_set_tlm_id(packet, id); -} - -uint16_t CTP_get_packet_len(const CommonTlmPacket* packet) -{ - return TSP_get_packet_len(packet); -} - -uint8_t* CTP_get_user_data_head(CommonTlmPacket* packet) -{ - return TSP_get_user_data_head(packet); -} - -void CTP_copy_packet(CommonTlmPacket* dest, const CommonTlmPacket* src) -{ - TSP_copy_packet(dest, src); -} - -#pragma section diff --git a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c index f08fd37cc..ee04bee9f 100644 --- a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c +++ b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c @@ -49,7 +49,11 @@ void CTP_set_on_board_subnet_time(CommonTlmPacket* packet) { // 何を設定するかはユーザー定義 // MOBC では主に TI を,sub OBC では主に 0xffffffff を +#ifdef C2A_MOBC_FEATURES TSP_set_on_board_subnet_time(packet, (uint32_t)TMGR_get_master_total_cycle()); +#else + TSP_set_on_board_subnet_time(packet, 0xffffffff); +#endif } ctp_dest_flags_t CTP_get_dest_flags(const CommonTlmPacket* packet) From 7bad27505ef2d626e2612dba8fb1cbc8aaac5ecf Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Wed, 3 Apr 2024 17:43:57 +0900 Subject: [PATCH 03/13] fix to build --- CMakeLists.txt | 3 +++ examples/mobc/src/src_user/tlm_cmd/CMakeLists.txt | 3 --- examples/subobc/src/src_user/tlm_cmd/CMakeLists.txt | 3 --- tlm_cmd/common_packet/space_packet/common_cmd_packet.c | 4 ++-- tlm_cmd/common_packet/space_packet/common_tlm_cmd_packet.c | 4 ++-- tlm_cmd/common_packet/space_packet/common_tlm_packet.c | 6 +++--- 6 files changed, 10 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e60650e0..d071312d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,9 @@ set(C2A_SRCS tlm_cmd/ccsds/space_packet_protocol/cmd_space_packet.c tlm_cmd/ccsds/space_packet_protocol/space_packet.c tlm_cmd/ccsds/space_packet_protocol/tlm_space_packet.c + tlm_cmd/common_packet/space_packet/common_cmd_packet.c + tlm_cmd/common_packet/space_packet/common_tlm_cmd_packet.c + tlm_cmd/common_packet/space_packet/common_tlm_packet.c ) if(C2A_USE_STDINT_WRAPPER) diff --git a/examples/mobc/src/src_user/tlm_cmd/CMakeLists.txt b/examples/mobc/src/src_user/tlm_cmd/CMakeLists.txt index cc0d7962a..3e21fd0d6 100644 --- a/examples/mobc/src/src_user/tlm_cmd/CMakeLists.txt +++ b/examples/mobc/src/src_user/tlm_cmd/CMakeLists.txt @@ -6,9 +6,6 @@ set(C2A_SRCS block_command_definitions.c block_command_user_settings.c command_definitions.c - common_cmd_packet.c - common_tlm_cmd_packet.c - common_tlm_packet.c telemetry_definitions.c user_packet_handler.c normal_block_command_definition/nbc_start_hk_tlm.c diff --git a/examples/subobc/src/src_user/tlm_cmd/CMakeLists.txt b/examples/subobc/src/src_user/tlm_cmd/CMakeLists.txt index 3b4ea3a5d..0a0544420 100644 --- a/examples/subobc/src/src_user/tlm_cmd/CMakeLists.txt +++ b/examples/subobc/src/src_user/tlm_cmd/CMakeLists.txt @@ -6,9 +6,6 @@ set(C2A_SRCS block_command_definitions.c block_command_user_settings.c command_definitions.c - common_cmd_packet.c - common_tlm_cmd_packet.c - common_tlm_packet.c telemetry_definitions.c user_packet_handler.c normal_block_command_definition/nbc_start_hk_tlm.c diff --git a/tlm_cmd/common_packet/space_packet/common_cmd_packet.c b/tlm_cmd/common_packet/space_packet/common_cmd_packet.c index 851227d07..b4fc1ce1e 100644 --- a/tlm_cmd/common_packet/space_packet/common_cmd_packet.c +++ b/tlm_cmd/common_packet/space_packet/common_cmd_packet.c @@ -4,8 +4,8 @@ * @brief CTP 関連基本関数の定義 * @note CCP: CommonCmdPacket */ -#include -#include +#include "../common_cmd_packet.h" +#include "../../ccsds/space_packet_protocol/cmd_space_packet.h" #include diff --git a/tlm_cmd/common_packet/space_packet/common_tlm_cmd_packet.c b/tlm_cmd/common_packet/space_packet/common_tlm_cmd_packet.c index 0ab4f01f9..3ad7be63b 100644 --- a/tlm_cmd/common_packet/space_packet/common_tlm_cmd_packet.c +++ b/tlm_cmd/common_packet/space_packet/common_tlm_cmd_packet.c @@ -6,8 +6,8 @@ * @note CTP: CommonTlmPacket * @note CCP: CommonCmdPacket */ -#include -#include +#include "../common_tlm_cmd_packet.h" +#include "../../ccsds/space_packet_protocol/space_packet.h" #include diff --git a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c index ee04bee9f..4379ed672 100644 --- a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c +++ b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c @@ -4,9 +4,9 @@ * @brief CTP 関連基本関数の定義 * @note CTP: CommonTlmPacket */ -#include -#include -#include +#include "../common_tlm_packet.h" +#include "../../ccsds/space_packet_protocol/tlm_space_packet.h" +#include "../../../system/time_manager/time_manager.h" #include From b5668a7f83046fbb9582d54d847c3587792a8a42 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Wed, 3 Apr 2024 17:54:25 +0900 Subject: [PATCH 04/13] add C2A_USE_SPACE_PACKET_AS_COMMON_PACKET option --- CMakeLists.txt | 9 ++++++--- .../common_packet/space_packet/CMakeLists.txt | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 tlm_cmd/common_packet/space_packet/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index d071312d8..90703a6b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ option(C2A_BUILD_FOR_SILS "Build C2A for SILS target" ON) option(C2A_USE_ALL_CORE_APPS "Use C2A-core all Applications" ON) option(C2A_USE_ALL_CORE_TEST_APPS "Use C2A-core all Test Applications" ON) option(C2A_USE_ALL_CORE_LIB "Use C2A-core all library" ON) +option(C2A_USE_SPACE_PACKET_AS_COMMON_PACKET "Use C2A-core Space Packet as Common Packet implementation" ON) ## C2A build target board option (標準実装などがこのオプションによってスイッチされる.デフォルトでは sub OBC を想定) option(C2A_MOBC_FEATURES "Enable some features for MOBC" OFF) @@ -65,9 +66,6 @@ set(C2A_SRCS tlm_cmd/ccsds/space_packet_protocol/cmd_space_packet.c tlm_cmd/ccsds/space_packet_protocol/space_packet.c tlm_cmd/ccsds/space_packet_protocol/tlm_space_packet.c - tlm_cmd/common_packet/space_packet/common_cmd_packet.c - tlm_cmd/common_packet/space_packet/common_tlm_cmd_packet.c - tlm_cmd/common_packet/space_packet/common_tlm_packet.c ) if(C2A_USE_STDINT_WRAPPER) @@ -111,6 +109,11 @@ if(C2A_USE_ALL_CORE_LIB) target_sources(${PROJECT_NAME} PUBLIC $) endif() +if(XXXXXXXXXXXXXXXXXXXXXXXXXXX) + add_subdirectory(tlm_cmd/common_packet/space_packet) + target_sources(${PROJECT_NAME} PUBLIC $) +endif() + if(C2A_USE_CORE_CCSDS_AOS_SPACE_DATA_LINK_PROTOCOL) add_subdirectory(tlm_cmd/ccsds/aos_space_data_link_protocol) target_sources(${PROJECT_NAME} PUBLIC $) diff --git a/tlm_cmd/common_packet/space_packet/CMakeLists.txt b/tlm_cmd/common_packet/space_packet/CMakeLists.txt new file mode 100644 index 000000000..984a86e91 --- /dev/null +++ b/tlm_cmd/common_packet/space_packet/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.13) + +project(C2A_CORE_SPACE_PACKET_AS_COMMON_PACKET) + +set(C2A_SRCS + common_cmd_packet.c + common_tlm_cmd_packet.c + common_tlm_packet.c +) + +if(C2A_BUILD_AS_CXX) + set_source_files_properties(${C2A_SRCS} PROPERTIES LANGUAGE CXX) # C++ +endif() + +add_library(${PROJECT_NAME} OBJECT ${C2A_SRCS}) + +include(${C2A_CORE_DIR}/common.cmake) From ef7649109f5b476c3c4de9daa82985bf4e2fe1c2 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Wed, 3 Apr 2024 17:56:31 +0900 Subject: [PATCH 05/13] add option --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90703a6b6..a914a142b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -109,7 +109,7 @@ if(C2A_USE_ALL_CORE_LIB) target_sources(${PROJECT_NAME} PUBLIC $) endif() -if(XXXXXXXXXXXXXXXXXXXXXXXXXXX) +if(C2A_USE_SPACE_PACKET_AS_COMMON_PACKET) add_subdirectory(tlm_cmd/common_packet/space_packet) target_sources(${PROJECT_NAME} PUBLIC $) endif() From 37bad3a3a5178869d1bed520dc9f09f40a3b1337 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Wed, 3 Apr 2024 18:03:48 +0900 Subject: [PATCH 06/13] add C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP --- CMakeLists.txt | 1 + tlm_cmd/common_packet/space_packet/common_tlm_packet.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a914a142b..9d47ad58c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ option(C2A_USE_ALL_CORE_APPS "Use C2A-core all Applications" ON) option(C2A_USE_ALL_CORE_TEST_APPS "Use C2A-core all Test Applications" ON) option(C2A_USE_ALL_CORE_LIB "Use C2A-core all library" ON) option(C2A_USE_SPACE_PACKET_AS_COMMON_PACKET "Use C2A-core Space Packet as Common Packet implementation" ON) +option(C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP "Use C2A-core default global time in Common Tlm Packet" ON) ## C2A build target board option (標準実装などがこのオプションによってスイッチされる.デフォルトでは sub OBC を想定) option(C2A_MOBC_FEATURES "Enable some features for MOBC" OFF) diff --git a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c index 4379ed672..fcae3edc1 100644 --- a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c +++ b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c @@ -33,12 +33,15 @@ double CTP_get_global_time(const CommonTlmPacket* packet) return TSP_get_global_time(packet); } +#ifdef C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP void CTP_set_global_time(CommonTlmPacket* packet) { // 何を設定するかはユーザー定義 // TMGR_get_curret_unixtime() で現在の unixtime を入れたり, gps 時刻 を入れたり, など + // User 独自の値を設定する場合は, C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP を OFF にすること TSP_set_global_time(packet, 0.0); } +#endif uint32_t CTP_get_on_board_subnet_time(const CommonTlmPacket* packet) { From c98b1b18378a943429432ae4920fde2fb02f2ded Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Wed, 3 Apr 2024 18:05:24 +0900 Subject: [PATCH 07/13] add comment --- tlm_cmd/common_packet/space_packet/common_tlm_packet.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c index fcae3edc1..75fe448e4 100644 --- a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c +++ b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c @@ -39,6 +39,7 @@ void CTP_set_global_time(CommonTlmPacket* packet) // 何を設定するかはユーザー定義 // TMGR_get_curret_unixtime() で現在の unixtime を入れたり, gps 時刻 を入れたり, など // User 独自の値を設定する場合は, C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP を OFF にすること + // その場合は user 側で独自に CTP_set_global_time を実装すること TSP_set_global_time(packet, 0.0); } #endif From 8733505756bedfb8af051764ed72fa43213ff9af Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Wed, 3 Apr 2024 18:13:46 +0900 Subject: [PATCH 08/13] on C2A_MOBC_FEATURES in mobc example --- examples/mobc/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/mobc/CMakeLists.txt b/examples/mobc/CMakeLists.txt index 0583bd82d..dec6d5278 100644 --- a/examples/mobc/CMakeLists.txt +++ b/examples/mobc/CMakeLists.txt @@ -20,6 +20,8 @@ option(C2A_BUILD_WITH_SILS_MOCKUP "Build C2A with SILS mockup for check undefine option(C2A_BUILD_FOR_SILS "Build C2A for SILS target" ON) +set(C2A_MOBC_FEATURES ON) + # core に同梱されている CCSDS の実装を使う set(C2A_USE_CORE_CCSDS_AOS_SPACE_DATA_LINK_PROTOCOL ON) set(C2A_USE_CORE_CCSDS_TC_SPACE_DATA_LINK_PROTOCOL ON) From fa22857e534305f0ec40c92a93ba956fb7655954 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Thu, 4 Apr 2024 19:58:54 +0900 Subject: [PATCH 09/13] add definition --- CMakeLists.txt | 5 +++++ tlm_cmd/common_packet/space_packet/common_tlm_packet.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d47ad58c..b87052c96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,11 @@ if(C2A_USE_STDINT_WRAPPER) include_directories(library/stdint_wrapper) endif() +if(C2A_MOBC_FEATURES) + message("Enable some features for MOBC") + target_compile_definitions(${PROJECT_NAME} PUBLIC C2A_MOBC_FEATURES) +endif() + execute_process( COMMAND git log -1 --format=%H WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c index 75fe448e4..c9d3be360 100644 --- a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c +++ b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c @@ -53,11 +53,11 @@ void CTP_set_on_board_subnet_time(CommonTlmPacket* packet) { // 何を設定するかはユーザー定義 // MOBC では主に TI を,sub OBC では主に 0xffffffff を + uint32_t time = 0xffffffff; #ifdef C2A_MOBC_FEATURES - TSP_set_on_board_subnet_time(packet, (uint32_t)TMGR_get_master_total_cycle()); -#else - TSP_set_on_board_subnet_time(packet, 0xffffffff); + time = (uint32_t)TMGR_get_master_total_cycle(); #endif + TSP_set_on_board_subnet_time(packet, time); } ctp_dest_flags_t CTP_get_dest_flags(const CommonTlmPacket* packet) From dd901bd5e956d017f157b3aecc8aefddee9a0ca1 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Thu, 4 Apr 2024 21:44:38 +0900 Subject: [PATCH 10/13] divide CTP_set_global_time --- CMakeLists.txt | 1 - .../mobc/src/src_user/settings/CMakeLists.txt | 1 + .../settings/tlm_cmd/common_tlm_packet_define.c | 16 ++++++++++++++++ .../subobc/src/src_user/settings/CMakeLists.txt | 1 + .../settings/tlm_cmd/common_tlm_packet_define.c | 16 ++++++++++++++++ examples/subobc/sync_with_mobc_example.bat | 1 + .../space_packet/common_tlm_packet.c | 11 ----------- 7 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c create mode 100644 examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c diff --git a/CMakeLists.txt b/CMakeLists.txt index b87052c96..245c465b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,6 @@ option(C2A_USE_ALL_CORE_APPS "Use C2A-core all Applications" ON) option(C2A_USE_ALL_CORE_TEST_APPS "Use C2A-core all Test Applications" ON) option(C2A_USE_ALL_CORE_LIB "Use C2A-core all library" ON) option(C2A_USE_SPACE_PACKET_AS_COMMON_PACKET "Use C2A-core Space Packet as Common Packet implementation" ON) -option(C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP "Use C2A-core default global time in Common Tlm Packet" ON) ## C2A build target board option (標準実装などがこのオプションによってスイッチされる.デフォルトでは sub OBC を想定) option(C2A_MOBC_FEATURES "Enable some features for MOBC" OFF) diff --git a/examples/mobc/src/src_user/settings/CMakeLists.txt b/examples/mobc/src/src_user/settings/CMakeLists.txt index 85905036d..b65d78263 100644 --- a/examples/mobc/src/src_user/settings/CMakeLists.txt +++ b/examples/mobc/src/src_user/settings/CMakeLists.txt @@ -18,6 +18,7 @@ set(C2A_SRCS system/event_handler_rules/event_handler_rules.c system/event_handler_rules/event_handler_rule_test.c tlm_cmd/common_cmd_packet_define.c + tlm_cmd/common_tlm_packet_define.c tlm_cmd/ccsds/aos_transfer_frame_define.c tlm_cmd/ccsds/apid_define.c tlm_cmd/ccsds/tc_transfer_frame_define.c diff --git a/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c b/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c new file mode 100644 index 000000000..359cfffaa --- /dev/null +++ b/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c @@ -0,0 +1,16 @@ +#pragma section REPRO +/** + * @file + * @brief CTP 型の user 定義 + */ +#include + +void CTP_set_global_time(CommonTlmPacket* packet) +{ + // 何を設定するかはユーザー定義 + // TMGR_get_curret_unixtime() で現在の unixtime を入れたり, gps 時刻 を入れたり, など + // User 独自の値を設定する場合は, C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP を OFF にすること + TSP_set_global_time(packet, 0.0); +} + +#pragma section diff --git a/examples/subobc/src/src_user/settings/CMakeLists.txt b/examples/subobc/src/src_user/settings/CMakeLists.txt index 93716c0c5..9aff96e45 100644 --- a/examples/subobc/src/src_user/settings/CMakeLists.txt +++ b/examples/subobc/src/src_user/settings/CMakeLists.txt @@ -15,6 +15,7 @@ set(C2A_SRCS system/event_logger_settings.c system/event_handler_rules/event_handler_rules.c tlm_cmd/common_cmd_packet_define.c + tlm_cmd/common_tlm_packet_define.c tlm_cmd/ccsds/apid_define.c ) diff --git a/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c b/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c new file mode 100644 index 000000000..359cfffaa --- /dev/null +++ b/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c @@ -0,0 +1,16 @@ +#pragma section REPRO +/** + * @file + * @brief CTP 型の user 定義 + */ +#include + +void CTP_set_global_time(CommonTlmPacket* packet) +{ + // 何を設定するかはユーザー定義 + // TMGR_get_curret_unixtime() で現在の unixtime を入れたり, gps 時刻 を入れたり, など + // User 独自の値を設定する場合は, C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP を OFF にすること + TSP_set_global_time(packet, 0.0); +} + +#pragma section diff --git a/examples/subobc/sync_with_mobc_example.bat b/examples/subobc/sync_with_mobc_example.bat index 0eb71b6b0..0df6b46ad 100644 --- a/examples/subobc/sync_with_mobc_example.bat +++ b/examples/subobc/sync_with_mobc_example.bat @@ -19,6 +19,7 @@ call :sync_file ".\src\src_user\hal\sils_mockup\wdt_sils.c" "..\mobc\src\src_use call :sync_file ".\src\src_user\settings\git_revision_config.h" "..\mobc\src\src_user\settings\git_revision_config.h" call :sync_file ".\src\src_user\settings\component_driver_super\driver_buffer_define.h" "..\mobc\src\src_user\settings\component_driver_super\driver_buffer_define.h" call :sync_file ".\src\src_user\settings\tlm_cmd\common_cmd_packet_define.c" "..\mobc\src\src_user\settings\tlm_cmd\common_cmd_packet_define.c" +call :sync_file ".\src\src_user\settings\tlm_cmd\common_tlm_packet_define.c" "..\mobc\src\src_user\settings\tlm_cmd\common_tlm_packet_define.c" call :sync_file ".\src\src_user\settings\tlm_cmd\common_tlm_cmd_packet_define.h" "..\mobc\src\src_user\settings\tlm_cmd\common_tlm_cmd_packet_define.h" call :sync_file ".\src\src_user\settings\tlm_cmd\ccsds\apid_define.c" "..\mobc\src\src_user\settings\tlm_cmd\ccsds\apid_define.c" call :sync_file ".\src\src_user\settings\tlm_cmd\ccsds\apid_define.h" "..\mobc\src\src_user\settings\tlm_cmd\ccsds\apid_define.h" diff --git a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c index c9d3be360..4c192bceb 100644 --- a/tlm_cmd/common_packet/space_packet/common_tlm_packet.c +++ b/tlm_cmd/common_packet/space_packet/common_tlm_packet.c @@ -33,17 +33,6 @@ double CTP_get_global_time(const CommonTlmPacket* packet) return TSP_get_global_time(packet); } -#ifdef C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP -void CTP_set_global_time(CommonTlmPacket* packet) -{ - // 何を設定するかはユーザー定義 - // TMGR_get_curret_unixtime() で現在の unixtime を入れたり, gps 時刻 を入れたり, など - // User 独自の値を設定する場合は, C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP を OFF にすること - // その場合は user 側で独自に CTP_set_global_time を実装すること - TSP_set_global_time(packet, 0.0); -} -#endif - uint32_t CTP_get_on_board_subnet_time(const CommonTlmPacket* packet) { return TSP_get_on_board_subnet_time(packet); From 14b486c193c9625c539caa7c1e3ab12eb1ce3d1f Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Thu, 4 Apr 2024 21:47:48 +0900 Subject: [PATCH 11/13] fix bug --- .../src/src_user/settings/tlm_cmd/common_tlm_packet_define.c | 1 + .../src/src_user/settings/tlm_cmd/common_tlm_packet_define.c | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c b/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c index 359cfffaa..55ef88c7c 100644 --- a/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c +++ b/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c @@ -4,6 +4,7 @@ * @brief CTP 型の user 定義 */ #include +#include void CTP_set_global_time(CommonTlmPacket* packet) { diff --git a/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c b/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c index 359cfffaa..55ef88c7c 100644 --- a/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c +++ b/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c @@ -4,6 +4,7 @@ * @brief CTP 型の user 定義 */ #include +#include void CTP_set_global_time(CommonTlmPacket* packet) { From 6261bc666c0413c296c5035657c381115321eba1 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Fri, 5 Apr 2024 09:11:27 +0900 Subject: [PATCH 12/13] fix cmake bug --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 245c465b8..de896e4c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,11 +73,6 @@ if(C2A_USE_STDINT_WRAPPER) include_directories(library/stdint_wrapper) endif() -if(C2A_MOBC_FEATURES) - message("Enable some features for MOBC") - target_compile_definitions(${PROJECT_NAME} PUBLIC C2A_MOBC_FEATURES) -endif() - execute_process( COMMAND git log -1 --format=%H WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -114,6 +109,11 @@ if(C2A_USE_ALL_CORE_LIB) target_sources(${PROJECT_NAME} PUBLIC $) endif() +if(C2A_MOBC_FEATURES) + message("Enable some features for MOBC") + target_compile_definitions(${PROJECT_NAME} PUBLIC C2A_MOBC_FEATURES) +endif() + if(C2A_USE_SPACE_PACKET_AS_COMMON_PACKET) add_subdirectory(tlm_cmd/common_packet/space_packet) target_sources(${PROJECT_NAME} PUBLIC $) From 80d2e8805e211bf105754804a4e93a0484d4eb23 Mon Sep 17 00:00:00 2001 From: Ryo Suzumoto Date: Mon, 8 Apr 2024 14:23:36 +0900 Subject: [PATCH 13/13] fix comment --- .../src/src_user/settings/tlm_cmd/common_tlm_packet_define.c | 1 - .../src/src_user/settings/tlm_cmd/common_tlm_packet_define.c | 1 - 2 files changed, 2 deletions(-) diff --git a/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c b/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c index 55ef88c7c..3cead370c 100644 --- a/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c +++ b/examples/mobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c @@ -10,7 +10,6 @@ void CTP_set_global_time(CommonTlmPacket* packet) { // 何を設定するかはユーザー定義 // TMGR_get_curret_unixtime() で現在の unixtime を入れたり, gps 時刻 を入れたり, など - // User 独自の値を設定する場合は, C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP を OFF にすること TSP_set_global_time(packet, 0.0); } diff --git a/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c b/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c index 55ef88c7c..3cead370c 100644 --- a/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c +++ b/examples/subobc/src/src_user/settings/tlm_cmd/common_tlm_packet_define.c @@ -10,7 +10,6 @@ void CTP_set_global_time(CommonTlmPacket* packet) { // 何を設定するかはユーザー定義 // TMGR_get_curret_unixtime() で現在の unixtime を入れたり, gps 時刻 を入れたり, など - // User 独自の値を設定する場合は, C2A_USE_DEFAULT_GLOBAL_TIME_IN_CTP を OFF にすること TSP_set_global_time(packet, 0.0); }