Skip to content

Commit 0209437

Browse files
committed
Update horus_gen_test_bits to generate v2 mode packets
1 parent c7c3810 commit 0209437

File tree

3 files changed

+469
-9
lines changed

3 files changed

+469
-9
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ add_executable(drs232_ldpc drs232_ldpc.c)
5656
target_link_libraries(drs232_ldpc m horus ${CMAKE_REQUIRED_LIBRARIES})
5757

5858
add_definitions(-DINTERLEAVER -DSCRAMBLER -DRUN_TIME_TABLES)
59-
add_executable(horus_gen_test_bits horus_gen_test_bits.c)
59+
add_executable(horus_gen_test_bits horus_gen_test_bits.c horus_l2.c)
6060
target_link_libraries(horus_gen_test_bits m horus)
6161

6262
add_definitions(-DHORUS_L2_RX -DINTERLEAVER -DSCRAMBLER -DRUN_TIME_TABLES)

src/horus_gen_test_bits.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <getopt.h>
2020

2121
#include "horus_l2.h"
22+
#include "H_128_384_23.h"
23+
#include "H_256_768_22.h"
2224

2325
// TODO: Move these packet format definitions to somehwere common.
2426

@@ -134,17 +136,14 @@ int main(int argc,char *argv[]) {
134136
int nbytes = sizeof(struct TBinaryPacket1);
135137
struct TBinaryPacket1 input_payload;
136138

137-
// TODO: Add Calculation of expected number of TX bytes based on LDPC code.
138-
int num_tx_data_bytes = nbytes;
139+
int num_tx_data_bytes = 4 + H_256_768_22_DATA_BYTES + H_256_768_22_PARITY_BYTES;
139140
unsigned char tx[num_tx_data_bytes];
140141

141142
/* all zeros is nastiest sequence for demod before scrambling */
142143
memset(&input_payload, 0, nbytes);
143144
input_payload.Checksum = horus_l2_gen_crc16((unsigned char*)&input_payload, nbytes-2);
144145

145-
146-
// TODO: Replaced with LDPC Encoding
147-
memcpy(tx, (unsigned char*)&input_payload, nbytes);
146+
int ldpc_tx_bytes = ldpc_encode_packet(tx, (unsigned char*)&input_payload, 1);
148147

149148
int b;
150149
uint8_t tx_bit;
@@ -164,16 +163,15 @@ int main(int argc,char *argv[]) {
164163
struct TBinaryPacket2 input_payload;
165164

166165
// TODO: Add Calculation of expected number of TX bytes based on LDPC code.
167-
int num_tx_data_bytes = nbytes;
166+
int num_tx_data_bytes = 4 + H_128_384_23_DATA_BYTES + H_128_384_23_PARITY_BYTES;
168167
unsigned char tx[num_tx_data_bytes];
169168

170169
/* all zeros is nastiest sequence for demod before scrambling */
171170
memset(&input_payload, 0, nbytes);
172171
input_payload.Checksum = horus_l2_gen_crc16((unsigned char*)&input_payload, nbytes-2);
173172

174173

175-
// TODO: Replaced with LDPC Encoding
176-
memcpy(tx, (unsigned char*)&input_payload, nbytes);
174+
int ldpc_tx_bytes = ldpc_encode_packet(tx, (unsigned char*)&input_payload, 2);
177175

178176
int b;
179177
uint8_t tx_bit;

0 commit comments

Comments
 (0)