-
Notifications
You must be signed in to change notification settings - Fork 0
/
ccsds-clcw.pk
62 lines (57 loc) · 2.05 KB
/
ccsds-clcw.pk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* @file ccsds-clcw.pk
* @author Conlan Wesson
* Poke support for CCSDS Communications Link Control Word (CLCW) (CCSDS 232.0-B-4 4.2.1).
*
* @ingroup ccsds
* @defgroup clcw CCSDS Communications Link Control Word (CLCW)
* @{
*/
/// CLCW Version 1 (4.2.1.3.2)
var CLCW_VERSION_1 = 0b00;
/**
* Communications Link Control Word
*/
type CLCW =
struct
{
uint<1> control_type : control_type == 0;
uint<2> version : version == CLCW_VERSION_1;
uint<3> status;
uint<2> cop_in_effect;
uint<6> vcid;
uint<2> spare1 = 0;
struct {
uint<1> no_rf_avail;
uint<1> no_bit_lock;
uint<1> lockout;
uint<1> wait;
uint<1> retransmit;
} flags;
uint<2> farm_b_counter;
uint<1> spare2 = 0;
uint<8> value;
/**
* Pretty printer.
*/
method _print = void:
{
print ("#<\n");
printf (" %<struct-field-name:Communications Link Control Word%>:\n");
printf (" %<struct-field-name:Version%>: %<integer:%u2d%>\n", version+1);
printf (" %<struct-field-name:Status%>: %<integer:%u3d%>\n", status);
printf (" %<struct-field-name:COP in Effect%>: %<integer:%u2d%>\n", cop_in_effect);
printf (" %<struct-field-name:Virtual Channel ID%>: %<integer:0x%u6x%>\n", vcid);
printf (" %<struct-field-name:Flags%>:\n");
printf (" %<struct-field-name:RF Available%>: %s\n", flags.no_rf_avail ? "No" : "Yes");
printf (" %<struct-field-name:Bit Lock%>: %s\n", flags.no_bit_lock ? "No" : "Yes");
printf (" %<struct-field-name:Lockout%>: %s\n", flags.lockout ? "Yes" : "No");
printf (" %<struct-field-name:Wait%>: %s\n", flags.wait ? "Yes" : "No");
printf (" %<struct-field-name:Retransmit%>: %s\n", flags.retransmit ? "Yes" : "No");
printf (" %<struct-field-name:FARM-B Counter%>: ...%<integer:%u2b%>\n", farm_b_counter);
printf (" %<struct-field-name:Report Value%>: %<integer:%u8d%>\n", value);
print (">\n");
}
};
assert(1#CLCW == 4#B);
/** @} */ // defgroup clcw