C2A_Core
tc_segment.c
[詳解]
1 #pragma section REPRO
6 #include "tc_segment.h"
7 
9 {
10  uint8_t pos = 0;
11  uint8_t mask = 0xc0; // 1100 0000b
12 
13  return (TCS_SEQ_FLAG)((tcs->packet[pos] & mask) >> 6);
14 }
15 
17 {
18  uint8_t pos = 0;
19  uint8_t mask = 0x3f; // 0011 1111b
20 
21  TCS_MAP_ID map_id = (TCS_MAP_ID)(tcs->packet[pos] & mask);
22 
23  switch (map_id)
24  {
25  case TCS_MAP_ID_DHU_HDC: // FALL THROUGH
26  case TCS_MAP_ID_NORMAL: // FALL THROUGH
27  case TCS_MAP_ID_LONG:
28  return map_id;
29 
30  default:
31  return TCS_MAP_ID_UNKNOWN;
32  }
33 }
34 
36 {
37  return (const CmdSpacePacket*)(&tcs->packet[TCS_HEADER_SIZE]);
38 }
39 
40 #pragma section
Space Packet (コマンド用)
TC Segment のパケット構造体
Definition: tc_segment.h:34
uint8_t packet[TCS_PACKET_MAX_LENGTH]
Definition: tc_segment.h:35
const CmdSpacePacket * TCS_get_command_space_packet(const TcSegment *tcs)
Command space packet 開始ポインタを取得
Definition: tc_segment.c:35
TCS_MAP_ID TCS_get_map_id(const TcSegment *tcs)
MAP ID を取得
Definition: tc_segment.c:16
TCS_SEQ_FLAG TCS_get_seq_flag(const TcSegment *tcs)
sequence flag を取得
Definition: tc_segment.c:8
CCSDS で規定される TC Segment の実装
TCS_MAP_ID
Multiplexer Access Point ID
Definition: tc_segment.h:57
@ TCS_MAP_ID_DHU_HDC
Definition: tc_segment.h:58
@ TCS_MAP_ID_LONG
Definition: tc_segment.h:60
@ TCS_MAP_ID_UNKNOWN
Definition: tc_segment.h:61
@ TCS_MAP_ID_NORMAL
Definition: tc_segment.h:59
TCS_SEQ_FLAG
Sequential Flag
Definition: tc_segment.h:44
#define TCS_HEADER_SIZE
Definition: tc_segment.h:26