123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099 |
- #ifndef _TARGET_IF_SPECTRAL_H_
- #define _TARGET_IF_SPECTRAL_H_
- #include <wlan_objmgr_cmn.h>
- #include <wlan_objmgr_psoc_obj.h>
- #include <wlan_objmgr_pdev_obj.h>
- #include <wlan_objmgr_vdev_obj.h>
- #include <wlan_reg_services_api.h>
- #include <qdf_lock.h>
- #include <wlan_spectral_public_structs.h>
- #include <reg_services_public_struct.h>
- #ifdef DIRECT_BUF_RX_ENABLE
- #include <target_if_direct_buf_rx_api.h>
- #endif
- #ifdef WIN32
- #pragma pack(push, target_if_spectral, 1)
- #define __ATTRIB_PACK
- #else
- #ifndef __ATTRIB_PACK
- #define __ATTRIB_PACK __attribute__ ((packed))
- #endif
- #endif
- #include <spectral_defs_i.h>
- #include <wmi_unified_param.h>
- #define FREQ_OFFSET_10MHZ (10)
- #define FREQ_OFFSET_40MHZ (40)
- #define FREQ_OFFSET_80MHZ (80)
- #define FREQ_OFFSET_85MHZ (85)
- #ifndef SPECTRAL_USE_NL_BCAST
- #define SPECTRAL_USE_NL_BCAST (0)
- #endif
- #define STATUS_PASS 1
- #define STATUS_FAIL 0
- #undef spectral_dbg_line
- #define spectral_dbg_line() \
- spectral_debug("----------------------------------------------------")
- #undef spectral_ops_not_registered
- #define spectral_ops_not_registered(str) \
- spectral_info("SPECTRAL : %s not registered\n", (str))
- #undef not_yet_implemented
- #define not_yet_implemented() \
- spectral_info("SPECTRAL : %s : %d Not yet implemented\n", \
- __func__, __LINE__)
- #define SPECTRAL_HT20_NUM_BINS 56
- #define SPECTRAL_HT20_FFT_LEN 56
- #define SPECTRAL_HT20_DC_INDEX (SPECTRAL_HT20_FFT_LEN / 2)
- #define SPECTRAL_HT20_DATA_LEN 60
- #define SPECTRAL_HT20_TOTAL_DATA_LEN (SPECTRAL_HT20_DATA_LEN + 3)
- #define SPECTRAL_HT40_TOTAL_NUM_BINS 128
- #define SPECTRAL_HT40_DATA_LEN 135
- #define SPECTRAL_HT40_TOTAL_DATA_LEN (SPECTRAL_HT40_DATA_LEN + 3)
- #define SPECTRAL_HT40_FFT_LEN 128
- #define SPECTRAL_HT40_DC_INDEX (SPECTRAL_HT40_FFT_LEN / 2)
- #define OFFSET_CH_WIDTH_20 65
- #define OFFSET_CH_WIDTH_40 62
- #define OFFSET_CH_WIDTH_80 56
- #define OFFSET_CH_WIDTH_160 50
- #define SPECTRAL_PARAM_FFT_SIZE_MIN_GEN2 (1)
- #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN2 (9)
- #define SPECTRAL_PARAM_FFT_SIZE_MIN_GEN3 (5)
- #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_DEFAULT (9)
- #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_QCN9000 (10)
- #define SPECTRAL_PARAM_FFT_SIZE_MIN_GEN3_BE (5)
- #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_BE (11)
- #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_BE_20MHZ (9)
- #define SPECTRAL_PARAM_FFT_SIZE_MAX_GEN3_BE_40MHZ (10)
- #define INVALID_FFT_SIZE (0xFFFF)
- #define SPECTRAL_PARAM_RPT_MODE_MIN (0)
- #define SPECTRAL_PARAM_RPT_MODE_MAX (3)
- #define SPECTRAL_PARAM_SCAN_COUNT_MAX_GEN3 (4095)
- #define SPECTRAL_PARAM_SCAN_COUNT_MAX_GEN3_BE (4095)
- #define SPECTRAL_DWORD_SIZE (4)
- #define MAX_FFTBIN_VALUE_LINEAR_MODE (U8_MAX)
- #define MAX_FFTBIN_VALUE_DBM_MODE (S8_MAX)
- #define MIN_FFTBIN_VALUE_DBM_MODE (S8_MIN)
- #define MAX_FFTBIN_VALUE (255)
- #define SPECTRAL_DBR_RING_DEBUG_SIZE 512
- #ifdef BIG_ENDIAN_HOST
- #define SPECTRAL_MESSAGE_COPY_CHAR_ARRAY(destp, srcp, len) do { \
- int j; \
- uint32_t *src, *dest; \
- src = (uint32_t *)(srcp); \
- dest = (uint32_t *)(destp); \
- for (j = 0; j < roundup((len), sizeof(uint32_t)) / 4; j++) { \
- *(dest + j) = qdf_le32_to_cpu(*(src + j)); \
- } \
- } while (0)
- #else
- #define SPECTRAL_MESSAGE_COPY_CHAR_ARRAY(destp, srcp, len) \
- OS_MEMCPY((destp), (srcp), (len));
- #endif
- #define DUMMY_NF_VALUE (-123)
- #define MAX_INTERF 10
- #define HOST_MAX_ANTENNA 3
- #define SPECTRAL_TSMASK 0xFFFFFFFF
- #define SPECTRAL_SIGNATURE 0xdeadbeef
- #define MEM_POISON_SIGNATURE (htobe32(0xdeadbeef))
- #define SPECTRAL_PHYERR_SIGNATURE_GEN2 0xbb
- #define TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN2 0xF9
- #define TLV_TAG_ADC_REPORT_GEN2 0xFA
- #define TLV_TAG_SEARCH_FFT_REPORT_GEN2 0xFB
- #define MAX_NUM_DEST_DETECTOR_INFO (3)
- #define MAX_DETECTORS_PER_PDEV (3)
- #define FFT_BIN_SIZE_1BYTE (1)
- #ifdef OPTIMIZED_SAMP_MESSAGE
- enum spectral_160mhz_report_delivery_state {
- SPECTRAL_REPORT_WAIT_PRIMARY80,
- SPECTRAL_REPORT_WAIT_SECONDARY80,
- };
- #else
- enum spectral_160mhz_report_delivery_state {
- SPECTRAL_REPORT_WAIT_PRIMARY80,
- SPECTRAL_REPORT_RX_PRIMARY80,
- SPECTRAL_REPORT_WAIT_SECONDARY80,
- SPECTRAL_REPORT_RX_SECONDARY80,
- };
- #endif
- enum spectral_freq_span_id {
- SPECTRAL_FREQ_SPAN_ID_0,
- SPECTRAL_FREQ_SPAN_ID_1,
- SPECTRAL_FREQ_SPAN_ID_2,
- };
- enum spectral_detector_id {
- SPECTRAL_DETECTOR_ID_0,
- SPECTRAL_DETECTOR_ID_1,
- SPECTRAL_DETECTOR_ID_2,
- SPECTRAL_DETECTOR_ID_MAX,
- SPECTRAL_DETECTOR_ID_INVALID = 0xff,
- };
- struct spectral_search_fft_info_gen2 {
- uint32_t relpwr_db;
- uint32_t num_str_bins_ib;
- uint32_t base_pwr;
- uint32_t total_gain_info;
- uint32_t fft_chn_idx;
- uint32_t avgpwr_db;
- uint32_t peak_mag;
- int16_t peak_inx;
- };
- #ifdef BIG_ENDIAN_HOST
- struct spectral_phyerr_tlv_gen2 {
- uint8_t signature;
- uint8_t tag;
- uint16_t length;
- } __ATTRIB_PACK;
- #else
- struct spectral_phyerr_tlv_gen2 {
- uint16_t length;
- uint8_t tag;
- uint8_t signature;
- } __ATTRIB_PACK;
- #endif
- struct spectral_phyerr_hdr_gen2 {
- uint32_t hdr_a;
- uint32_t hdr_b;
- };
- typedef uint32_t SPECTRAL_SEGID_INFO;
- struct spectral_phyerr_fft_gen2 {
- __QDF_DECLARE_FLEX_ARRAY(uint8_t, buf);
- };
- struct spectral_process_phyerr_info_gen2 {
- struct target_if_spectral_rfqual_info *p_rfqual;
- struct spectral_search_fft_info_gen2 *p_sfft;
- struct spectral_phyerr_fft_gen2 *pfft;
- struct target_if_spectral_acs_stats *acs_stats;
- uint64_t tsf64;
- uint8_t seg_id;
- };
- #define get_bitfield(value, size, pos) \
- (((value) >> (pos)) & ((1 << (size)) - 1))
- #define unsigned_to_signed(value, width) \
- (((value) >= (1 << ((width) - 1))) ? \
- (value - (1 << (width))) : (value))
- #define SSCAN_SUMMARY_REPORT_HDR_A_DETECTOR_ID_POS_GEN3 (29)
- #define SSCAN_SUMMARY_REPORT_HDR_A_DETECTOR_ID_SIZE_GEN3 (2)
- #define SSCAN_SUMMARY_REPORT_HDR_A_AGC_TOTAL_GAIN_POS_GEN3 (0)
- #define SSCAN_SUMMARY_REPORT_HDR_A_AGC_TOTAL_GAIN_SIZE_GEN3 (8)
- #define SSCAN_SUMMARY_REPORT_HDR_A_INBAND_PWR_DB_POS_GEN3 (18)
- #define SSCAN_SUMMARY_REPORT_HDR_A_INBAND_PWR_DB_SIZE_GEN3 (10)
- #define SSCAN_SUMMARY_REPORT_HDR_A_PRI80_POS_GEN3 (31)
- #define SSCAN_SUMMARY_REPORT_HDR_A_PRI80_SIZE_GEN3 (1)
- #define SSCAN_SUMMARY_REPORT_HDR_B_GAINCHANGE_POS_GEN3_V1 (30)
- #define SSCAN_SUMMARY_REPORT_HDR_B_GAINCHANGE_SIZE_GEN3_V1 (1)
- #define SSCAN_SUMMARY_REPORT_HDR_C_GAINCHANGE_POS_GEN3_V2 (16)
- #define SSCAN_SUMMARY_REPORT_HDR_C_GAINCHANGE_SIZE_GEN3_V2 (1)
- #define SSCAN_SUMMARY_REPORT_PAD_HDR_A_BLANKING_POS_GEN3_V2 (0)
- #define SSCAN_SUMMARY_REPORT_PAD_HDR_A_BLANKING_SIZE_GEN3_V2 (32)
- #define SSCAN_SUMMARY_REPORT_PAD_HDR_A_BLANKING_TAG_GEN3_V2 (0xc0debeaf)
- #define SPECTRAL_REPORT_LTS_HDR_LENGTH_POS_GEN3 (0)
- #define SPECTRAL_REPORT_LTS_HDR_LENGTH_SIZE_GEN3 (16)
- #define SPECTRAL_REPORT_LTS_TAG_POS_GEN3 (16)
- #define SPECTRAL_REPORT_LTS_TAG_SIZE_GEN3 (8)
- #define SPECTRAL_REPORT_LTS_SIGNATURE_POS_GEN3 (24)
- #define SPECTRAL_REPORT_LTS_SIGNATURE_SIZE_GEN3 (8)
- #define FFT_REPORT_HDR_A_DETECTOR_ID_POS_GEN3 (0)
- #define FFT_REPORT_HDR_A_DETECTOR_ID_SIZE_GEN3 (2)
- #define FFT_REPORT_HDR_A_FFT_NUM_POS_GEN3 (2)
- #define FFT_REPORT_HDR_A_FFT_NUM_SIZE_GEN3 (3)
- #define FFT_REPORT_HDR_A_RADAR_CHECK_POS_GEN3_V1 (5)
- #define FFT_REPORT_HDR_A_RADAR_CHECK_SIZE_GEN3_V1 (12)
- #define FFT_REPORT_HDR_A_RADAR_CHECK_POS_GEN3_V2 (5)
- #define FFT_REPORT_HDR_A_RADAR_CHECK_SIZE_GEN3_V2 (14)
- #define FFT_REPORT_HDR_A_PEAK_INDEX_POS_GEN3_V1 (17)
- #define FFT_REPORT_HDR_A_PEAK_INDEX_SIZE_GEN3_V1 (11)
- #define FFT_REPORT_HDR_A_PEAK_INDEX_POS_GEN3_V2 (19)
- #define FFT_REPORT_HDR_A_PEAK_INDEX_SIZE_GEN3_V2 (11)
- #define FFT_REPORT_HDR_A_CHAIN_INDEX_POS_GEN3_V1 (28)
- #define FFT_REPORT_HDR_A_CHAIN_INDEX_SIZE_GEN3_V1 (3)
- #define FFT_REPORT_HDR_B_CHAIN_INDEX_POS_GEN3_V2 (0)
- #define FFT_REPORT_HDR_B_CHAIN_INDEX_SIZE_GEN3_V2 (3)
- #define FFT_REPORT_HDR_B_BASE_PWR_POS_GEN3_V1 (0)
- #define FFT_REPORT_HDR_B_BASE_PWR_SIZE_GEN3_V1 (9)
- #define FFT_REPORT_HDR_B_BASE_PWR_POS_GEN3_V2 (3)
- #define FFT_REPORT_HDR_B_BASE_PWR_SIZE_GEN3_V2 (9)
- #define FFT_REPORT_HDR_B_TOTAL_GAIN_POS_GEN3_V1 (9)
- #define FFT_REPORT_HDR_B_TOTAL_GAIN_SIZE_GEN3_V1 (8)
- #define FFT_REPORT_HDR_B_TOTAL_GAIN_POS_GEN3_V2 (12)
- #define FFT_REPORT_HDR_B_TOTAL_GAIN_SIZE_GEN3_V2 (8)
- #define FFT_REPORT_HDR_C_NUM_STRONG_BINS_POS_GEN3 (0)
- #define FFT_REPORT_HDR_C_NUM_STRONG_BINS_SIZE_GEN3 (8)
- #define FFT_REPORT_HDR_C_PEAK_MAGNITUDE_POS_GEN3 (8)
- #define FFT_REPORT_HDR_C_PEAK_MAGNITUDE_SIZE_GEN3 (10)
- #define FFT_REPORT_HDR_C_AVG_PWR_POS_GEN3 (18)
- #define FFT_REPORT_HDR_C_AVG_PWR_SIZE_GEN3 (7)
- #define FFT_REPORT_HDR_C_RELATIVE_PWR_POS_GEN3 (25)
- #define FFT_REPORT_HDR_C_RELATIVE_PWR_SIZE_GEN3 (7)
- #define SPECTRAL_PHYERR_SIGNATURE_GEN3 (0xFA)
- #define TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN3 (0x02)
- #define TLV_TAG_SEARCH_FFT_REPORT_GEN3 (0x03)
- #define SPECTRAL_PHYERR_TLVSIZE_GEN3 (4)
- #define NUM_SPECTRAL_DETECTORS_GEN3_V1 (3)
- #define NUM_SPECTRAL_DETECTORS_GEN3_V2 (2)
- #define FFT_REPORT_HEADER_LENGTH_GEN3_V2 (24)
- #define FFT_REPORT_HEADER_LENGTH_GEN3_V1 (16)
- #define NUM_PADDING_BYTES_SSCAN_SUMARY_REPORT_GEN3_V1 (0)
- #define NUM_PADDING_BYTES_SSCAN_SUMARY_REPORT_GEN3_V2 (16)
- #define SPECTRAL_PHYERR_HDR_LTS_POS \
- (offsetof(struct spectral_phyerr_fft_report_gen3, fft_hdr_lts))
- #define SPECTRAL_FFT_BINS_POS \
- (offsetof(struct spectral_phyerr_fft_report_gen3, buf))
- struct phyerr_info {
- uint8_t *data;
- uint32_t datalen;
- struct target_if_spectral_rfqual_info *p_rfqual;
- struct target_if_spectral_chan_info *p_chaninfo;
- uint64_t tsf64;
- struct target_if_spectral_acs_stats *acs_stats;
- };
- struct spectral_search_fft_info_gen3 {
- uint32_t timestamp;
- uint32_t last_raw_timestamp;
- uint32_t adjusted_timestamp;
- uint32_t fft_detector_id;
- uint32_t fft_num;
- uint32_t fft_radar_check;
- int32_t fft_peak_sidx;
- uint32_t fft_chn_idx;
- uint32_t fft_base_pwr_db;
- uint32_t fft_total_gain_db;
- uint32_t fft_num_str_bins_ib;
- int32_t fft_peak_mag;
- uint32_t fft_avgpwr_db;
- uint32_t fft_relpwr_db;
- uint32_t fft_bin_count;
- uint8_t fft_bin_size;
- uint8_t *bin_pwr_data;
- };
- struct spectral_phyerr_fft_report_gen3 {
- uint32_t fft_timestamp;
- uint32_t fft_hdr_lts;
- uint32_t hdr_a;
- uint32_t hdr_b;
- uint32_t hdr_c;
- uint32_t resv;
- uint8_t buf[];
- } __ATTRIB_PACK;
- struct sscan_report_fields_gen3 {
- uint8_t sscan_agc_total_gain;
- int16_t inband_pwr_db;
- uint8_t sscan_gainchange;
- uint8_t sscan_pri80;
- uint8_t sscan_detector_id;
- uint8_t blanking_status;
- };
- struct spectral_sscan_summary_report_gen3 {
- u_int32_t sscan_timestamp;
- u_int32_t sscan_hdr_lts;
- u_int32_t hdr_a;
- u_int32_t res1;
- u_int32_t hdr_b;
- u_int32_t hdr_c;
- } __ATTRIB_PACK;
- struct spectral_sscan_summary_report_padding_gen3_v2 {
- u_int32_t hdr_a;
- u_int32_t hdr_b;
- u_int32_t hdr_c;
- u_int32_t hdr_d;
- } __ATTRIB_PACK;
- #ifdef DIRECT_BUF_RX_ENABLE
- struct spectral_report {
- uint8_t *data;
- int32_t noisefloor[DBR_MAX_CHAINS];
- uint32_t reset_delay;
- uint32_t cfreq1;
- uint32_t cfreq2;
- uint32_t ch_width;
- };
- #endif
- typedef signed char pwr_dbm;
- enum spectral_gen {
- SPECTRAL_GEN1,
- SPECTRAL_GEN2,
- SPECTRAL_GEN3,
- };
- enum spectral_fftbin_size_war {
- SPECTRAL_FFTBIN_SIZE_NO_WAR = 0,
- SPECTRAL_FFTBIN_SIZE_WAR_2BYTE_TO_1BYTE = 1,
- SPECTRAL_FFTBIN_SIZE_WAR_4BYTE_TO_1BYTE = 2,
- };
- enum spectral_report_format_version {
- SPECTRAL_REPORT_FORMAT_VERSION_1,
- SPECTRAL_REPORT_FORMAT_VERSION_2,
- };
- struct spectral_fft_bin_len_adj_swar {
- u_int8_t inband_fftbin_size_adj;
- u_int8_t null_fftbin_adj;
- uint8_t packmode_fftbin_size_adj;
- enum spectral_fftbin_size_war fftbin_size_war;
- };
- struct spectral_report_params {
- enum spectral_report_format_version version;
- uint8_t ssummary_padding_bytes;
- uint8_t fft_report_hdr_len;
- bool fragmentation_160[SPECTRAL_SCAN_MODE_MAX];
- enum spectral_scan_mode detid_mode_table[SPECTRAL_DETECTOR_ID_MAX];
- uint8_t num_spectral_detectors;
- struct spectral_fft_bin_markers_160_165mhz
- marker[SPECTRAL_SCAN_MODE_MAX];
- uint8_t hw_fft_bin_width;
- };
- struct spectral_param_min_max {
- uint16_t fft_size_min;
- uint16_t fft_size_max[CH_WIDTH_MAX];
- uint16_t scan_count_max;
- };
- struct spectral_timestamp_war {
- uint32_t timestamp_war_offset[SPECTRAL_SCAN_MODE_MAX];
- uint64_t target_reset_count;
- uint32_t last_fft_timestamp[SPECTRAL_SCAN_MODE_MAX];
- };
- #if ATH_PERF_PWR_OFFLOAD
- enum target_if_spectral_info {
- TARGET_IF_SPECTRAL_INFO_ACTIVE,
- TARGET_IF_SPECTRAL_INFO_ENABLED,
- TARGET_IF_SPECTRAL_INFO_PARAMS,
- };
- #endif
- struct target_if_spectral;
- struct target_if_spectral_chan_info {
- uint16_t center_freq1;
- uint16_t center_freq2;
- uint8_t chan_width;
- };
- struct target_if_spectral_acs_stats {
- int8_t nfc_ctl_rssi;
- int8_t nfc_ext_rssi;
- int8_t ctrl_nf;
- int8_t ext_nf;
- };
- struct target_if_spectral_perchain_rssi_info {
- int8_t rssi_pri20;
- int8_t rssi_sec20;
- int8_t rssi_sec40;
- int8_t rssi_sec80;
- };
- struct target_if_spectral_rfqual_info {
- int8_t rssi_comb;
- struct target_if_spectral_perchain_rssi_info pc_rssi_info[4];
- int16_t noise_floor[4];
- };
- #define GET_TARGET_IF_SPECTRAL_OPS(spectral) \
- ((struct target_if_spectral_ops *)(&((spectral)->spectral_ops)))
- struct target_if_spectral_ops {
- uint64_t (*get_tsf64)(void *arg);
- uint32_t (*get_capability)(
- void *arg, enum spectral_capability_type type);
- uint32_t (*set_rxfilter)(void *arg, int rxfilter);
- uint32_t (*get_rxfilter)(void *arg);
- uint32_t (*is_spectral_active)(void *arg,
- enum spectral_scan_mode smode);
- uint32_t (*is_spectral_enabled)(void *arg,
- enum spectral_scan_mode smode);
- uint32_t (*start_spectral_scan)(void *arg,
- enum spectral_scan_mode smode,
- enum spectral_cp_error_code *err);
- uint32_t (*stop_spectral_scan)(void *arg,
- enum spectral_scan_mode smode);
- uint32_t (*get_extension_channel)(void *arg,
- enum spectral_scan_mode smode);
- int8_t (*get_ctl_noisefloor)(void *arg);
- int8_t (*get_ext_noisefloor)(void *arg);
- uint32_t (*configure_spectral)(
- void *arg,
- struct spectral_config *params,
- enum spectral_scan_mode smode);
- uint32_t (*get_spectral_config)(
- void *arg,
- struct spectral_config *params,
- enum spectral_scan_mode smode);
- uint32_t (*get_ent_spectral_mask)(void *arg);
- uint32_t (*get_mac_address)(void *arg, char *addr);
- uint32_t (*get_current_channel)(void *arg,
- enum spectral_scan_mode smode);
- uint32_t (*reset_hw)(void *arg);
- uint32_t (*get_chain_noise_floor)(void *arg, int16_t *nf_buf);
- int (*spectral_process_phyerr)(struct target_if_spectral *spectral,
- uint8_t *data, uint32_t datalen,
- struct target_if_spectral_rfqual_info *p_rfqual,
- struct target_if_spectral_chan_info *p_chaninfo,
- uint64_t tsf64,
- struct target_if_spectral_acs_stats *acs_stats);
- int (*process_spectral_report)(struct wlan_objmgr_pdev *pdev,
- void *payload);
- QDF_STATUS (*byte_swap_headers)(
- struct target_if_spectral *spectral,
- void *data);
- QDF_STATUS (*byte_swap_fft_bins)(
- const struct spectral_report_params *rparams,
- void *bin_pwr_data, size_t num_fftbins);
- };
- struct target_if_spectral_stats {
- uint32_t num_spectral_detects;
- uint32_t total_phy_errors;
- uint32_t owl_phy_errors;
- uint32_t pri_phy_errors;
- uint32_t ext_phy_errors;
- uint32_t dc_phy_errors;
- uint32_t early_ext_phy_errors;
- uint32_t bwinfo_errors;
- uint32_t datalen_discards;
- uint32_t rssi_discards;
- uint64_t last_reset_tstamp;
- };
- struct target_if_spectral_event {
- uint32_t se_ts;
- uint64_t se_full_ts;
- uint8_t se_rssi;
- uint8_t se_bwinfo;
- uint8_t se_dur;
- uint8_t se_chanindex;
- STAILQ_ENTRY(spectral_event) se_list;
- };
- struct target_if_chain_noise_pwr_info {
- int rptcount;
- pwr_dbm un_cal_nf;
- pwr_dbm factory_cal_nf;
- pwr_dbm median_pwr;
- pwr_dbm pwr[];
- } __ATTRIB_PACK;
- struct target_if_spectral_chan_stats {
- int cycle_count;
- int channel_load;
- int per;
- int noisefloor;
- uint16_t comp_usablity;
- int8_t maxregpower;
- uint16_t comp_usablity_sec80;
- int8_t maxregpower_sec80;
- };
- #if ATH_PERF_PWR_OFFLOAD
- struct target_if_spectral_cache {
- uint8_t osc_spectral_enabled;
- uint8_t osc_spectral_active;
- struct spectral_config osc_params;
- uint8_t osc_is_valid;
- };
- struct target_if_spectral_param_state_info {
- qdf_spinlock_t osps_lock;
- struct target_if_spectral_cache osps_cache;
-
- };
- #endif
- struct vdev_spectral_configure_params;
- struct vdev_spectral_enable_params;
- struct spectral_wmi_ops {
- QDF_STATUS (*wmi_spectral_configure_cmd_send)(
- wmi_unified_t wmi_hdl,
- struct vdev_spectral_configure_params *param);
- QDF_STATUS (*wmi_spectral_enable_cmd_send)(
- wmi_unified_t wmi_hdl,
- struct vdev_spectral_enable_params *param);
- QDF_STATUS (*wmi_spectral_crash_inject)(
- wmi_unified_t wmi_handle, struct crash_inject *param);
- QDF_STATUS (*wmi_extract_pdev_sscan_fw_cmd_fixed_param)(
- wmi_unified_t wmi_handle, uint8_t *evt_buf,
- struct spectral_startscan_resp_params *param);
- QDF_STATUS (*wmi_extract_pdev_sscan_fft_bin_index)(
- wmi_unified_t wmi_handle, uint8_t *evt_buf,
- struct spectral_fft_bin_markers_160_165mhz *param);
- QDF_STATUS (*wmi_unified_register_event_handler)(
- wmi_unified_t wmi_handle,
- wmi_conv_event_id event_id,
- wmi_unified_event_handler handler_func,
- uint8_t rx_ctx);
- QDF_STATUS (*wmi_unified_unregister_event_handler)(
- wmi_unified_t wmi_handle,
- wmi_conv_event_id event_id);
- bool (*wmi_service_enabled)(wmi_unified_t wmi_handle,
- uint32_t service_id);
- QDF_STATUS (*extract_pdev_spectral_session_chan_info)(
- wmi_unified_t wmi_handle, void *event,
- struct spectral_session_chan_info *chan_info);
- QDF_STATUS (*extract_pdev_spectral_session_detector_info)(
- wmi_unified_t wmi_handle, void *event,
- struct spectral_session_det_info *det_info,
- uint8_t det_info_idx);
- QDF_STATUS (*extract_spectral_caps_fixed_param)(
- wmi_unified_t wmi_handle, void *event,
- struct spectral_capabilities_event_params *param);
- QDF_STATUS (*extract_spectral_scan_bw_caps)(
- wmi_unified_t wmi_handle, void *event,
- struct spectral_scan_bw_capabilities *bw_caps);
- QDF_STATUS (*extract_spectral_fft_size_caps)(
- wmi_unified_t wmi_handle, void *event,
- struct spectral_fft_size_capabilities *fft_size_caps);
- };
- struct spectral_tgt_ops {
- struct wlan_objmgr_psoc *(*tgt_get_psoc_from_scn_hdl)(void *scn_handle);
- };
- struct spectral_param_properties {
- bool supported;
- bool common_all_modes;
- };
- struct target_if_finite_spectral_scan_params {
- bool finite_spectral_scan;
- uint32_t num_reports_expected;
- };
- struct per_session_dest_det_info {
- uint8_t freq_span_id;
- bool is_sec80;
- uint8_t det_id;
- uint16_t dest_start_bin_idx;
- uint16_t dest_end_bin_idx;
- uint16_t lb_extrabins_start_idx;
- uint16_t lb_extrabins_num;
- uint16_t rb_extrabins_start_idx;
- uint16_t rb_extrabins_num;
- uint32_t start_freq;
- uint32_t end_freq;
- uint16_t src_start_bin_idx;
- };
- struct per_session_det_map {
- struct per_session_dest_det_info
- dest_det_info[MAX_NUM_DEST_DETECTOR_INFO];
- uint8_t num_dest_det_info;
- enum spectral_msg_buf_type buf_type;
- bool send_to_upper_layers;
- bool det_map_valid[SPECTRAL_SCAN_MODE_MAX];
- };
- struct per_session_report_info {
- uint32_t pri20_freq;
- uint32_t cfreq1;
- uint32_t cfreq2;
- enum phy_ch_width operating_bw;
- uint32_t sscan_cfreq1;
- uint32_t sscan_cfreq2;
- enum phy_ch_width sscan_bw;
- uint8_t num_spans;
- bool valid;
- };
- struct sscan_detector_list {
- uint8_t detectors[SPECTRAL_DETECTOR_ID_MAX];
- uint8_t num_detectors;
- };
- struct spectral_supported_bws {
- union {
- struct {
- uint32_t supports_sscan_bw_5:1,
- supports_sscan_bw_10:1,
- supports_sscan_bw_20:1,
- supports_sscan_bw_40:1,
- supports_sscan_bw_80:1,
- supports_sscan_bw_160:1,
- supports_sscan_bw_80_80:1,
- supports_sscan_bw_320:1,
- reserved:24;
- };
- uint32_t bandwidths;
- };
- };
- int get_supported_sscan_bw_pos(enum phy_ch_width sscan_bw);
- struct target_if_spectral {
- struct wlan_objmgr_pdev *pdev_obj;
- struct target_if_spectral_ops spectral_ops;
- struct spectral_caps capability;
- struct spectral_param_properties
- properties[SPECTRAL_SCAN_MODE_MAX][SPECTRAL_PARAM_MAX];
- qdf_spinlock_t spectral_lock;
- uint8_t vdev_id[SPECTRAL_SCAN_MODE_MAX];
- int16_t spectral_curchan_radindex;
- int16_t spectral_extchan_radindex;
- uint32_t spectraldomain;
- uint32_t spectral_proc_phyerr;
- struct spectral_config spectral_defaultparams;
- struct target_if_spectral_stats spectral_stats;
- struct target_if_spectral_event *events;
- unsigned int sc_spectral_ext_chan_ok:1,
- sc_spectral_combined_rssi_ok:1,
- sc_spectral_20_40_mode:1,
- sc_spectral_noise_pwr_cal:1,
- sc_spectral_non_edma:1;
- int upper_is_control;
- int upper_is_extension;
- int lower_is_control;
- int lower_is_extension;
- uint8_t sc_spectraltest_ieeechan;
- int spectral_numbins;
- int spectral_fft_len;
- int spectral_data_len;
-
- int lb_edge_extrabins;
- int rb_edge_extrabins;
- int spectral_max_index_offset;
- int spectral_upper_max_index_offset;
- int spectral_lower_max_index_offset;
- int spectral_dc_index;
- int send_single_packet;
- int spectral_sent_msg;
- int classify_scan;
- qdf_timer_t classify_timer;
- struct spectral_config params[SPECTRAL_SCAN_MODE_MAX];
- bool params_valid[SPECTRAL_SCAN_MODE_MAX];
- struct spectral_classifier_params classifier_params;
- int last_capture_time;
- int num_spectral_data;
- int total_spectral_data;
- int max_rssi;
- int detects_control_channel;
- int detects_extension_channel;
- int detects_below_dc;
- int detects_above_dc;
- int sc_scanning;
- int sc_spectral_scan;
- int sc_spectral_full_scan;
- uint64_t scan_start_tstamp;
- uint32_t last_tstamp;
- uint32_t first_tstamp;
- uint32_t spectral_samp_count;
- uint32_t sc_spectral_samp_count;
- int noise_pwr_reports_reqd;
- int noise_pwr_reports_recv;
- qdf_spinlock_t noise_pwr_reports_lock;
- struct target_if_chain_noise_pwr_info
- *noise_pwr_chain_ctl[HOST_MAX_ANTENNA];
- struct target_if_chain_noise_pwr_info
- *noise_pwr_chain_ext[HOST_MAX_ANTENNA];
- uint64_t tsf64;
- #if ATH_PERF_PWR_OFFLOAD
- struct target_if_spectral_param_state_info
- param_info[SPECTRAL_SCAN_MODE_MAX];
- #endif
- enum phy_ch_width ch_width[SPECTRAL_SCAN_MODE_MAX];
- bool sscan_width_configured[SPECTRAL_SCAN_MODE_MAX];
- struct spectral_diag_stats diag_stats;
- bool is_160_format;
- bool is_lb_edge_extrabins_format;
- bool is_rb_edge_extrabins_format;
- bool is_sec80_rssi_war_required;
- #ifdef QCA_SUPPORT_SPECTRAL_SIMULATION
- void *simctx;
- #endif
- enum spectral_gen spectral_gen;
- uint8_t hdr_sig_exp;
- uint8_t tag_sscan_summary_exp;
- uint8_t tag_sscan_fft_exp;
- uint8_t tlvhdr_size;
- struct spectral_nl_cb nl_cb;
- bool use_nl_bcast;
- int (*send_phy_data)(struct wlan_objmgr_pdev *pdev,
- enum spectral_msg_type smsg_type);
- struct spectral_fft_bin_len_adj_swar len_adj_swar;
- struct spectral_timestamp_war timestamp_war;
- enum spectral_160mhz_report_delivery_state
- state_160mhz_delivery[SPECTRAL_SCAN_MODE_MAX];
- bool dbr_ring_debug;
- bool dbr_buff_debug;
- bool direct_dma_support;
- #ifdef OPTIMIZED_SAMP_MESSAGE
- uint32_t prev_tstamp[MAX_DETECTORS_PER_PDEV];
- #else
- uint32_t prev_tstamp;
- #endif
- struct spectral_report_params rparams;
- struct spectral_param_min_max param_min_max;
- struct target_if_finite_spectral_scan_params
- finite_scan[SPECTRAL_SCAN_MODE_MAX];
- struct sscan_detector_list
- detector_list[SPECTRAL_SCAN_MODE_MAX][CH_WIDTH_MAX];
- qdf_spinlock_t detector_list_lock;
- struct per_session_det_map det_map[MAX_DETECTORS_PER_PDEV];
- qdf_spinlock_t session_det_map_lock;
- struct per_session_report_info report_info[SPECTRAL_SCAN_MODE_MAX];
- qdf_spinlock_t session_report_info_lock;
- struct spectral_supported_bws
- supported_bws[SPECTRAL_SCAN_MODE_MAX][CH_WIDTH_MAX];
-
- bool supported_sscan_bw_list[SPECTRAL_SCAN_MODE_MAX][CH_WIDTH_MAX];
- struct spectral_data_stats data_stats;
- };
- struct target_if_psoc_spectral {
- struct wlan_objmgr_psoc *psoc_obj;
- struct spectral_wmi_ops wmi_ops;
- };
- #ifdef OPTIMIZED_SAMP_MESSAGE
- struct target_if_samp_msg_params {
- uint8_t hw_detector_id;
- int8_t rssi;
- int8_t lower_rssi;
- int8_t upper_rssi;
- int8_t chain_ctl_rssi[HOST_MAX_ANTENNA];
- int8_t chain_ext_rssi[HOST_MAX_ANTENNA];
- uint32_t last_raw_timestamp;
- uint32_t raw_timestamp;
- uint32_t timestamp;
- uint32_t reset_delay;
- uint16_t max_mag;
- uint16_t max_index;
- int16_t noise_floor;
- uint8_t agc_total_gain;
- uint8_t gainchange;
- uint8_t pri80ind;
- uint8_t blanking_status;
- uint8_t *bin_pwr_data;
- };
- #else
- struct target_if_samp_msg_params {
- int8_t rssi;
- int8_t rssi_sec80;
- int8_t lower_rssi;
- int8_t upper_rssi;
- int8_t chain_ctl_rssi[HOST_MAX_ANTENNA];
- int8_t chain_ext_rssi[HOST_MAX_ANTENNA];
- uint16_t bwinfo;
- uint16_t datalen;
- uint16_t datalen_sec80;
- uint32_t tstamp;
- uint32_t last_tstamp;
- uint16_t max_mag;
- uint16_t max_mag_sec80;
- uint16_t max_index;
- uint16_t max_index_sec80;
- uint8_t max_exp;
- int peak;
- int pwr_count;
- int pwr_count_5mhz;
- int pwr_count_sec80;
- int8_t nb_lower;
- int8_t nb_upper;
- uint16_t max_lower_index;
- uint16_t max_upper_index;
- uint8_t *bin_pwr_data;
- uint8_t *bin_pwr_data_5mhz;
- uint8_t *bin_pwr_data_sec80;
- uint16_t freq;
- uint16_t vhtop_ch_freq_seg1;
- uint16_t vhtop_ch_freq_seg2;
- uint16_t agile_freq1;
- uint16_t agile_freq2;
- uint16_t freq_loading;
- int16_t noise_floor;
- int16_t noise_floor_sec80;
- struct interf_src_rsp interf_list;
- struct spectral_classifier_params classifier_params;
- struct ath_softc *sc;
- uint8_t agc_total_gain;
- uint8_t agc_total_gain_sec80;
- uint8_t gainchange;
- uint8_t gainchange_sec80;
- enum spectral_scan_mode smode;
- uint8_t pri80ind;
- uint8_t pri80ind_sec80;
- uint32_t last_raw_timestamp;
- uint32_t timestamp_war_offset;
- uint32_t raw_timestamp;
- uint32_t raw_timestamp_sec80;
- uint32_t reset_delay;
- uint32_t target_reset_count;
- };
- #endif
- struct target_if_spectral_agile_mode_cap {
- bool agile_spectral_cap;
- bool agile_spectral_cap_160;
- bool agile_spectral_cap_80p80;
- bool agile_spectral_cap_320;
- };
- #ifdef WLAN_CONV_SPECTRAL_ENABLE
- int target_if_spectral_dump_fft(uint8_t *pfft, int fftlen);
- void target_if_dbg_print_samp_param(struct target_if_samp_msg_params *p);
- uint32_t target_if_get_offset_swar_sec80(uint32_t channel_width);
- void target_if_sptrl_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
- #ifndef OPTIMIZED_SAMP_MESSAGE
- void target_if_spectral_create_samp_msg(
- struct target_if_spectral *spectral,
- struct target_if_samp_msg_params *params);
- #endif
- #ifdef OPTIMIZED_SAMP_MESSAGE
- QDF_STATUS target_if_spectral_fill_samp_msg(
- struct target_if_spectral *spectral,
- struct target_if_samp_msg_params *params);
- #endif
- int target_if_spectral_process_report_gen3(struct wlan_objmgr_pdev *pdev,
- void *buf);
- int target_if_process_phyerr_gen2(
- struct target_if_spectral *spectral,
- uint8_t *data,
- uint32_t datalen, struct target_if_spectral_rfqual_info *p_rfqual,
- struct target_if_spectral_chan_info *p_chaninfo,
- uint64_t tsf64,
- struct target_if_spectral_acs_stats *acs_stats);
- void target_if_spectral_send_intf_found_msg(
- struct wlan_objmgr_pdev *pdev,
- uint16_t cw_int, uint32_t dcs_enabled);
- QDF_STATUS target_if_stop_spectral_scan(struct wlan_objmgr_pdev *pdev,
- const enum spectral_scan_mode smode,
- enum spectral_cp_error_code *err);
- struct wlan_objmgr_vdev *target_if_spectral_get_vdev(
- struct target_if_spectral *spectral,
- enum spectral_scan_mode smode);
- int target_if_spectral_dump_hdr_gen2(struct spectral_phyerr_hdr_gen2 *phdr);
- int8_t target_if_get_combrssi_sec80_seg_gen2(
- struct target_if_spectral *spectral,
- struct spectral_search_fft_info_gen2 *p_sfft_sec80);
- int target_if_spectral_dump_tlv_gen2(
- struct spectral_phyerr_tlv_gen2 *ptlv, bool is_160_format);
- int target_if_spectral_dump_phyerr_data_gen2(
- uint8_t *data,
- uint32_t datalen,
- bool is_160_format);
- void target_if_dbg_print_samp_msg(struct spectral_samp_msg *pmsg);
- struct target_if_spectral *get_target_if_spectral_handle_from_pdev(
- struct wlan_objmgr_pdev *pdev);
- static inline
- struct target_if_psoc_spectral *get_target_if_spectral_handle_from_psoc(
- struct wlan_objmgr_psoc *psoc)
- {
- struct wlan_lmac_if_rx_ops *rx_ops;
- struct target_if_psoc_spectral *psoc_spectral;
- if (!psoc) {
- spectral_err("psoc is null");
- return NULL;
- }
- rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
- if (!rx_ops) {
- spectral_err("rx_ops is null");
- return NULL;
- }
- psoc_spectral = (struct target_if_psoc_spectral *)
- rx_ops->sptrl_rx_ops.sptrlro_get_psoc_target_handle(psoc);
- return psoc_spectral;
- }
- static inline
- int16_t target_if_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev)
- {
- struct wlan_objmgr_psoc *psoc = NULL;
- struct wlan_lmac_if_rx_ops *rx_ops;
- psoc = wlan_vdev_get_psoc(vdev);
- if (!psoc) {
- spectral_err("psoc is NULL");
- return -EINVAL;
- }
- rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
- if (!rx_ops) {
- spectral_err("rx_ops is null");
- return -EINVAL;
- }
- return rx_ops->sptrl_rx_ops.sptrlro_vdev_get_chan_freq(
- vdev);
- }
- static inline
- int16_t target_if_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev)
- {
- struct wlan_objmgr_psoc *psoc = NULL;
- struct wlan_lmac_if_rx_ops *rx_ops;
- psoc = wlan_vdev_get_psoc(vdev);
- if (!psoc) {
- spectral_err("psoc is NULL");
- return -EINVAL;
- }
- rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
- if (!rx_ops) {
- spectral_err("rx_ops is null");
- return -EINVAL;
- }
- return rx_ops->sptrl_rx_ops.sptrlro_vdev_get_chan_freq_seg2(vdev);
- }
- static inline
- enum phy_ch_width target_if_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev)
- {
- struct wlan_objmgr_psoc *psoc = NULL;
- enum phy_ch_width ch_width;
- struct wlan_lmac_if_rx_ops *rx_ops;
- psoc = wlan_vdev_get_psoc(vdev);
- if (!psoc) {
- spectral_err("psoc is NULL");
- return CH_WIDTH_INVALID;
- }
- rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
- if (!rx_ops) {
- spectral_err("rx_ops is null");
- return CH_WIDTH_INVALID;
- }
- ch_width = rx_ops->sptrl_rx_ops.sptrlro_vdev_get_ch_width(vdev);
- if (ch_width == CH_WIDTH_160MHZ) {
- int16_t cfreq2;
- cfreq2 = target_if_vdev_get_chan_freq_seg2(vdev);
- if (cfreq2 < 0) {
- spectral_err("Invalid value for cfreq2 %d", cfreq2);
- return CH_WIDTH_INVALID;
- }
-
- if (cfreq2)
- ch_width = CH_WIDTH_80P80MHZ;
- }
- return ch_width;
- }
- static inline
- int target_if_vdev_get_sec20chan_freq_mhz(
- struct wlan_objmgr_vdev *vdev,
- uint16_t *sec20chan_freq)
- {
- struct wlan_objmgr_psoc *psoc = NULL;
- struct wlan_lmac_if_rx_ops *rx_ops;
- psoc = wlan_vdev_get_psoc(vdev);
- if (!psoc) {
- spectral_err("psoc is NULL");
- return -EINVAL;
- }
- rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
- if (!rx_ops) {
- spectral_err("rx_ops is null");
- return -EINVAL;
- }
- return rx_ops->sptrl_rx_ops.
- sptrlro_vdev_get_sec20chan_freq_mhz(vdev, sec20chan_freq);
- }
- static inline
- bool target_if_spectral_is_feature_disabled_psoc(struct wlan_objmgr_psoc *psoc)
- {
- struct wlan_lmac_if_rx_ops *rx_ops;
- if (!psoc) {
- spectral_err("psoc is NULL");
- return true;
- }
- rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
- if (!rx_ops) {
- spectral_err("rx_ops is null");
- return true;
- }
- if (rx_ops->sptrl_rx_ops.
- sptrlro_spectral_is_feature_disabled_psoc)
- return rx_ops->sptrl_rx_ops.
- sptrlro_spectral_is_feature_disabled_psoc(psoc);
- return true;
- }
- static inline
- bool target_if_spectral_is_feature_disabled_pdev(struct wlan_objmgr_pdev *pdev)
- {
- struct wlan_lmac_if_rx_ops *rx_ops;
- struct wlan_objmgr_psoc *psoc;
- if (!pdev) {
- spectral_err("pdev is NULL");
- return true;
- }
- psoc = wlan_pdev_get_psoc(pdev);
- if (!psoc) {
- spectral_err("psoc is NULL");
- return true;
- }
- rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
- if (!rx_ops) {
- spectral_err("rx_ops is null");
- return true;
- }
- if (rx_ops->sptrl_rx_ops.
- sptrlro_spectral_is_feature_disabled_pdev)
- return rx_ops->sptrl_rx_ops.
- sptrlro_spectral_is_feature_disabled_pdev(pdev);
- return true;
- }
- static inline
- void target_if_spectral_set_rxchainmask(struct wlan_objmgr_pdev *pdev,
- uint8_t spectral_rx_chainmask)
- {
- struct wlan_objmgr_psoc *psoc = NULL;
- struct target_if_spectral *spectral = NULL;
- enum spectral_scan_mode smode = SPECTRAL_SCAN_MODE_NORMAL;
- struct wlan_lmac_if_rx_ops *rx_ops;
- psoc = wlan_pdev_get_psoc(pdev);
- if (!psoc) {
- spectral_err("psoc is NULL");
- return;
- }
- rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
- if (!rx_ops) {
- spectral_err("rx_ops is null");
- return;
- }
- if (smode >= SPECTRAL_SCAN_MODE_MAX) {
- spectral_err("Invalid Spectral mode %u", smode);
- return;
- }
- if (rx_ops->sptrl_rx_ops.
- sptrlro_spectral_is_feature_disabled_pdev(pdev)) {
- spectral_info("Spectral feature is disabled");
- return;
- }
- spectral = get_target_if_spectral_handle_from_pdev(pdev);
- if (!spectral) {
- spectral_err("Spectral target if object is null");
- return;
- }
-
- for (; smode < SPECTRAL_SCAN_MODE_MAX; smode++)
- spectral->params[smode].ss_chn_mask = spectral_rx_chainmask;
- }
- static inline
- void target_if_spectral_process_phyerr(
- struct wlan_objmgr_pdev *pdev,
- uint8_t *data, uint32_t datalen,
- struct target_if_spectral_rfqual_info *p_rfqual,
- struct target_if_spectral_chan_info *p_chaninfo,
- uint64_t tsf64,
- struct target_if_spectral_acs_stats *acs_stats)
- {
- struct target_if_spectral *spectral = NULL;
- struct target_if_spectral_ops *p_sops = NULL;
- spectral = get_target_if_spectral_handle_from_pdev(pdev);
- if (!spectral) {
- spectral_err("Spectral target if object is null");
- return;
- }
- p_sops = GET_TARGET_IF_SPECTRAL_OPS(spectral);
- if (!p_sops->spectral_process_phyerr) {
- spectral_err("null spectral_process_phyerr");
- return;
- }
- p_sops->spectral_process_phyerr(spectral, data, datalen,
- p_rfqual, p_chaninfo,
- tsf64, acs_stats);
- }
- static QDF_STATUS
- target_if_get_spectral_msg_type(enum spectral_scan_mode smode,
- enum spectral_msg_type *msg_type) {
- switch (smode) {
- case SPECTRAL_SCAN_MODE_NORMAL:
- *msg_type = SPECTRAL_MSG_NORMAL_MODE;
- break;
- case SPECTRAL_SCAN_MODE_AGILE:
- *msg_type = SPECTRAL_MSG_AGILE_MODE;
- break;
- default:
- spectral_err("Invalid spectral mode");
- return QDF_STATUS_E_FAILURE;
- }
- return QDF_STATUS_SUCCESS;
- }
- static inline bool
- is_ch_width_160_or_80p80(enum phy_ch_width ch_width)
- {
- return (ch_width == CH_WIDTH_160MHZ || ch_width == CH_WIDTH_80P80MHZ);
- }
- static inline void
- free_samp_msg_skb(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode)
- {
- enum spectral_msg_type smsg_type;
- QDF_STATUS ret;
- if (smode >= SPECTRAL_SCAN_MODE_MAX) {
- spectral_err_rl("Invalid Spectral mode %d", smode);
- return;
- }
- if (is_ch_width_160_or_80p80(spectral->ch_width[smode])) {
- ret = target_if_get_spectral_msg_type(smode, &smsg_type);
- if (QDF_IS_STATUS_ERROR(ret)) {
- spectral_err("Failed to get spectral message type");
- return;
- }
- spectral->nl_cb.free_sbuff(spectral->pdev_obj,
- smsg_type);
- }
- }
- static inline void
- init_160mhz_delivery_state_machine(struct target_if_spectral *spectral)
- {
- uint8_t smode;
- smode = 0;
- for (; smode < SPECTRAL_SCAN_MODE_MAX; smode++)
- spectral->state_160mhz_delivery[smode] =
- SPECTRAL_REPORT_WAIT_PRIMARY80;
- }
- static inline void
- reset_160mhz_delivery_state_machine(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode)
- {
- if (smode >= SPECTRAL_SCAN_MODE_MAX) {
- spectral_err_rl("Invalid Spectral mode %d", smode);
- return;
- }
- free_samp_msg_skb(spectral, smode);
- if (is_ch_width_160_or_80p80(spectral->ch_width[smode])) {
- spectral->state_160mhz_delivery[smode] =
- SPECTRAL_REPORT_WAIT_PRIMARY80;
- }
- }
- static inline
- bool is_secondaryseg_expected(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode)
- {
- return
- (is_ch_width_160_or_80p80(spectral->ch_width[smode]) &&
- spectral->rparams.fragmentation_160[smode] &&
- (spectral->state_160mhz_delivery[smode] ==
- SPECTRAL_REPORT_WAIT_SECONDARY80));
- }
- static inline
- bool is_primaryseg_expected(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode)
- {
- return
- (!is_ch_width_160_or_80p80(spectral->ch_width[smode]) ||
- !spectral->rparams.fragmentation_160[smode] ||
- (spectral->state_160mhz_delivery[smode] ==
- SPECTRAL_REPORT_WAIT_PRIMARY80));
- }
- #ifndef OPTIMIZED_SAMP_MESSAGE
- static inline
- bool is_primaryseg_rx_inprog(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode)
- {
- return
- (!is_ch_width_160_or_80p80(spectral->ch_width[smode]) ||
- spectral->spectral_gen == SPECTRAL_GEN2 ||
- (spectral->spectral_gen == SPECTRAL_GEN3 &&
- (!spectral->rparams.fragmentation_160[smode] ||
- spectral->state_160mhz_delivery[smode] ==
- SPECTRAL_REPORT_RX_PRIMARY80)));
- }
- static inline
- bool is_secondaryseg_rx_inprog(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode)
- {
- return
- (is_ch_width_160_or_80p80(spectral->ch_width[smode]) &&
- (spectral->spectral_gen == SPECTRAL_GEN2 ||
- ((spectral->spectral_gen == SPECTRAL_GEN3) &&
- (!spectral->rparams.fragmentation_160[smode] ||
- spectral->state_160mhz_delivery[smode] ==
- SPECTRAL_REPORT_RX_SECONDARY80))));
- }
- #endif
- static inline uint8_t
- clamp_fft_bin_value(uint16_t fft_bin_value, uint16_t pwr_format)
- {
- uint8_t clamped_fft_bin_value = 0;
- switch (pwr_format) {
- case SPECTRAL_PWR_FORMAT_LINEAR:
- if (qdf_unlikely(fft_bin_value > MAX_FFTBIN_VALUE_LINEAR_MODE))
- clamped_fft_bin_value = MAX_FFTBIN_VALUE_LINEAR_MODE;
- else
- clamped_fft_bin_value = fft_bin_value;
- break;
- case SPECTRAL_PWR_FORMAT_DBM:
- if (qdf_unlikely((int16_t)fft_bin_value >
- MAX_FFTBIN_VALUE_DBM_MODE))
- clamped_fft_bin_value = MAX_FFTBIN_VALUE_DBM_MODE;
- else if (qdf_unlikely((int16_t)fft_bin_value <
- MIN_FFTBIN_VALUE_DBM_MODE))
- clamped_fft_bin_value = MIN_FFTBIN_VALUE_DBM_MODE;
- else
- clamped_fft_bin_value = fft_bin_value;
- break;
- default:
- spectral_err_rl("Invalid pwr format: %d.", pwr_format);
- return 0;
- }
- return clamped_fft_bin_value;
- }
- QDF_STATUS
- target_if_160mhz_delivery_state_change(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode,
- uint8_t detector_id);
- uint32_t target_if_sops_is_spectral_enabled(void *arg,
- enum spectral_scan_mode smode);
- uint32_t target_if_sops_is_spectral_active(void *arg,
- enum spectral_scan_mode smode);
- uint32_t target_if_sops_start_spectral_scan(void *arg,
- enum spectral_scan_mode smode,
- enum spectral_cp_error_code *err);
- uint32_t target_if_sops_stop_spectral_scan(void *arg,
- enum spectral_scan_mode smode);
- uint32_t
- target_if_spectral_get_extension_channel(void *arg,
- enum spectral_scan_mode smode);
- uint32_t
- target_if_spectral_get_current_channel(void *arg,
- enum spectral_scan_mode smode);
- uint32_t target_if_spectral_reset_hw(void *arg);
- uint32_t target_if_spectral_get_chain_noise_floor(void *arg, int16_t *nf_buf);
- int8_t target_if_spectral_get_ext_noisefloor(void *arg);
- int8_t target_if_spectral_get_ctl_noisefloor(void *arg);
- uint32_t target_if_spectral_get_capability(
- void *arg, enum spectral_capability_type type);
- uint32_t target_if_spectral_set_rxfilter(void *arg, int rxfilter);
- uint32_t target_if_spectral_sops_configure_params(
- void *arg, struct spectral_config *params,
- enum spectral_scan_mode smode);
- uint32_t target_if_spectral_get_rxfilter(void *arg);
- void target_if_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev);
- QDF_STATUS target_if_set_spectral_config(struct wlan_objmgr_pdev *pdev,
- const struct spectral_cp_param *param,
- const enum spectral_scan_mode smode,
- enum spectral_cp_error_code *err);
- void *target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev);
- uint32_t target_if_spectral_sops_get_params(
- void *arg, struct spectral_config *params,
- enum spectral_scan_mode smode);
- QDF_STATUS
- target_if_init_spectral_capability(struct target_if_spectral *spectral,
- uint32_t target_type);
- QDF_STATUS target_if_start_spectral_scan(struct wlan_objmgr_pdev *pdev,
- uint8_t vdev_id,
- enum spectral_scan_mode smode,
- enum spectral_cp_error_code *err);
- QDF_STATUS target_if_get_spectral_config(struct wlan_objmgr_pdev *pdev,
- struct spectral_config *param,
- enum spectral_scan_mode smode);
- int target_if_spectral_scan_enable_params(
- struct target_if_spectral *spectral,
- struct spectral_config *spectral_params,
- enum spectral_scan_mode smode,
- enum spectral_cp_error_code *err);
- bool target_if_is_spectral_active(struct wlan_objmgr_pdev *pdev,
- enum spectral_scan_mode smode);
- bool target_if_is_spectral_enabled(struct wlan_objmgr_pdev *pdev,
- enum spectral_scan_mode smode);
- QDF_STATUS target_if_set_debug_level(struct wlan_objmgr_pdev *pdev,
- uint32_t debug_level);
- uint32_t target_if_get_debug_level(struct wlan_objmgr_pdev *pdev);
- QDF_STATUS target_if_get_spectral_capinfo(struct wlan_objmgr_pdev *pdev,
- struct spectral_caps *scaps);
- QDF_STATUS target_if_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev,
- struct spectral_diag_stats *stats);
- QDF_STATUS
- target_if_160mhz_delivery_state_change(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode,
- uint8_t detector_id);
- #ifdef OPTIMIZED_SAMP_MESSAGE
- static inline uint32_t
- target_if_spectral_get_num_fft_bins(uint32_t fft_size,
- enum spectral_report_mode report_mode)
- {
- switch (report_mode) {
- case SPECTRAL_REPORT_MODE_0:
- case SPECTRAL_REPORT_MODE_1:
- return 0;
- case SPECTRAL_REPORT_MODE_2:
- return (1 << (fft_size - 1));
- case SPECTRAL_REPORT_MODE_3:
- return (1 << fft_size);
- default:
- return -EINVAL;
- }
- }
- #endif
- #ifdef OPTIMIZED_SAMP_MESSAGE
- static inline
- enum phy_ch_width target_if_get_detector_chwidth(enum phy_ch_width ch_width,
- bool fragmentation_160)
- {
- return ((ch_width == CH_WIDTH_160MHZ && fragmentation_160) ?
- CH_WIDTH_80MHZ : ((ch_width == CH_WIDTH_80P80MHZ) ?
- CH_WIDTH_80MHZ : ch_width));
- }
- static inline
- void target_if_spectral_set_start_end_freq(uint32_t cfreq,
- enum phy_ch_width ch_width,
- bool fragmentation_160,
- uint32_t *start_end_freq)
- {
- enum phy_ch_width det_ch_width;
- det_ch_width = target_if_get_detector_chwidth(ch_width,
- fragmentation_160);
- start_end_freq[0] = cfreq - (wlan_reg_get_bw_value(det_ch_width) >> 1);
- start_end_freq[1] = cfreq + (wlan_reg_get_bw_value(det_ch_width) >> 1);
- }
- #endif
- #ifdef DIRECT_BUF_RX_ENABLE
- int
- target_if_consume_spectral_report_gen3(
- struct target_if_spectral *spectral,
- struct spectral_report *report);
- #endif
- QDF_STATUS target_if_spectral_fw_hang(struct target_if_spectral *spectral);
- QDF_STATUS
- target_if_spectral_finite_scan_update(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode);
- QDF_STATUS
- target_if_spectral_is_finite_scan(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode,
- bool *finite_spectral_scan);
- #ifdef BIG_ENDIAN_HOST
- QDF_STATUS target_if_byte_swap_spectral_headers_gen3(
- struct target_if_spectral *spectral,
- void *data);
- QDF_STATUS target_if_byte_swap_spectral_fft_bins_gen3(
- const struct spectral_report_params *rparams,
- void *bin_pwr_data, size_t num_fftbins);
- #endif
- #ifdef OPTIMIZED_SAMP_MESSAGE
- QDF_STATUS
- target_if_populate_fft_bins_info(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode);
- #else
- static inline QDF_STATUS
- target_if_populate_fft_bins_info(struct target_if_spectral *spectral,
- enum spectral_scan_mode smode)
- {
- return QDF_STATUS_SUCCESS;
- }
- #endif
- QDF_STATUS
- spectral_is_session_info_expected_from_target(struct wlan_objmgr_pdev *pdev,
- bool *is_session_info_expected);
- #ifdef WIN32
- #pragma pack(pop, target_if_spectral)
- #endif
- #ifdef __ATTRIB_PACK
- #undef __ATTRIB_PACK
- #endif
- QDF_STATUS
- target_if_spectral_copy_fft_bins(struct target_if_spectral *spectral,
- const void *src_fft_buf,
- void *dest_fft_buf,
- uint32_t fft_bin_count,
- uint32_t *bytes_copied,
- uint16_t pwr_format);
- #endif
- struct spectral_capabilities_event_params;
- QDF_STATUS target_if_wmi_extract_spectral_caps_fixed_param(
- struct wlan_objmgr_psoc *psoc,
- uint8_t *evt_buf,
- struct spectral_capabilities_event_params *param);
- struct spectral_scan_bw_capabilities;
- QDF_STATUS
- target_if_wmi_extract_spectral_scan_bw_caps(
- struct wlan_objmgr_psoc *psoc,
- uint8_t *evt_buf,
- struct spectral_scan_bw_capabilities *bw_caps);
- struct spectral_fft_size_capabilities;
- QDF_STATUS
- target_if_wmi_extract_spectral_fft_size_caps(
- struct wlan_objmgr_psoc *psoc,
- uint8_t *evt_buf,
- struct spectral_fft_size_capabilities *fft_size_caps);
- #endif
|