Skip to content

Commit

Permalink
fix var names
Browse files Browse the repository at this point in the history
  • Loading branch information
flap1 committed Oct 26, 2022
1 parent ae7ac20 commit 4e28f86
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 84 deletions.
4 changes: 2 additions & 2 deletions Examples/minimum_user/src/src_user/IfWrapper/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}
Expand All @@ -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;
Expand All @@ -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;

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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 <stddef.h>
#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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifndef SILS_SCI_IF_HPP_
#define SILS_SCI_IF_HPP_

#ifdef WIN32
#ifdef _WIN32
#include <Windows.h>
#else
#include <fcntl.h>
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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


Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4e28f86

Please sign in to comment.