File ccsds_415_frame.h¶
FileList > ccsds > ccsds_415_frame.h
Go to the source code of this file
One period of the CCSDS 415.1-B-1 point's stimulus as a frame description: the gap, the acquisition sequence, the start sequence and one CCSDS TC transfer frame (232.0-B-4), field by field. More...
#include "doppler/ccsds/ccsds_415.h"#include "doppler/wfm/wfm_frame.h"#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | dp_ccsds_415_frame_cfg_t |
| struct | dp_ccsds_415_frame_t |
Public Functions¶
| Type | Name |
|---|---|
| int | dp_ccsds_415_frame_desc (dp_ccsds_415_frame_t * f, const dp_ccsds_415_frame_cfg_t * cfg, size_t data_octets, const char ** why) Describe one period of the 415.1-B-1 stimulus with a frame of data_octets data octets. |
| size_t | dp_ccsds_415_period (const dp_ccsds_415_frame_cfg_t * cfg, const uint8_t * data, size_t data_octets, uint8_t * out, size_t max_out, size_t * data_off, const char ** why) Assemble one period of the 415.1-B-1 stimulus: the gap, the acquisition and start sequences and one TC transfer frame whose data field is data . |
Macros¶
| Type | Name |
|---|---|
| define | DP_CCSDS_415_ACQ_BITS 128u |
| define | DP_CCSDS_415_DATA_MAX 1017u |
| define | DP_CCSDS_415_DATA_MIN 1u |
| define | DP_CCSDS_415_FRAME_CFG_DEFAULTS { 42u, 1u, 0u, [**DP\_CCSDS\_415\_CODE\_ONLY\_SYM**](ccsds__415_8h.md#define-dp_ccsds_415_code_only_sym) } |
| define | DP_CCSDS_415_HEADER_BITS 40u |
| define | DP_CCSDS_415_START_BITS 16u |
| define | DP_CCSDS_415_START_SEQ 0xEB90u |
Detailed Description¶
docs/design/async-dsss-receiver.md §1.4 states the period; this is that table as DATA, a configuration of the general description in wfm/wfm_frame.h (which knows nothing about CCSDS), as dp_ccsds_tm_frame_describe() is 131.0-B's. Every field is named, so a caller reads a field's place by name (dp_wfm_frame_field_index(), dp_wfm_frame_desc_layout()) and checks the frame with dp_wfm_frame_desc_crc_ok() or dp_wfm_frame_check().
| field | bits | content |
|---|---|---|
gap |
gap_sym |
zeros: the code alone (415.1-B-1 §6.1) |
acq |
128 | 1010...: the acquisition sequence (231.0-B-4 §7.2.2), WFM_SEQ_DOTTED |
start |
16 | EB90, bit 0 first (231.0-B-4 §5.2.2.2) |
version |
2 | 00 (232.0-B-4 §4.1.2.2.2) |
bypass |
1 | 1, Type-B (§4.1.2.3.1) |
ctrl_cmd |
1 | 0, Type-D (§4.1.2.3.2) |
spare |
2 | 00 (§4.1.2.4.2) |
scid |
10 | the spacecraft identifier (§4.1.2.5) |
vcid |
6 | the virtual channel identifier (§4.1.2.6) |
length |
10 | the frame's octets minus one (§4.1.2.7.2) |
seq |
8 | the frame sequence number (§4.1.2.8) |
data |
8 x octets | the frame's data source (WFM_SEQ_DATA) |
fecf |
16 | CRC-16 over version .. data (§4.1.4) |
The FECF is the description's own CRC stage, WFM_STAGE_CRC16: CRC-16 with G(X) = X^16 + X^12 + X^5 + 1, preset to all ones, no final inversion (dp_crc16_ccitt(), DP_CRC_16_IBM_3740), which is 232.0-B-4 §4.1.4.2's.
Field 0 is the gap, not the start sequence, so dp_wfm_frame_desc_rx(), which reads a receiver's sync word from field 0, refuses this description (test_ccsds_415_frame.c pins the refusal). A receiver finds the frame by searching for the start sequence itself: detection's SyncFinder on the start field's bits.
The description BORROWS the bit arrays in its dp_ccsds_415_frame_t, so use it in place: a copy of the struct points into the original.
#include <doppler/ccsds/ccsds_415_frame.h>
dp_ccsds_415_frame_t f;
dp_ccsds_415_frame_cfg_t cfg = DP_CCSDS_415_FRAME_CFG_DEFAULTS;
wfm_frame_desc_layout_t lay;
if (dp_ccsds_415_frame_desc (&f, &cfg, 17, NULL) != 0
|| dp_wfm_frame_desc_layout (&f.desc, &lay) != 0)
return 1;
// lay.frame_bits == 275 + 128 + 16 + 40 + 17 * 8 + 16
Public Functions Documentation¶
function dp_ccsds_415_frame_desc¶
Describe one period of the 415.1-B-1 stimulus with a frame of data_octets data octets.
int dp_ccsds_415_frame_desc (
dp_ccsds_415_frame_t * f,
const dp_ccsds_415_frame_cfg_t * cfg,
size_t data_octets,
const char ** why
)
Fills f in place (see the file comment for the fields). The data field is a WFM_SEQ_DATA field: its bits come from the caller at assembly (dp_wfm_frame_assemble_data()). The header's length is written here, 5 + data_octets + 2 - 1, since a description is one frame of one known length.
Parameters:
freceives the description and the bits it borrows.cfgthe arbitrary values and the gap; NULL takes DP_CCSDS_415_FRAME_CFG_DEFAULTS.data_octetsthe data field's octets, DP_CCSDS_415_DATA_MIN to DP_CCSDS_415_DATA_MAX.whyon refusal, receives a static sentence naming the fix; may be NULL.
Returns:
0, or -1 with why set: data octets out of range, a value that does not fit its field, a gap of zero or more than WFM_FIELD_MAX_BITS symbols, or NULL f.
dp_ccsds_415_frame_t f;
const char *why = NULL;
if (dp_ccsds_415_frame_desc (&f, NULL, 1018, &why) != 0)
puts (why); // the data field holds 1 to 1,017 octets ...
function dp_ccsds_415_period¶
Assemble one period of the 415.1-B-1 stimulus: the gap, the acquisition and start sequences and one TC transfer frame whose data field is data .
size_t dp_ccsds_415_period (
const dp_ccsds_415_frame_cfg_t * cfg,
const uint8_t * data,
size_t data_octets,
uint8_t * out,
size_t max_out,
size_t * data_off,
const char ** why
)
The one place a period becomes bits: dp_ccsds_415_frame_desc() describes it and dp_wfm_frame_assemble_data() assembles it, the FECF computed over the header and data. The rpm-consumer example sends its stimulus through this and the specification point's draw certifies against it, so the two cannot send different periods.
Parameters:
cfgthe arbitrary values and the gap; NULL takes DP_CCSDS_415_FRAME_CFG_DEFAULTS.datathe data field,8 x data_octetsbits, one a byte (0 or 1), first bit on the wire first. May be NULL only whenoutis NULL.data_octetsDP_CCSDS_415_DATA_MIN to DP_CCSDS_415_DATA_MAX.outreceives the period, one bit a byte; NULL asks for its length alone.max_outbitsoutholds.data_offreceives the data field's first bit within the period; may be NULL.whyon refusal, receives a static sentence naming the fix; may be NULL.
Returns:
the period's length in bits (written to out unless it is NULL), or 0 with why set: dp_ccsds_415_frame_desc()'s refusals, NULL data with a non-NULL out, or max_out shorter than the period.
uint8_t data[8 * 17] = { 0 }, period[1024];
size_t at = 0;
const size_t n = dp_ccsds_415_period (NULL, data, 17, period,
sizeof period, &at, NULL);
// n == 275 + 128 + 16 + 40 + 17 * 8 + 16, at == 275 + 184
Macro Definition Documentation¶
define DP_CCSDS_415_ACQ_BITS¶
Bits of the acquisition sequence (231.0-B-4 §7.2.2's preferred minimum, 16 octets).
define DP_CCSDS_415_DATA_MAX¶
The most data octets a frame carries with its FECF present (232.0-B-4 §4.1.3.1.2): a 1,024-octet frame.
define DP_CCSDS_415_DATA_MIN¶
The fewest data octets a frame carries (232.0-B-4 §4.1.3.1.2).
define DP_CCSDS_415_FRAME_CFG_DEFAULTS¶
§1.4's values: SCID 42, VCID 1, sequence 0, and a gap of the point's code-only symbols (DP_CCSDS_415_CODE_ONLY_SYM).
define DP_CCSDS_415_HEADER_BITS¶
Bits of the transfer frame's primary header (232.0-B-4 §4.1.2).
define DP_CCSDS_415_START_BITS¶
Bits of the start sequence.
define DP_CCSDS_415_START_SEQ¶
The start sequence, EB90, sent from its most significant bit.
The documentation for this class was generated from the following file native/inc/doppler/ccsds/ccsds_415_frame.h