diff --git a/examples/mobc/src/src_user/Drivers/Aocs/aobc.c b/examples/mobc/src/src_user/Drivers/Aocs/aobc.c index e436d6739..6e88f116b 100644 --- a/examples/mobc/src/src_user/Drivers/Aocs/aobc.c +++ b/examples/mobc/src/src_user/Drivers/Aocs/aobc.c @@ -9,8 +9,8 @@ #include "./aobc_telemetry_buffer.h" #include #include -#include -#include +#include +#include #include #define AOBC_STREAM_TLM_CMD (0) //!< テレコマで使うストリーム @@ -19,13 +19,13 @@ static uint8_t AOBC_tx_frame_[EB90_FRAME_HEADER_SIZE + CTCP_MAX_LEN + EB90_FRAME_FOOTER_SIZE]; -static DS_ERR_CODE AOBC_load_driver_super_init_settings_(DriverSuper* p_super); -static DS_ERR_CODE AOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, +static FRM_ERR_CODE AOBC_load_driver_super_init_settings_(Framing* p_framing); +static FRM_ERR_CODE AOBC_analyze_rec_data_(FRM_StreamConfig* p_stream_config, void* p_driver); -DS_INIT_ERR_CODE AOBC_init(AOBC_Driver* aobc_driver, uint8_t ch, DS_StreamRecBuffer* rx_buffer) +FRM_INIT_ERR_CODE AOBC_init(AOBC_Driver* aobc_driver, uint8_t ch, FRM_StreamRecBuffer* rx_buffer) { - DS_ERR_CODE ret; + FRM_ERR_CODE ret; memset(aobc_driver, 0x00, sizeof(*aobc_driver)); AOBC_init_tlm_buffer(aobc_driver); @@ -36,55 +36,55 @@ DS_INIT_ERR_CODE AOBC_init(AOBC_Driver* aobc_driver, uint8_t ch, DS_StreamRecBuf aobc_driver->driver.uart_config.data_length = UART_DATA_LENGTH_8BIT; aobc_driver->driver.uart_config.stop_bit = UART_STOP_BIT_1BIT; - ret = DS_init(&(aobc_driver->driver.super), + ret = FRM_init(&(aobc_driver->driver.super), &(aobc_driver->driver.uart_config), rx_buffer, AOBC_load_driver_super_init_settings_); - if (ret != DS_ERR_CODE_OK) return DS_INIT_DS_INIT_ERR; - return DS_INIT_OK; + if (ret != FRM_ERR_CODE_OK) return FRM_INIT_FRM_INIT_ERR; + return FRM_INIT_OK; } -static DS_ERR_CODE AOBC_load_driver_super_init_settings_(DriverSuper* p_super) +static FRM_ERR_CODE AOBC_load_driver_super_init_settings_(Framing* p_framing) { - DS_StreamConfig* p_stream_config; + FRM_StreamConfig* p_stream_config; - p_super->interface = UART; + p_framing->interface = UART; // stream は 0 のみ - p_stream_config = &(p_super->stream_config[AOBC_STREAM_TLM_CMD]); + p_stream_config = &(p_framing->stream_config[AOBC_STREAM_TLM_CMD]); CTCP_init_dssc(p_stream_config, AOBC_tx_frame_, sizeof(AOBC_tx_frame_), AOBC_analyze_rec_data_); // 定期 TLM の監視機能の有効化しない → ので設定上書きなし - DSSC_enable(p_stream_config); + FRMSC_enable(p_stream_config); - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } -DS_REC_ERR_CODE AOBC_rec(AOBC_Driver* aobc_driver) +FRM_REC_ERR_CODE AOBC_rec(AOBC_Driver* aobc_driver) { - DS_ERR_CODE ret; - DS_StreamConfig* p_stream_config; + FRM_ERR_CODE ret; + FRM_StreamConfig* p_stream_config; - ret = DS_receive(&(aobc_driver->driver.super)); + ret = FRM_receive(&(aobc_driver->driver.super)); - if (ret != DS_ERR_CODE_OK) return DS_REC_DS_RECEIVE_ERR; + if (ret != FRM_ERR_CODE_OK) return FRM_REC_FRM_RECEIVE_ERR; p_stream_config = &(aobc_driver->driver.super.stream_config[AOBC_STREAM_TLM_CMD]); - if (DSSC_get_rec_status(p_stream_config)->status_code != DS_STREAM_REC_STATUS_FIXED_FRAME) return DS_REC_OK; // 受信せず([TODO] 詳細なエラー処理は一旦しない) + if (FRMSC_get_rec_status(p_stream_config)->status_code != FRM_STREAM_REC_STATUS_FIXED_FRAME) return FRM_REC_OK; // 受信せず([TODO] 詳細なエラー処理は一旦しない) - ret = DS_analyze_rec_data(&(aobc_driver->driver.super), AOBC_STREAM_TLM_CMD, aobc_driver); + ret = FRM_analyze_rec_data(&(aobc_driver->driver.super), AOBC_STREAM_TLM_CMD, aobc_driver); - if (ret != DS_ERR_CODE_OK) return DS_REC_ANALYZE_ERR; + if (ret != FRM_ERR_CODE_OK) return FRM_REC_ANALYZE_ERR; - return DS_REC_OK; + return FRM_REC_OK; } -static DS_ERR_CODE AOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, +static FRM_ERR_CODE AOBC_analyze_rec_data_(FRM_StreamConfig* p_stream_config, void* p_driver) { AOBC_Driver* aobc_driver = (AOBC_Driver*)p_driver; @@ -94,7 +94,7 @@ static DS_ERR_CODE AOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, if (!EB90_FRAME_is_valid_crc_of_dssc(p_stream_config)) { aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_CRC_ERR; - return DS_ERR_CODE_ERR; + return FRM_ERR_CODE_ERR; } return AOBC_buffer_tlm_packet(p_stream_config, aobc_driver); @@ -104,11 +104,11 @@ static DS_ERR_CODE AOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, // TODO: DS protocol 改修にともなって古くなったので治す #if 0 // 非C2A系列はこのように書く -static DS_ERR_CODE AOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, void* p_driver) +static FRM_ERR_CODE AOBC_analyze_rec_data_(FRM_StreamConfig* p_stream_config, void* p_driver) { AOBC_Driver* aobc_driver = (AOBC_Driver*)p_driver; - uint32_t tlm_ver = DS_ISSLFMT_get_tlm_version(p_stream_config); - uint32_t tlm_id = DS_ISSLFMT_get_tlm_id(tlm_ver, p_stream_config); + uint32_t tlm_ver = FRM_ISSLFMT_get_tlm_version(p_stream_config); + uint32_t tlm_id = FRM_ISSLFMT_get_tlm_id(tlm_ver, p_stream_config); aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_OK; @@ -119,16 +119,16 @@ static DS_ERR_CODE AOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, void return AOBC_analyze_tlm_hk_(p_stream_config, aobc_driver); default: aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_TLM_NOT_FOUND; - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } } #endif -DS_CMD_ERR_CODE AOBC_send_cmd(AOBC_Driver* aobc_driver, const CommonCmdPacket* packet) +FRM_CMD_ERR_CODE AOBC_send_cmd(AOBC_Driver* aobc_driver, const CommonCmdPacket* packet) { - DS_ERR_CODE ret; - DS_StreamConfig* p_stream_config; + FRM_ERR_CODE ret; + FRM_StreamConfig* p_stream_config; AOBC_CMD_CODE cmd_code; p_stream_config = &(aobc_driver->driver.super.stream_config[AOBC_STREAM_TLM_CMD]); @@ -151,21 +151,21 @@ DS_CMD_ERR_CODE AOBC_send_cmd(AOBC_Driver* aobc_driver, const CommonCmdPacket* p case AOBC_Cmd_CODE_TG_FORWARD_AS_HP_TLM: // FALLTHROUGH case AOBC_Cmd_CODE_TG_FORWARD_AS_RT_TLM: // FALLTHROUGH case AOBC_Cmd_CODE_TG_FORWARD_AS_ST_TLM: - ret = DS_send_req_tlm_cmd(&(aobc_driver->driver.super), AOBC_STREAM_TLM_CMD); + ret = FRM_send_req_tlm_cmd(&(aobc_driver->driver.super), AOBC_STREAM_TLM_CMD); break; default: - ret = DS_send_general_cmd(&(aobc_driver->driver.super), AOBC_STREAM_TLM_CMD); + ret = FRM_send_general_cmd(&(aobc_driver->driver.super), AOBC_STREAM_TLM_CMD); break; } - if (ret == DS_ERR_CODE_OK) + if (ret == FRM_ERR_CODE_OK) { - return DS_CMD_OK; + return FRM_CMD_OK; } else { // TODO: エラー処理? - return DS_CMD_DRIVER_SUPER_ERR; + return FRM_CMD_DRIVER_SUPER_ERR; } } diff --git a/examples/mobc/src/src_user/Drivers/Aocs/aobc.h b/examples/mobc/src/src_user/Drivers/Aocs/aobc.h index 0baaf3828..e1be5da5c 100644 --- a/examples/mobc/src/src_user/Drivers/Aocs/aobc.h +++ b/examples/mobc/src/src_user/Drivers/Aocs/aobc.h @@ -6,7 +6,7 @@ #define AOBC_H_ #include -#include +#include #include #include #include "./aobc_telemetry_data_definitions.h" @@ -64,7 +64,7 @@ struct AOBC_Driver { struct { - DriverSuper super; //!< DriverSuper class + Framing super; //!< Framing class UART_Config uart_config; //!< RS422 class } driver; AOBC_Info info; @@ -80,24 +80,24 @@ struct AOBC_Driver * @param aobc_driver: 初期化する AOBC_Driver 構造体へのポインタ * @param ch: AOBC が接続されている UART ポート番号 * @param rx_buffer: 受信バッファ - * @return DS_INIT_ERR_CODE + * @return FRM_INIT_ERR_CODE */ -DS_INIT_ERR_CODE AOBC_init(AOBC_Driver* aobc_driver, uint8_t ch, DS_StreamRecBuffer* rx_buffer); +FRM_INIT_ERR_CODE AOBC_init(AOBC_Driver* aobc_driver, uint8_t ch, FRM_StreamRecBuffer* rx_buffer); /** * @brief AOBC のデータ(テレメ)受信 * @param aobc_driver: AOBC_Driver 構造体へのポインタ - * @return DS_REC_ERR_CODE + * @return FRM_REC_ERR_CODE */ -DS_REC_ERR_CODE AOBC_rec(AOBC_Driver* aobc_driver); +FRM_REC_ERR_CODE AOBC_rec(AOBC_Driver* aobc_driver); /** * @brief AOBC へのコマンド送信 * @param aobc_driver: AOBC_Driver 構造体へのポインタ * @param packet: 送信する packet - * @return DS_CMD_ERR_CODE + * @return FRM_CMD_ERR_CODE * @note これを受信した AOBC C2A は, packet をそのまま PH_analyze_cmd_packet に流せばよい. */ -DS_CMD_ERR_CODE AOBC_send_cmd(AOBC_Driver* aobc_driver, const CommonCmdPacket* packet); +FRM_CMD_ERR_CODE AOBC_send_cmd(AOBC_Driver* aobc_driver, const CommonCmdPacket* packet); #endif diff --git a/examples/mobc/src/src_user/Drivers/Aocs/aobc_telemetry_buffer.c b/examples/mobc/src/src_user/Drivers/Aocs/aobc_telemetry_buffer.c index 497672443..55b1c0166 100644 --- a/examples/mobc/src/src_user/Drivers/Aocs/aobc_telemetry_buffer.c +++ b/examples/mobc/src/src_user/Drivers/Aocs/aobc_telemetry_buffer.c @@ -4,14 +4,14 @@ * @brief テレメトリバッファー(テレメ中継) * @note このコードは自動生成されています! */ -#include +#include #include "./aobc_telemetry_definitions.h" #include "./aobc_telemetry_buffer.h" #include "./aobc.h" #include -static DS_ERR_CODE AOBC_analyze_tlm_aobc_aobc_(const CommonTlmPacket* packet, AOBC_TLM_CODE tlm_id, AOBC_Driver* aobc_driver); -static DS_ERR_CODE AOBC_analyze_tlm_aobc_hk_(const CommonTlmPacket* packet, AOBC_TLM_CODE tlm_id, AOBC_Driver* aobc_driver); +static FRM_ERR_CODE AOBC_analyze_tlm_aobc_aobc_(const CommonTlmPacket* packet, AOBC_TLM_CODE tlm_id, AOBC_Driver* aobc_driver); +static FRM_ERR_CODE AOBC_analyze_tlm_aobc_hk_(const CommonTlmPacket* packet, AOBC_TLM_CODE tlm_id, AOBC_Driver* aobc_driver); static CommonTlmPacket AOBC_ctp_; @@ -25,13 +25,13 @@ void AOBC_init_tlm_buffer(AOBC_Driver* aobc_driver) } } -DS_ERR_CODE AOBC_buffer_tlm_packet(DS_StreamConfig* p_stream_config, AOBC_Driver* aobc_driver) +FRM_ERR_CODE AOBC_buffer_tlm_packet(FRM_StreamConfig* p_stream_config, AOBC_Driver* aobc_driver) { AOBC_TLM_CODE tlm_id; - DS_ERR_CODE ret; + FRM_ERR_CODE ret; ret = CTP_get_ctp_from_dssc(p_stream_config, &AOBC_ctp_); - if (ret != DS_ERR_CODE_OK) return ret; + if (ret != FRM_ERR_CODE_OK) return ret; tlm_id = (AOBC_TLM_CODE)CTP_get_id(&AOBC_ctp_); @@ -43,11 +43,11 @@ DS_ERR_CODE AOBC_buffer_tlm_packet(DS_StreamConfig* p_stream_config, AOBC_Driver return AOBC_analyze_tlm_aobc_hk_(&AOBC_ctp_, tlm_id, aobc_driver); default: aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_TLM_NOT_FOUND; - return DS_ERR_CODE_ERR; + return FRM_ERR_CODE_ERR; } } -static DS_ERR_CODE AOBC_analyze_tlm_aobc_aobc_(const CommonTlmPacket* packet, AOBC_TLM_CODE tlm_id, AOBC_Driver* aobc_driver) +static FRM_ERR_CODE AOBC_analyze_tlm_aobc_aobc_(const CommonTlmPacket* packet, AOBC_TLM_CODE tlm_id, AOBC_Driver* aobc_driver) { const uint8_t* f = packet->packet; int8_t temp_i8 = 0; @@ -192,10 +192,10 @@ static DS_ERR_CODE AOBC_analyze_tlm_aobc_aobc_(const CommonTlmPacket* packet, AO (void)temp_f; (void)temp_d; - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } -static DS_ERR_CODE AOBC_analyze_tlm_aobc_hk_(const CommonTlmPacket* packet, AOBC_TLM_CODE tlm_id, AOBC_Driver* aobc_driver) +static FRM_ERR_CODE AOBC_analyze_tlm_aobc_hk_(const CommonTlmPacket* packet, AOBC_TLM_CODE tlm_id, AOBC_Driver* aobc_driver) { const uint8_t* f = packet->packet; int8_t temp_i8 = 0; @@ -421,7 +421,7 @@ static DS_ERR_CODE AOBC_analyze_tlm_aobc_hk_(const CommonTlmPacket* packet, AOBC (void)temp_f; (void)temp_d; - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } TF_TLM_FUNC_ACK AOBC_pick_up_tlm_buffer(const AOBC_Driver* aobc_driver, AOBC_TLM_CODE tlm_id, uint8_t* packet, uint16_t* len, uint16_t max_len) diff --git a/examples/mobc/src/src_user/Drivers/Aocs/aobc_telemetry_buffer.h b/examples/mobc/src/src_user/Drivers/Aocs/aobc_telemetry_buffer.h index e27f83a86..db7d2c59d 100644 --- a/examples/mobc/src/src_user/Drivers/Aocs/aobc_telemetry_buffer.h +++ b/examples/mobc/src/src_user/Drivers/Aocs/aobc_telemetry_buffer.h @@ -7,7 +7,7 @@ #define AOBC_TELEMETRY_BUFFER_H_ #include "./aobc_telemetry_definitions.h" -#include +#include #include #include @@ -28,7 +28,7 @@ typedef struct void AOBC_init_tlm_buffer(AOBC_Driver* aobc_driver); -DS_ERR_CODE AOBC_buffer_tlm_packet(DS_StreamConfig* p_stream_config, AOBC_Driver* aobc_driver); +FRM_ERR_CODE AOBC_buffer_tlm_packet(FRM_StreamConfig* p_stream_config, AOBC_Driver* aobc_driver); TF_TLM_FUNC_ACK AOBC_pick_up_tlm_buffer(const AOBC_Driver* aobc_driver, AOBC_TLM_CODE tlm_id, uint8_t* packet, uint16_t* len, uint16_t max_len); diff --git a/examples/mobc/src/src_user/Drivers/Com/gs.c b/examples/mobc/src/src_user/Drivers/Com/gs.c index 7fd7e0ac8..2ce9eecef 100644 --- a/examples/mobc/src/src_user/Drivers/Com/gs.c +++ b/examples/mobc/src/src_user/Drivers/Com/gs.c @@ -11,7 +11,7 @@ #include "../../hal/ccsds_user.h" #include "../../tlm_cmd/ccsds/tc_transfer_frame.h" -#include +#include #include #include @@ -20,7 +20,7 @@ #define GS_RX_FRAMELENGTH_TYPE_SIZE (2) #define GS_TX_STREAM (0) // どれでも良いがとりあえず 0 で -#if GS_RX_HEADER_NUM > DS_STREAM_MAX +#if GS_RX_HEADER_NUM > FRM_STREAM_MAX #error GS RX HEADER NUM TOO MANY #endif @@ -30,38 +30,38 @@ static uint8_t GS_tx_frame_[VCDU_LEN]; /** * @brief CCSDS 側 Driver の DS 上での初期化設定 - * @param[in] p_super: DriverSuper - * @return DS_ERR_CODE + * @param[in] p_framing: Framing + * @return FRM_ERR_CODE */ -static DS_ERR_CODE GS_load_ccsds_driver_super_init_settings_(DriverSuper* p_super); +static FRM_ERR_CODE GS_load_ccsds_driver_super_init_settings_(Framing* p_framing); /** * @brief UART 側 Driver の DS 上での初期化設定 - * @param[in] p_super: DriverSuper - * @return DS_ERR_CODE + * @param[in] p_framing: Framing + * @return FRM_ERR_CODE */ -static DS_ERR_CODE GS_load_uart_driver_super_init_settings_(DriverSuper* p_super); +static FRM_ERR_CODE GS_load_uart_driver_super_init_settings_(Framing* p_framing); /** * @brief 上記初期化の共通部分をまとめた関数 - * @param[in] p_super: DriverSuper + * @param[in] p_framing: Framing */ -static void GS_load_default_driver_super_init_settings_(DriverSuper* p_super); +static void GS_load_default_driver_super_init_settings_(Framing* p_framing); /** * @brief 地上からの受信データ解析関数 - * @param[in] p_stream_config: DS_StreamConfig + * @param[in] p_stream_config: FRM_StreamConfig * @param[in] p_driver: GS_Driver * @param[in] */ -static DS_ERR_CODE GS_analyze_rec_data_(DS_StreamConfig* p_stream_config, void* p_driver); +static FRM_ERR_CODE GS_analyze_rec_data_(FRM_StreamConfig* p_stream_config, void* p_driver); -DS_INIT_ERR_CODE GS_init(GS_Driver* gs_driver, +FRM_INIT_ERR_CODE GS_init(GS_Driver* gs_driver, uint8_t uart_ch, - DS_StreamRecBuffer* ccsds_rx_buffers[DS_STREAM_MAX], - DS_StreamRecBuffer* uart_rx_buffers[DS_STREAM_MAX]) + FRM_StreamRecBuffer* ccsds_rx_buffers[FRM_STREAM_MAX], + FRM_StreamRecBuffer* uart_rx_buffers[FRM_STREAM_MAX]) { - DS_ERR_CODE ret_uart, ret_ccsds; + FRM_ERR_CODE ret_uart, ret_ccsds; int i; int stream; @@ -88,21 +88,21 @@ DS_INIT_ERR_CODE GS_init(GS_Driver* gs_driver, GS_rx_header_[stream][1] |= (uint8_t)(TCTF_SCID_SAMPLE_SATELLITE & 0xff); } - ret_ccsds = DS_init_streams(&gs_driver->driver_ccsds.super, + ret_ccsds = FRM_init_streams(&gs_driver->driver_ccsds.super, &gs_driver->driver_ccsds.ccsds_config, ccsds_rx_buffers, GS_load_ccsds_driver_super_init_settings_); - ret_uart = DS_init_streams(&gs_driver->driver_uart.super, + ret_uart = FRM_init_streams(&gs_driver->driver_uart.super, &gs_driver->driver_uart.uart_config, uart_rx_buffers, GS_load_uart_driver_super_init_settings_); - if (ret_ccsds != DS_ERR_CODE_OK || ret_uart != DS_ERR_CODE_OK) return DS_INIT_DS_INIT_ERR; + if (ret_ccsds != FRM_ERR_CODE_OK || ret_uart != FRM_ERR_CODE_OK) return FRM_INIT_FRM_INIT_ERR; gs_driver->latest_info = &gs_driver->info[GS_PORT_TYPE_CCSDS]; gs_driver->tlm_tx_port_type = GS_PORT_TYPE_CCSDS; for (i = 0; i < GS_PORT_TYPE_NUM; ++i) { - gs_driver->info[i].rx.rec_status = DS_ERR_CODE_OK; + gs_driver->info[i].rx.rec_status = FRM_ERR_CODE_OK; gs_driver->info[i].rx.ret_from_if_rx = 0; gs_driver->info[i].rx.last_dest_type = CCP_DEST_TYPE_TO_UNKOWN; gs_driver->info[i].rx.last_rec_time = 0; @@ -121,55 +121,55 @@ DS_INIT_ERR_CODE GS_init(GS_Driver* gs_driver, gs_driver->ccsds_info.buffer_num = 8; gs_driver->driver_uart.is_tlm_on = 1; - return DS_INIT_OK; + return FRM_INIT_OK; } -static DS_ERR_CODE GS_load_ccsds_driver_super_init_settings_(DriverSuper* p_super) +static FRM_ERR_CODE GS_load_ccsds_driver_super_init_settings_(Framing* p_framing) { - p_super->interface = CCSDS; - GS_load_default_driver_super_init_settings_(p_super); + p_framing->interface = CCSDS; + GS_load_default_driver_super_init_settings_(p_framing); - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } -static DS_ERR_CODE GS_load_uart_driver_super_init_settings_(DriverSuper* p_super) +static FRM_ERR_CODE GS_load_uart_driver_super_init_settings_(Framing* p_framing) { - p_super->interface = UART; - GS_load_default_driver_super_init_settings_(p_super); + p_framing->interface = UART; + GS_load_default_driver_super_init_settings_(p_framing); - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } -static void GS_load_default_driver_super_init_settings_(DriverSuper* p_super) +static void GS_load_default_driver_super_init_settings_(Framing* p_framing) { - DS_StreamConfig* p_stream_config; + FRM_StreamConfig* p_stream_config; int stream; for (stream = 0; stream < GS_RX_HEADER_NUM; ++stream) { - p_stream_config = &(p_super->stream_config[stream]); - DSSC_enable(p_stream_config); - DSSC_enable_strict_frame_search(p_stream_config); // 複数ストリームがあり,かつ論理的な受信漏れを0にするため. - - DSSC_set_tx_frame(p_stream_config, GS_tx_frame_); // 全 stream, uart, ccsds に関わらず共通 - DSSC_set_tx_frame_size(p_stream_config, VCDU_LEN); // VCDU を送信 - - DSSC_set_rx_header(p_stream_config, GS_rx_header_[stream], GS_RX_HEADER_SIZE); - DSSC_set_rx_frame_size(p_stream_config, -1); // 可変長 - DSSC_set_rx_framelength_pos(p_stream_config, GS_RX_HEADER_SIZE); - DSSC_set_rx_framelength_type_size(p_stream_config, GS_RX_FRAMELENGTH_TYPE_SIZE); - DSSC_set_rx_framelength_offset(p_stream_config, 1); // TCTF の framelength は 0 起算 - DSSC_set_data_analyzer(p_stream_config, GS_analyze_rec_data_); + p_stream_config = &(p_framing->stream_config[stream]); + FRMSC_enable(p_stream_config); + FRMSC_enable_strict_frame_search(p_stream_config); // 複数ストリームがあり,かつ論理的な受信漏れを0にするため. + + FRMSC_set_tx_frame(p_stream_config, GS_tx_frame_); // 全 stream, uart, ccsds に関わらず共通 + FRMSC_set_tx_frame_size(p_stream_config, VCDU_LEN); // VCDU を送信 + + FRMSC_set_rx_header(p_stream_config, GS_rx_header_[stream], GS_RX_HEADER_SIZE); + FRMSC_set_rx_frame_size(p_stream_config, -1); // 可変長 + FRMSC_set_rx_framelength_pos(p_stream_config, GS_RX_HEADER_SIZE); + FRMSC_set_rx_framelength_type_size(p_stream_config, GS_RX_FRAMELENGTH_TYPE_SIZE); + FRMSC_set_rx_framelength_offset(p_stream_config, 1); // TCTF の framelength は 0 起算 + FRMSC_set_data_analyzer(p_stream_config, GS_analyze_rec_data_); } } -DS_REC_ERR_CODE GS_rec_tctf(GS_Driver* gs_driver) +FRM_REC_ERR_CODE GS_rec_tctf(GS_Driver* gs_driver) { uint8_t i, stream; for (i = 0; i < GS_PORT_TYPE_NUM; ++i) { - DriverSuper* ds; + Framing* ds; if (i == GS_PORT_TYPE_CCSDS) { @@ -181,29 +181,29 @@ DS_REC_ERR_CODE GS_rec_tctf(GS_Driver* gs_driver) } // TODO: これはエラー情報をきちんと把握したいので,アノマリ発行を入れる - gs_driver->info[i].rx.rec_status = DS_receive(ds); + gs_driver->info[i].rx.rec_status = FRM_receive(ds); gs_driver->info[i].rx.ret_from_if_rx = DSC_get_rec_status(ds)->ret_from_if_rx; - if (gs_driver->info[i].rx.rec_status != DS_ERR_CODE_OK) continue; + if (gs_driver->info[i].rx.rec_status != FRM_ERR_CODE_OK) continue; for (stream = 0; stream < GS_RX_HEADER_NUM; ++stream) { - DS_StreamConfig* p_stream_config; + FRM_StreamConfig* p_stream_config; p_stream_config = &ds->stream_config[stream]; - if (DSSC_get_rec_status(p_stream_config)->status_code != DS_STREAM_REC_STATUS_FIXED_FRAME) continue; + if (FRMSC_get_rec_status(p_stream_config)->status_code != FRM_STREAM_REC_STATUS_FIXED_FRAME) continue; - gs_driver->info[i].rx.rec_status = DS_analyze_rec_data(ds, stream, gs_driver); + gs_driver->info[i].rx.rec_status = FRM_analyze_rec_data(ds, stream, gs_driver); } } // TODO: 常に OK を返すのでいいのか検討 - return DS_REC_OK; + return FRM_REC_OK; } -static DS_ERR_CODE GS_analyze_rec_data_(DS_StreamConfig* p_stream_config, void* p_driver) +static FRM_ERR_CODE GS_analyze_rec_data_(FRM_StreamConfig* p_stream_config, void* p_driver) { - const uint8_t* gs_rx_data = DSSC_get_rx_frame(p_stream_config); + const uint8_t* gs_rx_data = FRMSC_get_rx_frame(p_stream_config); const TcTransferFrame* tctf = TCTF_convert_from_bytes_to_tctf(gs_rx_data); GS_Driver* gs_driver = (GS_Driver*)p_driver; GS_PORT_TYPE driver_index; @@ -243,7 +243,7 @@ static DS_ERR_CODE GS_analyze_rec_data_(DS_StreamConfig* p_stream_config, void* break; } - if (tctf_validate_status != GS_VALIDATE_ERR_OK) return DS_ERR_CODE_ERR; + if (tctf_validate_status != GS_VALIDATE_ERR_OK) return FRM_ERR_CODE_ERR; tcs = TCTF_get_tc_segment(tctf); csp = TCS_get_command_space_packet(tcs); @@ -251,26 +251,26 @@ static DS_ERR_CODE GS_analyze_rec_data_(DS_StreamConfig* p_stream_config, void* gs_driver->info[driver_index].rx.last_rec_time = TMGR_get_master_total_cycle(); gs_driver->info[driver_index].rx.cmd_ack = PH_analyze_cmd_packet(csp); // 受信コマンドパケット解析 - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } -DS_CMD_ERR_CODE GS_send_vcdu(GS_Driver* gs_driver, const VCDU* vcdu) +FRM_CMD_ERR_CODE GS_send_vcdu(GS_Driver* gs_driver, const VCDU* vcdu) { - DS_ERR_CODE ret_ccsds = DS_ERR_CODE_OK; - DS_ERR_CODE ret_uart = DS_ERR_CODE_OK; + FRM_ERR_CODE ret_ccsds = FRM_ERR_CODE_OK; + FRM_ERR_CODE ret_uart = FRM_ERR_CODE_OK; size_t vcdu_size = sizeof(VCDU); // パディングが無ければ元を GS_tx_frame_ にコピーさせる (444Byte) のコピーが無駄 if (vcdu_size == VCDU_LEN) { - DSSC_set_tx_frame(&gs_driver->driver_ccsds.super.stream_config[GS_TX_STREAM], (uint8_t*)vcdu); - DSSC_set_tx_frame(&gs_driver->driver_uart.super.stream_config[GS_TX_STREAM], (uint8_t*)vcdu); + FRMSC_set_tx_frame(&gs_driver->driver_ccsds.super.stream_config[GS_TX_STREAM], (uint8_t*)vcdu); + FRMSC_set_tx_frame(&gs_driver->driver_uart.super.stream_config[GS_TX_STREAM], (uint8_t*)vcdu); } else { VCDU_generate_byte_stream(vcdu, GS_tx_frame_); // 送信元にセット 消したいなぁ... - DSSC_set_tx_frame(&gs_driver->driver_ccsds.super.stream_config[GS_TX_STREAM], GS_tx_frame_); - DSSC_set_tx_frame(&gs_driver->driver_uart.super.stream_config[GS_TX_STREAM], GS_tx_frame_); + FRMSC_set_tx_frame(&gs_driver->driver_ccsds.super.stream_config[GS_TX_STREAM], GS_tx_frame_); + FRMSC_set_tx_frame(&gs_driver->driver_uart.super.stream_config[GS_TX_STREAM], GS_tx_frame_); } // CCSDS @@ -282,7 +282,7 @@ DS_CMD_ERR_CODE GS_send_vcdu(GS_Driver* gs_driver, const VCDU* vcdu) gs_driver->info[GS_PORT_TYPE_CCSDS].tx.vcdu_counter = VCDU_get_vcdu_counter(vcdu); // DS 側の名称が cmd なだけで送信しているのは TLM - ret_ccsds = DS_send_general_cmd(&gs_driver->driver_ccsds.super, GS_TX_STREAM); + ret_ccsds = FRM_send_general_cmd(&gs_driver->driver_ccsds.super, GS_TX_STREAM); } // UART @@ -293,15 +293,15 @@ DS_CMD_ERR_CODE GS_send_vcdu(GS_Driver* gs_driver, const VCDU* vcdu) gs_driver->info[GS_PORT_TYPE_UART].tx.vcdu_counter = VCDU_get_vcdu_counter(vcdu); // DS 側の名称が cmd なだけで送信しているのは TLM - ret_uart = DS_send_general_cmd(&gs_driver->driver_uart.super, GS_TX_STREAM); + ret_uart = FRM_send_general_cmd(&gs_driver->driver_uart.super, GS_TX_STREAM); } - if (ret_ccsds != DS_ERR_CODE_OK || ret_uart != DS_ERR_CODE_OK) + if (ret_ccsds != FRM_ERR_CODE_OK || ret_uart != FRM_ERR_CODE_OK) { - return DS_CMD_DRIVER_SUPER_ERR; + return FRM_CMD_DRIVER_SUPER_ERR; } - return DS_CMD_OK; + return FRM_CMD_OK; } #pragma section diff --git a/examples/mobc/src/src_user/Drivers/Com/gs.h b/examples/mobc/src/src_user/Drivers/Com/gs.h index 969256fc0..146da215b 100644 --- a/examples/mobc/src/src_user/Drivers/Com/gs.h +++ b/examples/mobc/src/src_user/Drivers/Com/gs.h @@ -6,7 +6,7 @@ #define GS_H_ #include -#include +#include #include #include #include "../../hal/ccsds_user.h" @@ -35,7 +35,7 @@ typedef struct { struct { - DS_ERR_CODE rec_status; //!< DriverSuper からの受信結果 + FRM_ERR_CODE rec_status; //!< Framing からの受信結果 int ret_from_if_rx; //!< UART or CCSDS からの返り値 CCP_DEST_TYPE last_dest_type; //!< 最後に受信したパケットの dest type cycle_t last_rec_time; //!< 最後に受信した時刻 @@ -67,14 +67,14 @@ typedef struct // CCSDS 側の Driver struct { - DriverSuper super; + Framing super; CCSDS_Config ccsds_config; } driver_ccsds; // UART 側の Driver struct { - DriverSuper super; + Framing super; UART_Config uart_config; uint8_t is_tlm_on; //!< UART に TLM を流すかどうか, CCSDS では許容でも UART に TLM を送りすぎると詰まってしまうため } driver_uart; @@ -91,28 +91,28 @@ typedef struct * @param[in] uart_ch: 有線通信時の CH * @param[in] ccsds_rx_buffers: CCSDS 用受信バッファ * @param[in] uart_rx_buffers: UART 用受信バッファ - * @return DS_INIT_ERR_CODE + * @return FRM_INIT_ERR_CODE */ -DS_INIT_ERR_CODE GS_init(GS_Driver* gs_driver, +FRM_INIT_ERR_CODE GS_init(GS_Driver* gs_driver, uint8_t uart_ch, - DS_StreamRecBuffer* ccsds_rx_buffers[DS_STREAM_MAX], - DS_StreamRecBuffer* uart_rx_buffers[DS_STREAM_MAX]); + FRM_StreamRecBuffer* ccsds_rx_buffers[FRM_STREAM_MAX], + FRM_StreamRecBuffer* uart_rx_buffers[FRM_STREAM_MAX]); /** * @brief 地上から CMD を受信する. 形式は TC Transer Frame * @param[in] gs_driver: ドライバー - * @return DS_REC_ERR_CODE + * @return FRM_REC_ERR_CODE */ -DS_REC_ERR_CODE GS_rec_tctf(GS_Driver* gs_driver); +FRM_REC_ERR_CODE GS_rec_tctf(GS_Driver* gs_driver); /** * @brief 地上に向けて TLM を送信. 形式は VCDU - * @note DS_send_general_cmd が使われているが, これは DS は MOBC コンポ間を想定しているため, MOBC から見るとコンポに cmd を送信している様に見える, が 今回は MOBC から地上に TLM を送信している + * @note FRM_send_general_cmd が使われているが, これは DS は MOBC コンポ間を想定しているため, MOBC から見るとコンポに cmd を送信している様に見える, が 今回は MOBC から地上に TLM を送信している * @note TLM 送信, 形式は VCDU * @param[in] gs_driver: ドライバー * @param[in] vcdu: 送信する VCDU. 場合によってはそのまま DS に渡すので, local変数ではなくstaticな変数を渡すこと - * @return DS_CMD_ERR_CODE: 送信結果 + * @return FRM_CMD_ERR_CODE: 送信結果 */ -DS_CMD_ERR_CODE GS_send_vcdu(GS_Driver* gs_driver, const VCDU* vcdu); +FRM_CMD_ERR_CODE GS_send_vcdu(GS_Driver* gs_driver, const VCDU* vcdu); #endif diff --git a/examples/mobc/src/src_user/Drivers/Etc/uart_test.c b/examples/mobc/src/src_user/Drivers/Etc/uart_test.c index 1cbfe124f..6826ed962 100644 --- a/examples/mobc/src/src_user/Drivers/Etc/uart_test.c +++ b/examples/mobc/src/src_user/Drivers/Etc/uart_test.c @@ -24,13 +24,13 @@ static const uint8_t UART_TEST_footer_[UART_TEST_FOOTER_SIZE] = {0xBF, 0xBE}; static uint8_t UART_TEST_tx_frame_[UART_TEST_TX_FRAME_SIZE_MAX]; -static DS_ERR_CODE UART_TEST_load_driver_super_init_settings_(DriverSuper* p_super); -static DS_ERR_CODE UART_TEST_analyze_rec_data_(DS_StreamConfig* p_stream_config, void* p_driver); +static FRM_ERR_CODE UART_TEST_load_driver_super_init_settings_(Framing* p_framing); +static FRM_ERR_CODE UART_TEST_analyze_rec_data_(FRM_StreamConfig* p_stream_config, void* p_driver); -DS_INIT_ERR_CODE UART_TEST_init(UART_TEST_Driver* uart_test_driver, uint8_t ch, DS_StreamRecBuffer* rx_buffers[DS_STREAM_MAX]) +FRM_INIT_ERR_CODE UART_TEST_init(UART_TEST_Driver* uart_test_driver, uint8_t ch, FRM_StreamRecBuffer* rx_buffers[FRM_STREAM_MAX]) { - DS_ERR_CODE ret; + FRM_ERR_CODE ret; uart_test_driver->driver.uart_config.ch = ch; uart_test_driver->driver.uart_config.baudrate = 38400; @@ -38,87 +38,87 @@ DS_INIT_ERR_CODE UART_TEST_init(UART_TEST_Driver* uart_test_driver, uint8_t ch, 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 = DS_init_streams(&(uart_test_driver->driver.super), + ret = FRM_init_streams(&(uart_test_driver->driver.super), &(uart_test_driver->driver.uart_config), rx_buffers, UART_TEST_load_driver_super_init_settings_); - if (ret != DS_ERR_CODE_OK) return DS_INIT_DS_INIT_ERR; - return DS_INIT_OK; + if (ret != FRM_ERR_CODE_OK) return FRM_INIT_FRM_INIT_ERR; + return FRM_INIT_OK; } -static DS_ERR_CODE UART_TEST_load_driver_super_init_settings_(DriverSuper* p_super) +static FRM_ERR_CODE UART_TEST_load_driver_super_init_settings_(Framing* p_framing) { - DS_StreamConfig* p_stream_config; + FRM_StreamConfig* p_stream_config; - p_super->interface = UART; + p_framing->interface = UART; // stream0の設定 - p_stream_config = &(p_super->stream_config[UART_TEST_STREAM_FIX]); - DSSC_enable(p_stream_config); - DSSC_enable_strict_frame_search(p_stream_config); + p_stream_config = &(p_framing->stream_config[UART_TEST_STREAM_FIX]); + FRMSC_enable(p_stream_config); + FRMSC_enable_strict_frame_search(p_stream_config); // 送信はする - DSSC_set_tx_frame(p_stream_config, UART_TEST_tx_frame_); // 送る直前に中身をmemcpyする - DSSC_set_tx_frame_size(p_stream_config, 0); // 送る直前に値をセットする + FRMSC_set_tx_frame(p_stream_config, UART_TEST_tx_frame_); // 送る直前に中身をmemcpyする + FRMSC_set_tx_frame_size(p_stream_config, 0); // 送る直前に値をセットする // 定期的な受信はする - DSSC_set_rx_header(p_stream_config, UART_TEST_header_, UART_TEST_HEADER_SIZE); - DSSC_set_rx_footer(p_stream_config, UART_TEST_footer_, UART_TEST_FOOTER_SIZE); - DSSC_set_rx_frame_size(p_stream_config, 12); - DSSC_set_data_analyzer(p_stream_config, UART_TEST_analyze_rec_data_); + FRMSC_set_rx_header(p_stream_config, UART_TEST_header_, UART_TEST_HEADER_SIZE); + FRMSC_set_rx_footer(p_stream_config, UART_TEST_footer_, UART_TEST_FOOTER_SIZE); + FRMSC_set_rx_frame_size(p_stream_config, 12); + FRMSC_set_data_analyzer(p_stream_config, UART_TEST_analyze_rec_data_); // stream1の設定 - p_stream_config = &(p_super->stream_config[UART_TEST_STREAM_VAR]); - DSSC_enable(p_stream_config); - DSSC_enable_strict_frame_search(p_stream_config); + p_stream_config = &(p_framing->stream_config[UART_TEST_STREAM_VAR]); + FRMSC_enable(p_stream_config); + FRMSC_enable_strict_frame_search(p_stream_config); // 送信はしない // 定期的な受信はする - DSSC_set_rx_header(p_stream_config, UART_TEST_header_, UART_TEST_HEADER_SIZE); - DSSC_set_rx_footer(p_stream_config, UART_TEST_footer_, UART_TEST_FOOTER_SIZE); - DSSC_set_rx_frame_size(p_stream_config, -1); // 可変 - DSSC_set_rx_framelength_pos(p_stream_config, UART_TEST_HEADER_SIZE); - DSSC_set_rx_framelength_type_size(p_stream_config, 2); - DSSC_set_rx_framelength_offset(p_stream_config, UART_TEST_HEADER_SIZE + UART_TEST_FOOTER_SIZE); - DSSC_set_data_analyzer(p_stream_config, UART_TEST_analyze_rec_data_); + FRMSC_set_rx_header(p_stream_config, UART_TEST_header_, UART_TEST_HEADER_SIZE); + FRMSC_set_rx_footer(p_stream_config, UART_TEST_footer_, UART_TEST_FOOTER_SIZE); + FRMSC_set_rx_frame_size(p_stream_config, -1); // 可変 + FRMSC_set_rx_framelength_pos(p_stream_config, UART_TEST_HEADER_SIZE); + FRMSC_set_rx_framelength_type_size(p_stream_config, 2); + FRMSC_set_rx_framelength_offset(p_stream_config, UART_TEST_HEADER_SIZE + UART_TEST_FOOTER_SIZE); + FRMSC_set_data_analyzer(p_stream_config, UART_TEST_analyze_rec_data_); // 定期TLMの監視機能の有効化しない → ので設定上書きなし - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } -DS_REC_ERR_CODE UART_TEST_rec(UART_TEST_Driver* uart_test_driver) +FRM_REC_ERR_CODE UART_TEST_rec(UART_TEST_Driver* uart_test_driver) { - DS_ERR_CODE ret; - DS_StreamConfig* p_stream_config; + FRM_ERR_CODE ret; + FRM_StreamConfig* p_stream_config; - ret = DS_receive(&(uart_test_driver->driver.super)); + ret = FRM_receive(&(uart_test_driver->driver.super)); - if (ret != DS_ERR_CODE_OK) return DS_REC_DS_RECEIVE_ERR; + if (ret != FRM_ERR_CODE_OK) return FRM_REC_FRM_RECEIVE_ERR; p_stream_config = &(uart_test_driver->driver.super.stream_config[UART_TEST_STREAM_FIX]); - if (DSSC_get_rec_status(p_stream_config)->status_code == DS_STREAM_REC_STATUS_FIXED_FRAME) + if (FRMSC_get_rec_status(p_stream_config)->status_code == FRM_STREAM_REC_STATUS_FIXED_FRAME) { - ret = DS_analyze_rec_data(&(uart_test_driver->driver.super), UART_TEST_STREAM_FIX, uart_test_driver); + ret = FRM_analyze_rec_data(&(uart_test_driver->driver.super), UART_TEST_STREAM_FIX, uart_test_driver); } p_stream_config = &(uart_test_driver->driver.super.stream_config[UART_TEST_STREAM_VAR]); - if (DSSC_get_rec_status(p_stream_config)->status_code == DS_STREAM_REC_STATUS_FIXED_FRAME) + if (FRMSC_get_rec_status(p_stream_config)->status_code == FRM_STREAM_REC_STATUS_FIXED_FRAME) { - ret = DS_analyze_rec_data(&(uart_test_driver->driver.super), UART_TEST_STREAM_VAR, uart_test_driver); + ret = FRM_analyze_rec_data(&(uart_test_driver->driver.super), UART_TEST_STREAM_VAR, uart_test_driver); } // 返り値ぐだぐだだけど,まあテストコードなので... - if (ret != DS_ERR_CODE_OK) return DS_REC_ANALYZE_ERR; + if (ret != FRM_ERR_CODE_OK) return FRM_REC_ANALYZE_ERR; - return DS_REC_OK; + return FRM_REC_OK; } -static DS_ERR_CODE UART_TEST_analyze_rec_data_(DS_StreamConfig* p_stream_config, void* p_driver) +static FRM_ERR_CODE UART_TEST_analyze_rec_data_(FRM_StreamConfig* p_stream_config, void* p_driver) { UART_TEST_Driver* uart_test_driver = (UART_TEST_Driver*)p_driver; uint16_t i; @@ -126,28 +126,28 @@ static DS_ERR_CODE UART_TEST_analyze_rec_data_(DS_StreamConfig* p_stream_config, (void)(uart_test_driver); #ifndef SILS_FW - Printf("DEC DATA: %d\n", DSSC_get_rec_status(p_stream_config)->fixed_frame_len); - for (i = 0; i < DSSC_get_rec_status(p_stream_config)->fixed_frame_len; i++) + Printf("DEC DATA: %d\n", FRMSC_get_rec_status(p_stream_config)->fixed_frame_len); + for (i = 0; i < FRMSC_get_rec_status(p_stream_config)->fixed_frame_len; i++) { - Printf("%02x ", DSSC_get_rx_frame(p_stream_config)[i]); + Printf("%02x ", FRMSC_get_rx_frame(p_stream_config)[i]); } Printf(" \n"); #else - printf("DEC DATA: %d\n", DSSC_get_rec_status(p_stream_config)->fixed_frame_len); - for (i = 0; i < DSSC_get_rec_status(p_stream_config)->fixed_frame_len; i++) + printf("DEC DATA: %d\n", FRMSC_get_rec_status(p_stream_config)->fixed_frame_len); + for (i = 0; i < FRMSC_get_rec_status(p_stream_config)->fixed_frame_len; i++) { - printf("%02x ", DSSC_get_rx_frame(p_stream_config)[i]); + printf("%02x ", FRMSC_get_rx_frame(p_stream_config)[i]); } printf(" \n"); #endif - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } -DS_CMD_ERR_CODE UART_TEST_send(UART_TEST_Driver* uart_test_driver, uint8_t id) +FRM_CMD_ERR_CODE UART_TEST_send(UART_TEST_Driver* uart_test_driver, uint8_t id) { - DS_ERR_CODE ret; - DS_StreamConfig* p_stream_config; + FRM_ERR_CODE ret; + FRM_StreamConfig* p_stream_config; p_stream_config = &(uart_test_driver->driver.super.stream_config[UART_TEST_STREAM_FIX]); @@ -161,7 +161,7 @@ DS_CMD_ERR_CODE UART_TEST_send(UART_TEST_Driver* uart_test_driver, uint8_t id) UART_TEST_tx_frame_[4] = 'b'; UART_TEST_tx_frame_[5] = 0x0d; UART_TEST_tx_frame_[6] = 0x0a; - DSSC_set_tx_frame_size(p_stream_config, 7); + FRMSC_set_tx_frame_size(p_stream_config, 7); break; case 1: UART_TEST_tx_frame_[0] = 'i'; @@ -171,7 +171,7 @@ DS_CMD_ERR_CODE UART_TEST_send(UART_TEST_Driver* uart_test_driver, uint8_t id) UART_TEST_tx_frame_[4] = 'B'; UART_TEST_tx_frame_[5] = 0x0d; UART_TEST_tx_frame_[6] = 0x0a; - DSSC_set_tx_frame_size(p_stream_config, 7); + FRMSC_set_tx_frame_size(p_stream_config, 7); break; case 2: UART_TEST_tx_frame_[0] = 'i'; @@ -179,7 +179,7 @@ DS_CMD_ERR_CODE UART_TEST_send(UART_TEST_Driver* uart_test_driver, uint8_t id) UART_TEST_tx_frame_[2] = '2'; UART_TEST_tx_frame_[3] = 0x0d; UART_TEST_tx_frame_[4] = 0x0a; - DSSC_set_tx_frame_size(p_stream_config, 5); + FRMSC_set_tx_frame_size(p_stream_config, 5); break; default: UART_TEST_tx_frame_[0] = 'd'; @@ -191,18 +191,18 @@ DS_CMD_ERR_CODE UART_TEST_send(UART_TEST_Driver* uart_test_driver, uint8_t id) UART_TEST_tx_frame_[6] = 't'; UART_TEST_tx_frame_[7] = 0x0d; UART_TEST_tx_frame_[8] = 0x0a; - DSSC_set_tx_frame_size(p_stream_config, 9); + FRMSC_set_tx_frame_size(p_stream_config, 9); break; } - ret = DS_send_general_cmd(&(uart_test_driver->driver.super), UART_TEST_STREAM_FIX); - if (ret == DS_ERR_CODE_OK) + ret = FRM_send_general_cmd(&(uart_test_driver->driver.super), UART_TEST_STREAM_FIX); + if (ret == FRM_ERR_CODE_OK) { - return DS_CMD_OK; + return FRM_CMD_OK; } else { - return DS_CMD_DRIVER_SUPER_ERR; + return FRM_CMD_DRIVER_SUPER_ERR; } } diff --git a/examples/mobc/src/src_user/Drivers/Etc/uart_test.h b/examples/mobc/src/src_user/Drivers/Etc/uart_test.h index 69cd9ef52..3db95ca8a 100644 --- a/examples/mobc/src/src_user/Drivers/Etc/uart_test.h +++ b/examples/mobc/src/src_user/Drivers/Etc/uart_test.h @@ -6,7 +6,7 @@ #define UART_TEST_H_ #include -#include +#include /** * @struct UART_TEST_Info @@ -25,7 +25,7 @@ typedef struct { struct { - DriverSuper super; //!< DriverSuper class + Framing super; //!< Framing class UART_Config uart_config; //!< RS422 class } driver; UART_TEST_Info info; @@ -41,23 +41,23 @@ typedef struct * @param uart_test_driver: 初期化するUART_TEST_Driver構造体へのポインタ * @param ch: UART_TESTが接続されているUARTポート番号 * @param rx_buffers: 受信バッファ - * @return DS_INIT_ERR_CODE + * @return FRM_INIT_ERR_CODE */ -DS_INIT_ERR_CODE UART_TEST_init(UART_TEST_Driver* uart_test_driver, uint8_t ch, DS_StreamRecBuffer* rx_buffers[DS_STREAM_MAX]); +FRM_INIT_ERR_CODE UART_TEST_init(UART_TEST_Driver* uart_test_driver, uint8_t ch, FRM_StreamRecBuffer* rx_buffers[FRM_STREAM_MAX]); /** * @brief UART_TESTのデータ(テレメ)受信 * @param uart_test_driver: UART_TEST_Driver構造体へのポインタ - * @return DS_REC_ERR_CODE + * @return FRM_REC_ERR_CODE */ -DS_REC_ERR_CODE UART_TEST_rec(UART_TEST_Driver* uart_test_driver); +FRM_REC_ERR_CODE UART_TEST_rec(UART_TEST_Driver* uart_test_driver); /** * @brief UART_TESTへのコマンド送信 * @param uart_test_driver: UART_TEST_Driver構造体へのポインタ * @param id: Cmd id - * @return DS_CMD_ERR_CODE + * @return FRM_CMD_ERR_CODE */ -DS_CMD_ERR_CODE UART_TEST_send(UART_TEST_Driver* uart_test_driver, uint8_t id); +FRM_CMD_ERR_CODE UART_TEST_send(UART_TEST_Driver* uart_test_driver, uint8_t id); #endif diff --git a/examples/mobc/src/src_user/Settings/DriverSuper/driver_super_params.h b/examples/mobc/src/src_user/Settings/DriverSuper/driver_super_params.h deleted file mode 100644 index 1599d14dc..000000000 --- a/examples/mobc/src/src_user/Settings/DriverSuper/driver_super_params.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @file - * @brief DriverSuperパラメタのオーバーライド用ヘッダー - */ -#ifndef DRIVER_SUPER_PARAMS_H_ -#define DRIVER_SUPER_PARAMS_H_ - -#undef DS_STREAM_MAX -#undef DS_IF_RX_BUFFER_SIZE - -#define DS_STREAM_MAX (3) -#define DS_IF_RX_BUFFER_SIZE (1024) - -#endif diff --git a/examples/mobc/src/src_user/Settings/DriverSuper/driver_buffer_define.h b/examples/mobc/src/src_user/Settings/framing/framing_buffer_define.h similarity index 54% rename from examples/mobc/src/src_user/Settings/DriverSuper/driver_buffer_define.h rename to examples/mobc/src/src_user/Settings/framing/framing_buffer_define.h index 03ef3305a..40dc1210c 100644 --- a/examples/mobc/src/src_user/Settings/DriverSuper/driver_buffer_define.h +++ b/examples/mobc/src/src_user/Settings/framing/framing_buffer_define.h @@ -2,13 +2,13 @@ * @file * @brief Driver の各種バッファサイズなどの定義 */ -#ifndef DRIVER_BUFFER_DEFINE_H_ -#define DRIVER_BUFFER_DEFINE_H_ +#ifndef FRAMING_BUFFER_DEFINE_H_ +#define FRAMING_BUFFER_DEFINE_H_ -#include "./driver_super_params.h" +#include "./framing_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 FRM_STREAM_REC_BUFFER_SIZE_DEFAULT (FRM_IF_RX_BUFFER_SIZE * 2) /*!< FRM_StreamRecBuffer のバッファサイズのデフォルト値 + UART などの非同期通信はメモリに余力があれば FRM_IF_RX_BUFFER_SIZE * 2 を推奨 詳細は dirver_super.c の @note を参照 */ #endif diff --git a/examples/mobc/src/src_user/Settings/framing/framing_params.h b/examples/mobc/src/src_user/Settings/framing/framing_params.h new file mode 100644 index 000000000..36c9737c2 --- /dev/null +++ b/examples/mobc/src/src_user/Settings/framing/framing_params.h @@ -0,0 +1,14 @@ +/** + * @file + * @brief Framingパラメタのオーバーライド用ヘッダー + */ +#ifndef FRAMING_PARAMS_H_ +#define FRAMING_PARAMS_H_ + +#undef FRM_STREAM_MAX +#undef FRM_IF_RX_BUFFER_SIZE + +#define FRM_STREAM_MAX (3) +#define FRM_IF_RX_BUFFER_SIZE (1024) + +#endif diff --git a/examples/mobc/src/src_user/applications/driver_instances/di_aobc.c b/examples/mobc/src/src_user/applications/driver_instances/di_aobc.c index 9a2874b5c..daf3a2cea 100644 --- a/examples/mobc/src/src_user/applications/driver_instances/di_aobc.c +++ b/examples/mobc/src/src_user/applications/driver_instances/di_aobc.c @@ -11,7 +11,7 @@ #include #include #include "../../Settings/port_config.h" -#include "../../Settings/DriverSuper/driver_buffer_define.h" +#include "../../Settings/framing/framing_buffer_define.h" #include static RESULT DI_AOBC_init_(void); @@ -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 FRM_StreamRecBuffer DI_AOBC_rx_buffer_; +static uint8_t DI_AOBC_rx_buffer_allocation_[FRM_STREAM_REC_BUFFER_SIZE_DEFAULT]; AppInfo DI_AOBC_update(void) @@ -39,21 +39,21 @@ AppInfo DI_AOBC_update(void) static RESULT DI_AOBC_init_(void) { - DS_ERR_CODE ret1; - DS_INIT_ERR_CODE ret2; + FRM_ERR_CODE ret1; + FRM_INIT_ERR_CODE ret2; RESULT err = RESULT_OK; - ret1 = DS_init_stream_rec_buffer(&DI_AOBC_rx_buffer_, + ret1 = FRM_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 != FRM_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 != FRM_INIT_OK) { Printf("AOBC init Failed ! %d \n", ret2); err = RESULT_ERR; @@ -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; + FRM_CMD_ERR_CODE ret; CommonCmdPacket* pckt = (CommonCmdPacket*)packet; // const_cast // ここで CCP_DEST_TYPE を宛先で受理できるように変更(なので const cast が発生している...) @@ -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 FRM_conv_cmd_err_to_ccp_cmd_ret(ret); } diff --git a/examples/mobc/src/src_user/applications/driver_instances/di_aobc.h b/examples/mobc/src/src_user/applications/driver_instances/di_aobc.h index 6df5365b1..280484e06 100644 --- a/examples/mobc/src/src_user/applications/driver_instances/di_aobc.h +++ b/examples/mobc/src/src_user/applications/driver_instances/di_aobc.h @@ -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 それ以外: 転送失敗(FRM_CMD_ERR_CODE を CCP_EXEC_STS に変換して返す.詳細エラーは Framing を参照) */ CCP_CmdRet DI_AOBC_dispatch_command(const CommonCmdPacket* packet); diff --git a/examples/mobc/src/src_user/applications/driver_instances/di_gs.c b/examples/mobc/src/src_user/applications/driver_instances/di_gs.c index ec4ecd0b7..4d23abb6e 100644 --- a/examples/mobc/src/src_user/applications/driver_instances/di_gs.c +++ b/examples/mobc/src/src_user/applications/driver_instances/di_gs.c @@ -10,7 +10,7 @@ #include #include "../../Drivers/Com/gs_validate.h" #include "../../Settings/port_config.h" -#include "../../Settings/DriverSuper/driver_buffer_define.h" +#include "../../Settings/framing/framing_buffer_define.h" static RESULT DI_GS_init_(void); @@ -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 FRM_StreamRecBuffer DI_GS_ccsds_rx_buffer_[GS_RX_HEADER_NUM]; +static uint8_t DI_GS_ccsds_rx_buffer_allocation_[GS_RX_HEADER_NUM][FRM_STREAM_REC_BUFFER_SIZE_DEFAULT]; +static FRM_StreamRecBuffer DI_GS_uart_rx_buffer_[GS_RX_HEADER_NUM]; +static uint8_t DI_GS_uart_rx_buffer_allocation_[GS_RX_HEADER_NUM][FRM_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); + FRM_INIT_ERR_CODE ret; + FRM_StreamRecBuffer* ccsds_rx_buffers[FRM_STREAM_MAX]; + FRM_StreamRecBuffer* uart_rx_buffers[FRM_STREAM_MAX]; + FRM_nullify_stream_rec_buffers(ccsds_rx_buffers); + FRM_nullify_stream_rec_buffers(uart_rx_buffers); - // GS_RX_HEADER_NUM > DS_STREAM_MAX のアサーションは gs.c でやっているのでここではしない + // GS_RX_HEADER_NUM > FRM_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], + FRM_ERR_CODE ret1; + FRM_ERR_CODE ret2; + ret1 = FRM_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 = FRM_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 != FRM_ERR_CODE_OK || ret2 != FRM_ERR_CODE_OK) { Printf("GS buffer init Failed ! %d, %d \n", ret1, ret2); return RESULT_ERR; @@ -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 != FRM_INIT_OK) { Printf("!! GS Init Error %d !!\n", ret); return RESULT_ERR; diff --git a/examples/mobc/src/src_user/applications/driver_instances/di_uart_test.c b/examples/mobc/src/src_user/applications/driver_instances/di_uart_test.c index ca8658359..7484f76f9 100644 --- a/examples/mobc/src/src_user/applications/driver_instances/di_uart_test.c +++ b/examples/mobc/src/src_user/applications/driver_instances/di_uart_test.c @@ -1,14 +1,14 @@ #pragma section REPRO /** * @file - * @brief UART と DriverSuper テスト用 + * @brief UART と Framing テスト用 */ #include "di_uart_test.h" #include // for NULL #include #include #include "../../Settings/port_config.h" -#include "../../Settings/DriverSuper/driver_buffer_define.h" +#include "../../Settings/framing/framing_buffer_define.h" #include static RESULT UART_TEST_init_by_AM_(void); @@ -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 FRM_StreamRecBuffer DI_UART_TEST_rx_buffer_0_; +static FRM_StreamRecBuffer DI_UART_TEST_rx_buffer_1_; +static uint8_t DI_UART_TEST_rx_buffer_allocation_0_[FRM_STREAM_REC_BUFFER_SIZE_DEFAULT]; +static uint8_t DI_UART_TEST_rx_buffer_allocation_1_[FRM_STREAM_REC_BUFFER_SIZE_DEFAULT]; // !!!!!!!!!! 注意 !!!!!!!!!! @@ -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); + FRM_ERR_CODE ret1; + FRM_INIT_ERR_CODE ret2; + FRM_StreamRecBuffer* rx_buffers[FRM_STREAM_MAX]; + FRM_nullify_stream_rec_buffers(rx_buffers); - ret1 = DS_init_stream_rec_buffer(&DI_UART_TEST_rx_buffer_0_, + ret1 = FRM_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 != FRM_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 = FRM_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 != FRM_ERR_CODE_OK) { Printf("UART_TEST buffer1 init Failed ! %d \n", ret1); } - if (DS_STREAM_MAX < 2) + if (FRM_STREAM_MAX < 2) { Printf("UART_TEST init Failed ! Lack of streams \n"); return; @@ -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 != FRM_INIT_OK) { Printf("UART_TEST init Failed! Err:%d \n", ret2); } @@ -92,7 +92,7 @@ static void UART_TEST_init_(void) static RESULT UART_TEST_update_(void) { - DS_REC_ERR_CODE ret; + FRM_REC_ERR_CODE ret; ret = UART_TEST_rec(&uart_test_driver_); @@ -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; + FRM_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 FRM_conv_cmd_err_to_ccp_cmd_ret(ret); } #pragma section diff --git a/examples/mobc/src/src_user/applications/driver_instances/di_uart_test.h b/examples/mobc/src/src_user/applications/driver_instances/di_uart_test.h index 37920952a..a33dc189f 100644 --- a/examples/mobc/src/src_user/applications/driver_instances/di_uart_test.h +++ b/examples/mobc/src/src_user/applications/driver_instances/di_uart_test.h @@ -1,6 +1,6 @@ /** * @file - * @brief UART と DriverSuper テスト用 + * @brief UART と Framing テスト用 */ #ifndef DI_UART_TEST_H_ #define DI_UART_TEST_H_ diff --git a/examples/mobc/src/src_user/tlm_cmd/user_packet_handler.h b/examples/mobc/src/src_user/tlm_cmd/user_packet_handler.h index a2d075cf8..72ac7fc94 100644 --- a/examples/mobc/src/src_user/tlm_cmd/user_packet_handler.h +++ b/examples/mobc/src/src_user/tlm_cmd/user_packet_handler.h @@ -47,7 +47,7 @@ PH_ACK PH_user_analyze_cmd(const CommonCmdPacket* packet); * ここから Driver を叩いて送信まで行うことになる(実行時間は CA_execute_cmd と同じだけ許容されているので OK) * @param packet: CCP * @retval CCP_CmdRet{CCP_EXEC_SUCCESS, *} など: 無事に転送された.転送先の結果を返す - * @retval CCP_CmdRet{CCP_EXEC_ROUTING_FAILED, *}: 転送失敗(詳細エラーは DriverSuper を参照) + * @retval CCP_CmdRet{CCP_EXEC_ROUTING_FAILED, *}: 転送失敗(詳細エラーは Framing を参照) */ CCP_CmdRet PH_user_cmd_router(const CommonCmdPacket* packet); diff --git a/examples/subobc/src/src_user/Drivers/Etc/mobc.c b/examples/subobc/src/src_user/Drivers/Etc/mobc.c index a607b0d70..3c24e2201 100644 --- a/examples/subobc/src/src_user/Drivers/Etc/mobc.c +++ b/examples/subobc/src/src_user/Drivers/Etc/mobc.c @@ -8,8 +8,8 @@ #include "./mobc.h" #include -#include -#include +#include +#include #include #define MOBC_STREAM_TLM_CMD (0) //!< テレコマで使うストリーム @@ -18,14 +18,14 @@ static uint8_t MOBC_tx_frame_[EB90_FRAME_HEADER_SIZE + CTCP_MAX_LEN + EB90_FRAME_FOOTER_SIZE]; -static DS_ERR_CODE MOBC_load_driver_super_init_settings_(DriverSuper* p_super); -static DS_ERR_CODE MOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, +static FRM_ERR_CODE MOBC_load_driver_super_init_settings_(Framing* p_framing); +static FRM_ERR_CODE MOBC_analyze_rec_data_(FRM_StreamConfig* p_stream_config, void* p_driver); -DS_INIT_ERR_CODE MOBC_init(MOBC_Driver* mobc_driver, uint8_t ch, DS_StreamRecBuffer* rx_buffer) +FRM_INIT_ERR_CODE MOBC_init(MOBC_Driver* mobc_driver, uint8_t ch, FRM_StreamRecBuffer* rx_buffer) { - DS_ERR_CODE ret; + FRM_ERR_CODE ret; memset(mobc_driver, 0x00, sizeof(MOBC_Driver)); @@ -35,62 +35,62 @@ DS_INIT_ERR_CODE MOBC_init(MOBC_Driver* mobc_driver, uint8_t ch, DS_StreamRecBuf mobc_driver->driver.uart_config.data_length = UART_DATA_LENGTH_8BIT; mobc_driver->driver.uart_config.stop_bit = UART_STOP_BIT_1BIT; - ret = DS_init(&(mobc_driver->driver.super), + ret = FRM_init(&(mobc_driver->driver.super), &(mobc_driver->driver.uart_config), rx_buffer, MOBC_load_driver_super_init_settings_); - if (ret != DS_ERR_CODE_OK) return DS_INIT_DS_INIT_ERR; - return DS_INIT_OK; + if (ret != FRM_ERR_CODE_OK) return FRM_INIT_FRM_INIT_ERR; + return FRM_INIT_OK; } -static DS_ERR_CODE MOBC_load_driver_super_init_settings_(DriverSuper* p_super) +static FRM_ERR_CODE MOBC_load_driver_super_init_settings_(Framing* p_framing) { - DS_StreamConfig* p_stream_config; + FRM_StreamConfig* p_stream_config; - p_super->interface = UART; + p_framing->interface = UART; // stream は 0 のみ - p_stream_config = &(p_super->stream_config[MOBC_STREAM_TLM_CMD]); + p_stream_config = &(p_framing->stream_config[MOBC_STREAM_TLM_CMD]); CTCP_init_dssc(p_stream_config, MOBC_tx_frame_, sizeof(MOBC_tx_frame_), MOBC_analyze_rec_data_); // 定期 TLM の監視機能の有効化しない → ので設定上書きなし - DSSC_enable(p_stream_config); + FRMSC_enable(p_stream_config); - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } -DS_REC_ERR_CODE MOBC_rec(MOBC_Driver* mobc_driver) +FRM_REC_ERR_CODE MOBC_rec(MOBC_Driver* mobc_driver) { - DS_ERR_CODE ret; - DS_StreamConfig* p_stream_config; + FRM_ERR_CODE ret; + FRM_StreamConfig* p_stream_config; - ret = DS_receive(&(mobc_driver->driver.super)); + ret = FRM_receive(&(mobc_driver->driver.super)); - if (ret != DS_ERR_CODE_OK) return DS_REC_DS_RECEIVE_ERR; + if (ret != FRM_ERR_CODE_OK) return FRM_REC_FRM_RECEIVE_ERR; p_stream_config = &(mobc_driver->driver.super.stream_config[MOBC_STREAM_TLM_CMD]); - if (DSSC_get_rec_status(p_stream_config)->status_code != DS_STREAM_REC_STATUS_FIXED_FRAME) return DS_REC_OK; // 受信せず(TODO: 詳細なエラー処理は一旦しない) + if (FRMSC_get_rec_status(p_stream_config)->status_code != FRM_STREAM_REC_STATUS_FIXED_FRAME) return FRM_REC_OK; // 受信せず(TODO: 詳細なエラー処理は一旦しない) - ret = DS_analyze_rec_data(&(mobc_driver->driver.super), MOBC_STREAM_TLM_CMD, mobc_driver); + ret = FRM_analyze_rec_data(&(mobc_driver->driver.super), MOBC_STREAM_TLM_CMD, mobc_driver); - if (ret != DS_ERR_CODE_OK) return DS_REC_ANALYZE_ERR; + if (ret != FRM_ERR_CODE_OK) return FRM_REC_ANALYZE_ERR; - return DS_REC_OK; + return FRM_REC_OK; } -static DS_ERR_CODE MOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, void* p_driver) +static FRM_ERR_CODE MOBC_analyze_rec_data_(FRM_StreamConfig* p_stream_config, void* p_driver) { MOBC_Driver* mobc_driver = (MOBC_Driver*)p_driver; CommonCmdPacket packet; // FIXME: これは static にする? // static のほうがコンパイル時にアドレスが確定して安全. Out of stack space を回避できる // 一方でメモリ使用量は増える. - DS_ERR_CODE ret = CCP_get_ccp_from_dssc(p_stream_config, &packet); - if (ret != DS_ERR_CODE_OK) + FRM_ERR_CODE ret = CCP_get_ccp_from_dssc(p_stream_config, &packet); + if (ret != FRM_ERR_CODE_OK) { mobc_driver->info.comm.rx_err_code = MOBC_RX_ERR_CODE_INVALID_PACKET; return ret; @@ -101,7 +101,7 @@ static DS_ERR_CODE MOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, void if (!EB90_FRAME_is_valid_crc_of_dssc(p_stream_config)) { mobc_driver->info.comm.rx_err_code = MOBC_RX_ERR_CODE_CRC_ERR; - return DS_ERR_CODE_ERR; + return FRM_ERR_CODE_ERR; } // MOBC からのコマンドは以下のパターン @@ -120,30 +120,30 @@ static DS_ERR_CODE MOBC_analyze_rec_data_(DS_StreamConfig* p_stream_config, void // FIXME: CTCP 大工事が終わったら,返り値をちゃんと見るようにする mobc_driver->info.c2a.ph_ack = PH_analyze_cmd_packet(&packet); - return DS_ERR_CODE_OK; + return FRM_ERR_CODE_OK; } -DS_CMD_ERR_CODE MOBC_send(MOBC_Driver* mobc_driver, const CommonTlmPacket* packet) +FRM_CMD_ERR_CODE MOBC_send(MOBC_Driver* mobc_driver, const CommonTlmPacket* packet) { - DS_ERR_CODE ret; - DS_StreamConfig* p_stream_config; + FRM_ERR_CODE ret; + FRM_StreamConfig* p_stream_config; p_stream_config = &(mobc_driver->driver.super.stream_config[MOBC_STREAM_TLM_CMD]); // tx_frameの設定 CTP_set_tx_frame_to_dssc(p_stream_config, packet); - ret = DS_send_general_cmd(&(mobc_driver->driver.super), MOBC_STREAM_TLM_CMD); + ret = FRM_send_general_cmd(&(mobc_driver->driver.super), MOBC_STREAM_TLM_CMD); - if (ret == DS_ERR_CODE_OK) + if (ret == FRM_ERR_CODE_OK) { - return DS_CMD_OK; + return FRM_CMD_OK; } else { // TODO: エラー処理? - return DS_CMD_DRIVER_SUPER_ERR; + return FRM_CMD_DRIVER_SUPER_ERR; } } diff --git a/examples/subobc/src/src_user/Drivers/Etc/mobc.h b/examples/subobc/src/src_user/Drivers/Etc/mobc.h index 85281dab3..f391a8f9c 100644 --- a/examples/subobc/src/src_user/Drivers/Etc/mobc.h +++ b/examples/subobc/src/src_user/Drivers/Etc/mobc.h @@ -6,7 +6,7 @@ #define MOBC_H_ #include -#include +#include #include #include #include @@ -46,14 +46,14 @@ typedef struct // C2A 情報 struct { - DS_CMD_ERR_CODE send_tlm_err_code; //!< テレメトリ送信時のエラーコード + FRM_CMD_ERR_CODE send_tlm_err_code; //!< テレメトリ送信時のエラーコード PH_ACK ph_ack; //!< 受信したコマンドを PH に渡したときの返り値 } c2a; //!< C2A 情報 // 通信情報 struct { - MOBC_TX_ERR_CODE tx_err_code; //!< DriverSuper ではなく Driver が持つべき通信エラー情報 - MOBC_RX_ERR_CODE rx_err_code; //!< DriverSuper ではなく Driver が持つべき通信エラー情報 + MOBC_TX_ERR_CODE tx_err_code; //!< Framing ではなく Driver が持つべき通信エラー情報 + MOBC_RX_ERR_CODE rx_err_code; //!< Framing ではなく Driver が持つべき通信エラー情報 } comm; //!< 通信情報 } MOBC_Info; @@ -66,7 +66,7 @@ typedef struct { struct { - DriverSuper super; //!< DriverSuper class + Framing super; //!< Framing class UART_Config uart_config; //!< UART class } driver; MOBC_Info info; @@ -80,25 +80,25 @@ typedef struct * @param mobc_driver: 初期化する MOBC_Driver 構造体へのポインタ * @param ch: MOBC が接続されている UART ポート番号 * @param rx_buffer: 受信バッファ - * @return DS_INIT_ERR_CODE + * @return FRM_INIT_ERR_CODE */ -DS_INIT_ERR_CODE MOBC_init(MOBC_Driver* mobc_driver, uint8_t ch, DS_StreamRecBuffer* rx_buffer); +FRM_INIT_ERR_CODE MOBC_init(MOBC_Driver* mobc_driver, uint8_t ch, FRM_StreamRecBuffer* rx_buffer); /** * @brief MOBC からのデータ( MOBC → AOBC のコマンド)受信 * @param mobc_driver: MOBC_Driver 構造体へのポインタ - * @return DS_REC_ERR_CODE + * @return FRM_REC_ERR_CODE */ -DS_REC_ERR_CODE MOBC_rec(MOBC_Driver* mobc_driver); +FRM_REC_ERR_CODE MOBC_rec(MOBC_Driver* mobc_driver); /** * @brief MOBC へのデータ(MOBC → AOBCのテレメ)送信 * @param mobc_driver: MOBC_Driver 構造体へのポインタ * @param packet: 送信する CTP packet - * @return DS_CMD_ERR_CODE + * @return FRM_CMD_ERR_CODE */ -DS_CMD_ERR_CODE MOBC_send(MOBC_Driver* mobc_driver, const CommonTlmPacket* packet); +FRM_CMD_ERR_CODE MOBC_send(MOBC_Driver* mobc_driver, const CommonTlmPacket* packet); #endif diff --git a/examples/subobc/src/src_user/Settings/DriverSuper/driver_super_params.h b/examples/subobc/src/src_user/Settings/DriverSuper/driver_super_params.h deleted file mode 100644 index c82fe0a33..000000000 --- a/examples/subobc/src/src_user/Settings/DriverSuper/driver_super_params.h +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @file - * @brief DriverSuperパラメタのオーバーライド用ヘッダー - */ -#ifndef DRIVER_SUPER_PARAMS_H_ -#define DRIVER_SUPER_PARAMS_H_ - -// Core のデフォルト設定をそのまま使う - -#endif diff --git a/examples/subobc/src/src_user/Settings/DriverSuper/driver_buffer_define.h b/examples/subobc/src/src_user/Settings/framing/framing_buffer_define.h similarity index 54% rename from examples/subobc/src/src_user/Settings/DriverSuper/driver_buffer_define.h rename to examples/subobc/src/src_user/Settings/framing/framing_buffer_define.h index 03ef3305a..40dc1210c 100644 --- a/examples/subobc/src/src_user/Settings/DriverSuper/driver_buffer_define.h +++ b/examples/subobc/src/src_user/Settings/framing/framing_buffer_define.h @@ -2,13 +2,13 @@ * @file * @brief Driver の各種バッファサイズなどの定義 */ -#ifndef DRIVER_BUFFER_DEFINE_H_ -#define DRIVER_BUFFER_DEFINE_H_ +#ifndef FRAMING_BUFFER_DEFINE_H_ +#define FRAMING_BUFFER_DEFINE_H_ -#include "./driver_super_params.h" +#include "./framing_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 FRM_STREAM_REC_BUFFER_SIZE_DEFAULT (FRM_IF_RX_BUFFER_SIZE * 2) /*!< FRM_StreamRecBuffer のバッファサイズのデフォルト値 + UART などの非同期通信はメモリに余力があれば FRM_IF_RX_BUFFER_SIZE * 2 を推奨 詳細は dirver_super.c の @note を参照 */ #endif diff --git a/examples/subobc/src/src_user/Settings/framing/framing_params.h b/examples/subobc/src/src_user/Settings/framing/framing_params.h new file mode 100644 index 000000000..0117cd5f5 --- /dev/null +++ b/examples/subobc/src/src_user/Settings/framing/framing_params.h @@ -0,0 +1,10 @@ +/** + * @file + * @brief Framingパラメタのオーバーライド用ヘッダー + */ +#ifndef FRAMING_PARAMS_H_ +#define FRAMING_PARAMS_H_ + +// Core のデフォルト設定をそのまま使う + +#endif diff --git a/examples/subobc/src/src_user/applications/driver_instances/di_mobc.c b/examples/subobc/src/src_user/applications/driver_instances/di_mobc.c index 8db5eb741..99dac680c 100644 --- a/examples/subobc/src/src_user/applications/driver_instances/di_mobc.c +++ b/examples/subobc/src/src_user/applications/driver_instances/di_mobc.c @@ -8,7 +8,7 @@ #include #include #include "../../Settings/port_config.h" -#include "../../Settings/DriverSuper/driver_buffer_define.h" +#include "../../Settings/framing/framing_buffer_define.h" #include static RESULT DI_MOBC_init_(void); @@ -20,8 +20,8 @@ static MOBC_Driver mobc_driver_; const MOBC_Driver* const mobc_driver = &mobc_driver_; // バッファ -static DS_StreamRecBuffer DI_MOBC_rx_buffer_; -static uint8_t DI_MOBC_rx_buffer_allocation_[DS_STREAM_REC_BUFFER_SIZE_DEFAULT]; +static FRM_StreamRecBuffer DI_MOBC_rx_buffer_; +static uint8_t DI_MOBC_rx_buffer_allocation_[FRM_STREAM_REC_BUFFER_SIZE_DEFAULT]; static const uint8_t DI_MOBC_kRtTlmPhMaxNumOfProc_ = 4; //!< 一度に送出する最大テレメ数 @@ -33,21 +33,21 @@ AppInfo DI_MOBC_update(void) static RESULT DI_MOBC_init_(void) { - DS_ERR_CODE ret1; - DS_INIT_ERR_CODE ret2; + FRM_ERR_CODE ret1; + FRM_INIT_ERR_CODE ret2; RESULT err = RESULT_OK; - ret1 = DS_init_stream_rec_buffer(&DI_MOBC_rx_buffer_, + ret1 = FRM_init_stream_rec_buffer(&DI_MOBC_rx_buffer_, DI_MOBC_rx_buffer_allocation_, sizeof(DI_MOBC_rx_buffer_allocation_)); - if (ret1 != DS_ERR_CODE_OK) + if (ret1 != FRM_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_); - if (ret2 != DS_INIT_OK) + if (ret2 != FRM_INIT_OK) { Printf("MOBC init Failed ! %d \n", ret2); err = RESULT_ERR; @@ -58,7 +58,7 @@ static RESULT DI_MOBC_init_(void) static RESULT DI_MOBC_update_(void) { - DS_REC_ERR_CODE ret; + FRM_REC_ERR_CODE ret; ret = MOBC_rec(&mobc_driver_); // TODO: 必要があればここに処理を @@ -86,11 +86,11 @@ static RESULT DI_MOBC_rt_tlm_packet_handler_(void) CommonTlmPacket packet; // FIXME: これは static にする? // static のほうがコンパイル時にアドレスが確定して安全. Out of stack space を回避できる // 一方でメモリ使用量は増える. - mobc_driver_.info.c2a.send_tlm_err_code = DS_CMD_OK; + mobc_driver_.info.c2a.send_tlm_err_code = FRM_CMD_OK; for (i = 0; i < DI_MOBC_kRtTlmPhMaxNumOfProc_; i++) { - DS_CMD_ERR_CODE ret; + FRM_CMD_ERR_CODE ret; // TODO: ここは一部 MW に入れるべきなのかなぁ...? // 最近 C2A の MW の扱いが難しい.いっそなくすか? @@ -119,14 +119,14 @@ static RESULT DI_MOBC_rt_tlm_packet_handler_(void) // AOBC のアノマリ基準は? // 最後に起きたエラーを保存する - mobc_driver_.info.c2a.send_tlm_err_code = DS_CMD_ILLEGAL_PARAMETER; + mobc_driver_.info.c2a.send_tlm_err_code = FRM_CMD_ILLEGAL_PARAMETER; continue; } // TODO: TPC のヘッダを別途設定する必要はないか,ちゃんと確認する.多分ないと思うけど ret = MOBC_send(&mobc_driver_, &packet); - if (ret != DS_CMD_OK) + if (ret != FRM_CMD_OK) { // 最後に起きたエラーを保存する mobc_driver_.info.c2a.send_tlm_err_code = ret; diff --git a/examples/subobc/src/src_user/tlm_cmd/user_packet_handler.h b/examples/subobc/src/src_user/tlm_cmd/user_packet_handler.h index d26c7c69e..ae0631351 100644 --- a/examples/subobc/src/src_user/tlm_cmd/user_packet_handler.h +++ b/examples/subobc/src/src_user/tlm_cmd/user_packet_handler.h @@ -44,7 +44,7 @@ PH_ACK PH_user_analyze_cmd(const CommonCmdPacket* packet); * ここから Driver を叩いて送信まで行うことになる(実行時間は CA_execute_cmd と同じだけ許容されているので OK) * @param packet: CCP * @retval CCP_CmdRet{CCP_EXEC_SUCCESS, *} など: 無事に転送された.転送先の結果を返す - * @retval CCP_CmdRet{CCP_EXEC_ROUTING_FAILED, *}: 転送失敗(詳細エラーは DriverSuper を参照) + * @retval CCP_CmdRet{CCP_EXEC_ROUTING_FAILED, *}: 転送失敗(詳細エラーは Framing を参照) */ CCP_CmdRet PH_user_cmd_router(const CommonCmdPacket* packet); diff --git a/examples/subobc/sync_with_mobc_example.bat b/examples/subobc/sync_with_mobc_example.bat index 16067ff76..b13d59c9d 100644 --- a/examples/subobc/sync_with_mobc_example.bat +++ b/examples/subobc/sync_with_mobc_example.bat @@ -20,7 +20,7 @@ call :sync_file ".\src\src_user\hal\sils_mockup\README.md" "..\mobc\src\src_user call :sync_file ".\src\src_user\hal\sils_mockup\uart_sils.c" "..\mobc\src\src_user\hal\sils_mockup\uart_sils.c" call :sync_file ".\src\src_user\hal\sils_mockup\wdt_sils.c" "..\mobc\src\src_user\hal\sils_mockup\wdt_sils.c" call :sync_file ".\src\src_user\Settings\git_revision_config.h" "..\mobc\src\src_user\Settings\git_revision_config.h" -call :sync_file ".\src\src_user\Settings\DriverSuper\driver_buffer_define.h" "..\mobc\src\src_user\Settings\DriverSuper\driver_buffer_define.h" +call :sync_file ".\src\src_user\Settings\framing\driver_buffer_define.h" "..\mobc\src\src_user\Settings\framing\driver_buffer_define.h" call :sync_file ".\src\src_user\Settings\tlm_cmd\common_cmd_packet_define.c" "..\mobc\src\src_user\Settings\tlm_cmd\common_cmd_packet_define.c" call :sync_file ".\src\src_user\Settings\tlm_cmd\common_tlm_cmd_packet_define.h" "..\mobc\src\src_user\Settings\tlm_cmd\common_tlm_cmd_packet_define.h" call :sync_file ".\src\src_user\tlm_cmd\block_command_user_settings.c" "..\mobc\src\src_user\tlm_cmd\block_command_user_settings.c"