summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreb2008-09-24 00:07:57 +0000
committereb2008-09-24 00:07:57 +0000
commit8979083cd32897b7fc258d071b17d19fae0cc9d1 (patch)
tree0e3b53d8bf3dc05d4511595eebe24655eeda9680
parent801b22a99512ed3dfd2b92bfc597bfc3451ccbc9 (diff)
downloadgnuradio-8979083cd32897b7fc258d071b17d19fae0cc9d1.tar.gz
gnuradio-8979083cd32897b7fc258d071b17d19fae0cc9d1.tar.bz2
gnuradio-8979083cd32897b7fc258d071b17d19fae0cc9d1.zip
Renamed identifiers for consistency: s/complex_float/32fc/ s/complex_16/16sc/.
Merged eb/u2-wip -r9645:9646 into trunk. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9647 221aa14e-8319-0410-a670-987f0aec2ac5
-rw-r--r--gr-usrp2/src/rx_16sc_handler.h2
-rw-r--r--gr-usrp2/src/rx_32fc_handler.h2
-rw-r--r--gr-usrp2/src/usrp2_sink_16sc.cc4
-rw-r--r--gr-usrp2/src/usrp2_sink_32fc.cc6
-rw-r--r--usrp2/host/apps/rx_streaming_samples.cc24
-rw-r--r--usrp2/host/apps/tx_samples.cc2
-rw-r--r--usrp2/host/include/usrp2/copiers.h24
-rw-r--r--usrp2/host/include/usrp2/usrp2.h28
-rw-r--r--usrp2/host/lib/copiers.cc24
-rw-r--r--usrp2/host/lib/usrp2.cc20
-rw-r--r--usrp2/host/lib/usrp2_impl.cc20
-rw-r--r--usrp2/host/lib/usrp2_impl.h18
12 files changed, 91 insertions, 83 deletions
diff --git a/gr-usrp2/src/rx_16sc_handler.h b/gr-usrp2/src/rx_16sc_handler.h
index cb83d860f..d9a9e72e4 100644
--- a/gr-usrp2/src/rx_16sc_handler.h
+++ b/gr-usrp2/src/rx_16sc_handler.h
@@ -56,7 +56,7 @@ public:
printf("rx_16sc_handler: called with items=%zu ", nitems);
// Copy/reformat/endian swap USRP2 data to destination buffer
- usrp2::copy_u2_complex_16_to_host_complex_16(nitems, items, d_dest);
+ usrp2::copy_u2_16sc_to_host_16sc(nitems, items, d_dest);
d_dest += nitems;
// FIXME: do something with metadata
diff --git a/gr-usrp2/src/rx_32fc_handler.h b/gr-usrp2/src/rx_32fc_handler.h
index 875027968..028dfadab 100644
--- a/gr-usrp2/src/rx_32fc_handler.h
+++ b/gr-usrp2/src/rx_32fc_handler.h
@@ -57,7 +57,7 @@ public:
printf("rx_32fc_handler: called with items=%zu ", nitems);
// Copy/reformat/endian swap USRP2 data to destination buffer
- usrp2::copy_u2_complex_16_to_host_complex_float(nitems, items, d_dest);
+ usrp2::copy_u2_16sc_to_host_32fc(nitems, items, d_dest);
d_dest += nitems;
// FIXME: do something with metadata
diff --git a/gr-usrp2/src/usrp2_sink_16sc.cc b/gr-usrp2/src/usrp2_sink_16sc.cc
index fd87ea868..bbd85563c 100644
--- a/gr-usrp2/src/usrp2_sink_16sc.cc
+++ b/gr-usrp2/src/usrp2_sink_16sc.cc
@@ -62,8 +62,8 @@ usrp2_sink_16sc::work(int noutput_items,
metadata.send_now = 1;
metadata.start_of_burst = 1;
- bool ok = d_u2->tx_complex_int16(0, // FIXME: someday, streams will have channel numbers
- in, noutput_items, &metadata);
+ bool ok = d_u2->tx_16sc(0, // FIXME: someday, streams will have channel numbers
+ in, noutput_items, &metadata);
if (!ok)
std::cerr << "usrp2_sink_16sc: tx_complex_int16 failed" << std::endl;
diff --git a/gr-usrp2/src/usrp2_sink_32fc.cc b/gr-usrp2/src/usrp2_sink_32fc.cc
index acbba7aba..fbb56e707 100644
--- a/gr-usrp2/src/usrp2_sink_32fc.cc
+++ b/gr-usrp2/src/usrp2_sink_32fc.cc
@@ -62,10 +62,10 @@ usrp2_sink_32fc::work(int noutput_items,
metadata.send_now = 1;
metadata.start_of_burst = 1;
- bool ok = d_u2->tx_complex_float(0, // FIXME: someday, streams will have channel numbers
- in, noutput_items, &metadata);
+ bool ok = d_u2->tx_32fc(0, // FIXME: someday, streams will have channel numbers
+ in, noutput_items, &metadata);
if (!ok)
- std::cerr << "usrp2_sink_32fc: tx_complex_float failed" << std::endl;
+ std::cerr << "usrp2_sink_32fc: tx_32fc failed" << std::endl;
return noutput_items;
}
diff --git a/usrp2/host/apps/rx_streaming_samples.cc b/usrp2/host/apps/rx_streaming_samples.cc
index 70f2c5d73..931ab9707 100644
--- a/usrp2/host/apps/rx_streaming_samples.cc
+++ b/usrp2/host/apps/rx_streaming_samples.cc
@@ -62,14 +62,14 @@ install_sig_handler(int signum,
// FIXME make this a template
-class complex_16_file_writer : public usrp2::rx_nop_handler
+class file_writer_16sc : public usrp2::rx_nop_handler
{
FILE *d_fp;
std::string d_filename;
public:
- complex_16_file_writer(const std::string &filename, uint64_t max_samples)
+ file_writer_16sc(const std::string &filename, uint64_t max_samples)
: usrp2::rx_nop_handler(max_samples), d_filename(filename)
{
d_fp = fopen(filename.c_str(), "wb");
@@ -79,7 +79,7 @@ public:
}
}
- ~complex_16_file_writer();
+ ~file_writer_16sc();
bool
operator()(const uint32_t *items, size_t nitems, const usrp2::rx_metadata *metadata)
@@ -89,7 +89,7 @@ public:
size_t host_nitems = nitems;
std::complex<int16_t> host_items[host_nitems];
- usrp2::copy_u2_complex_16_to_host_complex_16(nitems, items, host_items);
+ usrp2::copy_u2_16sc_to_host_16sc(nitems, items, host_items);
size_t n = 0;
while (n < host_nitems){
@@ -107,21 +107,21 @@ public:
}
};
-complex_16_file_writer::~complex_16_file_writer()
+file_writer_16sc::~file_writer_16sc()
{
fclose(d_fp);
}
// ------------------------------------------------------------------------
-class complex_float_file_writer : public usrp2::rx_nop_handler
+class file_writer_32fc : public usrp2::rx_nop_handler
{
FILE *d_fp;
std::string d_filename;
public:
- complex_float_file_writer(const std::string &filename, uint64_t max_samples)
+ file_writer_32fc(const std::string &filename, uint64_t max_samples)
: usrp2::rx_nop_handler(max_samples), d_filename(filename)
{
d_fp = fopen(filename.c_str(), "wb");
@@ -131,7 +131,7 @@ public:
}
}
- ~complex_float_file_writer();
+ ~file_writer_32fc();
bool
operator()(const uint32_t *items, size_t nitems, const usrp2::rx_metadata *metadata)
@@ -141,7 +141,7 @@ public:
size_t host_nitems = nitems;
std::complex<float> host_items[host_nitems];
- usrp2::copy_u2_complex_16_to_host_complex_float(nitems, items, host_items);
+ usrp2::copy_u2_16sc_to_host_32fc(nitems, items, host_items);
size_t n = 0;
while (n < host_nitems){
@@ -159,7 +159,7 @@ public:
}
};
-complex_float_file_writer::~complex_float_file_writer()
+file_writer_32fc::~file_writer_32fc()
{
fclose(d_fp);
}
@@ -278,9 +278,9 @@ main(int argc, char **argv)
if (output_filename){
if (output_shorts)
- handler = usrp2::rx_nop_handler::sptr(new complex_16_file_writer(output_filename, nsamples));
+ handler = usrp2::rx_nop_handler::sptr(new file_writer_16sc(output_filename, nsamples));
else
- handler = usrp2::rx_nop_handler::sptr(new complex_float_file_writer(output_filename, nsamples));
+ handler = usrp2::rx_nop_handler::sptr(new file_writer_32fc(output_filename, nsamples));
}
else
handler = usrp2::rx_nop_handler::sptr(new usrp2::rx_nop_handler(nsamples));
diff --git a/usrp2/host/apps/tx_samples.cc b/usrp2/host/apps/tx_samples.cc
index b4a3c8ed6..e497e023e 100644
--- a/usrp2/host/apps/tx_samples.cc
+++ b/usrp2/host/apps/tx_samples.cc
@@ -253,7 +253,7 @@ main(int argc, char **argv)
// FIXME if r < 9, pad to 9 for minimum packet size constraint
- if (!u2->tx_complex_int16(0, samples, r, &md)){
+ if (!u2->tx_16sc(0, samples, r, &md)){
fprintf(stderr, "tx_complex_int16 failed\n");
break;
}
diff --git a/usrp2/host/include/usrp2/copiers.h b/usrp2/host/include/usrp2/copiers.h
index 43674f7ac..e98126f65 100644
--- a/usrp2/host/include/usrp2/copiers.h
+++ b/usrp2/host/include/usrp2/copiers.h
@@ -33,14 +33,14 @@ namespace usrp2 {
*/
void
- copy_u2_complex_16_to_host_complex_16(size_t nitems,
- const uint32_t *items,
- std::complex<int16_t> *host_items);
+ copy_u2_16sc_to_host_16sc(size_t nitems,
+ const uint32_t *items,
+ std::complex<int16_t> *host_items);
void
- copy_u2_complex_16_to_host_complex_float(size_t nitems,
- const uint32_t *items,
- std::complex<float> *host_items);
+ copy_u2_16sc_to_host_32fc(size_t nitems,
+ const uint32_t *items,
+ std::complex<float> *host_items);
/*
* ----------------------------------------------------------------
@@ -49,14 +49,14 @@ namespace usrp2 {
*/
void
- copy_host_complex_16_to_u2_complex_16(size_t nitems,
- const std::complex<int16_t> *host_items,
- uint32_t *items);
+ copy_host_16sc_to_u2_16sc(size_t nitems,
+ const std::complex<int16_t> *host_items,
+ uint32_t *items);
void
- copy_host_complex_float_to_u2_complex_16(size_t nitems,
- const std::complex<float> *host_items,
- uint32_t *items);
+ copy_host_32fc_to_u2_16sc(size_t nitems,
+ const std::complex<float> *host_items,
+ uint32_t *items);
}
diff --git a/usrp2/host/include/usrp2/usrp2.h b/usrp2/host/include/usrp2/usrp2.h
index 4e875d343..b76d31c8d 100644
--- a/usrp2/host/include/usrp2/usrp2.h
+++ b/usrp2/host/include/usrp2/usrp2.h
@@ -205,14 +205,18 @@ namespace usrp2 {
* \brief transmit complex<float> samples to USRP2
*
* \param channel specifies the channel to send them to
- * \param samples are the samples to transmit
+ * \param samples are the samples to transmit. They should be in the range [-1.0, +1.0]
* \param nsamples is the number of samples to transmit
* \param metadata provides the timestamp and flags
+ *
+ * The complex<float> samples are converted to the appropriate
+ * "on the wire" representation, depending on the current USRP2
+ * configuration. Typically, this is big-endian 16-bit I & Q.
*/
- bool tx_complex_float(unsigned int channel,
- const std::complex<float> *samples,
- size_t nsamples,
- const tx_metadata *metadata);
+ bool tx_32fc(unsigned int channel,
+ const std::complex<float> *samples,
+ size_t nsamples,
+ const tx_metadata *metadata);
/*!
* \brief transmit complex<int16_t> samples to USRP2
@@ -221,11 +225,15 @@ namespace usrp2 {
* \param samples are the samples to transmit
* \param nsamples is the number of samples to transmit
* \param metadata provides the timestamp and flags
+ *
+ * The complex<int16_t> samples are converted to the appropriate
+ * "on the wire" representation, depending on the current USRP2
+ * configuration. Typically, this is big-endian 16-bit I & Q.
*/
- bool tx_complex_int16(unsigned int channel,
- const std::complex<int16_t> *samples,
- size_t nsamples,
- const tx_metadata *metadata);
+ bool tx_16sc(unsigned int channel,
+ const std::complex<int16_t> *samples,
+ size_t nsamples,
+ const tx_metadata *metadata);
/*!
* \brief transmit raw uint32_t data items to USRP2
@@ -233,7 +241,7 @@ namespace usrp2 {
* The caller is responsible for ensuring that the items are
* formatted appropriately for the USRP2 and its configuration.
* This method is used primarily by the system itself. Users
- * should call tx_complex_float or tx_complex_16 instead.
+ * should call tx_32fc or tx_16sc instead.
*
* \param channel specifies the channel to send them to
* \param items are the data items to transmit
diff --git a/usrp2/host/lib/copiers.cc b/usrp2/host/lib/copiers.cc
index 833bb790d..52c66f616 100644
--- a/usrp2/host/lib/copiers.cc
+++ b/usrp2/host/lib/copiers.cc
@@ -45,9 +45,9 @@ namespace usrp2 {
* ----------------------------------------------------------------
*/
void
- copy_u2_complex_16_to_host_complex_16(size_t nitems,
- const uint32_t *items,
- std::complex<int16_t> *host_items)
+ copy_u2_16sc_to_host_16sc(size_t nitems,
+ const uint32_t *items,
+ std::complex<int16_t> *host_items)
{
#ifdef WORDS_BIGENDIAN
@@ -72,9 +72,9 @@ namespace usrp2 {
* endian swap if required and map [-32768, 32767] -> [1.0, +1.0)
*/
void
- copy_u2_complex_16_to_host_complex_float(size_t nitems,
- const uint32_t *items,
- std::complex<float> *host_items)
+ copy_u2_16sc_to_host_32fc(size_t nitems,
+ const uint32_t *items,
+ std::complex<float> *host_items)
{
for (size_t i = 0; i < nitems; i++){
uint32_t t = ntohx(items[i]);
@@ -90,9 +90,9 @@ namespace usrp2 {
* ----------------------------------------------------------------
*/
void
- copy_host_complex_16_to_u2_complex_16(size_t nitems,
- const std::complex<int16_t> *host_items,
- uint32_t *items)
+ copy_host_16sc_to_u2_16sc(size_t nitems,
+ const std::complex<int16_t> *host_items,
+ uint32_t *items)
{
#ifdef WORDS_BIGENDIAN
@@ -118,9 +118,9 @@ namespace usrp2 {
}
void
- copy_host_complex_float_to_u2_complex_16(size_t nitems,
- const std::complex<float> *host_items,
- uint32_t *items)
+ copy_host_32fc_to_u2_16sc(size_t nitems,
+ const std::complex<float> *host_items,
+ uint32_t *items)
{
for (size_t i = 0; i < nitems; i++){
int16_t re = clip_and_scale(host_items[i].real());
diff --git a/usrp2/host/lib/usrp2.cc b/usrp2/host/lib/usrp2.cc
index c71fb728b..eda73cdc5 100644
--- a/usrp2/host/lib/usrp2.cc
+++ b/usrp2/host/lib/usrp2.cc
@@ -250,21 +250,21 @@ namespace usrp2 {
}
bool
- usrp2::tx_complex_float(unsigned int channel,
- const std::complex<float> *samples,
- size_t nsamples,
- const tx_metadata *metadata)
+ usrp2::tx_32fc(unsigned int channel,
+ const std::complex<float> *samples,
+ size_t nsamples,
+ const tx_metadata *metadata)
{
- return d_impl->tx_complex_float(channel, samples, nsamples, metadata);
+ return d_impl->tx_32fc(channel, samples, nsamples, metadata);
}
bool
- usrp2::tx_complex_int16(unsigned int channel,
- const std::complex<int16_t> *samples,
- size_t nsamples,
- const tx_metadata *metadata)
+ usrp2::tx_16sc(unsigned int channel,
+ const std::complex<int16_t> *samples,
+ size_t nsamples,
+ const tx_metadata *metadata)
{
- return d_impl->tx_complex_int16(channel, samples, nsamples, metadata);
+ return d_impl->tx_16sc(channel, samples, nsamples, metadata);
}
bool
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index eb52242f8..4b64d06c3 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -773,21 +773,21 @@ namespace usrp2 {
}
bool
- usrp2::impl::tx_complex_float(unsigned int channel,
- const std::complex<float> *samples,
- size_t nsamples,
- const tx_metadata *metadata)
+ usrp2::impl::tx_32fc(unsigned int channel,
+ const std::complex<float> *samples,
+ size_t nsamples,
+ const tx_metadata *metadata)
{
uint32_t items[nsamples];
- copy_host_complex_float_to_u2_complex_16(nsamples, samples, items);
+ copy_host_32fc_to_u2_16sc(nsamples, samples, items);
return tx_raw(channel, items, nsamples, metadata);
}
bool
- usrp2::impl::tx_complex_int16(unsigned int channel,
- const std::complex<int16_t> *samples,
- size_t nsamples,
- const tx_metadata *metadata)
+ usrp2::impl::tx_16sc(unsigned int channel,
+ const std::complex<int16_t> *samples,
+ size_t nsamples,
+ const tx_metadata *metadata)
{
#ifdef WORDS_BIGENDIAN
@@ -800,7 +800,7 @@ namespace usrp2 {
#else
uint32_t items[nsamples];
- copy_host_complex_16_to_u2_complex_16(nsamples, samples, items);
+ copy_host_16sc_to_u2_16sc(nsamples, samples, items);
return tx_raw(channel, items, nsamples, metadata);
#endif
diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h
index 37109c9e3..0c5849780 100644
--- a/usrp2/host/lib/usrp2_impl.h
+++ b/usrp2/host/lib/usrp2_impl.h
@@ -112,15 +112,15 @@ namespace usrp2 {
bool set_tx_interp(int interpolation_factor);
bool set_tx_scale_iq(int scale_i, int scale_q);
- bool tx_complex_float(unsigned int channel,
- const std::complex<float> *samples,
- size_t nsamples,
- const tx_metadata *metadata);
-
- bool tx_complex_int16(unsigned int channel,
- const std::complex<int16_t> *samples,
- size_t nsamples,
- const tx_metadata *metadata);
+ bool tx_32fc(unsigned int channel,
+ const std::complex<float> *samples,
+ size_t nsamples,
+ const tx_metadata *metadata);
+
+ bool tx_16sc(unsigned int channel,
+ const std::complex<int16_t> *samples,
+ size_t nsamples,
+ const tx_metadata *metadata);
bool tx_raw(unsigned int channel,
const uint32_t *items,