C2A_Core
tc_transfer_frame.h ファイル

CCSDS で規定される TC Transfer Frame の実装 [詳解]

#include <stddef.h>
#include <stdint.h>
#include "tc_segment.h"
tc_transfer_frame.h の依存先関係図:
被依存関係図:

[ソースコード]

データ構造

struct  TcTransferFrame
 TC Transfer Frame のパケット構造体 [詳解]
 

マクロ定義

#define TCTF_MAX_LEN   (1024)
 
#define TCTF_HEADER_SIZE   (5)
 
#define TCTF_FECF_SIZE   (2)
 
#define TCTF_BC_CMD_CODE_UNLOCK   (0x00)
 
#define TCTF_BC_CMD_CODE_SET_VR_1ST_BYTE   (0x82)
 
#define TCTF_BC_CMD_CODE_SET_VR_2ND_BYTE   (0x00)
 

列挙型

enum  TCTF_VER { TCTF_VER_1 = 0 , TCTF_VER_UNKNOWN }
 Version [詳解]
 
enum  TCTF_TYPE { TCTF_TYPE_AD = 0 , TCTF_TYPE_BD = 2 , TCTF_TYPE_BC = 3 , TCTF_TYPE_UNKNOWN }
 Type [詳解]
 
enum  TCTF_SCID { TCTF_SCID_SAMPLE_SATELLITE = 0x157 , TCTF_SCID_UNKNOWN }
 Spacecraft ID [詳解]
 
enum  TCTF_VCID { TCTF_VCID_REALTIME = 0 , TCTF_VCID_UNKNOWN }
 Virtual Channel ID [詳解]
 

関数

TCTF_VER TCTF_get_ver (const TcTransferFrame *tctf)
 version を取得 [詳解]
 
TCTF_TYPE TCTF_get_type (const TcTransferFrame *tctf)
 command type を取得 [詳解]
 
TCTF_SCID TCTF_get_scid (const TcTransferFrame *tctf)
 SCID を取得 [詳解]
 
TCTF_VCID TCTF_get_vcid (const TcTransferFrame *tctf)
 VCID を取得 [詳解]
 
uint16_t TCTF_get_frame_len (const TcTransferFrame *tctf)
 Frame Length を取得 [詳解]
 
uint8_t TCTF_get_frame_seq_num (const TcTransferFrame *tctf)
 Frame Sequence Number を取得 [詳解]
 
uint16_t TCTF_get_fecw (const TcTransferFrame *tctf)
 FECW を取得 [詳解]
 
const TcSegmentTCTF_get_tc_segment (const TcTransferFrame *tctf)
 TC Segment を取得 [詳解]
 
uint8_t TCTF_check_fecw (const TcTransferFrame *tctf)
 TCTF FECW のチェック [詳解]
 
const TcTransferFrameTCTF_convert_from_bytes_to_tctf (const uint8_t *byte)
 受信 byte 列を TcTransferFrame* に変換 [詳解]
 

詳解

CCSDS で規定される TC Transfer Frame の実装

覚え書き
packet 構造 |------—+----—+----—+-----------------------—| | Pos | Pos | Size | Name | | [octet] | [bit] | [bit] | | |------—+----—+----—+-----------------------—| | === Primary Header ================================| |------—+----—+----—+-----------------------—| | 0 | 0 | 2 | Version | | 0 | 2 | 2 | Type | | 0 | 4 | 2 | N/A | | 0 | 6 | 10 | Spacecraft ID | | 2 | 0 | 6 | Virtual Channel ID | | 2 | 6 | 10 | Frame Length | | 4 | 0 | 8 | Frame Sequence Number | |------—+----—+----—+-----------------------—| | === User Data Field ===============================| |------—+----—+----—+-----------------------—| | 5 | 0 | * | TC Segment | |------—+----—+----—+-----------------------—| | === Frame Error Control Field =====================| |------—+----—+----—+-----------------------—| | * | 0 | 16 | Frame Error Control Word | |------—+----—+----—+-----------------------—|

tc_transfer_frame.h に定義があります。

マクロ定義詳解

◆ TCTF_BC_CMD_CODE_SET_VR_1ST_BYTE

#define TCTF_BC_CMD_CODE_SET_VR_1ST_BYTE   (0x82)

tc_transfer_frame.h41 行目に定義があります。

◆ TCTF_BC_CMD_CODE_SET_VR_2ND_BYTE

#define TCTF_BC_CMD_CODE_SET_VR_2ND_BYTE   (0x00)

tc_transfer_frame.h42 行目に定義があります。

◆ TCTF_BC_CMD_CODE_UNLOCK

#define TCTF_BC_CMD_CODE_UNLOCK   (0x00)

tc_transfer_frame.h40 行目に定義があります。

◆ TCTF_FECF_SIZE

#define TCTF_FECF_SIZE   (2)

tc_transfer_frame.h38 行目に定義があります。

◆ TCTF_HEADER_SIZE

#define TCTF_HEADER_SIZE   (5)

tc_transfer_frame.h37 行目に定義があります。

◆ TCTF_MAX_LEN

#define TCTF_MAX_LEN   (1024)

tc_transfer_frame.h36 行目に定義があります。

列挙型詳解

◆ TCTF_SCID

enum TCTF_SCID

Spacecraft ID

覚え書き
10 bit
列挙値
TCTF_SCID_SAMPLE_SATELLITE 
TCTF_SCID_UNKNOWN 

tc_transfer_frame.h86 行目に定義があります。

◆ TCTF_TYPE

enum TCTF_TYPE

Type

覚え書き
2 bit
列挙値
TCTF_TYPE_AD 
TCTF_TYPE_BD 
TCTF_TYPE_BC 
TCTF_TYPE_UNKNOWN 

tc_transfer_frame.h73 行目に定義があります。

◆ TCTF_VCID

enum TCTF_VCID

Virtual Channel ID

覚え書き
6 bit
列挙値
TCTF_VCID_REALTIME 
TCTF_VCID_UNKNOWN 

tc_transfer_frame.h97 行目に定義があります。

◆ TCTF_VER

enum TCTF_VER

Version

覚え書き
2 bit
列挙値
TCTF_VER_1 
TCTF_VER_UNKNOWN 

tc_transfer_frame.h62 行目に定義があります。

関数詳解

◆ TCTF_check_fecw()

uint8_t TCTF_check_fecw ( const TcTransferFrame tctf)

TCTF FECW のチェック

引数
[in]tctfTcTransferFrame
戻り値
bool: 1: ok, 0: error
覚え書き
ここでは標準として CRC-16-CCITT を採用している

tc_transfer_frame.c119 行目に定義があります。

呼び出し関係図:
被呼び出し関係図:

◆ TCTF_convert_from_bytes_to_tctf()

const TcTransferFrame* TCTF_convert_from_bytes_to_tctf ( const uint8_t *  byte)

受信 byte 列を TcTransferFrame* に変換

引数
[in]byte受信 byte 列
戻り値
TcTransferFrame*

tc_transfer_frame.c127 行目に定義があります。

被呼び出し関係図:

◆ TCTF_get_fecw()

uint16_t TCTF_get_fecw ( const TcTransferFrame tctf)

FECW を取得

引数
[in]tctfTcTransferFrame
戻り値
FECW
覚え書き
エンディアンは既に考慮されている (ccsds は big endian)

tc_transfer_frame.c108 行目に定義があります。

呼び出し関係図:

◆ TCTF_get_frame_len()

uint16_t TCTF_get_frame_len ( const TcTransferFrame tctf)

Frame Length を取得

引数
[in]tctfTcTransferFrame
戻り値
Frame Length

tc_transfer_frame.c84 行目に定義があります。

被呼び出し関係図:

◆ TCTF_get_frame_seq_num()

uint8_t TCTF_get_frame_seq_num ( const TcTransferFrame tctf)

Frame Sequence Number を取得

引数
[in]tctfTcTransferFrame
戻り値
Frame Sequence Number

tc_transfer_frame.c98 行目に定義があります。

被呼び出し関係図:

◆ TCTF_get_scid()

TCTF_SCID TCTF_get_scid ( const TcTransferFrame tctf)

SCID を取得

引数
[in]tctfTcTransferFrame
戻り値
TCTF_SCID

tc_transfer_frame.c47 行目に定義があります。

被呼び出し関係図:

◆ TCTF_get_tc_segment()

const TcSegment* TCTF_get_tc_segment ( const TcTransferFrame tctf)

TC Segment を取得

引数
[in]tctfTcTransferFrame
戻り値
TC Segment

tc_transfer_frame.c103 行目に定義があります。

被呼び出し関係図:

◆ TCTF_get_type()

TCTF_TYPE TCTF_get_type ( const TcTransferFrame tctf)

command type を取得

引数
[in]tctfTcTransferFrame
戻り値
TCTF_TYPE

tc_transfer_frame.c28 行目に定義があります。

被呼び出し関係図:

◆ TCTF_get_vcid()

TCTF_VCID TCTF_get_vcid ( const TcTransferFrame tctf)

VCID を取得

引数
[in]tctfTcTransferFrame
戻り値
TCTF_VCID

tc_transfer_frame.c67 行目に定義があります。

被呼び出し関係図:

◆ TCTF_get_ver()

TCTF_VER TCTF_get_ver ( const TcTransferFrame tctf)

version を取得

引数
[in]tctfTcTransferFrame
戻り値
TCTF_VER

tc_transfer_frame.c11 行目に定義があります。

被呼び出し関係図: