mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-26 04:57:40 +00:00 
			
		
		
		
	Add more extensive use of cstdint typenames
This commit is contained in:
		| @@ -36,6 +36,7 @@ | ||||
| #include "fpga_switch.h" | ||||
| #include <boost/shared_ptr.hpp> | ||||
| #include <gnuradio/msg_queue.h> | ||||
| #include <cstdint> | ||||
| #include <string> | ||||
|  | ||||
| class ConfigurationInterface; | ||||
| @@ -76,11 +77,11 @@ private: | ||||
|     std::string role_; | ||||
|  | ||||
|     // Front-end settings | ||||
|     std::string uri_;     // device direction | ||||
|     unsigned long freq_;  // frequency of local oscillator | ||||
|     unsigned long sample_rate_; | ||||
|     unsigned long bandwidth_; | ||||
|     unsigned long buffer_size_;  // reception buffer | ||||
|     std::string uri_;  // device direction | ||||
|     uint64_t freq_;    // frequency of local oscillator | ||||
|     uint64_t sample_rate_; | ||||
|     uint64_t bandwidth_; | ||||
|     uint64_t buffer_size_;  // reception buffer | ||||
|     bool rx1_en_; | ||||
|     bool rx2_en_; | ||||
|     bool quadrature_; | ||||
| @@ -96,14 +97,14 @@ private: | ||||
|  | ||||
|     // DDS configuration for LO generation for external mixer | ||||
|     bool enable_dds_lo_; | ||||
|     unsigned long freq_rf_tx_hz_; | ||||
|     unsigned long freq_dds_tx_hz_; | ||||
|     uint64_t freq_rf_tx_hz_; | ||||
|     uint64_t freq_dds_tx_hz_; | ||||
|     double scale_dds_dbfs_; | ||||
|     double phase_dds_deg_; | ||||
|     double tx_attenuation_db_; | ||||
|  | ||||
|     unsigned int in_stream_; | ||||
|     unsigned int out_stream_; | ||||
|     uint32_t in_stream_; | ||||
|     uint32_t out_stream_; | ||||
|  | ||||
|     std::string item_type_; | ||||
|     size_t item_size_; | ||||
|   | ||||
| @@ -70,7 +70,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, | ||||
|  | ||||
|     double seconds_to_skip = configuration->property(role + ".seconds_to_skip", default_seconds_to_skip); | ||||
|     header_size = configuration->property(role + ".header_size", 0); | ||||
|     long samples_to_skip = 0; | ||||
|     int64_t samples_to_skip = 0; | ||||
|  | ||||
|     bool is_complex = false; | ||||
|  | ||||
| @@ -112,7 +112,7 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, | ||||
|  | ||||
|             if (seconds_to_skip > 0) | ||||
|                 { | ||||
|                     samples_to_skip = static_cast<long>(seconds_to_skip * sampling_frequency_); | ||||
|                     samples_to_skip = static_cast<int64_t>(seconds_to_skip * sampling_frequency_); | ||||
|  | ||||
|                     if (is_complex) | ||||
|                         { | ||||
| @@ -200,8 +200,8 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, | ||||
|  | ||||
|             if (size > 0) | ||||
|                 { | ||||
|                     long bytes_to_skip = samples_to_skip * item_size_; | ||||
|                     long bytes_to_process = static_cast<long>(size) - bytes_to_skip; | ||||
|                     int64_t bytes_to_skip = samples_to_skip * item_size_; | ||||
|                     int64_t bytes_to_process = static_cast<int64_t>(size) - bytes_to_skip; | ||||
|                     samples_ = floor(static_cast<double>(bytes_to_process) / static_cast<double>(item_size()) - ceil(0.002 * static_cast<double>(sampling_frequency_)));  //process all the samples available in the file excluding at least the last 1 ms | ||||
|                 } | ||||
|         } | ||||
|   | ||||
| @@ -41,6 +41,7 @@ | ||||
| #include <gnuradio/blocks/throttle.h> | ||||
| #include <gnuradio/hier_block2.h> | ||||
| #include <gnuradio/msg_queue.h> | ||||
| #include <cstdint> | ||||
| #include <string> | ||||
|  | ||||
| class ConfigurationInterface; | ||||
| @@ -107,7 +108,7 @@ public: | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     unsigned long long samples_; | ||||
|     uint64_t samples_; | ||||
|     long sampling_frequency_; | ||||
|     std::string filename_; | ||||
|     std::string item_type_; | ||||
| @@ -115,8 +116,8 @@ private: | ||||
|     bool dump_; | ||||
|     std::string dump_filename_; | ||||
|     std::string role_; | ||||
|     unsigned int in_streams_; | ||||
|     unsigned int out_streams_; | ||||
|     uint32_t in_streams_; | ||||
|     uint32_t out_streams_; | ||||
|     gr::blocks::file_source::sptr file_source_; | ||||
|     boost::shared_ptr<gr::block> valve_; | ||||
|     gr::blocks::file_sink::sptr sink_; | ||||
|   | ||||
| @@ -42,7 +42,7 @@ using google::LogMessage; | ||||
|  | ||||
|  | ||||
| SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, | ||||
|     std::string role, unsigned int in_streams, unsigned int out_streams, gr::msg_queue::sptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) | ||||
|     std::string role, uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr queue) : role_(role), in_streams_(in_streams), out_streams_(out_streams), queue_(queue) | ||||
| { | ||||
|     std::string default_filename = "../data/my_capture.dat"; | ||||
|     std::string default_dump_filename = "../data/my_capture_dump.dat"; | ||||
| @@ -60,7 +60,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* | ||||
|     n_channels_ = configuration->property(role + ".total_channels", 1); | ||||
|     sel_ch_ = configuration->property(role + ".sel_ch", 1); | ||||
|     item_size_ = sizeof(int); | ||||
|     long bytes_seek = configuration->property(role + ".bytes_to_skip", 65536); | ||||
|     int64_t bytes_seek = configuration->property(role + ".bytes_to_skip", 65536); | ||||
|     double sample_size_byte = static_cast<double>(adc_bits_) / 4.0; | ||||
|  | ||||
|     if (sel_ch_ > n_channels_) | ||||
| @@ -69,7 +69,7 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* | ||||
|         } | ||||
|     if (n_channels_ > 1) | ||||
|         { | ||||
|             for (unsigned int i = 0; i < (n_channels_ - 1); i++) | ||||
|             for (uint32_t i = 0; i < (n_channels_ - 1); i++) | ||||
|                 { | ||||
|                     null_sinks_.push_back(gr::blocks::null_sink::make(item_size_)); | ||||
|                 } | ||||
| @@ -133,8 +133,8 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* | ||||
|  | ||||
|             if (size > 0) | ||||
|                 { | ||||
|                     samples_ = static_cast<unsigned long long>(floor(static_cast<double>(static_cast<long>(size) - static_cast<long>(bytes_seek)) / (sample_size_byte * static_cast<double>(n_channels_)))); | ||||
|                     samples_ = samples_ - static_cast<unsigned long long>(ceil(0.002 * sampling_frequency_));  //process all the samples available in the file excluding the last 2 ms | ||||
|                     samples_ = static_cast<uint64_t>(floor(static_cast<double>(static_cast<int64_t>(size) - static_cast<int64_t>(bytes_seek)) / (sample_size_byte * static_cast<double>(n_channels_)))); | ||||
|                     samples_ = samples_ - static_cast<uint64_t>(ceil(0.002 * sampling_frequency_));  //process all the samples available in the file excluding the last 2 ms | ||||
|                 } | ||||
|         } | ||||
|  | ||||
| @@ -199,8 +199,8 @@ void SpirGSS6450FileSignalSource::connect(gr::top_block_sptr top_block) | ||||
|                 } | ||||
|             if (n_channels_ > 1) | ||||
|                 { | ||||
|                     unsigned int aux = 0; | ||||
|                     for (unsigned int i = 0; i < n_channels_; i++) | ||||
|                     uint32_t aux = 0; | ||||
|                     for (uint32_t i = 0; i < n_channels_; i++) | ||||
|                         { | ||||
|                             if (i != (sel_ch_ - 1)) | ||||
|                                 { | ||||
| @@ -246,8 +246,8 @@ void SpirGSS6450FileSignalSource::disconnect(gr::top_block_sptr top_block) | ||||
|                 } | ||||
|             if (n_channels_ > 1) | ||||
|                 { | ||||
|                     unsigned int aux = 0; | ||||
|                     for (unsigned int i = 0; i < n_channels_; i++) | ||||
|                     uint32_t aux = 0; | ||||
|                     for (uint32_t i = 0; i < n_channels_; i++) | ||||
|                         { | ||||
|                             if (i != (sel_ch_ - 1)) | ||||
|                                 { | ||||
|   | ||||
| @@ -43,6 +43,7 @@ | ||||
| #include <gnuradio/blocks/endian_swap.h> | ||||
| #include <gnuradio/hier_block2.h> | ||||
| #include <gnuradio/msg_queue.h> | ||||
| #include <cstdint> | ||||
| #include <string> | ||||
| #include <vector> | ||||
|  | ||||
| @@ -57,7 +58,7 @@ class SpirGSS6450FileSignalSource : public GNSSBlockInterface | ||||
| { | ||||
| public: | ||||
|     SpirGSS6450FileSignalSource(ConfigurationInterface* configuration, std::string role, | ||||
|         unsigned int in_streams, unsigned int out_streams, gr::msg_queue::sptr queue); | ||||
|         uint32_t in_streams, uint32_t out_streams, gr::msg_queue::sptr queue); | ||||
|  | ||||
|     virtual ~SpirGSS6450FileSignalSource(); | ||||
|     inline std::string role() override | ||||
| @@ -106,7 +107,7 @@ public: | ||||
|     } | ||||
|  | ||||
| private: | ||||
|     unsigned long long samples_; | ||||
|     uint64_t samples_; | ||||
|     double sampling_frequency_; | ||||
|     std::string filename_; | ||||
|     bool repeat_; | ||||
| @@ -116,11 +117,11 @@ private: | ||||
|     std::string dump_filename_; | ||||
|     std::string role_; | ||||
|     std::string item_type_; | ||||
|     unsigned int in_streams_; | ||||
|     unsigned int out_streams_; | ||||
|     unsigned int adc_bits_; | ||||
|     unsigned int n_channels_; | ||||
|     unsigned int sel_ch_; | ||||
|     uint32_t in_streams_; | ||||
|     uint32_t out_streams_; | ||||
|     uint32_t adc_bits_; | ||||
|     uint32_t n_channels_; | ||||
|     uint32_t sel_ch_; | ||||
|     gr::blocks::file_source::sptr file_source_; | ||||
|     gr::blocks::deinterleave::sptr deint_; | ||||
|     gr::blocks::endian_swap::sptr endian_; | ||||
|   | ||||
| @@ -46,8 +46,8 @@ void errchk(int v, const char *what) | ||||
| } | ||||
|  | ||||
|  | ||||
| /* write attribute: long long int */ | ||||
| void wr_ch_lli(struct iio_channel *chn, const char *what, long long val) | ||||
| /* write attribute: int64_t int */ | ||||
| void wr_ch_lli(struct iio_channel *chn, const char *what, int64_t val) | ||||
| { | ||||
|     errchk(iio_channel_attr_write_longlong(chn, what, val), what); | ||||
| } | ||||
| @@ -176,9 +176,9 @@ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, en | ||||
| } | ||||
|  | ||||
|  | ||||
| bool config_ad9361_rx_local(unsigned long bandwidth_, | ||||
|     unsigned long sample_rate_, | ||||
|     unsigned long freq_, | ||||
| bool config_ad9361_rx_local(uint64_t bandwidth_, | ||||
|     uint64_t sample_rate_, | ||||
|     uint64_t freq_, | ||||
|     std::string rf_port_select_, | ||||
|     std::string gain_mode_rx1_, | ||||
|     std::string gain_mode_rx2_, | ||||
| @@ -292,9 +292,9 @@ bool config_ad9361_rx_local(unsigned long bandwidth_, | ||||
|  | ||||
|  | ||||
| bool config_ad9361_rx_remote(std::string remote_host, | ||||
|     unsigned long bandwidth_, | ||||
|     unsigned long sample_rate_, | ||||
|     unsigned long freq_, | ||||
|     uint64_t bandwidth_, | ||||
|     uint64_t sample_rate_, | ||||
|     uint64_t freq_, | ||||
|     std::string rf_port_select_, | ||||
|     std::string gain_mode_rx1_, | ||||
|     std::string gain_mode_rx2_, | ||||
| @@ -407,11 +407,11 @@ bool config_ad9361_rx_remote(std::string remote_host, | ||||
| } | ||||
|  | ||||
|  | ||||
| bool config_ad9361_lo_local(unsigned long bandwidth_, | ||||
|     unsigned long sample_rate_, | ||||
|     unsigned long freq_rf_tx_hz_, | ||||
| bool config_ad9361_lo_local(uint64_t bandwidth_, | ||||
|     uint64_t sample_rate_, | ||||
|     uint64_t freq_rf_tx_hz_, | ||||
|     double tx_attenuation_db_, | ||||
|     long long freq_dds_tx_hz_, | ||||
|     int64_t freq_dds_tx_hz_, | ||||
|     double scale_dds_dbfs_) | ||||
| { | ||||
|     // TX stream config | ||||
| @@ -476,13 +476,13 @@ bool config_ad9361_lo_local(unsigned long bandwidth_, | ||||
|  | ||||
|     //set frequency, scale and phase | ||||
|  | ||||
|     ret = iio_channel_attr_write_longlong(dds_channel0_I, "frequency", (long long)freq_dds_tx_hz_); | ||||
|     ret = iio_channel_attr_write_longlong(dds_channel0_I, "frequency", static_cast<int64_t>(freq_dds_tx_hz_)); | ||||
|     if (ret < 0) | ||||
|         { | ||||
|             std::cout << "Failed to set TX DDS frequency I: " << ret << std::endl; | ||||
|         } | ||||
|  | ||||
|     ret = iio_channel_attr_write_longlong(dds_channel0_Q, "frequency", (long long)freq_dds_tx_hz_); | ||||
|     ret = iio_channel_attr_write_longlong(dds_channel0_Q, "frequency", static_cast<int64_t>(freq_dds_tx_hz_)); | ||||
|     if (ret < 0) | ||||
|         { | ||||
|             std::cout << "Failed to set TX DDS frequency Q: " << ret << std::endl; | ||||
| @@ -544,11 +544,11 @@ bool config_ad9361_lo_local(unsigned long bandwidth_, | ||||
|  | ||||
|  | ||||
| bool config_ad9361_lo_remote(std::string remote_host, | ||||
|     unsigned long bandwidth_, | ||||
|     unsigned long sample_rate_, | ||||
|     unsigned long freq_rf_tx_hz_, | ||||
|     uint64_t bandwidth_, | ||||
|     uint64_t sample_rate_, | ||||
|     uint64_t freq_rf_tx_hz_, | ||||
|     double tx_attenuation_db_, | ||||
|     long long freq_dds_tx_hz_, | ||||
|     int64_t freq_dds_tx_hz_, | ||||
|     double scale_dds_dbfs_) | ||||
| { | ||||
|     // TX stream config | ||||
| @@ -613,13 +613,13 @@ bool config_ad9361_lo_remote(std::string remote_host, | ||||
|  | ||||
|     //set frequency, scale and phase | ||||
|  | ||||
|     ret = iio_channel_attr_write_longlong(dds_channel0_I, "frequency", (long long)freq_dds_tx_hz_); | ||||
|     ret = iio_channel_attr_write_longlong(dds_channel0_I, "frequency", static_cast<int64_t>(freq_dds_tx_hz_)); | ||||
|     if (ret < 0) | ||||
|         { | ||||
|             std::cout << "Failed to set TX DDS frequency I: " << ret << std::endl; | ||||
|         } | ||||
|  | ||||
|     ret = iio_channel_attr_write_longlong(dds_channel0_Q, "frequency", (long long)freq_dds_tx_hz_); | ||||
|     ret = iio_channel_attr_write_longlong(dds_channel0_Q, "frequency", static_cast<int64_t>(freq_dds_tx_hz_)); | ||||
|     if (ret < 0) | ||||
|         { | ||||
|             std::cout << "Failed to set TX DDS frequency Q: " << ret << std::endl; | ||||
|   | ||||
| @@ -33,6 +33,7 @@ | ||||
| #ifndef GNSS_SDR_AD9361_MANAGER_H | ||||
| #define GNSS_SDR_AD9361_MANAGER_H | ||||
|  | ||||
| #include <cstdint> | ||||
| #include <string> | ||||
|  | ||||
| #ifdef __APPLE__ | ||||
| @@ -51,9 +52,9 @@ enum iodev | ||||
| /* common RX and TX streaming params */ | ||||
| struct stream_cfg | ||||
| { | ||||
|     long long bw_hz;     // Analog banwidth in Hz | ||||
|     long long fs_hz;     // Baseband sample rate in Hz | ||||
|     long long lo_hz;     // Local oscillator frequency in Hz | ||||
|     int64_t bw_hz;       // Analog banwidth in Hz | ||||
|     int64_t fs_hz;       // Baseband sample rate in Hz | ||||
|     int64_t lo_hz;       // Local oscillator frequency in Hz | ||||
|     const char *rfport;  // Port name | ||||
| }; | ||||
|  | ||||
| @@ -61,8 +62,8 @@ struct stream_cfg | ||||
| /* check return value of attr_write function */ | ||||
| void errchk(int v, const char *what); | ||||
|  | ||||
| /* write attribute: long long int */ | ||||
| void wr_ch_lli(struct iio_channel *chn, const char *what, long long val); | ||||
| /* write attribute: int64_t int */ | ||||
| void wr_ch_lli(struct iio_channel *chn, const char *what, int64_t val); | ||||
|  | ||||
| /* write attribute: string */ | ||||
| void wr_ch_str(struct iio_channel *chn, const char *what, const char *str); | ||||
| @@ -88,9 +89,9 @@ bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn | ||||
| /* applies streaming configuration through IIO */ | ||||
| bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, enum iodev type, int chid); | ||||
|  | ||||
| bool config_ad9361_rx_local(unsigned long bandwidth_, | ||||
|     unsigned long sample_rate_, | ||||
|     unsigned long freq_, | ||||
| bool config_ad9361_rx_local(uint64_t bandwidth_, | ||||
|     uint64_t sample_rate_, | ||||
|     uint64_t freq_, | ||||
|     std::string rf_port_select_, | ||||
|     std::string gain_mode_rx1_, | ||||
|     std::string gain_mode_rx2_, | ||||
| @@ -98,28 +99,28 @@ bool config_ad9361_rx_local(unsigned long bandwidth_, | ||||
|     double rf_gain_rx2_); | ||||
|  | ||||
| bool config_ad9361_rx_remote(std::string remote_host, | ||||
|     unsigned long bandwidth_, | ||||
|     unsigned long sample_rate_, | ||||
|     unsigned long freq_, | ||||
|     uint64_t bandwidth_, | ||||
|     uint64_t sample_rate_, | ||||
|     uint64_t freq_, | ||||
|     std::string rf_port_select_, | ||||
|     std::string gain_mode_rx1_, | ||||
|     std::string gain_mode_rx2_, | ||||
|     double rf_gain_rx1_, | ||||
|     double rf_gain_rx2_); | ||||
|  | ||||
| bool config_ad9361_lo_local(unsigned long bandwidth_, | ||||
|     unsigned long sample_rate_, | ||||
|     unsigned long freq_rf_tx_hz_, | ||||
| bool config_ad9361_lo_local(uint64_t bandwidth_, | ||||
|     uint64_t sample_rate_, | ||||
|     uint64_t freq_rf_tx_hz_, | ||||
|     double tx_attenuation_db_, | ||||
|     long long freq_dds_tx_hz_, | ||||
|     int64_t freq_dds_tx_hz_, | ||||
|     double scale_dds_dbfs_); | ||||
|  | ||||
| bool config_ad9361_lo_remote(std::string remote_host, | ||||
|     unsigned long bandwidth_, | ||||
|     unsigned long sample_rate_, | ||||
|     unsigned long freq_rf_tx_hz_, | ||||
|     uint64_t bandwidth_, | ||||
|     uint64_t sample_rate_, | ||||
|     uint64_t freq_rf_tx_hz_, | ||||
|     double tx_attenuation_db_, | ||||
|     long long freq_dds_tx_hz_, | ||||
|     int64_t freq_dds_tx_hz_, | ||||
|     double scale_dds_dbfs_); | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Carles Fernandez
					Carles Fernandez