Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move TCPacket to C2A Core #207

Merged
merged 2 commits into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ set(C2A_CORE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

set(C2A_SRCS
c2a_core_main.c
TlmCmd/block_command_loader.c
TlmCmd/block_command_table.c
TlmCmd/block_command_executor.c
TlmCmd/command_analyze.c
TlmCmd/command_dispatcher.c
TlmCmd/common_tlm_cmd_packet_util.c
TlmCmd/packet_handler.c
TlmCmd/packet_list.c
TlmCmd/telemetry_frame.c
TlmCmd/telemetry_generator.c
Drivers/Super/driver_super.c
Drivers/Super/driver_super_issl_format.c
System/AnomalyLogger/anomaly_logger.c
Expand All @@ -34,6 +24,17 @@ set(C2A_SRCS
System/TimeManager/obc_time.c
System/TimeManager/time_manager.c
System/WatchdogTimer/watchdog_timer.c
TlmCmd/block_command_loader.c
TlmCmd/block_command_table.c
TlmCmd/block_command_executor.c
TlmCmd/command_analyze.c
TlmCmd/command_dispatcher.c
TlmCmd/common_tlm_cmd_packet_util.c
TlmCmd/packet_handler.c
TlmCmd/packet_list.c
TlmCmd/telemetry_frame.c
TlmCmd/telemetry_generator.c
TlmCmd/Ccsds/TCPacket.c
)

if(BUILD_C2A_AS_CXX)
Expand Down
1 change: 0 additions & 1 deletion Drivers/Super/driver_super.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <src_user/Library/stdint.h>
#include "../../Library/endian_memcpy.h" // パスが不定な自動生成コード類で使えるように
#include "../../System/TimeManager/time_manager.h"
// #include <src_user/TlmCmd/CCSDS/TCPacket.h>

#define DS_STREAM_MAX (3) /*!< DS_StreamConfigの最大数
uint8_t を想定 */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* @file
* @brief TCP のユーザー設定
* @note https://github.com/ut-issl/c2a-core/issues/206 を実装するまでの一時的なつなぎファイル
*/
#ifndef TCPACKET_PARAMS_H_
#define TCPACKET_PARAMS_H_

#undef TCP_MAX_LEN

#define TCP_MAX_LEN (432u)

// FIXME: #206 を実装する際は,これは params.h ではなく define.h で定義すべき
/**
* @enum TCP_APID
* @brief Application Process ID
* @note GSTOS の蓄積データの拡張子につく数字
* @note 11bit
* @note CTCP_DEST_ID として typedef する
*/
typedef enum
{
TCP_APID_MOBC_CMD = 0x210, // 01000010000b:
TCP_APID_AOBC_CMD = 0x211, // 01000010001b:
TCP_APID_TOBC_CMD = 0x212, // 01000010010b:
TCP_APID_TCAL_TLM = 0x410, // 10000010000b: APID for TIME CARIBLATION TLM
TCP_APID_MIS_TLM = 0x510, // 10100010000b: APID for MIS TLM
TCP_APID_DUMP_TLM = 0x710, // 11100010000b: APID for DUMP TLM
TCP_APID_FILL_PKT = 0x7ff, // 11111111111b: APID for FILL PACKET
TCP_APID_UNKNOWN
} TCP_APID;

/**
* @enum TCP_CMD_DEST_TYPE
* @brief コマンドの解釈の宛先を規定
* @note TO_ME: 自分自身 → 自分自身のTLCやBCとして解釈
* @note TO_*: 転送先のTLやBCとして解釈(GSから来たコマンドを自身のキューにいれない)
* @note 0x*0を想定
* @note 下位4bitは TCP_CMD_EXEC_TYPE と CCP_EXEC_TYPE に
*/
typedef enum
{
TCP_CMD_DEST_TYPE_TO_ME = 0x00,
TCP_CMD_DEST_TYPE_TO_MOBC = 0x10,
TCP_CMD_DEST_TYPE_TO_AOBC = 0x20,
TCP_CMD_DEST_TYPE_TO_TOBC = 0x30,
TCP_CMD_DEST_TYPE_TO_UNKOWN = 0x40
} TCP_CMD_DEST_TYPE;

#endif
chutaro marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef COMMON_TLM_CMD_PACKET_DEFINE_H_
#define COMMON_TLM_CMD_PACKET_DEFINE_H_

#include "../../TlmCmd/Ccsds/TCPacket.h"
#include <src_core/TlmCmd/Ccsds/TCPacket.h>

// 使用するパケット構造体をCTCP型として定義する
typedef TCP CTCP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef COMMON_TLM_CMD_PACKET_PARAMS_H_
#define COMMON_TLM_CMD_PACKET_PARAMS_H_

#include "../../TlmCmd/Ccsds/TCPacket.h"
#include <src_core/TlmCmd/Ccsds/TCPacket.h>

#undef CTCP_MY_DST_ID

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ set(C2A_SRCS
Ccsds/m_pdu.c
Ccsds/TCFrame.c
Ccsds/tcp_to_m_pdu.c
Ccsds/TCPacket.c
Ccsds/TCSegment.c
Ccsds/vcdu.c
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stddef.h> // for size_t

#include "../../Library/stdint.h"
#include "TCPacket.h"
#include <src_core/TlmCmd/Ccsds/TCPacket.h>

#define TCS_HEADER_SIZE (1u)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "string.h" // for memcpy

#include "TCPacket.h"
#include <src_core/TlmCmd/Ccsds/TCPacket.h>

static void M_PDU_clear_spare_(M_PDU* m_pdu);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <string.h> // for memcpy
#include "./Ccsds/TCPacket.h"
#include <src_core/TlmCmd/Ccsds/TCPacket.h>
#include <src_core/TlmCmd/common_tlm_cmd_packet.h>
#include <src_core/Library/endian_memcpy.h>

Expand Down
1 change: 0 additions & 1 deletion System/TimeManager/time_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
#include "time_manager.h"
#include <string.h>
#include <src_user/TlmCmd/Ccsds/TCPacket.h>
#include "../TaskManager/task_dispatcher.h"
#include "../../TlmCmd/common_tlm_cmd_packet_util.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

#include <string.h> // for memcpy

#include <src_core/TlmCmd/common_tlm_cmd_packet.h>
#include "../command_definitions.h" // for Cmd_CODE_EXECUTE_APP
#include <src_core/TlmCmd/packet_handler.h> // for TL_CMD_LIST_LINE
#include <src_core/TlmCmd/block_command_table.h> // for BCT_MAX_BLOCK
#include <src_core/Library/endian_memcpy.h>
#include "../../TlmCmd/common_tlm_cmd_packet.h"
#include "../../TlmCmd/packet_handler.h" // for TL_CMD_LIST_LINE
#include "../../TlmCmd/block_command_table.h" // for BCT_MAX_BLOCK
#include "../../Library/endian_memcpy.h"
#include <src_user/TlmCmd/command_definitions.h> // for Cmd_CODE_EXECUTE_APP

/**
* @struct TCP_PacketParams
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@

#include <stddef.h> // for size_t

#include "../../Library/stdint.h"
#include <src_user/Library/stdint.h>

#define TCP_MAX_LEN (432u)
#define TCP_PRM_HDR_LEN (6u)
#define TCP_TLM_2ND_HDR_LEN (7u)
#define TCP_CMD_2ND_HDR_LEN (1u)
#define TCP_CMD_USER_HDR_LEN (8u)

// TCP_MAX_LEN を再定義
// TCP_APID, TCP_CMD_DEST_TYPE を定義する
#include <src_user/Settings/TlmCmd/Ccsds/tcpacket_params.h>


/**
* @struct TCP
Expand Down Expand Up @@ -54,25 +58,6 @@ typedef enum
TCP_2ND_HDR_PRESENT = 1 // 1b: Secondary Header Present
} TCP_2ND_HDR_FLAG;

/**
* @enum TCP_APID
* @brief Application Process ID
* @note GSTOS の蓄積データの拡張子につく数字
* @note 11bit
* @note CTCP_DEST_ID として typedef する
*/
typedef enum
{
TCP_APID_MOBC_CMD = 0x210, // 01000010000b:
TCP_APID_AOBC_CMD = 0x211, // 01000010001b:
TCP_APID_TOBC_CMD = 0x212, // 01000010010b:
TCP_APID_TCAL_TLM = 0x410, // 10000010000b: APID for TIME CARIBLATION TLM
TCP_APID_MIS_TLM = 0x510, // 10100010000b: APID for MIS TLM
TCP_APID_DUMP_TLM = 0x710, // 11100010000b: APID for DUMP TLM
TCP_APID_FILL_PKT = 0x7ff, // 11111111111b: APID for FILL PACKET
TCP_APID_UNKNOWN
} TCP_APID;

/**
* @enum TCP_SEQ_FLAG
* @brief Sequence Flag
Expand Down Expand Up @@ -133,23 +118,6 @@ typedef enum
TCP_CMD_EXEC_TYPE_UNKNOWN
} TCP_CMD_EXEC_TYPE;

/**
* @enum TCP_CMD_DEST_TYPE
* @brief コマンドの解釈の宛先を規定
* @note TO_ME: 自分自身 → 自分自身のTLCやBCとして解釈
* @note TO_*: 転送先のTLやBCとして解釈(GSから来たコマンドを自身のキューにいれない)
* @note 0x*0を想定
* @note 下位4bitは TCP_CMD_EXEC_TYPE と CCP_EXEC_TYPE に
*/
typedef enum
{
TCP_CMD_DEST_TYPE_TO_ME = 0x00,
TCP_CMD_DEST_TYPE_TO_MOBC = 0x10,
TCP_CMD_DEST_TYPE_TO_AOBC = 0x20,
TCP_CMD_DEST_TYPE_TO_TOBC = 0x30,
TCP_CMD_DEST_TYPE_TO_UNKOWN = 0x40
} TCP_CMD_DEST_TYPE;


// *******************
// TCP getter/setter
Expand Down