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

一時的なCTCPのtypedefを消し,各所のCTCPをCommonTlmCmdPacket, CommonTlmPacket, CommonCmdPacketのどれかに割り当てる #210

Merged
merged 8 commits into from
Jan 25, 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
16 changes: 8 additions & 8 deletions Applications/anomaly_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static void AH_respond_to_anomaly_(size_t id)
// これが呼ばれてるには,anomaly_handler_.elements[].is_active == 1は保証されている.

// 対応ブロックコマンドをリアルタイムコマンドで展開
CTCP packet;
CommonCmdPacket packet;
// 通常BCなのでTLC1に展開
CCP_form_block_deploy_cmd(&packet, TL_ID_DEPLOY_BC, anomaly_handler_.elements[id].rule.bc_id);
PH_dispatch_command(&packet);
Expand Down Expand Up @@ -253,7 +253,7 @@ static void AH_print_ah_status_(void)
}


CCP_EXEC_STS Cmd_AH_REGISTER_RULE(const CTCP* packet)
CCP_EXEC_STS Cmd_AH_REGISTER_RULE(const CommonCmdPacket* packet)
{
enum
{
Expand Down Expand Up @@ -298,7 +298,7 @@ static void AH_add_rule_(size_t id, const AH_Rule* ahr)
}


CCP_EXEC_STS Cmd_AH_ACTIVATE_RULE(const CTCP* packet)
CCP_EXEC_STS Cmd_AH_ACTIVATE_RULE(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
size_t id;
Expand All @@ -322,7 +322,7 @@ void AH_activate_rule(size_t id)
}


CCP_EXEC_STS Cmd_AH_INACTIVATE_RULE(const CTCP* packet)
CCP_EXEC_STS Cmd_AH_INACTIVATE_RULE(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
size_t id;
Expand All @@ -345,7 +345,7 @@ void AH_inactivate_rule(size_t id)
}


CCP_EXEC_STS Cmd_AH_CLEAR_LOG(const CTCP* packet)
CCP_EXEC_STS Cmd_AH_CLEAR_LOG(const CommonCmdPacket* packet)
{
(void)packet;
AH_clear_log_();
Expand All @@ -367,7 +367,7 @@ static void AH_clear_log_(void)
}


CCP_EXEC_STS Cmd_AH_SET_PAGE_FOR_TLM(const CTCP* packet)
CCP_EXEC_STS Cmd_AH_SET_PAGE_FOR_TLM(const CommonCmdPacket* packet)
{
uint8_t page;

Expand Down Expand Up @@ -396,15 +396,15 @@ static void AH_respond_log_clear(void)
}


CCP_EXEC_STS Cmd_AHRES_LOG_CLEAR(const CTCP* packet)
CCP_EXEC_STS Cmd_AHRES_LOG_CLEAR(const CommonCmdPacket* packet)
{
(void)packet;
AH_respond_log_clear();
return CCP_EXEC_SUCCESS;
}


CCP_EXEC_STS Cmd_AHRES_LOG_SET_PAGE_FOR_TLM(const CTCP* packet)
CCP_EXEC_STS Cmd_AHRES_LOG_SET_PAGE_FOR_TLM(const CommonCmdPacket* packet)
{
uint8_t page;

Expand Down
14 changes: 7 additions & 7 deletions Applications/anomaly_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ void AH_inactivate_rule(size_t id);
// こいつは初期化時に使われるので,選択制にした
void AH_add_rule(size_t id, const AH_Rule* ahr, uint8_t is_active);

CCP_EXEC_STS Cmd_AH_REGISTER_RULE(const CTCP* packet);
CCP_EXEC_STS Cmd_AH_REGISTER_RULE(const CommonCmdPacket* packet);

CCP_EXEC_STS Cmd_AH_ACTIVATE_RULE(const CTCP* packet);
CCP_EXEC_STS Cmd_AH_ACTIVATE_RULE(const CommonCmdPacket* packet);

CCP_EXEC_STS Cmd_AH_INACTIVATE_RULE(const CTCP* packet);
CCP_EXEC_STS Cmd_AH_INACTIVATE_RULE(const CommonCmdPacket* packet);

CCP_EXEC_STS Cmd_AH_CLEAR_LOG(const CTCP* packet);
CCP_EXEC_STS Cmd_AH_CLEAR_LOG(const CommonCmdPacket* packet);

CCP_EXEC_STS Cmd_AH_SET_PAGE_FOR_TLM(const CTCP* packet);
CCP_EXEC_STS Cmd_AH_SET_PAGE_FOR_TLM(const CommonCmdPacket* packet);

CCP_EXEC_STS Cmd_AHRES_LOG_CLEAR(const CTCP* packet);
CCP_EXEC_STS Cmd_AHRES_LOG_CLEAR(const CommonCmdPacket* packet);

CCP_EXEC_STS Cmd_AHRES_LOG_SET_PAGE_FOR_TLM(const CTCP* packet);
CCP_EXEC_STS Cmd_AHRES_LOG_SET_PAGE_FOR_TLM(const CommonCmdPacket* packet);

#endif
10 changes: 5 additions & 5 deletions Applications/divided_cmd_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static void DCU_create_log_on_front_(CMD_CODE cmd_code);
static DividedCmdUtility divided_cmd_utility_;
const DividedCmdUtility* const divided_cmd_utility = &divided_cmd_utility_;

static CTCP DCU_packet_;
static CommonCmdPacket DCU_packet_;


AppInfo DCU_create_app(void)
Expand Down Expand Up @@ -213,7 +213,7 @@ DCU_ACK DCU_register_next(CMD_CODE cmd_code, const uint8_t* param, uint16_t len)

ret = CCP_form_rtc(&DCU_packet_, cmd_code, param, len);
if (ret != CCP_UTIL_ACK_OK) return DCU_ACK_ERR;
if (PH_analyze_packet(&DCU_packet_) != PH_REGISTERED)
if (PH_analyze_packet(&DCU_packet_) != PH_REGISTERED) // FIXME: CTCP, SpacePacket 整理で直す
{
return DCU_ACK_ERR;
}
Expand Down Expand Up @@ -284,7 +284,7 @@ DCU_LOG_ACK DCU_search_and_get_log(CMD_CODE cmd_code, const DCU_ExecStatus* exec
}


CCP_EXEC_STS Cmd_DCU_ABORT_CMD(const CTCP* packet)
CCP_EXEC_STS Cmd_DCU_ABORT_CMD(const CommonCmdPacket* packet)
{
// CMD_CODE は u16 と想定する
CMD_CODE target_cmd = (CMD_CODE)CCP_get_param_from_packet(packet, 0, uint16_t);
Expand All @@ -295,7 +295,7 @@ CCP_EXEC_STS Cmd_DCU_ABORT_CMD(const CTCP* packet)
}


CCP_EXEC_STS Cmd_DCU_DOWN_ABORT_FLAG(const CTCP* packet)
CCP_EXEC_STS Cmd_DCU_DOWN_ABORT_FLAG(const CommonCmdPacket* packet)
{
// CMD_CODE は u16 と想定する
CMD_CODE target_cmd = (CMD_CODE)CCP_get_param_from_packet(packet, 0, uint16_t);
Expand All @@ -306,7 +306,7 @@ CCP_EXEC_STS Cmd_DCU_DOWN_ABORT_FLAG(const CTCP* packet)
}


CCP_EXEC_STS Cmd_DCU_CLEAR_LOG(const CTCP* packet)
CCP_EXEC_STS Cmd_DCU_CLEAR_LOG(const CommonCmdPacket* packet)
{
(void)packet;

Expand Down
6 changes: 3 additions & 3 deletions Applications/divided_cmd_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ DCU_LOG_ACK DCU_search_and_get_log(CMD_CODE cmd_code, const DCU_ExecStatus* exec
* @brief 実行中の分割コマンドを停止する
* @note もし,指定した Cmd が実行中ではなくても CCP_EXEC_SUCCESS を返す
*/
CCP_EXEC_STS Cmd_DCU_ABORT_CMD(const CTCP* packet);
CCP_EXEC_STS Cmd_DCU_ABORT_CMD(const CommonCmdPacket* packet);

/**
* @brief エラー,またはコマンドによって中断ステータスとなっているコマンドを,実行可能状態に戻す
* @note もし,指定した Cmd が中断ステータスではなくても CCP_EXEC_SUCCESS を返す
*/
CCP_EXEC_STS Cmd_DCU_DOWN_ABORT_FLAG(const CTCP* packet);
CCP_EXEC_STS Cmd_DCU_DOWN_ABORT_FLAG(const CommonCmdPacket* packet);

/**
* @brief ログをクリアする
*/
CCP_EXEC_STS Cmd_DCU_CLEAR_LOG(const CTCP* packet);
CCP_EXEC_STS Cmd_DCU_CLEAR_LOG(const CommonCmdPacket* packet);

#endif
6 changes: 3 additions & 3 deletions Applications/event_utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ static void EVENT_UTIL_update_()
}
}

CCP_EXEC_STS Cmd_EVENT_UTIL_ENABLE_EH_EXEC(const CTCP* packet)
CCP_EXEC_STS Cmd_EVENT_UTIL_ENABLE_EH_EXEC(const CommonCmdPacket* packet)
{
(void)packet;
event_utility_.is_enabled_eh_execution = 1;
return CCP_EXEC_SUCCESS;
}

CCP_EXEC_STS Cmd_EVENT_UTIL_DISABLE_EH_EXEC(const CTCP* packet)
CCP_EXEC_STS Cmd_EVENT_UTIL_DISABLE_EH_EXEC(const CommonCmdPacket* packet)
{
(void)packet;
event_utility_.is_enabled_eh_execution = 0;
return CCP_EXEC_SUCCESS;
}

CCP_EXEC_STS Cmd_EVENT_UTIL_EXEC_EH(const CTCP* packet)
CCP_EXEC_STS Cmd_EVENT_UTIL_EXEC_EH(const CommonCmdPacket* packet)
{
(void)packet;
EH_execute();
Expand Down
6 changes: 3 additions & 3 deletions Applications/event_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ typedef struct

extern const EventUtility* const event_utility;

CCP_EXEC_STS Cmd_EVENT_UTIL_ENABLE_EH_EXEC(const CTCP* packet);
CCP_EXEC_STS Cmd_EVENT_UTIL_DISABLE_EH_EXEC(const CTCP* packet);
CCP_EXEC_STS Cmd_EVENT_UTIL_EXEC_EH(const CTCP* packet);
CCP_EXEC_STS Cmd_EVENT_UTIL_ENABLE_EH_EXEC(const CommonCmdPacket* packet);
CCP_EXEC_STS Cmd_EVENT_UTIL_DISABLE_EH_EXEC(const CommonCmdPacket* packet);
CCP_EXEC_STS Cmd_EVENT_UTIL_EXEC_EH(const CommonCmdPacket* packet);

#endif
2 changes: 1 addition & 1 deletion Applications/gs_command_dispatcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void GSCD_dispatch_(void)
CDIS_dispatch_command(&gs_command_dispatcher_);
}

CCP_EXEC_STS Cmd_GSCD_CLEAR_ERR_LOG(const CTCP* packet)
CCP_EXEC_STS Cmd_GSCD_CLEAR_ERR_LOG(const CommonCmdPacket* packet)
{
(void)packet;

Expand Down
2 changes: 1 addition & 1 deletion Applications/gs_command_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ extern const CommandDispatcher* const gs_command_dispatcher;
*/
AppInfo GSCD_create_app(void);

CCP_EXEC_STS Cmd_GSCD_CLEAR_ERR_LOG(const CTCP* packet);
CCP_EXEC_STS Cmd_GSCD_CLEAR_ERR_LOG(const CommonCmdPacket* packet);

#endif
35 changes: 18 additions & 17 deletions Applications/memory_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
static MemoryDump memory_dump_;
const MemoryDump* const memory_dump = &memory_dump_;

static CTCP MEM_ctcp_; // データサイズが大きいのでstatic確保
static CommonTlmPacket MEM_ctp_; // データサイズが大きいのでstatic確保

static void MEM_init_(void);

Expand All @@ -33,7 +33,7 @@ static void MEM_setup_header_(TCP* packet,
uint16_t adu_seq_cnt,
uint32_t adu_len);

static void MEM_send_packet_(const CTCP* packet,
static void MEM_send_packet_(const CommonTlmPacket* packet,
uint8_t num_dumps);

AppInfo MEM_create_app(void)
Expand All @@ -50,7 +50,7 @@ static void MEM_init_(void)
memory_dump_.adu_counter = 0;
}

CCP_EXEC_STS Cmd_MEM_SET_REGION(const CTCP* packet)
CCP_EXEC_STS Cmd_MEM_SET_REGION(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
uint32_t begin, end, span;
Expand Down Expand Up @@ -84,7 +84,7 @@ CCP_EXEC_STS Cmd_MEM_SET_REGION(const CTCP* packet)
return CCP_EXEC_SUCCESS;
}

CCP_EXEC_STS Cmd_MEM_DUMP_REGION_SEQ(const CTCP* packet)
CCP_EXEC_STS Cmd_MEM_DUMP_REGION_SEQ(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
uint8_t category, num_dumps;
Expand All @@ -104,7 +104,7 @@ CCP_EXEC_STS Cmd_MEM_DUMP_REGION_SEQ(const CTCP* packet)
return MEM_dump_region_(category, num_dumps);
}

CCP_EXEC_STS Cmd_MEM_DUMP_REGION_RND(const CTCP* packet)
CCP_EXEC_STS Cmd_MEM_DUMP_REGION_RND(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
uint8_t category, num_dumps;
Expand Down Expand Up @@ -142,7 +142,7 @@ CCP_EXEC_STS Cmd_MEM_DUMP_REGION_RND(const CTCP* packet)
}
}

CCP_EXEC_STS Cmd_MEM_DUMP_SINGLE(const CTCP* packet)
CCP_EXEC_STS Cmd_MEM_DUMP_SINGLE(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
uint8_t category, num_dumps;
Expand Down Expand Up @@ -170,7 +170,7 @@ CCP_EXEC_STS Cmd_MEM_DUMP_SINGLE(const CTCP* packet)
// Packet Sequence Counter for each ADUは単パケットなので0固定。
// ADU分割形式にしなければ5Bytes分ダンプ領域を増やせるが、
// Packet IDも別にする必要が生じるのでひとまず形式を合わせて実装する。
MEM_setup_header_(&MEM_ctcp_,
MEM_setup_header_(&MEM_ctp_,
MEM_DUMP_WIDTH, // 1パケットの最大長をダンプする
category, // 送出カテゴリはパラメータで指定
MEM_get_next_adu_counter_(), // 単ADUなのでADUカウント値を直接割り当て
Expand All @@ -179,16 +179,17 @@ CCP_EXEC_STS Cmd_MEM_DUMP_SINGLE(const CTCP* packet)
MEM_DUMP_WIDTH); // ADU長はDUMP長と同一

// ダンプデータを設定
data = TCP_TLM_get_user_data_head(&MEM_ctcp_) + 5; // ADU分割によりヘッダ長が5Bytes増える
// FIXME: CTCP, SpacePacket 整理で直す. TCP依存性もやめる
data = TCP_TLM_get_user_data_head(&MEM_ctp_) + 5; // ADU分割によりヘッダ長が5Bytes増える
memcpy(data, (const void*)start_addr, MEM_DUMP_WIDTH);

// 生成したパケットを送出
MEM_send_packet_(&MEM_ctcp_, num_dumps);
MEM_send_packet_(&MEM_ctp_, num_dumps);

return CCP_EXEC_SUCCESS;
}

CCP_EXEC_STS Cmd_MEM_LOAD(const CTCP* packet)
CCP_EXEC_STS Cmd_MEM_LOAD(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
size_t param_len = CCP_get_param_len(packet);
Expand All @@ -207,7 +208,7 @@ CCP_EXEC_STS Cmd_MEM_LOAD(const CTCP* packet)
return CCP_EXEC_SUCCESS;
}

CCP_EXEC_STS Cmd_MEM_SET_DESTINATION(const CTCP* packet)
CCP_EXEC_STS Cmd_MEM_SET_DESTINATION(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
uint32_t dest;
Expand All @@ -227,7 +228,7 @@ CCP_EXEC_STS Cmd_MEM_SET_DESTINATION(const CTCP* packet)
return CCP_EXEC_SUCCESS;
}

CCP_EXEC_STS Cmd_MEM_COPY_REGION_SEQ(const CTCP* packet)
CCP_EXEC_STS Cmd_MEM_COPY_REGION_SEQ(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
uint32_t copy_width, wp;
Expand Down Expand Up @@ -271,13 +272,13 @@ static CCP_EXEC_STS MEM_dump_region_(uint8_t category,
MEM_ACK ack;

// 設定値にもとづき送出すべきパケットを構築
ack = MEM_form_packet_(&MEM_ctcp_, category);
ack = MEM_form_packet_(&MEM_ctp_, category);

switch (ack)
{
case MEM_SUCCESS:
// 生成したパケットを送出し、ADU Sequence Counterの値を更新
MEM_send_packet_(&MEM_ctcp_, num_dumps);
MEM_send_packet_(&MEM_ctp_, num_dumps);
++memory_dump_.adu_seq;
return CCP_EXEC_SUCCESS;

Expand Down Expand Up @@ -320,7 +321,7 @@ static MEM_ACK MEM_form_packet_(TCP* packet,
seq_flag = MEM_judge_seq_flag_(rp, len);

// メモリダンプパケットのヘッダを設定
MEM_setup_header_(&MEM_ctcp_,
MEM_setup_header_(&MEM_ctp_,
len,
category,
memory_dump_.adu_counter,
Expand Down Expand Up @@ -393,7 +394,7 @@ static void MEM_setup_header_(TCP* packet,
data[2] = (uint8_t)(adu_len);
}

static void MEM_send_packet_(const CTCP* packet,
static void MEM_send_packet_(const CommonTlmPacket* packet,
uint8_t num_dumps)
{
int i;
Expand All @@ -402,7 +403,7 @@ static void MEM_send_packet_(const CTCP* packet,
for (i = 0; i < num_dumps; ++i)
{
// num_dumpsの回数だけ生成したパケットを配送処理へ渡す
PH_analyze_packet(packet);
PH_analyze_packet(packet); // FIXME: CTCP, SpacePacket 整理で直す
}
}

Expand Down
14 changes: 7 additions & 7 deletions Applications/memory_dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,27 @@ AppInfo MEM_create_app(void);

// 2018/08/24
// 自分の解釈をコメントとして追加
CCP_EXEC_STS Cmd_MEM_SET_REGION(const CTCP* packet);
CCP_EXEC_STS Cmd_MEM_SET_REGION(const CommonCmdPacket* packet);

CCP_EXEC_STS Cmd_MEM_DUMP_REGION_SEQ(const CTCP* packet);
CCP_EXEC_STS Cmd_MEM_DUMP_REGION_SEQ(const CommonCmdPacket* packet);
// 1パケットに入り切らない場合は,最初のADU分割された最初のパケットのみダンプ
// もう一度送ると,その次のパケットがダンプ
// 最後はちゃんと止まる

CCP_EXEC_STS Cmd_MEM_DUMP_REGION_RND(const CTCP* packet);
CCP_EXEC_STS Cmd_MEM_DUMP_REGION_RND(const CommonCmdPacket* packet);
// ADU分割された場合,その途中のパケットからダンプ

CCP_EXEC_STS Cmd_MEM_DUMP_SINGLE(const CTCP* packet);
CCP_EXEC_STS Cmd_MEM_DUMP_SINGLE(const CommonCmdPacket* packet);
// アドレスを指定して,ダンプ?
// Cmd_MEM_SET_REGION は無視?

CCP_EXEC_STS Cmd_MEM_LOAD(const CTCP* packet);
CCP_EXEC_STS Cmd_MEM_LOAD(const CommonCmdPacket* packet);
// MEMにアップリンクして書き込み

CCP_EXEC_STS Cmd_MEM_SET_DESTINATION(const CTCP* packet);
CCP_EXEC_STS Cmd_MEM_SET_DESTINATION(const CommonCmdPacket* packet);
// Cmd_MEM_COPY_REGION_SEQのコピー先を指定

CCP_EXEC_STS Cmd_MEM_COPY_REGION_SEQ(const CTCP* packet);
CCP_EXEC_STS Cmd_MEM_COPY_REGION_SEQ(const CommonCmdPacket* packet);
// destにrpを指定幅だけコピーしていく
// これもCmd_MEM_DUMP_REGION_SEQと同様に,何度も繰り返し発行して使う.

Expand Down
Loading