Skip to content

Commit

Permalink
Update horus_gen_test_bits to generate v2 mode packets
Browse files Browse the repository at this point in the history
  • Loading branch information
darksidelemm committed Jul 11, 2020
1 parent c7c3810 commit 0209437
Show file tree
Hide file tree
Showing 3 changed files with 469 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ add_executable(drs232_ldpc drs232_ldpc.c)
target_link_libraries(drs232_ldpc m horus ${CMAKE_REQUIRED_LIBRARIES})

add_definitions(-DINTERLEAVER -DSCRAMBLER -DRUN_TIME_TABLES)
add_executable(horus_gen_test_bits horus_gen_test_bits.c)
add_executable(horus_gen_test_bits horus_gen_test_bits.c horus_l2.c)
target_link_libraries(horus_gen_test_bits m horus)

add_definitions(-DHORUS_L2_RX -DINTERLEAVER -DSCRAMBLER -DRUN_TIME_TABLES)
Expand Down
14 changes: 6 additions & 8 deletions src/horus_gen_test_bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include <getopt.h>

#include "horus_l2.h"
#include "H_128_384_23.h"
#include "H_256_768_22.h"

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

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

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

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


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

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

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

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


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

int b;
uint8_t tx_bit;
Expand Down
Loading

0 comments on commit 0209437

Please sign in to comment.