From 4e28f86018fadf4a49cdf4116c0155f84a0da168 Mon Sep 17 00:00:00 2001 From: flap1 Date: Wed, 26 Oct 2022 12:20:02 +0900 Subject: [PATCH] fix var names --- .../src/src_user/IfWrapper/CMakeLists.txt | 4 +-- .../src_user/IfWrapper/Sils/ccsds_sils.cpp | 8 ++--- .../IfWrapper/Sils/ccsds_sils_sci_if.cpp | 34 ------------------ .../IfWrapper/Sils/ccsds_sils_sci_if.hpp | 23 ------------ .../IfWrapper/Sils/sils_sci_ccsds_if.cpp | 36 +++++++++++++++++++ .../IfWrapper/Sils/sils_sci_ccsds_if.hpp | 25 +++++++++++++ .../src_user/IfWrapper/Sils/sils_sci_if.cpp | 14 ++++---- .../src_user/IfWrapper/Sils/sils_sci_if.hpp | 4 +-- ...t_sils_sci_if.cpp => sils_sci_uart_if.cpp} | 14 ++++---- ...t_sils_sci_if.hpp => sils_sci_uart_if.hpp} | 8 ++--- .../src/src_user/IfWrapper/Sils/uart_sils.cpp | 2 +- 11 files changed, 88 insertions(+), 84 deletions(-) delete mode 100644 Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils_sci_if.cpp delete mode 100644 Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils_sci_if.hpp create mode 100644 Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_ccsds_if.cpp create mode 100644 Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_ccsds_if.hpp rename Examples/minimum_user/src/src_user/IfWrapper/Sils/{uart_sils_sci_if.cpp => sils_sci_uart_if.cpp} (59%) rename Examples/minimum_user/src/src_user/IfWrapper/Sils/{uart_sils_sci_if.hpp => sils_sci_uart_if.hpp} (74%) diff --git a/Examples/minimum_user/src/src_user/IfWrapper/CMakeLists.txt b/Examples/minimum_user/src/src_user/IfWrapper/CMakeLists.txt index d080aeb73..6cfb60f18 100644 --- a/Examples/minimum_user/src/src_user/IfWrapper/CMakeLists.txt +++ b/Examples/minimum_user/src/src_user/IfWrapper/CMakeLists.txt @@ -30,7 +30,7 @@ if(USE_SCI_COM_WINGS AND NOT USE_SILS_MOCKUP) #target_sources(${PROJECT_NAME} PUBLIC list(APPEND C2A_SRCS Sils/sils_sci_if.cpp - Sils/ccsds_sils_sci_if.cpp + Sils/sils_sci_ccsds_if.cpp ) message("USE SCI_COM_WINGS") endif() @@ -40,7 +40,7 @@ if(USE_SCI_COM_UART AND NOT USE_SILS_MOCKUP) #target_sources(${PROJECT_NAME} PUBLIC list(APPEND C2A_SRCS Sils/sils_sci_if.cpp - Sils/uart_sils_sci_if.cpp + Sils/sils_sci_uart_if.cpp ) message("USE SCI_COM_UART") endif() diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils.cpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils.cpp index c4412d369..2a5074c79 100644 --- a/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils.cpp +++ b/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils.cpp @@ -14,7 +14,7 @@ #include "../ccsds_user.h" #ifdef USE_SCI_COM_WINGS -#include "ccsds_sils_sci_if.hpp" +#include "sils_sci_ccsds_if.hpp" #endif #define CCSDS_TX_VALID_SIZE (444) @@ -26,7 +26,7 @@ int CCSDS_init(void* my_ccsds_v) CCSDS_set_rate(0xAD, my_ccsds); // 初期値 230.4 [kbps] #ifdef USE_SCI_COM_WINGS - SILS_SIC_IF_init(); + SILS_SCI_CCSDS_IF_init(); #endif return CCSDS_ERR_OK; } @@ -37,7 +37,7 @@ int CCSDS_rx(void* my_ccsds_v, void* data_v, int buffer_size) (CCSDS_Config*)my_ccsds_v; #ifdef USE_SCI_COM_WINGS - return SILS_SIC_IF_RX(data, buffer_size); + return SILS_SCI_CCSDS_IF_RX(data, buffer_size); #endif return 0; @@ -53,7 +53,7 @@ int CCSDS_tx(void* my_ccsds_v, void* data_v, int data_size) if (!CCSDS_get_buffer_num()) return CCSDS_ERR_TX_NO_BUFFER; #ifdef USE_SCI_COM_WINGS - ret = SILS_SIC_IF_TX(data, data_size); + ret = SILS_SCI_CCSDS_IF_TX(data, data_size); #endif if (ret == 0) return CCSDS_ERR_TX_INVALID; diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils_sci_if.cpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils_sci_if.cpp deleted file mode 100644 index ba77df80e..000000000 --- a/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils_sci_if.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#pragma section REPRO -/** - * @file - * @brief ccsds_sils_sci_if - * @details WINGS TMTC IFとCCSDSのTransfer FrameをSCI COMでやりとりするIF - */ - -#include "ccsds_sils_sci_if.hpp" - - -// 最初だけ初期化して、プログラム終了時にポートを閉じるようにしたい -#ifdef WIN32 -static SCIComPortCcsds SILS_SCI_IF_sci_com_(11); -#else -static SCIComPortCcsds SILS_SCI_IF_sci_com_(1); -#endif - -int SILS_SIC_IF_init(void) -{ - return 0; -} - -int SILS_SIC_IF_TX(unsigned char* data_v, int count) -{ - SILS_SCI_IF_sci_com_.Send(data_v, 0, count); - return 0; -} - -int SILS_SIC_IF_RX(unsigned char* data_v, int count) -{ - return SILS_SCI_IF_sci_com_.Receive(data_v, 0, count); -} - -#pragma section diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils_sci_if.hpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils_sci_if.hpp deleted file mode 100644 index 1361eeba2..000000000 --- a/Examples/minimum_user/src/src_user/IfWrapper/Sils/ccsds_sils_sci_if.hpp +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @file - * @brief ccsds_sils_sci_if - * @details WINGS TMTC IFとCCSDSのTransfer FrameをSCI COMでやりとりするIF - */ -#ifndef CCSDS_SILS_SCI_IF_HPP_ -#define CCSDS_SILS_SCI_IF_HPP_ - -#include -#include "sils_sci_if.hpp" - -class SCIComPortCcsds : public SCIComPort -{ -public: - SCIComPortCcsds(int port) : SCIComPort(port) {}; - ~SCIComPortCcsds(void) {}; -}; - -int SILS_SIC_IF_init(); -int SILS_SIC_IF_TX(unsigned char* data_v, int count); -int SILS_SIC_IF_RX(unsigned char* data_v, int count); - -#endif diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_ccsds_if.cpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_ccsds_if.cpp new file mode 100644 index 000000000..74fcf6db5 --- /dev/null +++ b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_ccsds_if.cpp @@ -0,0 +1,36 @@ +#pragma section REPRO +/** + * @file + * @brief sils_sci_ccsds_if + * @details WINGS TMTC IFとCCSDSのTransfer FrameをSCI COMでやりとりするIF + * Windows上でcom0comを使うことを想定 + * SCIComPort classは基本的にEQU ZEUSのコードを流用 + */ + +#include "sils_sci_ccsds_if.hpp" + + +// 最初だけ初期化して、プログラム終了時にポートを閉じるようにしたい +#ifdef _WIN32 +static SCIComPortCcsds SILS_SCI_CCSDS_IF_sci_com_(11); +#else +static SCIComPortCcsds SILS_SCI_CCSDS_IF_sci_com_(1); +#endif + +int SILS_SCI_CCSDS_IF_init(void) +{ + return 0; +} + +int SILS_SCI_CCSDS_IF_TX(unsigned char* data_v, int count) +{ + SILS_SCI_CCSDS_IF_sci_com_.Send(data_v, 0, count); + return 0; +} + +int SILS_SCI_CCSDS_IF_RX(unsigned char* data_v, int count) +{ + return SILS_SCI_CCSDS_IF_sci_com_.Receive(data_v, 0, count); +} + +#pragma section diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_ccsds_if.hpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_ccsds_if.hpp new file mode 100644 index 000000000..6096cea0a --- /dev/null +++ b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_ccsds_if.hpp @@ -0,0 +1,25 @@ +/** + * @file + * @brief sils_sci_ccsds_if + * @details WINGS TMTC IFとCCSDSのTransfer FrameをSCI COMでやりとりするIF + * Windows上でcom0comを使うことを想定 + * SCIComPort classは基本的にEQU ZEUSのコードを流用 + */ +#ifndef SILS_SCI_CCSDS_IF_HPP_ +#define SILS_SCI_CCSDS_IF_HPP_ + +#include +#include "sils_sci_if.hpp" + +class SCIComPortCcsds : public SCIComPort +{ +public: + SCIComPortCcsds(int port) : SCIComPort(port) {}; + ~SCIComPortCcsds(void) {}; +}; + +int SILS_SCI_CCSDS_IF_init(); +int SILS_SCI_CCSDS_IF_TX(unsigned char* data_v, int count); +int SILS_SCI_CCSDS_IF_RX(unsigned char* data_v, int count); + +#endif diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_if.cpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_if.cpp index a3109651f..37b218820 100644 --- a/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_if.cpp +++ b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_if.cpp @@ -7,12 +7,12 @@ #include "sils_sci_if.hpp" -#ifdef WIN32 +#ifdef _WIN32 SCIComPort::SCIComPort(int port) { - char port_settings[15]; - snprintf(port_settings, 15, "%s%d", "\\\\.\\COM", port); - myHComPort_ = CreateFile(port_settings, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + char port_name[15]; + snprintf(port_name, 15, "%s%d", "\\\\.\\COM", port); + myHComPort_ = CreateFile(port_name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if ((int)myHComPort_ == -1) { @@ -97,9 +97,9 @@ int SCIComPort::Receive(unsigned char* buffer, size_t offset, size_t count) SCIComPort::SCIComPort(int port) { - char port_settings[13]; - snprintf(port_settings, 13, "%s%d", "/dev/tnt", port); - if ((myHComPort_ = open(port_settings, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) + char port_name[13]; + snprintf(port_name, 13, "%s%d", "/dev/tnt", port); + if ((myHComPort_ = open(port_name, O_RDWR | O_NOCTTY | O_NONBLOCK)) < 0) { close(myHComPort_); init_success = false; diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_if.hpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_if.hpp index 6f9dd694f..568bf6099 100644 --- a/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_if.hpp +++ b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_if.hpp @@ -6,7 +6,7 @@ #ifndef SILS_SCI_IF_HPP_ #define SILS_SCI_IF_HPP_ -#ifdef WIN32 +#ifdef _WIN32 #include #else #include @@ -27,7 +27,7 @@ class SCIComPort int Receive(unsigned char* buffer, size_t length, size_t offset); private: -#ifdef WIN32 +#ifdef _WIN32 HANDLE myHComPort_; DCB config_; #else diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils_sci_if.cpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_uart_if.cpp similarity index 59% rename from Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils_sci_if.cpp rename to Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_uart_if.cpp index 5ef70143b..10dcc38bd 100644 --- a/Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils_sci_if.cpp +++ b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_uart_if.cpp @@ -1,18 +1,18 @@ #pragma section REPRO /** * @file - * @brief uart_sils_sci_if + * @brief sils_sci_uart_if * @details SILSでDriverのテストをするように作った */ -#include "uart_sils_sci_if.hpp" +#include "sils_sci_uart_if.hpp" // 最初だけ初期化して、プログラム終了時にポートを閉じるようにしたい -#ifdef WIN32 -static SCIComPortUart SILS_SCI_IF_sci_com_uart_(13); +#ifdef _WIN32 +static SCIComPortUart SILS_SCI_UART_IF_sci_com_(13); #else -static SCIComPortUart SILS_SCI_IF_sci_com_uart_(3); +static SCIComPortUart SILS_SCI_UART_IF_sci_com_(3); #endif @@ -23,13 +23,13 @@ int SILS_SCI_UART_IF_init(void) int SILS_SCI_UART_IF_TX(unsigned char* data_v, int count) { - SILS_SCI_IF_sci_com_uart_.Send(data_v, 0, count); + SILS_SCI_UART_IF_sci_com_.Send(data_v, 0, count); return 0; } int SILS_SCI_UART_IF_RX(unsigned char* data_v, int count) { - return SILS_SCI_IF_sci_com_uart_.Receive(data_v, 0, count); + return SILS_SCI_UART_IF_sci_com_.Receive(data_v, 0, count); } #pragma section diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils_sci_if.hpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_uart_if.hpp similarity index 74% rename from Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils_sci_if.hpp rename to Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_uart_if.hpp index d58e33124..4ee7127dd 100644 --- a/Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils_sci_if.hpp +++ b/Examples/minimum_user/src/src_user/IfWrapper/Sils/sils_sci_uart_if.hpp @@ -1,11 +1,11 @@ /** * @file - * @brief uart_sils_sci_if + * @brief sils_sci_uart_if * @details SILSでDriverのテストをするように作った - ccsds_sils_sci_if.c/hのほぼコピー + sils_sci_ccsds_if.c/hのほぼコピー */ -#ifndef UART_SILS_SCI_IF_HPP_ -#define UART_SILS_SCI_IF_HPP_ +#ifndef SILS_SCI_UART_IF_HPP_ +#define SILS_SCI_UART_IF_HPP_ #include "sils_sci_if.hpp" diff --git a/Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils.cpp b/Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils.cpp index 2209d1b39..f289a7e9a 100644 --- a/Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils.cpp +++ b/Examples/minimum_user/src/src_user/IfWrapper/Sils/uart_sils.cpp @@ -3,7 +3,7 @@ #include "../../Settings/port_config.h" #ifdef USE_SCI_COM_UART -#include "uart_sils_sci_if.hpp" +#include "sils_sci_urat_if.hpp" #endif int OBC_C2A_SendFromObc(int port_id, unsigned char* buffer, int offset, int count);