Skip to content

Commit

Permalink
Merge pull request #149 from arkedge/feature/fix_driver_small
Browse files Browse the repository at this point in the history
Component Driver の rename に伴う微修正
  • Loading branch information
meltingrabbit authored Oct 13, 2023
2 parents 7fb819a + 940f930 commit bdfcdad
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include "./driver_super_params.h"

#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 を参照 */
#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
Expand Up @@ -44,8 +44,8 @@ static RESULT DI_AOBC_init_(void)
RESULT err = RESULT_OK;

ret1 = CDS_init_stream_rec_buffer(&DI_AOBC_rx_buffer_,
DI_AOBC_rx_buffer_allocation_,
sizeof(DI_AOBC_rx_buffer_allocation_));
DI_AOBC_rx_buffer_allocation_,
sizeof(DI_AOBC_rx_buffer_allocation_));
if (ret1 != CDS_ERR_CODE_OK)
{
Printf("AOBC buffer init Failed ! %d \n", ret1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ static RESULT DI_GS_init_(void)
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]));
DI_GS_ccsds_rx_buffer_allocation_[stream],
sizeof(DI_GS_ccsds_rx_buffer_allocation_[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]));
DI_GS_uart_rx_buffer_allocation_[stream],
sizeof(DI_GS_uart_rx_buffer_allocation_[stream]));
if (ret1 != CDS_ERR_CODE_OK || ret2 != CDS_ERR_CODE_OK)
{
Printf("GS buffer init Failed ! %d, %d \n", ret1, ret2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ static void UART_TEST_init_(void)
CDS_nullify_stream_rec_buffers(rx_buffers);

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_));
DI_UART_TEST_rx_buffer_allocation_0_,
sizeof(DI_UART_TEST_rx_buffer_allocation_0_));
if (ret1 != CDS_ERR_CODE_OK)
{
Printf("UART_TEST buffer0 init Failed ! %d \n", ret1);
}
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_));
DI_UART_TEST_rx_buffer_allocation_1_,
sizeof(DI_UART_TEST_rx_buffer_allocation_1_));
if (ret1 != CDS_ERR_CODE_OK)
{
Printf("UART_TEST buffer1 init Failed ! %d \n", ret1);
Expand Down
10 changes: 5 additions & 5 deletions examples/mobc/src/src_user/component_driver/aocs/aobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static uint8_t AOBC_tx_frame_[EB90_FRAME_HEADER_SIZE +

static CDS_ERR_CODE AOBC_load_driver_super_init_settings_(ComponentDriverSuper* p_super);
static CDS_ERR_CODE AOBC_analyze_rec_data_(CDS_StreamConfig* p_stream_config,
void* p_driver);
void* p_driver);

CDS_INIT_ERR_CODE AOBC_init(AOBC_Driver* aobc_driver, uint8_t ch, CDS_StreamRecBuffer* rx_buffer)
{
Expand All @@ -37,9 +37,9 @@ CDS_INIT_ERR_CODE AOBC_init(AOBC_Driver* aobc_driver, uint8_t ch, CDS_StreamRecB
aobc_driver->driver.uart_config.stop_bit = UART_STOP_BIT_1BIT;

ret = CDS_init(&(aobc_driver->driver.super),
&(aobc_driver->driver.uart_config),
rx_buffer,
AOBC_load_driver_super_init_settings_);
&(aobc_driver->driver.uart_config),
rx_buffer,
AOBC_load_driver_super_init_settings_);
if (ret != CDS_ERR_CODE_OK) return CDS_INIT_CDS_INIT_ERR;
return CDS_INIT_OK;
}
Expand Down Expand Up @@ -85,7 +85,7 @@ CDS_REC_ERR_CODE AOBC_rec(AOBC_Driver* aobc_driver)


static CDS_ERR_CODE AOBC_analyze_rec_data_(CDS_StreamConfig* p_stream_config,
void* p_driver)
void* p_driver)
{
AOBC_Driver* aobc_driver = (AOBC_Driver*)p_driver;

Expand Down
32 changes: 16 additions & 16 deletions examples/mobc/src/src_user/component_driver/com/gs.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ static void GS_load_default_driver_super_init_settings_(ComponentDriverSuper* p_
static CDS_ERR_CODE GS_analyze_rec_data_(CDS_StreamConfig* p_stream_config, void* p_driver);

CDS_INIT_ERR_CODE GS_init(GS_Driver* gs_driver,
uint8_t uart_ch,
CDS_StreamRecBuffer* ccsds_rx_buffers[CDS_STREAM_MAX],
CDS_StreamRecBuffer* uart_rx_buffers[CDS_STREAM_MAX])
uint8_t uart_ch,
CDS_StreamRecBuffer* ccsds_rx_buffers[CDS_STREAM_MAX],
CDS_StreamRecBuffer* uart_rx_buffers[CDS_STREAM_MAX])
{
CDS_ERR_CODE ret_uart, ret_ccsds;
int i;
Expand Down Expand Up @@ -89,13 +89,13 @@ CDS_INIT_ERR_CODE GS_init(GS_Driver* gs_driver,
}

ret_ccsds = CDS_init_streams(&gs_driver->driver_ccsds.super,
&gs_driver->driver_ccsds.ccsds_config,
ccsds_rx_buffers,
GS_load_ccsds_driver_super_init_settings_);
&gs_driver->driver_ccsds.ccsds_config,
ccsds_rx_buffers,
GS_load_ccsds_driver_super_init_settings_);
ret_uart = CDS_init_streams(&gs_driver->driver_uart.super,
&gs_driver->driver_uart.uart_config,
uart_rx_buffers,
GS_load_uart_driver_super_init_settings_);
&gs_driver->driver_uart.uart_config,
uart_rx_buffers,
GS_load_uart_driver_super_init_settings_);
if (ret_ccsds != CDS_ERR_CODE_OK || ret_uart != CDS_ERR_CODE_OK) return CDS_INIT_CDS_INIT_ERR;
gs_driver->latest_info = &gs_driver->info[GS_PORT_TYPE_CCSDS];
gs_driver->tlm_tx_port_type = GS_PORT_TYPE_CCSDS;
Expand Down Expand Up @@ -169,31 +169,31 @@ CDS_REC_ERR_CODE GS_rec_tctf(GS_Driver* gs_driver)

for (i = 0; i < GS_PORT_TYPE_NUM; ++i)
{
ComponentDriverSuper* ds;
ComponentDriverSuper* cds;

if (i == GS_PORT_TYPE_CCSDS)
{
ds = &gs_driver->driver_ccsds.super;
cds = &gs_driver->driver_ccsds.super;
}
else
{
ds = &gs_driver->driver_uart.super;
cds = &gs_driver->driver_uart.super;
}

// TODO: これはエラー情報をきちんと把握したいので,アノマリ発行を入れる
gs_driver->info[i].rx.rec_status = CDS_receive(ds);
gs_driver->info[i].rx.ret_from_if_rx = CDSC_get_rec_status(ds)->ret_from_if_rx;
gs_driver->info[i].rx.rec_status = CDS_receive(cds);
gs_driver->info[i].rx.ret_from_if_rx = CDSC_get_rec_status(cds)->ret_from_if_rx;

if (gs_driver->info[i].rx.rec_status != CDS_ERR_CODE_OK) continue;

for (stream = 0; stream < GS_RX_HEADER_NUM; ++stream)
{
CDS_StreamConfig* p_stream_config;

p_stream_config = &ds->stream_config[stream];
p_stream_config = &cds->stream_config[stream];
if (CDSSC_get_rec_status(p_stream_config)->status_code != CDS_STREAM_REC_STATUS_FIXED_FRAME) continue;

gs_driver->info[i].rx.rec_status = CDS_analyze_rec_data(ds, stream, gs_driver);
gs_driver->info[i].rx.rec_status = CDS_analyze_rec_data(cds, stream, gs_driver);
}
}

Expand Down
8 changes: 4 additions & 4 deletions examples/mobc/src/src_user/component_driver/com/gs.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef struct
{
struct
{
CDS_ERR_CODE rec_status; //!< ComponentDriverSuper からの受信結果
CDS_ERR_CODE rec_status; //!< ComponentDriverSuper からの受信結果
int ret_from_if_rx; //!< UART or CCSDS からの返り値
CCP_DEST_TYPE last_dest_type; //!< 最後に受信したパケットの dest type
cycle_t last_rec_time; //!< 最後に受信した時刻
Expand Down Expand Up @@ -94,9 +94,9 @@ typedef struct
* @return CDS_INIT_ERR_CODE
*/
CDS_INIT_ERR_CODE GS_init(GS_Driver* gs_driver,
uint8_t uart_ch,
CDS_StreamRecBuffer* ccsds_rx_buffers[CDS_STREAM_MAX],
CDS_StreamRecBuffer* uart_rx_buffers[CDS_STREAM_MAX]);
uint8_t uart_ch,
CDS_StreamRecBuffer* ccsds_rx_buffers[CDS_STREAM_MAX],
CDS_StreamRecBuffer* uart_rx_buffers[CDS_STREAM_MAX]);

/**
* @brief 地上から CMD を受信する. 形式は TC Transer Frame
Expand Down
10 changes: 5 additions & 5 deletions examples/mobc/src/src_user/component_driver/etc/uart_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ CDS_INIT_ERR_CODE UART_TEST_init(UART_TEST_Driver* uart_test_driver, uint8_t ch,
{
CDS_ERR_CODE ret;

uart_test_driver->driver.uart_config.ch = ch;
uart_test_driver->driver.uart_config.baudrate = 38400;
uart_test_driver->driver.uart_config.ch = ch;
uart_test_driver->driver.uart_config.baudrate = 38400;
uart_test_driver->driver.uart_config.parity_settings = PARITY_SETTINGS_NONE;
uart_test_driver->driver.uart_config.data_length = UART_DATA_LENGTH_8BIT;
uart_test_driver->driver.uart_config.stop_bit = UART_STOP_BIT_1BIT;

ret = CDS_init_streams(&(uart_test_driver->driver.super),
&(uart_test_driver->driver.uart_config),
rx_buffers,
UART_TEST_load_driver_super_init_settings_);
&(uart_test_driver->driver.uart_config),
rx_buffers,
UART_TEST_load_driver_super_init_settings_);
if (ret != CDS_ERR_CODE_OK) return CDS_INIT_CDS_INIT_ERR;
return CDS_INIT_OK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include "./driver_super_params.h"

#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 を参照 */
#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
Expand Up @@ -38,8 +38,8 @@ static RESULT DI_MOBC_init_(void)
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_));
DI_MOBC_rx_buffer_allocation_,
sizeof(DI_MOBC_rx_buffer_allocation_));
if (ret1 != CDS_ERR_CODE_OK)
{
Printf("MOBC buffer init Failed ! %d \n", ret1);
Expand Down
8 changes: 4 additions & 4 deletions examples/subobc/src/src_user/component_driver/etc/mobc.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static uint8_t MOBC_tx_frame_[EB90_FRAME_HEADER_SIZE +

static CDS_ERR_CODE MOBC_load_driver_super_init_settings_(ComponentDriverSuper* p_super);
static CDS_ERR_CODE MOBC_analyze_rec_data_(CDS_StreamConfig* p_stream_config,
void* p_driver);
void* p_driver);


CDS_INIT_ERR_CODE MOBC_init(MOBC_Driver* mobc_driver, uint8_t ch, CDS_StreamRecBuffer* rx_buffer)
Expand All @@ -36,9 +36,9 @@ CDS_INIT_ERR_CODE MOBC_init(MOBC_Driver* mobc_driver, uint8_t ch, CDS_StreamRecB
mobc_driver->driver.uart_config.stop_bit = UART_STOP_BIT_1BIT;

ret = CDS_init(&(mobc_driver->driver.super),
&(mobc_driver->driver.uart_config),
rx_buffer,
MOBC_load_driver_super_init_settings_);
&(mobc_driver->driver.uart_config),
rx_buffer,
MOBC_load_driver_super_init_settings_);
if (ret != CDS_ERR_CODE_OK) return CDS_INIT_CDS_INIT_ERR;
return CDS_INIT_OK;
}
Expand Down

0 comments on commit bdfcdad

Please sign in to comment.