From b292dd7b1a62bf6118f88329044f9c7930aa810c Mon Sep 17 00:00:00 2001 From: Edayilliam Jayadev Date: Tue, 9 Apr 2019 15:06:46 +0530 Subject: [PATCH] qcacmn: Use common Spectral config definition Today Driver and applications maintain a separate copy of spectral config definitions, which is error prone. Solution is to expose the definitions via a header file from driver and include them in all applications using Spectral. CRs-Fixed: 2432011 Change-Id: I107c2db05e1cb71b379d6f15a282a889882da2f8 --- spectral/dispatcher/inc/spectral_ioctl.h | 89 +++++++++++++++++++ .../inc/wlan_spectral_public_structs.h | 85 ------------------ 2 files changed, 89 insertions(+), 85 deletions(-) diff --git a/spectral/dispatcher/inc/spectral_ioctl.h b/spectral/dispatcher/inc/spectral_ioctl.h index 13efc57bf9..e5a9607947 100644 --- a/spectral/dispatcher/inc/spectral_ioctl.h +++ b/spectral/dispatcher/inc/spectral_ioctl.h @@ -20,6 +20,10 @@ #define _SPECTRAL_IOCTL_H_ #include +#ifndef AH_MAX_CHAINS +#define AH_MAX_CHAINS 3 +#endif + /* * ioctl defines */ @@ -97,6 +101,91 @@ enum spectral_cap_hw_gen { SPECTRAL_CAP_HW_GEN_3 = 2, }; +/** + * struct spectral_config - spectral config parameters + * @ss_fft_period: Skip interval for FFT reports + * @ss_period: Spectral scan period + * @ss_count: # of reports to return from ss_active + * @ss_short_report: Set to report only 1 set of FFT results + * @radar_bin_thresh_sel: Select threshold to classify strong bin for FFT + * @ss_spectral_pri: Priority, and are we doing a noise power cal ? + * @ss_fft_size: Defines the number of FFT data points to compute, + * defined as a log index num_fft_pts = + * 2^ss_fft_size + * @ss_gc_ena: Set, to enable targeted gain change before + * starting the spectral scan FFT + * @ss_restart_ena: Set, to enable abort of receive frames when in high + * priority and a spectral scan is queued + * @ss_noise_floor_ref: Noise floor reference number (signed) for the + * calculation of bin power (dBm) Though stored as an + * unsigned this should be treated as a signed 8-bit int. + * @ss_init_delay: Disallow spectral scan triggers after tx/rx packets + * by setting this delay value to roughly SIFS time + * period or greater Delay timer count in units of 0.25us + * @ss_nb_tone_thr: Number of strong bins (inclusive) per sub-channel, + * below which a signal is declared a narrowband tone + * @ss_str_bin_thr: Bin/max_bin ratio threshold over which a bin is + * declared strong (for spectral scan bandwidth analysis) + * @ss_wb_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER + * (phy_error=36), if none of the sub-channels are + * deemed narrowband + * @ss_rssi_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER + * (phy_error=36), if the ADC RSSI is below the + * threshold ss_rssi_thr + * @ss_rssi_thr: ADC RSSI must be greater than or equal to this + * threshold (signed Db) to ensure spectral scan + * reporting with normal phy error codes (please see + * ss_rssi_rpt_mode above).Though stored as an unsigned + * value, this should be treated as a signed 8-bit int + * @ss_pwr_format: Format of frequency bin magnitude for spectral scan + * triggered FFTs 0: linear magnitude + * 1: log magnitude (20*log10(lin_mag), 1/2 dB step size) + * @ss_rpt_mode: Format of per-FFT reports to software for spectral + * scan triggered FFTs + * 0: No FFT report (only pulse end summary) + * 1: 2-dword summary of metrics for each completed FFT + * 2: 2-dword summary + 1x-oversampled bins(in-band) per + * FFT + * 3: 2-dword summary + 2x-oversampled bins (all) per FFT + * @ss_bin_scale: Number of LSBs to shift out to scale the FFT bins + * for spectral scan triggered FFTs + * @ss_dbm_adj: Set (with ss_pwr_format=1), to report bin + * magnitudes + * converted to dBm power using the noisefloor + * calibration results + * @ss_chn_mask: Per chain enable mask to select input ADC for search + * FFT + * @ss_nf_cal: nf calibrated values for ctl+ext + * @ss_nf_pwr: nf pwr values for ctl+ext + * @ss_nf_temp_data: temperature data taken during nf scan + */ +struct spectral_config { + uint16_t ss_fft_period; + uint16_t ss_period; + uint16_t ss_count; + uint16_t ss_short_report; + uint8_t radar_bin_thresh_sel; + uint16_t ss_spectral_pri; + uint16_t ss_fft_size; + uint16_t ss_gc_ena; + uint16_t ss_restart_ena; + uint16_t ss_noise_floor_ref; + uint16_t ss_init_delay; + uint16_t ss_nb_tone_thr; + uint16_t ss_str_bin_thr; + uint16_t ss_wb_rpt_mode; + uint16_t ss_rssi_rpt_mode; + uint16_t ss_rssi_thr; + uint16_t ss_pwr_format; + uint16_t ss_rpt_mode; + uint16_t ss_bin_scale; + uint16_t ss_dbm_adj; + uint16_t ss_chn_mask; + int8_t ss_nf_cal[AH_MAX_CHAINS * 2]; + int8_t ss_nf_pwr[AH_MAX_CHAINS * 2]; + int32_t ss_nf_temp_data; +}; + /** * struct spectral_caps - Spectral capabilities structure * @phydiag_cap: Phydiag capability diff --git a/spectral/dispatcher/inc/wlan_spectral_public_structs.h b/spectral/dispatcher/inc/wlan_spectral_public_structs.h index ea97a9e2a2..f12f3537ca 100644 --- a/spectral/dispatcher/inc/wlan_spectral_public_structs.h +++ b/spectral/dispatcher/inc/wlan_spectral_public_structs.h @@ -231,91 +231,6 @@ struct spectral_diag_stats { uint64_t spectral_invalid_detector_id; }; -/** - * struct spectral_config - spectral config parameters - * @ss_fft_period: Skip interval for FFT reports - * @ss_period: Spectral scan period - * @ss_count: # of reports to return from ss_active - * @ss_short_report: Set to report only 1 set of FFT results - * @radar_bin_thresh_sel: Select threshold to classify strong bin for FFT - * @ss_spectral_pri: Priority, and are we doing a noise power cal ? - * @ss_fft_size: Defines the number of FFT data points to compute, - * defined as a log index num_fft_pts = - * 2^ss_fft_size - * @ss_gc_ena: Set, to enable targeted gain change before - * starting the spectral scan FFT - * @ss_restart_ena: Set, to enable abort of receive frames when in high - * priority and a spectral scan is queued - * @ss_noise_floor_ref: Noise floor reference number (signed) for the - * calculation of bin power (dBm) Though stored as an - * unsigned this should be treated as a signed 8-bit int. - * @ss_init_delay: Disallow spectral scan triggers after tx/rx packets - * by setting this delay value to roughly SIFS time - * period or greater Delay timer count in units of 0.25us - * @ss_nb_tone_thr: Number of strong bins (inclusive) per sub-channel, - * below which a signal is declared a narrowband tone - * @ss_str_bin_thr: Bin/max_bin ratio threshold over which a bin is - * declared strong (for spectral scan bandwidth analysis) - * @ss_wb_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER - * (phy_error=36), if none of the sub-channels are - * deemed narrowband - * @ss_rssi_rpt_mode: Set this bit to report spectral scans as EXT_BLOCKER - * (phy_error=36), if the ADC RSSI is below the - * threshold ss_rssi_thr - * @ss_rssi_thr: ADC RSSI must be greater than or equal to this - * threshold (signed Db) to ensure spectral scan - * reporting with normal phy error codes (please see - * ss_rssi_rpt_mode above).Though stored as an unsigned - * value, this should be treated as a signed 8-bit int - * @ss_pwr_format: Format of frequency bin magnitude for spectral scan - * triggered FFTs 0: linear magnitude - * 1: log magnitude (20*log10(lin_mag), 1/2 dB step size) - * @ss_rpt_mode: Format of per-FFT reports to software for spectral - * scan triggered FFTs - * 0: No FFT report (only pulse end summary) - * 1: 2-dword summary of metrics for each completed FFT - * 2: 2-dword summary + 1x-oversampled bins(in-band) per - * FFT - * 3: 2-dword summary + 2x-oversampled bins (all) per FFT - * @ss_bin_scale: Number of LSBs to shift out to scale the FFT bins - * for spectral scan triggered FFTs - * @ss_dbm_adj: Set (with ss_pwr_format=1), to report bin - * magnitudes - * converted to dBm power using the noisefloor - * calibration results - * @ss_chn_mask: Per chain enable mask to select input ADC for search - * FFT - * @ss_nf_cal: nf calibrated values for ctl+ext - * @ss_nf_pwr: nf pwr values for ctl+ext - * @ss_nf_temp_data: temperature data taken during nf scan - */ -struct spectral_config { - uint16_t ss_fft_period; - uint16_t ss_period; - uint16_t ss_count; - uint16_t ss_short_report; - uint8_t radar_bin_thresh_sel; - uint16_t ss_spectral_pri; - uint16_t ss_fft_size; - uint16_t ss_gc_ena; - uint16_t ss_restart_ena; - uint16_t ss_noise_floor_ref; - uint16_t ss_init_delay; - uint16_t ss_nb_tone_thr; - uint16_t ss_str_bin_thr; - uint16_t ss_wb_rpt_mode; - uint16_t ss_rssi_rpt_mode; - uint16_t ss_rssi_thr; - uint16_t ss_pwr_format; - uint16_t ss_rpt_mode; - uint16_t ss_bin_scale; - uint16_t ss_dbm_adj; - uint16_t ss_chn_mask; - int8_t ss_nf_cal[AH_MAX_CHAINS * 2]; - int8_t ss_nf_pwr[AH_MAX_CHAINS * 2]; - int32_t ss_nf_temp_data; -}; - /** * struct spectral_scan_state - State of spectral scan * @is_active: Is spectral scan active