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

Apply rename migration: Driver -> Component Driver #147

Merged
merged 2 commits into from
Oct 13, 2023
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
2 changes: 1 addition & 1 deletion examples/mobc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ add_definitions("-DGIT_REVISION_C2A_USER_SHORT=0x${GIT_REVISION_C2A_USER_SHORT}"
add_subdirectory(${C2A_CORE_DIR})

add_subdirectory(${C2A_USER_DIR}/applications)
add_subdirectory(${C2A_USER_DIR}/driver)
add_subdirectory(${C2A_USER_DIR}/component_driver)
add_subdirectory(${C2A_USER_DIR}/hal)
add_subdirectory(${C2A_USER_DIR}/library)
add_subdirectory(${C2A_USER_DIR}/Settings)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "../../../tlm_cmd/block_command_definitions.h"
#include "../../../tlm_cmd/command_definitions.h"

#include "../../../driver/com/gs.h"
#include "../../../component_driver/com/gs.h"

#include <src_core/applications/timeline_command_dispatcher_id_define.h>
#include <src_core/tlm_cmd/block_command_loader.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include "./driver_super_params.h"

#define DS_STREAM_REC_BUFFER_SIZE_DEFAULT (DS_IF_RX_BUFFER_SIZE * 2) /*!< DS_StreamRecBuffer のバッファサイズのデフォルト値
UART などの非同期通信はメモリに余力があれば DS_IF_RX_BUFFER_SIZE * 2 を推奨
#define CDS_STREAM_REC_BUFFER_SIZE_DEFAULT (CDS_IF_RX_BUFFER_SIZE * 2) /*!< CDS_StreamRecBuffer のバッファサイズのデフォルト値
UART などの非同期通信はメモリに余力があれば CDS_IF_RX_BUFFER_SIZE * 2 を推奨
詳細は dirver_super.c の @note を参照 */

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @file
* @brief ComponentDriverSuperパラメタのオーバーライド用ヘッダー
*/
#ifndef DRIVER_SUPER_PARAMS_H_
#define DRIVER_SUPER_PARAMS_H_

#undef CDS_STREAM_MAX
#undef CDS_IF_RX_BUFFER_SIZE

#define CDS_STREAM_MAX (3)
#define CDS_IF_RX_BUFFER_SIZE (1024)

#endif
22 changes: 11 additions & 11 deletions examples/mobc/src/src_user/applications/driver_instances/di_aobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
*/

#include "di_aobc.h"
#include "../../driver/aocs/aobc.h"
#include "../../component_driver/aocs/aobc.h"
#include "../../tlm_cmd/user_packet_handler.h"
#include <src_core/library/print.h>
#include <src_core/tlm_cmd/common_cmd_packet_util.h>
#include "../../Settings/port_config.h"
#include "../../Settings/DriverSuper/driver_buffer_define.h"
#include "../../Settings/component_driver_super/driver_buffer_define.h"
#include <src_core/library/result.h>

static RESULT DI_AOBC_init_(void);
Expand All @@ -27,8 +27,8 @@ static CommandDispatcher DI_AOBC_cdis_;
const CommandDispatcher* const DI_AOBC_cdis = &DI_AOBC_cdis_;

// バッファ
static DS_StreamRecBuffer DI_AOBC_rx_buffer_;
static uint8_t DI_AOBC_rx_buffer_allocation_[DS_STREAM_REC_BUFFER_SIZE_DEFAULT];
static CDS_StreamRecBuffer DI_AOBC_rx_buffer_;
static uint8_t DI_AOBC_rx_buffer_allocation_[CDS_STREAM_REC_BUFFER_SIZE_DEFAULT];


AppInfo DI_AOBC_update(void)
Expand All @@ -39,21 +39,21 @@ AppInfo DI_AOBC_update(void)

static RESULT DI_AOBC_init_(void)
{
DS_ERR_CODE ret1;
DS_INIT_ERR_CODE ret2;
CDS_ERR_CODE ret1;
CDS_INIT_ERR_CODE ret2;
RESULT err = RESULT_OK;

ret1 = DS_init_stream_rec_buffer(&DI_AOBC_rx_buffer_,
ret1 = CDS_init_stream_rec_buffer(&DI_AOBC_rx_buffer_,
DI_AOBC_rx_buffer_allocation_,
sizeof(DI_AOBC_rx_buffer_allocation_));
if (ret1 != DS_ERR_CODE_OK)
if (ret1 != CDS_ERR_CODE_OK)
{
Printf("AOBC buffer init Failed ! %d \n", ret1);
err = RESULT_ERR;
}

ret2 = AOBC_init(&aobc_driver_, PORT_CH_RS422_AOBC, &DI_AOBC_rx_buffer_);
if (ret2 != DS_INIT_OK)
if (ret2 != CDS_INIT_OK)
{
Printf("AOBC init Failed ! %d \n", ret2);
err = RESULT_ERR;
Expand Down Expand Up @@ -98,7 +98,7 @@ static RESULT DI_AOBC_cmd_dispatcher_(void)

CCP_CmdRet DI_AOBC_dispatch_command(const CommonCmdPacket* packet)
{
DS_CMD_ERR_CODE ret;
CDS_CMD_ERR_CODE ret;
CommonCmdPacket* pckt = (CommonCmdPacket*)packet; // const_cast
// ここで CCP_DEST_TYPE を宛先で受理できるように変更(なので const cast が発生している...)

Expand All @@ -121,7 +121,7 @@ CCP_CmdRet DI_AOBC_dispatch_command(const CommonCmdPacket* packet)

ret = AOBC_send_cmd(&aobc_driver_, pckt);
// FIXME: ここも一旦握りつぶす(後で直す)
return DS_conv_cmd_err_to_ccp_cmd_ret(ret);
return CDS_conv_cmd_err_to_ccp_cmd_ret(ret);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#ifndef DI_AOBC_H_
#define DI_AOBC_H_

#include "../../driver/aocs/aobc.h"
#include "../../driver/aocs/aobc_command_definitions.h"
#include "../../driver/aocs/aobc_telemetry_definitions.h"
#include "../../component_driver/aocs/aobc.h"
#include "../../component_driver/aocs/aobc_command_definitions.h"
#include "../../component_driver/aocs/aobc_telemetry_definitions.h"
#include <src_core/system/application_manager/app_info.h>
#include <src_core/tlm_cmd/command_dispatcher.h>
#include <src_core/tlm_cmd/common_cmd_packet.h>
Expand Down Expand Up @@ -36,7 +36,7 @@ AppInfo DI_AOBC_cmd_dispatcher(void);
* @note この関数を呼んでも良いのは,user_packet_handler のみ!
* @param packet: CommonCmdPacket packet
* @retval CCP_CmdRet{CCP_EXEC_SUCCESS, *}: 無事に転送された
* @retval それ以外: 転送失敗(DS_CMD_ERR_CODE を CCP_EXEC_STS に変換して返す.詳細エラーは DriverSuper を参照)
* @retval それ以外: 転送失敗(CDS_CMD_ERR_CODE を CCP_EXEC_STS に変換して返す.詳細エラーは ComponentDriverSuper を参照)
*/
CCP_CmdRet DI_AOBC_dispatch_command(const CommonCmdPacket* packet);

Expand Down
36 changes: 18 additions & 18 deletions examples/mobc/src/src_user/applications/driver_instances/di_gs.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include <src_core/tlm_cmd/common_cmd_packet_util.h>
#include <src_core/library/print.h>
#include <src_core/library/result.h>
#include "../../driver/com/gs_validate.h"
#include "../../component_driver/com/gs_validate.h"
#include "../../Settings/port_config.h"
#include "../../Settings/DriverSuper/driver_buffer_define.h"
#include "../../Settings/component_driver_super/driver_buffer_define.h"

static RESULT DI_GS_init_(void);

Expand All @@ -34,33 +34,33 @@ static DI_GS_TlmPacketHandler DI_GS_rp_tlm_packet_handler_;
const DI_GS_TlmPacketHandler* const DI_GS_rp_tlm_packet_handler = &DI_GS_rp_tlm_packet_handler_;

// バッファ
static DS_StreamRecBuffer DI_GS_ccsds_rx_buffer_[GS_RX_HEADER_NUM];
static uint8_t DI_GS_ccsds_rx_buffer_allocation_[GS_RX_HEADER_NUM][DS_STREAM_REC_BUFFER_SIZE_DEFAULT];
static DS_StreamRecBuffer DI_GS_uart_rx_buffer_[GS_RX_HEADER_NUM];
static uint8_t DI_GS_uart_rx_buffer_allocation_[GS_RX_HEADER_NUM][DS_STREAM_REC_BUFFER_SIZE_DEFAULT];
static CDS_StreamRecBuffer DI_GS_ccsds_rx_buffer_[GS_RX_HEADER_NUM];
static uint8_t DI_GS_ccsds_rx_buffer_allocation_[GS_RX_HEADER_NUM][CDS_STREAM_REC_BUFFER_SIZE_DEFAULT];
static CDS_StreamRecBuffer DI_GS_uart_rx_buffer_[GS_RX_HEADER_NUM];
static uint8_t DI_GS_uart_rx_buffer_allocation_[GS_RX_HEADER_NUM][CDS_STREAM_REC_BUFFER_SIZE_DEFAULT];


static RESULT DI_GS_init_(void)
{
int stream;
DS_INIT_ERR_CODE ret;
DS_StreamRecBuffer* ccsds_rx_buffers[DS_STREAM_MAX];
DS_StreamRecBuffer* uart_rx_buffers[DS_STREAM_MAX];
DS_nullify_stream_rec_buffers(ccsds_rx_buffers);
DS_nullify_stream_rec_buffers(uart_rx_buffers);
CDS_INIT_ERR_CODE ret;
CDS_StreamRecBuffer* ccsds_rx_buffers[CDS_STREAM_MAX];
CDS_StreamRecBuffer* uart_rx_buffers[CDS_STREAM_MAX];
CDS_nullify_stream_rec_buffers(ccsds_rx_buffers);
CDS_nullify_stream_rec_buffers(uart_rx_buffers);

// GS_RX_HEADER_NUM > DS_STREAM_MAX のアサーションは gs.c でやっているのでここではしない
// GS_RX_HEADER_NUM > CDS_STREAM_MAX のアサーションは gs.c でやっているのでここではしない
for (stream = 0; stream < GS_RX_HEADER_NUM; ++stream)
{
DS_ERR_CODE ret1;
DS_ERR_CODE ret2;
ret1 = DS_init_stream_rec_buffer(&DI_GS_ccsds_rx_buffer_[stream],
CDS_ERR_CODE ret1;
CDS_ERR_CODE ret2;
ret1 = CDS_init_stream_rec_buffer(&DI_GS_ccsds_rx_buffer_[stream],
DI_GS_ccsds_rx_buffer_allocation_[stream],
sizeof(DI_GS_ccsds_rx_buffer_allocation_[stream]));
ret2 = DS_init_stream_rec_buffer(&DI_GS_uart_rx_buffer_[stream],
ret2 = CDS_init_stream_rec_buffer(&DI_GS_uart_rx_buffer_[stream],
DI_GS_uart_rx_buffer_allocation_[stream],
sizeof(DI_GS_uart_rx_buffer_allocation_[stream]));
if (ret1 != DS_ERR_CODE_OK || ret2 != DS_ERR_CODE_OK)
if (ret1 != CDS_ERR_CODE_OK || ret2 != CDS_ERR_CODE_OK)
{
Printf("GS buffer init Failed ! %d, %d \n", ret1, ret2);
return RESULT_ERR;
Expand All @@ -71,7 +71,7 @@ static RESULT DI_GS_init_(void)

ret = GS_init(&gs_driver_, PORT_CH_RS422_MOBC_EXT, ccsds_rx_buffers, uart_rx_buffers);

if (ret != DS_INIT_OK)
if (ret != CDS_INIT_OK)
{
Printf("!! GS Init Error %d !!\n", ret);
return RESULT_ERR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <stdint.h>

#include "../../driver/com/gs.h"
#include "../../component_driver/com/gs.h"
#include "../../tlm_cmd/ccsds/tcp_to_m_pdu.h"
#include "../../tlm_cmd/ccsds/vcdu.h"
#include <src_core/system/application_manager/app_info.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#pragma section REPRO
/**
* @file
* @brief UART と DriverSuper テスト用
* @brief UART と ComponentDriverSuper テスト用
*/
#include "di_uart_test.h"
#include <stddef.h> // for NULL
#include <src_core/library/print.h>
#include <src_core/tlm_cmd/common_cmd_packet_util.h>
#include "../../Settings/port_config.h"
#include "../../Settings/DriverSuper/driver_buffer_define.h"
#include "../../Settings/component_driver_super/driver_buffer_define.h"
#include <src_core/library/result.h>

static RESULT UART_TEST_init_by_AM_(void);
Expand All @@ -25,10 +25,10 @@ static UART_TEST_Driver uart_test_driver_;
const UART_TEST_Driver* const uart_test_driver = &uart_test_driver_;

// バッファ
static DS_StreamRecBuffer DI_UART_TEST_rx_buffer_0_;
static DS_StreamRecBuffer DI_UART_TEST_rx_buffer_1_;
static uint8_t DI_UART_TEST_rx_buffer_allocation_0_[DS_STREAM_REC_BUFFER_SIZE_DEFAULT];
static uint8_t DI_UART_TEST_rx_buffer_allocation_1_[DS_STREAM_REC_BUFFER_SIZE_DEFAULT];
static CDS_StreamRecBuffer DI_UART_TEST_rx_buffer_0_;
static CDS_StreamRecBuffer DI_UART_TEST_rx_buffer_1_;
static uint8_t DI_UART_TEST_rx_buffer_allocation_0_[CDS_STREAM_REC_BUFFER_SIZE_DEFAULT];
static uint8_t DI_UART_TEST_rx_buffer_allocation_1_[CDS_STREAM_REC_BUFFER_SIZE_DEFAULT];


// !!!!!!!!!! 注意 !!!!!!!!!!
Expand All @@ -49,27 +49,27 @@ static RESULT UART_TEST_init_by_AM_(void)

static void UART_TEST_init_(void)
{
DS_ERR_CODE ret1;
DS_INIT_ERR_CODE ret2;
DS_StreamRecBuffer* rx_buffers[DS_STREAM_MAX];
DS_nullify_stream_rec_buffers(rx_buffers);
CDS_ERR_CODE ret1;
CDS_INIT_ERR_CODE ret2;
CDS_StreamRecBuffer* rx_buffers[CDS_STREAM_MAX];
CDS_nullify_stream_rec_buffers(rx_buffers);

ret1 = DS_init_stream_rec_buffer(&DI_UART_TEST_rx_buffer_0_,
ret1 = CDS_init_stream_rec_buffer(&DI_UART_TEST_rx_buffer_0_,
DI_UART_TEST_rx_buffer_allocation_0_,
sizeof(DI_UART_TEST_rx_buffer_allocation_0_));
if (ret1 != DS_ERR_CODE_OK)
if (ret1 != CDS_ERR_CODE_OK)
{
Printf("UART_TEST buffer0 init Failed ! %d \n", ret1);
}
ret1 = DS_init_stream_rec_buffer(&DI_UART_TEST_rx_buffer_1_,
ret1 = CDS_init_stream_rec_buffer(&DI_UART_TEST_rx_buffer_1_,
DI_UART_TEST_rx_buffer_allocation_1_,
sizeof(DI_UART_TEST_rx_buffer_allocation_1_));
if (ret1 != DS_ERR_CODE_OK)
if (ret1 != CDS_ERR_CODE_OK)
{
Printf("UART_TEST buffer1 init Failed ! %d \n", ret1);
}

if (DS_STREAM_MAX < 2)
if (CDS_STREAM_MAX < 2)
{
Printf("UART_TEST init Failed ! Lack of streams \n");
return;
Expand All @@ -79,7 +79,7 @@ static void UART_TEST_init_(void)
rx_buffers[1] = &DI_UART_TEST_rx_buffer_1_;

ret2 = UART_TEST_init(&uart_test_driver_, PORT_CH_UART_TEST, rx_buffers);
if (ret2 != DS_INIT_OK)
if (ret2 != CDS_INIT_OK)
{
Printf("UART_TEST init Failed! Err:%d \n", ret2);
}
Expand All @@ -92,7 +92,7 @@ static void UART_TEST_init_(void)

static RESULT UART_TEST_update_(void)
{
DS_REC_ERR_CODE ret;
CDS_REC_ERR_CODE ret;

ret = UART_TEST_rec(&uart_test_driver_);

Expand Down Expand Up @@ -126,12 +126,12 @@ CCP_CmdRet Cmd_UART_TEST_SEND_TEST(const CommonCmdPacket* packet)
{
const uint8_t* param = CCP_get_param_head(packet);
uint8_t id;
DS_CMD_ERR_CODE ret;
CDS_CMD_ERR_CODE ret;

id = param[0];

ret = UART_TEST_send(&uart_test_driver_, id);
return DS_conv_cmd_err_to_ccp_cmd_ret(ret);
return CDS_conv_cmd_err_to_ccp_cmd_ret(ret);
}

#pragma section
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* @file
* @brief UART と DriverSuper テスト用
* @brief UART と ComponentDriverSuper テスト用
*/
#ifndef DI_UART_TEST_H_
#define DI_UART_TEST_H_

#include "../../driver/etc/uart_test.h"
#include "../../component_driver/etc/uart_test.h"
#include <src_core/system/application_manager/app_info.h>
#include <src_core/tlm_cmd/common_cmd_packet.h>

Expand Down
Loading
Loading