Skip to content

Commit

Permalink
examples/subobc: apply driver_instances -> component_service migration
Browse files Browse the repository at this point in the history
  • Loading branch information
sksat committed Oct 13, 2023
1 parent c57d6b2 commit b50f9ea
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

void BCL_load_tl_elem_gs_related_process(void)
{
BCL_tool_register_app(0, AR_DI_MOBC_CMD_PH);
BCL_tool_register_app(0, AR_CSRV_MOBC_CMD_PH);
BCL_tool_register_app(1, AR_GSC_DISPATCHER);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void BCL_load_tl_elem_tlm_cmd_hirate(void)
BCL_tool_register_app (0, AR_RTC_DISPATCHER);
BCL_tool_register_app (1, AR_TLC_DISPATCHER_BC);
BCL_tool_register_app (2, AR_TLC_DISPATCHER_TLM);
BCL_tool_register_app (3, AR_DI_MOBC_RT_TLM_PH);
BCL_tool_register_app (3, AR_CSRV_MOBC_RT_TLM_PH);
#ifdef TLCD_ENABLE_MISSION_TL
BCL_tool_register_app (5, AR_TLC_DISPATCHER_MIS);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
.MOBC_RT.TG_FORWARD_AS_RT_TLM 0x511 0x90 # AOBC AOBC
.#
.# AOBCリセット
.MOBC_RT.AM_INITIALIZE_APP 4 # AR_DI_AOBC
.MOBC_RT.AM_INITIALIZE_APP 4 # AR_CSRV_AOBC
.MOBC_RT.TG_FORWARD_AS_RT_TLM 0x511 0x90 # AOBC AOBC → CNT ERR が出るはず
.AOBC_RT.TG_GENERATE_RT_TLM 0x90 # AOBC AOBC
.MOBC_RT.TG_FORWARD_AS_RT_TLM 0x511 0x90 # AOBC AOBC
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_c2a_comm_blc():
@pytest.mark.real
@pytest.mark.sils
def test_c2a_comm_tlm_buffer():
send_mobc_gsc(mobc_c2a_enum.Cmd_CODE_AM_INITIALIZE_APP, (mobc_c2a_enum.AR_DI_AOBC,))
send_mobc_gsc(mobc_c2a_enum.Cmd_CODE_AM_INITIALIZE_APP, (mobc_c2a_enum.AR_CSRV_AOBC,))

# MOBC の tlm buffer が空なのでエラー
assert "CNT" == wings.util.send_rt_cmd_and_confirm(
Expand Down
2 changes: 1 addition & 1 deletion examples/subobc/src/src_user/applications/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(C2A_USER_APPS)

set(C2A_SRCS
app_registry.c
driver_instances/di_mobc.c
component_service/csrv_mobc.c
user_defined/debug_apps.c
${C2A_CORE_DIR}/applications/gs_command_dispatcher.c
${C2A_CORE_DIR}/applications/event_utility.c
Expand Down
2 changes: 1 addition & 1 deletion examples/subobc/src/src_user/applications/app_headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <src_core/applications/test_app/test_ccp_util.h>

// DI
#include "driver_instances/di_mobc.h"
#include "component_service/csrv_mobc.h"

// UserDefined
#include "user_defined/debug_apps.h"
Expand Down
4 changes: 2 additions & 2 deletions examples/subobc/src/src_user/applications/app_registry.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ static AM_ACK add_application_(size_t id,
void AR_load_initial_settings(void)
{
add_application_(AR_NOP, NOP_create_app);
add_application_(AR_DI_MOBC_CMD_PH, DI_MOBC_update);
add_application_(AR_DI_MOBC_RT_TLM_PH, DI_MOBC_rt_tlm_packet_handler);
add_application_(AR_CSRV_MOBC_CMD_PH, CSRV_MOBC_update);
add_application_(AR_CSRV_MOBC_RT_TLM_PH, CSRV_MOBC_rt_tlm_packet_handler);
add_application_(AR_GSC_DISPATCHER, GSCD_create_app);
add_application_(AR_RTC_DISPATCHER, RTCD_create_app);
add_application_(AR_TLC_DISPATCHER_GS, TLCD_gs_create_app);
Expand Down
4 changes: 2 additions & 2 deletions examples/subobc/src/src_user/applications/app_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
typedef enum
{
AR_NOP,
AR_DI_MOBC_CMD_PH,
AR_DI_MOBC_RT_TLM_PH,
AR_CSRV_MOBC_CMD_PH,
AR_CSRV_MOBC_RT_TLM_PH,
AR_GSC_DISPATCHER,
AR_RTC_DISPATCHER,
AR_TLC_DISPATCHER_GS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,49 @@
* @brief MOBC の DI. MOBC における GS との DI に相当する
*/

#include "di_mobc.h"
#include "csrv_mobc.h"
#include <src_core/tlm_cmd/packet_handler.h>
#include <src_core/library/print.h>
#include "../../Settings/port_config.h"
#include "../../Settings/component_driver_super/driver_buffer_define.h"
#include <src_core/library/result.h>

static RESULT DI_MOBC_init_(void);
static RESULT DI_MOBC_update_(void);
static RESULT DI_MOBC_rt_tlm_packet_handler_init_(void);
static RESULT DI_MOBC_rt_tlm_packet_handler_(void);
static RESULT CSRV_MOBC_init_(void);
static RESULT CSRV_MOBC_update_(void);
static RESULT CSRV_MOBC_rt_tlm_packet_handler_init_(void);
static RESULT CSRV_MOBC_rt_tlm_packet_handler_(void);

static MOBC_Driver mobc_driver_;
const MOBC_Driver* const mobc_driver = &mobc_driver_;

// バッファ
static CDS_StreamRecBuffer DI_MOBC_rx_buffer_;
static uint8_t DI_MOBC_rx_buffer_allocation_[CDS_STREAM_REC_BUFFER_SIZE_DEFAULT];
static CDS_StreamRecBuffer CSRV_MOBC_rx_buffer_;
static uint8_t CSRV_MOBC_rx_buffer_allocation_[CDS_STREAM_REC_BUFFER_SIZE_DEFAULT];

static const uint8_t DI_MOBC_kRtTlmPhMaxNumOfProc_ = 4; //!< 一度に送出する最大テレメ数
static const uint8_t CSRV_MOBC_kRtTlmPhMaxNumOfProc_ = 4; //!< 一度に送出する最大テレメ数


AppInfo DI_MOBC_update(void)
AppInfo CSRV_MOBC_update(void)
{
return AI_create_app_info("update_MOBC", DI_MOBC_init_, DI_MOBC_update_);
return AI_create_app_info("update_MOBC", CSRV_MOBC_init_, CSRV_MOBC_update_);
}

static RESULT DI_MOBC_init_(void)
static RESULT CSRV_MOBC_init_(void)
{
CDS_ERR_CODE ret1;
CDS_INIT_ERR_CODE ret2;
RESULT err = RESULT_OK;

ret1 = CDS_init_stream_rec_buffer(&DI_MOBC_rx_buffer_,
DI_MOBC_rx_buffer_allocation_,
sizeof(DI_MOBC_rx_buffer_allocation_));
ret1 = CDS_init_stream_rec_buffer(&CSRV_MOBC_rx_buffer_,
CSRV_MOBC_rx_buffer_allocation_,
sizeof(CSRV_MOBC_rx_buffer_allocation_));
if (ret1 != CDS_ERR_CODE_OK)
{
Printf("MOBC buffer init Failed ! %d \n", ret1);
err = RESULT_ERR;
}

ret2 = MOBC_init(&mobc_driver_, PORT_CH_UART_MOBC, &DI_MOBC_rx_buffer_);
ret2 = MOBC_init(&mobc_driver_, PORT_CH_UART_MOBC, &CSRV_MOBC_rx_buffer_);
if (ret2 != CDS_INIT_OK)
{
Printf("MOBC init Failed ! %d \n", ret2);
Expand All @@ -56,7 +56,7 @@ static RESULT DI_MOBC_init_(void)
return err;
}

static RESULT DI_MOBC_update_(void)
static RESULT CSRV_MOBC_update_(void)
{
CDS_REC_ERR_CODE ret;
ret = MOBC_rec(&mobc_driver_);
Expand All @@ -67,28 +67,28 @@ static RESULT DI_MOBC_update_(void)
}


AppInfo DI_MOBC_rt_tlm_packet_handler(void)
AppInfo CSRV_MOBC_rt_tlm_packet_handler(void)
{
return AI_create_app_info("MOBC_rt_tlm_ph",
DI_MOBC_rt_tlm_packet_handler_init_,
DI_MOBC_rt_tlm_packet_handler_);
CSRV_MOBC_rt_tlm_packet_handler_init_,
CSRV_MOBC_rt_tlm_packet_handler_);
}

static RESULT DI_MOBC_rt_tlm_packet_handler_init_(void)
static RESULT CSRV_MOBC_rt_tlm_packet_handler_init_(void)
{
// なにもしない
return RESULT_OK;
}

static RESULT DI_MOBC_rt_tlm_packet_handler_(void)
static RESULT CSRV_MOBC_rt_tlm_packet_handler_(void)
{
uint8_t i;
CommonTlmPacket packet; // FIXME: これは static にする?
// static のほうがコンパイル時にアドレスが確定して安全. Out of stack space を回避できる
// 一方でメモリ使用量は増える.
mobc_driver_.info.c2a.send_tlm_err_code = CDS_CMD_OK;

for (i = 0; i < DI_MOBC_kRtTlmPhMaxNumOfProc_; i++)
for (i = 0; i < CSRV_MOBC_kRtTlmPhMaxNumOfProc_; i++)
{
CDS_CMD_ERR_CODE ret;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* @file
* @brief MOBC の DI. MOBC における GS との DI に相当する
*/
#ifndef DI_MOBC_H_
#define DI_MOBC_H_
#ifndef CSRV_MOBC_H_
#define CSRV_MOBC_H_

#include "../../component_driver/etc/mobc.h"
#include <src_core/system/application_manager/app_info.h>
Expand All @@ -16,14 +16,14 @@ extern const MOBC_Driver* const mobc_driver; //!< MOBC driver
* @param void
* @return AppInfo
*/
AppInfo DI_MOBC_update(void);
AppInfo CSRV_MOBC_update(void);

/**
* @brief MOBC RT_TLM (Realtime Telemetry) PH (packet handler) アプリ生成関数
* @param void
* @return AppInfo
* @note ひとまずテレメは RT_TLM のみ実装する
*/
AppInfo DI_MOBC_rt_tlm_packet_handler(void);
AppInfo CSRV_MOBC_rt_tlm_packet_handler(void);

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <src_core/applications/gs_command_dispatcher.h>
#include <src_core/applications/realtime_command_dispatcher.h>
#include <src_core/applications/timeline_command_dispatcher.h>
#include "../../applications/driver_instances/di_mobc.h"
#include "../../applications/component_service/csrv_mobc.h"
// #include <src_core/tlm_cmd/telemetry_generator.h>
#include "../../library/vt100.h"
#include <src_core/library/result.h>
Expand Down

0 comments on commit b50f9ea

Please sign in to comment.