C2A_Core
tc_transfer_frame.h
[詳解]
1 
28 #ifndef TC_TRANSFER_FRAME_H_
29 #define TC_TRANSFER_FRAME_H_
30 
31 #include <stddef.h>
32 #include <stdint.h>
33 
34 #include "tc_segment.h"
35 
36 #define TCTF_MAX_LEN (1024)
37 #define TCTF_HEADER_SIZE (5)
38 #define TCTF_FECF_SIZE (2)
39 
40 #define TCTF_BC_CMD_CODE_UNLOCK (0x00)
41 #define TCTF_BC_CMD_CODE_SET_VR_1ST_BYTE (0x82)
42 #define TCTF_BC_CMD_CODE_SET_VR_2ND_BYTE (0x00)
43 
44 #if TCTF_HEADER_SIZE + TCS_PACKET_MAX_LENGTH + TCTF_FECF_SIZE > TCTF_MAX_LEN
45 #error TCTCF LEN IS LONGER THAN TCTF MAX LEN
46 #endif
47 
52 typedef struct
53 {
54  uint8_t packet[TCTF_MAX_LEN];
56 
62 typedef enum
63 {
64  TCTF_VER_1 = 0, // 00b: Version 1
67 
73 typedef enum
74 {
75  TCTF_TYPE_AD = 0, // 00b: TC data with FARM
76  TCTF_TYPE_BD = 2, // 10b: TC data without FARM
77  TCTF_TYPE_BC = 3, // 11b: FARM Control Command
80 
86 typedef enum
87 {
88  TCTF_SCID_SAMPLE_SATELLITE = 0x157, // SCID for command of sample satellite
91 
97 typedef enum
98 {
102 
109 
116 
123 
130 
136 uint16_t TCTF_get_frame_len(const TcTransferFrame* tctf);
137 
143 uint8_t TCTF_get_frame_seq_num(const TcTransferFrame* tctf);
144 
151 uint16_t TCTF_get_fecw(const TcTransferFrame* tctf);
152 
158 const TcSegment* TCTF_get_tc_segment(const TcTransferFrame* tctf);
159 
166 uint8_t TCTF_check_fecw(const TcTransferFrame* tctf);
167 
173 const TcTransferFrame* TCTF_convert_from_bytes_to_tctf(const uint8_t* byte);
174 
175 #endif
C89 環境用 stdint.h
TC Segment のパケット構造体
Definition: tc_segment.h:34
TC Transfer Frame のパケット構造体
CCSDS で規定される TC Segment の実装
#define TCTF_MAX_LEN
const TcSegment * TCTF_get_tc_segment(const TcTransferFrame *tctf)
TC Segment を取得
TCTF_VER
Version
@ TCTF_VER_UNKNOWN
@ TCTF_VER_1
const TcTransferFrame * TCTF_convert_from_bytes_to_tctf(const uint8_t *byte)
受信 byte 列を TcTransferFrame* に変換
TCTF_SCID
Spacecraft ID
@ TCTF_SCID_UNKNOWN
@ TCTF_SCID_SAMPLE_SATELLITE
uint16_t TCTF_get_fecw(const TcTransferFrame *tctf)
FECW を取得
uint8_t TCTF_check_fecw(const TcTransferFrame *tctf)
TCTF FECW のチェック
uint16_t TCTF_get_frame_len(const TcTransferFrame *tctf)
Frame Length を取得
TCTF_TYPE TCTF_get_type(const TcTransferFrame *tctf)
command type を取得
TCTF_SCID TCTF_get_scid(const TcTransferFrame *tctf)
SCID を取得
TCTF_TYPE
Type
@ TCTF_TYPE_BD
@ TCTF_TYPE_AD
@ TCTF_TYPE_UNKNOWN
@ TCTF_TYPE_BC
TCTF_VER TCTF_get_ver(const TcTransferFrame *tctf)
version を取得
TCTF_VCID
Virtual Channel ID
@ TCTF_VCID_UNKNOWN
@ TCTF_VCID_REALTIME
uint8_t TCTF_get_frame_seq_num(const TcTransferFrame *tctf)
Frame Sequence Number を取得
TCTF_VCID TCTF_get_vcid(const TcTransferFrame *tctf)
VCID を取得