Skip to content

Commit 309739c

Browse files
Address code review feedback: fix bitfield, frame_length, add thread-safety note
Co-authored-by: Michal-Pogorzelec <80826463+Michal-Pogorzelec@users.noreply.github.com>
1 parent c63e1d3 commit 309739c

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

include/sdlp_tc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ typedef struct {
1616
uint8_t virtual_channel_id : 6;
1717
uint8_t reserved2 : 2;
1818
uint16_t frame_length : 10;
19-
uint16_t frame_sequence_number : 8;
19+
uint8_t frame_sequence_number;
2020
} sdlp_tc_header_t;
2121

2222
typedef struct {

src/sdlp_tc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int sdlp_tc_create_frame(sdlp_tc_frame_t *frame, uint16_t spacecraft_id,
1717
frame->header.spacecraft_id = spacecraft_id & 0x3FF;
1818
frame->header.virtual_channel_id = virtual_channel_id & 0x3F;
1919
frame->header.reserved2 = 0;
20-
frame->header.frame_length = data_length + TC_PRIMARY_HEADER_SIZE - 1;
20+
frame->header.frame_length = data_length - 1;
2121
frame->header.frame_sequence_number = frame_seq_num;
2222

2323
memcpy(frame->data, data, data_length);

src/sdlp_tm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "sdlp_tm.h"
22
#include <string.h>
33

4+
/* Note: not thread-safe, caller must ensure sequential access */
45
static uint8_t tm_frame_counter = 0;
56

67
int sdlp_tm_create_frame(sdlp_tm_frame_t *frame, uint16_t spacecraft_id,

0 commit comments

Comments
 (0)