-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created header_format_esttc in hopes of replacing heron_rx_bb. Listed…
… heron_rx_bb as deprecated.
- Loading branch information
1 parent
d36c9cc
commit dddc7cc
Showing
13 changed files
with
325 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
id: UTAT_HERON_header_format_esttc | ||
label: ESTTC Header Format | ||
category: '[UTAT]' | ||
flags: [ show_id, python, cpp ] | ||
|
||
value: ${ UTAT_HERON.header_format_esttc() } | ||
|
||
templates: | ||
imports: from gnuradio import UTAT_HERON | ||
var_make: self.${id} = ${id} = UTAT_HERON.header_format_esttc() | ||
|
||
cpp_templates: | ||
includes: ['#include <gnuradio/UTAT_HERON/header_format_esttc.h>'] | ||
declarations: 'UTAT_HERON::header_format_esttc::sptr ${id};' | ||
var_make: this->${id} = ${id} = UTAT_HERON::header_format_esttc(); | ||
link: ['gnuradio::gnuradio-digital'] | ||
|
||
# Make one 'parameters' list entry for every parameter you want settable from the GUI. | ||
# Keys include: | ||
# * id (makes the value accessible as keyname, e.g. in the make entry) | ||
# * label (label shown in the GUI) | ||
# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...) | ||
# * default | ||
# parameters: | ||
# - id: parametername_replace_me | ||
# label: FIX ME: | ||
# dtype: string | ||
# default: You need to fill in your grc/UTAT_HERON_header_format_esttc.block.yaml | ||
#- id: ... | ||
# label: ... | ||
# dtype: ... | ||
|
||
# Make one 'inputs' list entry per input and one 'outputs' list entry per output. | ||
# Keys include: | ||
# * label (an identifier for the GUI) | ||
# * domain (optional - stream or message. Default is stream) | ||
# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...) | ||
# * vlen (optional - data stream vector length. Default is 1) | ||
# * optional (optional - set to 1 for optional inputs. Default is 0) | ||
inputs: | ||
#- label: ... | ||
# domain: ... | ||
# dtype: ... | ||
# vlen: ... | ||
# optional: ... | ||
|
||
outputs: | ||
#- label: ... | ||
# domain: ... | ||
# dtype: ... | ||
# vlen: ... | ||
# optional: ... | ||
|
||
# 'file_format' specifies the version of the GRC yml format used in the file | ||
# and should usually not be changed. | ||
file_format: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2023 University of Toronto Aerospace Team. | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#ifndef INCLUDED_UTAT_HERON_HEADER_FORMAT_ESTTC_H | ||
#define INCLUDED_UTAT_HERON_HEADER_FORMAT_ESTTC_H | ||
|
||
#include <gnuradio/UTAT_HERON/api.h> | ||
#include <gnuradio/digital/header_format_default.h> | ||
|
||
namespace gr { | ||
namespace UTAT_HERON { | ||
|
||
/*! | ||
* \brief <+description+> | ||
* | ||
*/ | ||
class UTAT_HERON_API header_format_esttc : public gr::digital::header_format_default | ||
{ | ||
public: | ||
typedef std::shared_ptr<header_format_esttc> sptr; | ||
static sptr make(); | ||
header_format_esttc(); | ||
~header_format_esttc(); | ||
bool format( | ||
int nbytes_in, | ||
const unsigned char* input, | ||
pmt::pmt_t& output, | ||
pmt::pmt_t& info) override; | ||
size_t header_nbits() const override; | ||
protected: | ||
void enter_have_sync() override; | ||
void enter_have_header(int payload_len) override; | ||
void enter_search() override; | ||
bool header_ok() override; | ||
int header_payload() override; | ||
}; | ||
|
||
} // namespace UTAT_HERON | ||
} // namespace gr | ||
|
||
#endif /* INCLUDED_UTAT_HERON_HEADER_FORMAT_ESTTC_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2023 University of Toronto Aerospace Team. | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#include <gnuradio/UTAT_HERON/header_format_esttc.h> | ||
#include <gnuradio/io_signature.h> | ||
#include <volk/volk_alloc.hh> | ||
|
||
namespace gr { | ||
namespace UTAT_HERON { | ||
|
||
header_format_esttc::sptr header_format_esttc::make(){ | ||
return header_format_esttc::sptr(new header_format_esttc()); | ||
} | ||
|
||
header_format_esttc::header_format_esttc(): | ||
header_format_default("101010101010101010101010101010101010101001111110", 3, 1) | ||
{} | ||
|
||
header_format_esttc::~header_format_esttc() {} | ||
|
||
bool header_format_esttc::format(int nbytes_in, | ||
const unsigned char* input, | ||
pmt::pmt_t& output, | ||
pmt::pmt_t& info) | ||
{ | ||
|
||
if(nbytes_in > 128) | ||
throw std::runtime_error("header_format_esttc: Packet length cannot exceed 128 bits"); | ||
|
||
// Creating the output pmt copies data; free our own here when done. | ||
volk::vector<uint8_t> bytes_out(header_nbytes()); | ||
|
||
gr::digital::header_buffer header(bytes_out.data()); | ||
header.add_field64(d_access_code, d_access_code_len); | ||
header.add_field8((uint8_t)(nbytes_in)); | ||
|
||
// Package output data into a PMT vector | ||
output = pmt::init_u8vector(header_nbytes(), bytes_out.data()); | ||
|
||
return true; | ||
} | ||
|
||
|
||
size_t header_format_esttc::header_nbits() const{ | ||
return d_access_code_len + 8 * 1 * sizeof(uint8_t); | ||
} | ||
|
||
inline void header_format_esttc::enter_have_sync(){ | ||
d_state = STATE_HAVE_SYNC; | ||
d_hdr_reg.clear(); | ||
} | ||
inline void header_format_esttc::enter_have_header(int payload_len){ | ||
d_state = STATE_SYNC_SEARCH; | ||
d_pkt_len = payload_len; | ||
d_pkt_count = 0; | ||
} | ||
inline void header_format_esttc::enter_search(){ | ||
d_state = STATE_SYNC_SEARCH; | ||
} | ||
|
||
bool header_format_esttc::header_ok(){ | ||
return d_hdr_reg.length() == 8 * 1 * sizeof(uint8_t); | ||
} | ||
|
||
int header_format_esttc::header_payload(){ | ||
|
||
uint8_t len = d_hdr_reg.extract_field16(0, 8); | ||
|
||
d_info = pmt::make_dict(); | ||
d_info = pmt::dict_add( | ||
d_info, pmt::intern("payload symbols"), pmt::from_long(8 * len / d_bps)); | ||
return static_cast<int>(len); | ||
} | ||
|
||
} /* namespace UTAT_HERON */ | ||
} /* namespace gr */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* -*- c++ -*- */ | ||
/* | ||
* Copyright 2023 University of Toronto Aerospace Team. | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#include <gnuradio/UTAT_HERON/header_format_esttc.h> | ||
#include <gnuradio/attributes.h> | ||
#include <boost/test/unit_test.hpp> | ||
|
||
namespace gr { | ||
namespace UTAT_HERON { | ||
|
||
BOOST_AUTO_TEST_CASE(test_header_format_esttc_replace_with_specific_test_name) | ||
{ | ||
// Put test here | ||
BOOST_TEST(1); | ||
} | ||
|
||
} /* namespace UTAT_HERON */ | ||
} /* namespace gr */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
python/UTAT_HERON/bindings/docstrings/header_format_esttc_pydoc_template.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2023 Free Software Foundation, Inc. | ||
* | ||
* This file is part of GNU Radio | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
* | ||
*/ | ||
#include "pydoc_macros.h" | ||
#define D(...) DOC(gr, UTAT_HERON, __VA_ARGS__) | ||
/* | ||
This file contains placeholders for docstrings for the Python bindings. | ||
Do not edit! These were automatically extracted during the binding process | ||
and will be overwritten during the build process | ||
*/ | ||
|
||
|
||
|
||
static const char *__doc_gr_UTAT_HERON_header_format_esttc = R"doc()doc"; | ||
|
||
|
||
static const char *__doc_gr_UTAT_HERON_header_format_esttc_header_format_esttc = R"doc()doc"; | ||
|
||
|
||
static const char *__doc_gr_UTAT_HERON_header_format_esttc_make = R"doc()doc"; | ||
|
||
|
||
static const char *__doc_gr_UTAT_HERON_header_format_esttc_format = R"doc()doc"; | ||
|
||
|
||
static const char *__doc_gr_UTAT_HERON_header_format_esttc_header_nbits = R"doc()doc"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright 2023 Free Software Foundation, Inc. | ||
* | ||
* This file is part of GNU Radio | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
* | ||
*/ | ||
|
||
/***********************************************************************************/ | ||
/* This file is automatically generated using bindtool and can be manually edited */ | ||
/* The following lines can be configured to regenerate this file during cmake */ | ||
/* If manual edits are made, the following tags should be modified accordingly. */ | ||
/* BINDTOOL_GEN_AUTOMATIC(0) */ | ||
/* BINDTOOL_USE_PYGCCXML(0) */ | ||
/* BINDTOOL_HEADER_FILE(header_format_esttc.h) */ | ||
/* BINDTOOL_HEADER_FILE_HASH(41bda5cf854f7a82ab2d53b92e58e7f5) */ | ||
/***********************************************************************************/ | ||
|
||
#include <pybind11/complex.h> | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/stl.h> | ||
|
||
namespace py = pybind11; | ||
|
||
#include <gnuradio/UTAT_HERON/header_format_esttc.h> | ||
// pydoc.h is automatically generated in the build directory | ||
#include <header_format_esttc_pydoc.h> | ||
|
||
void bind_header_format_esttc(py::module& m) | ||
{ | ||
|
||
using header_format_esttc = gr::UTAT_HERON::header_format_esttc; | ||
|
||
|
||
py::class_<header_format_esttc, gr::digital::header_format_default, | ||
std::shared_ptr<header_format_esttc>>(m, "header_format_esttc", D(header_format_esttc)) | ||
|
||
.def(py::init(&header_format_esttc::make), | ||
D(header_format_esttc,make) | ||
) | ||
.def_static( | ||
"make", | ||
&header_format_esttc::make, | ||
D(header_format_esttc,make) | ||
) | ||
.def( | ||
"format", | ||
&header_format_esttc::format, | ||
py::arg("nbytes_in"), | ||
py::arg("input"), | ||
py::arg("output"), | ||
py::arg("info"), | ||
D(header_format_esttc, format)) | ||
.def( | ||
"header_nbits", | ||
&header_format_esttc::header_nbits, | ||
D(header_format_esttc, header_nbits)) | ||
|
||
|
||
|
||
; | ||
|
||
|
||
|
||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.