ll.h 126 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423
  1. /**************************************************************************************************
  2. Phyplus Microelectronics Limited confidential and proprietary.
  3. All rights reserved.
  4. IMPORTANT: All rights of this software belong to Phyplus Microelectronics
  5. Limited ("Phyplus"). Your use of this Software is limited to those
  6. specific rights granted under the terms of the business contract, the
  7. confidential agreement, the non-disclosure agreement and any other forms
  8. of agreements as a customer or a partner of Phyplus. You may not use this
  9. Software unless you agree to abide by the terms of these agreements.
  10. You acknowledge that the Software may not be modified, copied,
  11. distributed or disclosed unless embedded on a Phyplus Bluetooth Low Energy
  12. (BLE) integrated circuit, either as a product or is integrated into your
  13. products. Other than for the aforementioned purposes, you may not use,
  14. reproduce, copy, prepare derivative works of, modify, distribute, perform,
  15. display or sell this Software and/or its documentation for any purposes.
  16. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  17. PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  18. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  19. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  20. PHYPLUS OR ITS SUBSIDIARIES BE LIABLE OR OBLIGATED UNDER CONTRACT,
  21. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  22. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  23. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  24. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  25. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  26. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  27. **************************************************************************************************/
  28. /*******************************************************************************
  29. Filename: ll.h
  30. Revised:
  31. Revision:
  32. Description: This file contains the Link Layer (LL) API for the Bluetooth
  33. Low Energy (BLE) Controller. It provides the defines, types,
  34. and functions for all supported Bluetooth Low Energy (BLE)
  35. commands.
  36. This API is based on the Bluetooth Core Specification,
  37. V4.0.0, Vol. 6.
  38. *******************************************************************************/
  39. #ifndef LL_H
  40. #define LL_H
  41. #ifdef __cplusplus
  42. extern "C"
  43. {
  44. #endif
  45. /*******************************************************************************
  46. * INCLUDES
  47. */
  48. #include "bcomdef.h"
  49. #include "timer.h"
  50. #include "ll_def.h"
  51. /*******************************************************************************
  52. * MACROS
  53. */
  54. // check if connection parameter ranges for CI (min/max), SL, and LSTO are valid
  55. #define LL_INVALID_CONN_TIME_PARAM( ciMin, ciMax, sl, lsto ) \
  56. (((ciMin) < LL_CONN_INTERVAL_MIN) || \
  57. ((ciMin) > LL_CONN_INTERVAL_MAX) || \
  58. ((ciMax) < LL_CONN_INTERVAL_MIN) || \
  59. ((ciMax) > LL_CONN_INTERVAL_MAX) || \
  60. ((ciMax) < (ciMin)) || \
  61. ((sl) > LL_SLAVE_LATENCY_MAX) || \
  62. ((lsto) < LL_CONN_TIMEOUT_MIN) || \
  63. ((lsto) > LL_CONN_TIMEOUT_MAX))
  64. // check if the CI/SL/LSTO combination is valid
  65. // based on: LSTO > (1 + Slave Latency) * (Connection Interval * 2)
  66. // Note: The CI * 2 requirement based on ESR05 V1.0, Erratum 3904.
  67. // Note: LSTO time is normalized to units of 1.25ms (i.e. 10ms = 8 * 1.25ms).
  68. #define LL_INVALID_CONN_TIME_PARAM_COMBO( ci, sl, lsto ) \
  69. ((uint32)((lsto)*8) <= ((uint32)(1+(sl)) * (uint32)((ci)*2)))
  70. #define LL_TIME_DELTA(T1, T2) ((T2 >= T1) ? (T2 - T1) : (BASE_TIME_UNITS - T1 + T2))
  71. /*******************************************************************************
  72. * CONSTANTS
  73. */
  74. /*
  75. ** LL API Status Codes
  76. **
  77. ** Note: These status values map directly to the HCI Error Codes.
  78. ** Per the Bluetooth Core Specification, V4.0.0, Vol. 2, Part D.
  79. */
  80. #define LL_STATUS_SUCCESS 0x00 // Success
  81. #define LL_STATUS_ERROR_UNKNOWN_CONN_HANDLE 0x02 // Unknown Connection Identifier
  82. #define LL_STATUS_ERROR_INACTIVE_CONNECTION 0x02 // Unknown Connection Identifier for now; may be needed for multiple connections
  83. #define LL_STATUS_ERROR_AUTH_FAILURE 0x05 // Authentication Failure
  84. #define LL_STATUS_ERROR_PIN_OR_KEY_MISSING 0x06 // Pin or Key Missing
  85. #define LL_STATUS_ERROR_OUT_OF_CONN_RESOURCES 0x07 // Memory Capacity Exceeded
  86. #define LL_STATUS_ERROR_OUT_OF_TX_MEM 0x07 // Memory Capacity Exceeded
  87. #define LL_STATUS_ERROR_OUT_OF_RX_MEM 0x07 // Memory Capacity Exceeded
  88. #define LL_STATUS_ERROR_OUT_OF_HEAP 0x07 // Memory Capacity Exceeded
  89. #define LL_STATUS_ERROR_WL_TABLE_FULL 0x07 // Memory Capacity Exceeded
  90. #define LL_STATUS_ERROR_RL_TABLE_FULL 0x07 // Memory Capacity Exceeded, add by HZF
  91. #define LL_STATUS_ERROR_TX_DATA_QUEUE_FULL 0x07 // Memory Capacity Exceeded
  92. #define LL_STATUS_ERROR_TX_DATA_QUEUE_EMPTY 0x07 // Memory Capacity Exceeded
  93. #define LL_STATUS_ERROR_CONNECTION_TIMEOUT 0x08 // Connection Timeout
  94. #define LL_STATUS_ERROR_CONNECTION_LIMIT_EXCEEDED 0x09 // Connection Limit Exceeded
  95. #define LL_STATUS_ERROR_COMMAND_DISALLOWED 0x0C // Command Disallowed
  96. #define LL_STATUS_ERROR_DUE_TO_LIMITED_RESOURCES 0x0D // Command Rejected Due To Limited Resources
  97. #define LL_STATUS_ERROR_DUE_TO_DELAYED_RESOURCES 0x0D // Command Delayed Due To Limited Resources
  98. #define LL_STATUS_ERROR_FEATURE_NOT_SUPPORTED 0x11 // Unsupported Feature or Parameter Value
  99. #define LL_STATUS_ERROR_UNEXPECTED_PARAMETER 0x12 // Invalid HCI Command Parameters
  100. #define LL_STATUS_ERROR_ILLEGAL_PARAM_COMBINATION 0x12 // Invalid HCI Command Parameters
  101. #define LL_STATUS_ERROR_BAD_PARAMETER 0x12 // Invalid HCI Command Parameters or 0x30: Parameter Out of Mandatory Range?
  102. #define LL_STATUS_ERROR_UNKNOWN_ADV_EVT_TYPE 0x12 // Invalid HCI Command Parameters or 0x30: Parameter Out of Mandatory Range?
  103. #define LL_STATUS_ERROR_PEER_TERM 0x13 // Remote User Terminated Connection
  104. #define LL_STATUS_ERROR_PEER_DEVICE_TERM_LOW_RESOURCES 0x14 // Remote Device Terminated Connection Due To Low Resources
  105. #define LL_STATUS_ERROR_PEER_DEVICE_TERM_POWER_OFF 0x15 // Remote Device Terminated Connection Due To Power Off
  106. #define LL_STATUS_ERROR_HOST_TERM 0x16 // Connection Terminated By Local Host
  107. #define LL_STATUS_ERROR_UNSUPPORTED_REMOTE_FEATURE 0x1A // Unsupported Remote Feature
  108. // 2020-01-23 add error Code
  109. #define LL_STATUS_ERROR_INVALID_LMP_LL_PARAMETER 0x1E
  110. #define LL_STATUS_ERROR_WL_ENTRY_NOT_FOUND 0x1F // Unspecified Error
  111. #define LL_STATUS_ERROR_WL_TABLE_EMPTY 0x1F // Unspecified Error
  112. #define LL_STATUS_ERROR_RL_ENTRY_NOT_FOUND 0x1F // Unspecified Error
  113. #define LL_STATUS_ERROR_RL_TABLE_EMPTY 0x1F // Unspecified Error
  114. #define LL_STATUS_ERROR_RNG_FAILURE 0x1F // Unspecified Error
  115. #define LL_STATUS_ERROR_DISCONNECT_IMMEDIATE 0x1F // Unspecified Error
  116. #define LL_STATUS_ERROR_DATA_PACKET_QUEUED 0x1F // Unspecified Error
  117. // 2020-01-23 add error Code
  118. #define LL_STATUS_ERROR_UNSUPPORT_LMP_LL_PARAMETER 0x20
  119. #define LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE 0x21 // Role Change Not Allowed
  120. #define LL_STATUS_ERROR_LL_TIMEOUT 0x22 // Link Layer Response Timeout
  121. #define LL_STATUS_ERROR_LL_TIMEOUT_HOST 0x22 // Link Layer Response Timeout
  122. #define LL_STATUS_ERROR_LL_TIMEOUT_PEER 0x22 // Link Layer Response Timeout
  123. #define LL_STATUS_ERROR_LL_PROCEDURE_COLLISION 0x23 // Link Layer Procedure collision
  124. #define LL_STATUS_ERROR_INSTANT_PASSED 0x28 // Instant Passed
  125. #define LL_STATUS_ERROR_INSTANT_PASSED_HOST 0x28 // Instant Passed
  126. #define LL_STATUS_ERROR_INSTANT_PASSED_PEER 0x28 // Instant Passed
  127. #define LL_STATUS_ERROR_KEY_PAIRING_NOT_SUPPORTED 0x29 // Pairing With Unit Key Not Supported
  128. #define LL_STATUS_ERROR_DIFF_TRANSACTION_COLLISION 0x2A // Link Layer collision in same procedure
  129. #define LL_STATUS_ERROR_NO_ADV_CHAN_FOUND 0x30 // Parameter Out Of Mandatory Range
  130. #define LL_STATUS_ERROR_PARAM_OUT_OF_RANGE 0x30 // Parameter Out Of Mandatory Range
  131. #define LL_STATUS_ERROR_UPDATE_CTRL_PROC_PENDING 0x3A // Controller Busy
  132. #define LL_STATUS_ERROR_CTRL_PROC_ALREADY_ACTIVE 0x3A // Controller Busy
  133. #define LL_STATUS_ERROR_VER_INFO_REQ_ALREADY_PENDING 0x3A // Controller Busy
  134. #define LL_STATUS_ERROR_UNACCEPTABLE_CONN_INTERVAL 0x3B // Unacceptable Connection Interval
  135. #define LL_STATUS_ERROR_DIRECTED_ADV_TIMEOUT 0x3C // Directed Advertising Timeout
  136. #define LL_STATUS_ERROR_CONN_TERM_DUE_TO_MIC_FAILURE 0x3D // Connection Terminated Due To MIC Failure
  137. #define LL_STATUS_ERROR_CONN_FAILED_TO_BE_ESTABLISHED 0x3E // Connection Failed To Be Established
  138. #define LL_STATUS_ERROR_CONN_TIMING_FAILURE 0x3F // MAC Connection Failed
  139. #define LL_STATUS_ERROR_COARSE_CLK_ADJ_REJECT 0x40 // Coarse Clock Adjustment Rejected but Will Try to Adjust Using Clock Dragging
  140. #define LL_STATUS_ERROR_TYPE0_SUBMAP_NOT_DEF 0x41 // Type0 Submap Not Defined
  141. #define LL_STATUS_ERROR_UNKNOWN_ADV_ID 0x42 // Unknown Advertising Identifier
  142. #define LL_STATUS_ERROR_LIMIT_REACHED 0x43 // Limit Reached
  143. #define LL_STATUS_ERROR_OP_CANCEL_BY_HOST 0x44 // Operation Cancelled by Host
  144. #define LL_STATUS_ERROR_PACKET_TOO_LONG 0x45 // Packet Too Long
  145. // Internal
  146. #define LL_STATUS_DISABLE_LATENCY_INACTIVE_CONN 0x81
  147. #define LL_STATUS_DISABLE_LATENCY_DISABLED 0x82
  148. #define LL_STATUS_DISABLE_LATENCY_PENDING 0x83
  149. #define LL_STATUS_DISABLE_LATENCY_MISS_EVT 0x84
  150. #define LL_STATUS_DISABLE_LATENCY_FAIL 0x8F
  151. #define LL_STATUS_WARNING_WAITING_LLIRQ 0xFE // only used internally, so value doesn't matter
  152. #define LL_STATUS_WARNING_TX_DISABLED 0xFF // only used internally, so value doesn't matter
  153. #define LL_STATUS_WARNING_FLAG_UNCHANGED 0xFF // only used internally, so value doesn't matter
  154. // Encryption Key Request Reason Codes
  155. #define LL_ENC_KEY_REQ_ACCEPTED LL_STATUS_SUCCESS
  156. #define LL_ENC_KEY_REQ_REJECTED LL_STATUS_ERROR_PIN_OR_KEY_MISSING
  157. #define LL_ENC_KEY_REQ_UNSUPPORTED_FEATURE LL_STATUS_ERROR_UNSUPPORTED_REMOTE_FEATURE
  158. // Disconnect Reason Codes
  159. #define LL_SUPERVISION_TIMEOUT_TERM LL_STATUS_ERROR_CONNECTION_TIMEOUT
  160. #define LL_PEER_REQUESTED_TERM LL_STATUS_ERROR_PEER_TERM
  161. #define LL_PEER_REQUESTED_LOW_RESOURCES_TERM LL_STATUS_ERROR_PEER_DEVICE_TERM_LOW_RESOURCES
  162. #define LL_PEER_REQUESTED_POWER_OFF_TERM LL_STATUS_ERROR_PEER_DEVICE_TERM_POWER_OFF
  163. #define LL_HOST_REQUESTED_TERM LL_STATUS_ERROR_HOST_TERM
  164. #define LL_CTRL_PKT_TIMEOUT_TERM LL_STATUS_ERROR_LL_TIMEOUT
  165. #define LL_CTRL_PKT_TIMEOUT_HOST_TERM LL_STATUS_ERROR_LL_TIMEOUT_HOST
  166. #define LL_CTRL_PKT_TIMEOUT_PEER_TERM LL_STATUS_ERROR_LL_TIMEOUT_PEER
  167. #define LL_CTRL_PKT_INSTANT_PASSED_TERM LL_STATUS_ERROR_INSTANT_PASSED
  168. #define LL_CTRL_PKT_INSTANT_PASSED_HOST_TERM LL_STATUS_ERROR_INSTANT_PASSED_HOST
  169. #define LL_CTRL_PKT_INSTANT_PASSED_PEER_TERM LL_STATUS_ERROR_INSTANT_PASSED_PEER
  170. #define LL_UNACCEPTABLE_CONN_INTERVAL_TERM LL_STATUS_ERROR_UNACCEPTABLE_CONN_INTERVAL
  171. #define LL_MIC_FAILURE_TERM LL_STATUS_ERROR_CONN_TERM_DUE_TO_MIC_FAILURE
  172. #define LL_CONN_ESTABLISHMENT_FAILED_TERM LL_STATUS_ERROR_CONN_FAILED_TO_BE_ESTABLISHED
  173. // Disconnect API Parameter
  174. #define LL_DISCONNECT_AUTH_FAILURE LL_STATUS_ERROR_AUTH_FAILURE
  175. #define LL_DISCONNECT_REMOTE_USER_TERM LL_STATUS_ERROR_PEER_TERM
  176. #define LL_DISCONNECT_REMOTE_DEV_LOW_RESOURCES LL_STATUS_ERROR_PEER_DEVICE_TERM_LOW_RESOURCES
  177. #define LL_DISCONNECT_REMOTE_DEV_POWER_OFF LL_STATUS_ERROR_PEER_DEVICE_TERM_POWER_OFF
  178. #define LL_DISCONNECT_UNSUPPORTED_REMOTE_FEATURE LL_STATUS_ERROR_UNSUPPORTED_REMOTE_FEATURE
  179. #define LL_DISCONNECT_KEY_PAIRING_NOT_SUPPORTED LL_STATUS_ERROR_KEY_PAIRING_NOT_SUPPORTED
  180. #define LL_DISCONNECT_UNACCEPTABLE_CONN_INTERVAL LL_STATUS_ERROR_UNACCEPTABLE_CONN_INTERVAL
  181. // LL Advertiser Events
  182. #define LL_ADV_CONNECTABLE_UNDIRECTED_EVT 0
  183. #define LL_ADV_CONNECTABLE_HDC_DIRECTED_EVT 1 // High Duty Cycle
  184. #define LL_ADV_SCANNABLE_UNDIRECTED_EVT 2
  185. #define LL_ADV_NONCONNECTABLE_UNDIRECTED_EVT 3
  186. #define LL_ADV_CONNECTABLE_LDC_DIRECTED_EVT 4 // Low Duty Cycle
  187. // LL Address Type
  188. #define LL_DEV_ADDR_TYPE_PUBLIC 0
  189. #define LL_DEV_ADDR_TYPE_RANDOM 1
  190. #define LL_DEV_ADDR_TYPE_RPA_PUBLIC 2 // Controller generates Resolvable Private Address based on the local IRK from resolving list. If resolving list contains no matching entry, use public address
  191. #define LL_DEV_ADDR_TYPE_RPA_RANDOM 3 // Controller generates Resolvable Private Address based on the local IRK from resolving list. If resolving list contains no matching entry, use random address from LE_Set_Random_Address.
  192. // Advertiser White List Policy
  193. #define LL_ADV_WL_POLICY_ANY_REQ 0 // any scan request or connect request
  194. #define LL_ADV_WL_POLICY_WL_SCAN_REQ 1 // any connect request, white list scan request
  195. #define LL_ADV_WL_POLICY_WL_CONNECT_REQ 2 // any scan request, white list connect request
  196. #define LL_ADV_WL_POLICY_WL_ALL_REQ 3 // white list scan request and connect request
  197. // Scanner White List Policy
  198. #define LL_SCAN_WL_POLICY_ANY_ADV_PKTS 0
  199. #define LL_SCAN_WL_POLICY_USE_WHITE_LIST 1
  200. #define LL_SCAN_WL_POLICY_BLE42_1 2
  201. #define LL_SCAN_WL_POLICY_BLE42_2 3
  202. // Initiator White List Policy
  203. #define LL_INIT_WL_POLICY_USE_PEER_ADDR 0
  204. #define LL_INIT_WL_POLICY_USE_WHITE_LIST 1
  205. // Black List Control
  206. #define LL_SET_BLACKLIST_DISABLE 0
  207. #define LL_SET_BLACKLIST_ENABLE 1
  208. // Advertiser Commands
  209. #define LL_ADV_MODE_OFF 0
  210. #define LL_ADV_MODE_ON 1
  211. #define LL_ADV_MODE_RESERVED 2
  212. // LL Scan Commands
  213. #define LL_SCAN_STOP 0
  214. #define LL_SCAN_START 1
  215. // LL Scan Filtering
  216. #define LL_FILTER_REPORTS_DISABLE 0
  217. #define LL_FILTER_REPORTS_ENABLE 1
  218. // LL Scan Types
  219. #define LL_SCAN_PASSIVE 0
  220. #define LL_SCAN_ACTIVE 1
  221. // LL Tx Power Types
  222. #define LL_READ_CURRENT_TX_POWER_LEVEL 0
  223. #define LL_READ_MAX_TX_POWER_LEVEL 1
  224. // Data Fragmentation Flag
  225. #define LL_DATA_FIRST_PKT_HOST_TO_CTRL 0
  226. #define LL_DATA_CONTINUATION_PKT 1
  227. #define LL_DATA_FIRST_PKT_CTRL_TO_HOST 2
  228. // Connection Complete Role
  229. #define LL_LINK_CONNECT_COMPLETE_MASTER 0
  230. #define LL_LINK_CONNECT_COMPLETE_SLAVE 1
  231. // Encryption Related
  232. #define LL_ENCRYPTION_OFF 0
  233. #define LL_ENCRYPTION_ON 1
  234. // Feature Set Related
  235. #define LL_MAX_FEATURE_SET_SIZE 8 // in bytes
  236. //
  237. #define LL_FEATURE_RFU 0 // all bits in a byte
  238. #define LL_FEATURE_ENCRYPTION 1 // byte 0, bit 0
  239. #define LL_FEATURE_EXT_REJECT_IND 4 // byte 0, bit 0
  240. #define LL_FEATURE_DATA_LENGTH_EXTENSION 0x20 // byte 0, bit 0
  241. #define LL_FEATURE_2M_PHY 0x01 // byte 1, bit 0
  242. #define LL_FEATURE_CODED_PHY 0x08 // byte 1, bit 3
  243. // 2020-01-15 add
  244. // CODE PHY feature
  245. #define LL_FEATURE_CODE_PHY_IDX 1 // byte 1
  246. #define LL_FEATURE_CODE_PHY 0x08
  247. // extended advertisingCTE feature
  248. #define LL_FEATURE_EXT_ADV_IDX 1
  249. #define LL_FEATURE_EXT_ADV 0x10
  250. // periodic advertising
  251. #define LL_FEATURE_PRD_ADV_IDX 1
  252. #define LL_FEATURE_PRD_ADV 0x20
  253. // Channel selection Algorithm #2
  254. #define LL_FEATURE_CSA2_IDX 1
  255. #define LL_FEATURE_CSA2 0x40
  256. // CTE FEATURE
  257. #define LL_CTE_FEATURE_IDX 2
  258. #define LL_CONN_CTE_REQ 0x02
  259. #define LL_CONN_CTE_RSP 0x04
  260. #define LL_CONNLESS_CTE_TRANSMITER 0x08
  261. #define LL_CONNLESS_CTE_RECEIVER 0x10
  262. #define LL_AOD_SUPPORT 0x20
  263. #define LL_AOA_SUPPORT 0x40
  264. // Receive Flow Control
  265. #define LL_DISABLE_RX_FLOW_CONTROL 0
  266. #define LL_ENABLE_RX_FLOW_CONTROL 1
  267. // Direct Test Mode
  268. #define LL_DIRECT_TEST_NUM_RF_CHANS 40 // PHY_NUM_RF_CHANS
  269. #define LL_DIRECT_TEST_MAX_PAYLOAD_LEN 37
  270. //
  271. #define LL_DIRECT_TEST_PAYLOAD_PRBS9 0
  272. #define LL_DIRECT_TEST_PAYLOAD_0x0F 1
  273. #define LL_DIRECT_TEST_PAYLOAD_0x55 2
  274. #define LL_DIRECT_TEST_PAYLOAD_PRBS15 3
  275. #define LL_DIRECT_TEST_PAYLOAD_0xFF 4
  276. #define LL_DIRECT_TEST_PAYLOAD_0x00 5
  277. #define LL_DIRECT_TEST_PAYLOAD_0xF0 6
  278. #define LL_DIRECT_TEST_PAYLOAD_0xAA 7
  279. #define LL_DIRECT_TEST_PAYLOAD_UNDEFINED 0xFF
  280. //
  281. #define LL_DIRECT_TEST_MODE_TX 0
  282. #define LL_DIRECT_TEST_MODE_RX 1
  283. //
  284. #define LL_RF_RSSI_UNDEFINED PHY_RSSI_VALUE_INVALID
  285. // Vendor Specific
  286. #define LL_EXT_RX_GAIN_STD 0
  287. #define LL_EXT_RX_GAIN_HIGH 1
  288. //
  289. #define LL_EXT_TX_POWER_MINUS_23_DBM 0
  290. #define LL_EXT_TX_POWER_MINUS_6_DBM 1
  291. #define LL_EXT_TX_POWER_0_DBM 2
  292. #define LL_EXT_TX_POWER_4_DBM 3
  293. //
  294. #define LL_EXT_DISABLE_ONE_PKT_PER_EVT 0
  295. #define LL_EXT_ENABLE_ONE_PKT_PER_EVT 1
  296. //
  297. #define LL_EXT_DISABLE_CLK_DIVIDE_ON_HALT 0
  298. #define LL_EXT_ENABLE_CLK_DIVIDE_ON_HALT 1
  299. //
  300. #define LL_EXT_NV_NOT_IN_USE 0
  301. #define LL_EXT_NV_IN_USE 1
  302. //
  303. #define LL_EXT_DISABLE_FAST_TX_RESP_TIME 0
  304. #define LL_EXT_ENABLE_FAST_TX_RESP_TIME 1
  305. //
  306. #define LL_EXT_DISABLE_SL_OVERRIDE 0
  307. #define LL_EXT_ENABLE_SL_OVERRIDE 1
  308. //
  309. #define LL_EXT_TX_MODULATED_CARRIER 0
  310. #define LL_EXT_TX_UNMODULATED_CARRIER 1
  311. //
  312. #define LL_EXT_SET_FREQ_TUNE_DOWN 0
  313. #define LL_EXT_SET_FREQ_TUNE_UP 1
  314. //
  315. #define LL_EXT_PER_RESET 0
  316. #define LL_EXT_PER_READ 1
  317. //
  318. #define LL_EXT_HALT_DURING_RF_DISABLE 0
  319. #define LL_EXT_HALT_DURING_RF_ENABLE 1
  320. //
  321. #define LL_EXT_SET_USER_REVISION 0
  322. #define LL_EXT_READ_BUILD_REVISION 1
  323. //
  324. #define LL_EXT_RESET_SYSTEM_DELAY 100 // in ms
  325. #define LL_EXT_RESET_SYSTEM_HARD 0
  326. #define LL_EXT_RESET_SYSTEM_SOFT 1
  327. //
  328. #define LL_EXT_DISABLE_OVERLAPPED_PROCESSING 0
  329. #define LL_EXT_ENABLE_OVERLAPPED_PROCESSING 1
  330. //
  331. #define LL_EXT_DISABLE_NUM_COMPL_PKTS_ON_EVENT 0
  332. #define LL_EXT_ENABLE_NUM_COMPL_PKTS_ON_EVENT 1
  333. /*
  334. ** Event Parameters
  335. */
  336. // Advertising Report Data
  337. #define LL_ADV_RPT_ADV_IND LL_ADV_CONNECTABLE_UNDIRECTED_EVT
  338. #define LL_ADV_RPT_ADV_DIRECT_IND LL_ADV_CONNECTABLE_HDC_DIRECTED_EVT
  339. #define LL_ADV_RPT_ADV_SCANNABLE_IND LL_ADV_SCANNABLE_UNDIRECTED_EVT
  340. #define LL_ADV_RPT_ADV_NONCONN_IND LL_ADV_NONCONNECTABLE_UNDIRECTED_EVT
  341. #define LL_ADV_RPT_SCAN_RSP (LL_ADV_NONCONNECTABLE_UNDIRECTED_EVT + 1)
  342. #define LL_ADV_RPT_INVALID 0xFF
  343. //
  344. #define LL_RSSI_NOT_AVAILABLE 127
  345. // Sleep Clock Accuracy (SCA)
  346. #define LL_SCA_500_PPM 0
  347. #define LL_SCA_250_PPM 1
  348. #define LL_SCA_150_PPM 2
  349. #define LL_SCA_100_PPM 3
  350. #define LL_SCA_75_PPM 4
  351. #define LL_SCA_50_PPM 5
  352. #define LL_SCA_30_PPM 6
  353. #define LL_SCA_20_PPM 7
  354. // Default SCA
  355. //#define LL_SCA_MASTER_DEFAULT 5 // 50ppm (ordinal value)
  356. #define LL_SCA_MASTER_DEFAULT 0 // 500ppm (ordinal value)
  357. #define LL_SCA_SLAVE_DEFAULT 500 // 500ppm
  358. // LL Advertiser Channels
  359. #define LL_ADV_CHAN_37 1
  360. #define LL_ADV_CHAN_38 2
  361. #define LL_ADV_CHAN_39 4
  362. #define LL_ADV_CHAN_ALL (LL_ADV_CHAN_37 | LL_ADV_CHAN_38 | LL_ADV_CHAN_39)
  363. #define LL_ADV_CHAN_MAP_DEFAULT LL_ADV_CHAN_ALL
  364. #define LL_ADV_CHAN_FIRST 37
  365. #define LL_ADV_CHAN_LAST 39
  366. // max future number of events for an update to parameters or data channel
  367. #define LL_MAX_UPDATE_COUNT_RANGE 32767
  368. // Extended Header Flags
  369. #define LE_EXT_HDR_ADVA_PRESENT_BITMASK 0x01
  370. #define LE_EXT_HDR_TARGETA_PRESENT_BITMASK 0x02
  371. #define LE_EXT_HDR_CTE_INFO_PRESENT_BITMASK 0x04
  372. #define LE_EXT_HDR_ADI_PRESENT_BITMASK 0x08
  373. #define LE_EXT_HDR_AUX_PTR_PRESENT_BITMASK 0x10
  374. #define LE_EXT_HDR_SYNC_INFO_PRESENT_BITMASK 0x20
  375. #define LE_EXT_HDR_TX_PWR_PRESENT_BITMASK 0x40
  376. #define LE_EXT_HDR_RFU_PRESENT_BITMASK 0x80
  377. // extended advertisement Macros
  378. #define LE_ADV_PROP_CONN_BITMASK 0x00000001
  379. #define LE_ADV_PROP_SCAN_BITMASK 0x00000002
  380. #define LE_ADV_PROP_DIRECT_BITMASK 0x00000004
  381. #define LE_ADV_PROP_HI_DC_CONN_BITMASK 0x00000008
  382. #define LE_ADV_PROP_LEGACY_BITMASK 0x00000010
  383. #define LE_ADV_PROP_ANON_BITMASK 0x00000020 // applicable to extended adv only
  384. #define LE_ADV_PROP_TX_POWER_BITMASK 0x00000040 // applicable to extended adv & periodic adv
  385. /* TODO: update according to spec
  386. 0x00 Intermediate fragment of fragmented extended advertising data
  387. 0x01 First fragment of fragmented extended advertising data
  388. 0x02 Last fragment of fragmented extended advertising data
  389. 0x03 Complete extended advertising data
  390. 0x04 Unchanged data (just update the Advertising DID) */
  391. #define BLE_EXT_ADV_OP_INTERM_FRAG 0x00
  392. #define BLE_EXT_ADV_OP_FIRST_FRAG 0x01
  393. #define BLE_EXT_ADV_OP_LAST_FRAG 0x02
  394. #define BLE_EXT_ADV_OP_COMPLETE_DATA 0x03
  395. #define BLE_EXT_ADV_OP_UNCHANGED_DATA 0x04
  396. #define BLE_EXT_ADV_FRAG_ENABLED 0x00
  397. #define BLE_EXT_ADV_FRAG_DISABLED 0x01
  398. #define LL_EXT_ADV_MODE_NOCONN_NOSC 0
  399. #define LL_EXT_ADV_MODE_AUX_CONN_RSP 0
  400. #define LL_EXT_ADV_MODE_CONN 1
  401. #define LL_EXT_ADV_MODE_SC 2
  402. #define LL_EXT_ADV_MODE_RFU 3
  403. // AuxPtr
  404. // channel Idx(6bits) | CA(1bit) | offset Unit(1 bit) | Aux offset(13bits) | Aux PHY
  405. #define LL_AUX_PTR_CHN_IDX_SHIFT 0
  406. #define LL_AUX_PTR_CA_SHIFT 6
  407. #define LL_AUX_PTR_OFFSET_UNIT_SHIFT 7
  408. #define LL_AUX_PTR_AUX_OFFSET_SHIFT 8
  409. #define LL_AUX_PTR_AUX_PHY_SHIFT 21
  410. #define LL_AUX_PTR_CHN_IDX_MASK 0x3F
  411. #define LL_AUX_PTR_CA_MASK 0x1
  412. #define LL_AUX_PTR_OFFSET_UNIT_MASK 0x1
  413. #define LL_AUX_PTR_AUX_OFFSET_MASK 0x1FFF
  414. #define LL_AUX_PTR_AUX_PHY_MASK 0x7
  415. // for Periodic scanner
  416. #define LL_PERIODIC_ADV_CREATE_SYNC_USING_ADV_LIST_BITMASK 0x00000001
  417. #define LL_PERIODIC_ADV_CREATE_SYNC_INIT_RPT_DISABLE_BITMASK 0x00000002
  418. /*
  419. ** Miscellaneous
  420. */
  421. #define BLE_PKT40_LEN 42
  422. #define BLE_PKT51_LEN 262
  423. #define BLE_PKT_VERSION_4_0 0
  424. #define BLE_PKT_VERSION_5_1 1
  425. /*******************************************************************************
  426. * TYPEDEFS
  427. */
  428. /*******************************************************************************
  429. * LOCAL VARIABLES
  430. */
  431. /*******************************************************************************
  432. * GLOBAL VARIABLES
  433. */
  434. /*******************************************************************************
  435. * LL OSAL Functions
  436. */
  437. /*******************************************************************************
  438. * @fn LL_Init
  439. *
  440. * @brief This is the Link Layer task initialization called by OSAL. It
  441. * must be called once when the software system is started and
  442. * before any other function in the LL API is called.
  443. *
  444. * input parameters
  445. *
  446. * @param taskId - Task identifier assigned by OSAL.
  447. *
  448. * output parameters
  449. *
  450. * @param None.
  451. *
  452. * @return None.
  453. */
  454. extern void LL_Init( uint8 taskId );
  455. /*******************************************************************************
  456. * @fn LL_ProcessEvent
  457. *
  458. * @brief This is the Link Layer process event handler called by OSAL.
  459. *
  460. * input parameters
  461. *
  462. * @param taskId - Task identifier assigned by OSAL.
  463. * events - Event flags to be processed by this task.
  464. *
  465. * output parameters
  466. *
  467. * @param None.
  468. *
  469. * @return Unprocessed event flags.
  470. */
  471. extern uint16 LL_ProcessEvent( uint8 task_id, uint16 events );
  472. /*******************************************************************************
  473. * LL API for HCI
  474. */
  475. /*******************************************************************************
  476. * @fn LL_TX_bm_alloc API
  477. *
  478. * @brief This API is used to allocate memory using buffer management.
  479. *
  480. * Note: This function should never be called by the application.
  481. * It is only used by HCI and L2CAP_bm_alloc.
  482. *
  483. * input parameters
  484. *
  485. * @param size - Number of bytes to allocate from the heap.
  486. *
  487. * output parameters
  488. *
  489. * @param None.
  490. *
  491. * @return Pointer to buffer, or NULL.
  492. */
  493. extern void *LL_TX_bm_alloc( uint16 size );
  494. /*******************************************************************************
  495. * @fn LL_RX_bm_alloc API
  496. *
  497. * @brief This API is used to allocate memory using buffer management.
  498. *
  499. * Note: This function should never be called by the application.
  500. * It is only used by HCI and L2CAP_bm_alloc.
  501. *
  502. * input parameters
  503. *
  504. * @param size - Number of bytes to allocate from the heap.
  505. *
  506. * output parameters
  507. *
  508. * @param None.
  509. *
  510. * @return Pointer to buffer, or NULL.
  511. */
  512. extern void *LL_RX_bm_alloc( uint16 size );
  513. /*******************************************************************************
  514. * @fn LL_Reset API
  515. *
  516. * @brief This function is used by the HCI to reset and initialize the
  517. * LL Controller.
  518. *
  519. * input parameters
  520. *
  521. * @param None.
  522. *
  523. * output parameters
  524. *
  525. * @param None.
  526. *
  527. * @return LL_STATUS_SUCCESS
  528. */
  529. extern llStatus_t LL_Reset( void );
  530. /*******************************************************************************
  531. * @fn LL_ReadBDADDR API
  532. *
  533. * @brief This API is called by the HCI to read the controller's
  534. * own public device address.
  535. *
  536. * Note: The device's address is stored in NV memory.
  537. *
  538. * input parameters
  539. *
  540. * @param None.
  541. *
  542. * output parameters
  543. *
  544. * @param bdAddr - A pointer to a buffer to hold this device's address.
  545. *
  546. * @return LL_STATUS_SUCCESS
  547. */
  548. extern llStatus_t LL_ReadBDADDR( uint8 *bdAddr );
  549. /*******************************************************************************
  550. *
  551. * @fn LL_SetRandomAddress API
  552. *
  553. * @brief This function is used to save this device's random address. It
  554. * is provided by the Host for devices that are unable to store a
  555. * IEEE assigned public address in NV memory.
  556. *
  557. * input parameters
  558. *
  559. * @param devAddr - Pointer to a random address (LSO..MSO).
  560. *
  561. * output parameters
  562. *
  563. * @param None.
  564. *
  565. * @return LL_STATUS_SUCCESS
  566. *
  567. */
  568. extern llStatus_t LL_SetRandomAddress( uint8 *devAddr );
  569. extern llStatus_t LL_GetRabdomAddress( uint8 *devAddr );
  570. /*******************************************************************************
  571. * @fn LL_ClearWhiteList API
  572. *
  573. * @brief This API is called by the HCI to clear the White List.
  574. *
  575. * Note: If Scanning is enabled using filtering, and the white
  576. * list policy is "Any", then this command will be
  577. * disallowed.
  578. *
  579. * input parameters
  580. *
  581. * @param None.
  582. *
  583. * output parameters
  584. *
  585. * @param None.
  586. *
  587. * @return LL_STATUS_SUCCESS
  588. */
  589. extern llStatus_t LL_ClearWhiteList( void );
  590. /*******************************************************************************
  591. * @fn LL_AddWhiteListDevice API
  592. *
  593. * @brief This API is called by the HCI to add a device address and its
  594. * type to the White List.
  595. *
  596. * input parameters
  597. *
  598. * @param devAddr - Pointer to a 6 byte device address.
  599. * @param addrType - Public or Random device address.
  600. *
  601. * output parameters
  602. *
  603. * @param None.
  604. *
  605. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  606. * LL_STATUS_ERROR_WL_TABLE_FULL
  607. */
  608. extern llStatus_t LL_AddWhiteListDevice( uint8 *devAddr,
  609. uint8 addrType );
  610. /*******************************************************************************
  611. * @fn LL_RemoveWhiteListDevice API
  612. *
  613. * @brief This API is called by the HCI to remove a device address and
  614. * it's type from the White List.
  615. *
  616. * input parameters
  617. *
  618. * @param devAddr - Pointer to a 6 byte device address.
  619. * @param addrType - Public or Random device address.
  620. *
  621. * output parameters
  622. *
  623. * @param None.
  624. *
  625. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  626. * LL_STATUS_ERROR_WL_TABLE_EMPTY,
  627. * LL_STATUS_ERROR_WL_ENTRY_NOT_FOUND
  628. */
  629. extern llStatus_t LL_RemoveWhiteListDevice( uint8 *devAddr,
  630. uint8 addrType );
  631. /*******************************************************************************
  632. * @fn LL_ReadWlSize API
  633. *
  634. * @brief This API is called by the HCI to get the total number of white
  635. * list entries that can be stored in the Controller.
  636. *
  637. * input parameters
  638. *
  639. * @param None.
  640. *
  641. * output parameters
  642. *
  643. * @param *numEntries - Total number of available White List entries.
  644. *
  645. * @return LL_STATUS_SUCCESS
  646. */
  647. extern llStatus_t LL_ReadWlSize( uint8 *numEntries );
  648. /*******************************************************************************
  649. * @fn LL_NumEmptyWlEntries API
  650. *
  651. * @brief This API is called by the HCI to get the number of White List
  652. * entries that are empty.
  653. *
  654. * input parameters
  655. *
  656. * @param None.
  657. *
  658. * output parameters
  659. *
  660. * @param *numEmptyEntries - number of empty entries in the White List.
  661. *
  662. * @return LL_STATUS_SUCCESS
  663. */
  664. extern llStatus_t LL_NumEmptyWlEntries( uint8 *numEmptyEntries );
  665. /*******************************************************************************
  666. * @fn LL_Encrypt API
  667. *
  668. * @brief This API is called by the HCI to request the LL to encrypt the
  669. * data in the command using the key given in the command.
  670. *
  671. * Note: The parameters are byte ordered MSO to LSO.
  672. *
  673. * input parameters
  674. *
  675. * @param *key - A 128 bit key to be used to calculate the
  676. * session key.
  677. * @param *plaintextData - A 128 bit block that is to be encrypted.
  678. *
  679. * output parameters
  680. *
  681. * @param *encryptedData - A 128 bit block that is encrypted.
  682. *
  683. * @param None.
  684. *
  685. * @return LL_STATUS_SUCCESS
  686. */
  687. extern llStatus_t LL_Encrypt( uint8 *key,
  688. uint8 *plaintextData,
  689. uint8 *encryptedData );
  690. /*******************************************************************************
  691. * @fn LL_Rand API
  692. *
  693. * @brief This API is called by the HCI to request the LL Controller to
  694. * provide a data block with random content.
  695. *
  696. * Note: If the radio is in use, then this operation has to be
  697. * delayed until the radio finishes.
  698. *
  699. * input parameters
  700. *
  701. * @param *randData - Pointer to buffer to place a random block of data.
  702. * @param dataLen - The length of the random data block, from 1-255.
  703. *
  704. * output parameters
  705. *
  706. * @param *randData - Pointer to buffer containing a block of true random
  707. * data.
  708. *
  709. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_DUE_TO_LIMITED_RESOURCES,
  710. * LL_STATUS_ERROR_COMMAND_DISALLOWED,
  711. * LL_STATUS_ERROR_BAD_PARAMETER, LL_STATUS_ERROR_RNG_FAILURE
  712. */
  713. extern llStatus_t LL_Rand( uint8 *randData,
  714. uint8 dataLen );
  715. /*******************************************************************************
  716. * @fn LL_ReadSupportedStates API
  717. *
  718. * @brief This function is used to provide the HCI with the Link Layer
  719. * supported states and supported state/role combinations.
  720. *
  721. * input parameters
  722. *
  723. * @param None.
  724. *
  725. * output parameters
  726. *
  727. * @param *states - Eight byte Bit map of supported states/combos.
  728. *
  729. * @return LL_STATUS_SUCCESS
  730. */
  731. extern llStatus_t LL_ReadSupportedStates( uint8 *states );
  732. /*******************************************************************************
  733. * @fn LL_ReadLocalSupportedFeatures API
  734. *
  735. * @brief This API is called by the HCI to read the controller's
  736. * Features Set. The Controller indicates which features it
  737. * supports.
  738. *
  739. * input parameters
  740. *
  741. * @param featureSet - A pointer to the Feature Set where each bit:
  742. * 0: Feature not supported.
  743. * 1: Feature supported by controller.
  744. *
  745. * output parameters
  746. *
  747. * @param None.
  748. *
  749. * @return LL_STATUS_SUCCESS
  750. */
  751. extern llStatus_t LL_ReadLocalSupportedFeatures( uint8 *featureSet );
  752. /*******************************************************************************
  753. * @fn LL_ReadLocalVersionInfo API
  754. *
  755. * @brief This API is called by the HCI to read the controller's
  756. * Version information.
  757. *
  758. * input parameters
  759. *
  760. * @param None.
  761. *
  762. * output parameters
  763. *
  764. * @param verNum - Version of the Bluetooth Controller specification.
  765. * @param comId - Company identifier of the manufacturer of the
  766. * Bluetooth Controller.
  767. * @param subverNum - A unique value for each implementation or revision
  768. * of an implementation of the Bluetooth Controller.
  769. *
  770. * @return LL_STATUS_SUCCESS
  771. */
  772. extern llStatus_t LL_ReadLocalVersionInfo( uint8 *verNum,
  773. uint16 *comId,
  774. uint16 *subverNum );
  775. /*******************************************************************************
  776. * @fn LL_CtrlToHostFlowControl API
  777. *
  778. * @brief This function is used to indicate if the LL enable/disable
  779. * receive FIFO processing. This function provides support for
  780. * Controller to Host flow control.
  781. *
  782. * input parameters
  783. *
  784. * @param mode: LL_ENABLE_RX_FLOW_CONTROL, LL_DISABLE_RX_FLOW_CONTROL
  785. *
  786. * output parameters
  787. *
  788. * @param None.
  789. *
  790. * @return LL_STATUS_SUCCESS
  791. */
  792. extern llStatus_t LL_CtrlToHostFlowControl( uint8 mode );
  793. /*******************************************************************************
  794. * @fn LL_ReadRemoteVersionInfo API
  795. *
  796. * @brief This API is called by the HCI to read the peer controller's
  797. * Version Information. If the peer's Version Information has
  798. * already been received by its request for our Version
  799. * Information, then this data is already cached and can be
  800. * directly returned to the Host. If the peer's Version Information
  801. * is not already cached, then it will be requested from the peer,
  802. * and when received, returned to the Host via the
  803. * LL_ReadRemoteVersionInfoCback callback.
  804. *
  805. * Note: Only one Version Indication is allowed for a connection.
  806. *
  807. * input parameters
  808. *
  809. * @param None.
  810. *
  811. * output parameters
  812. *
  813. * @param connId - The LL connection ID on which to send this data.
  814. *
  815. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_VER_IND_ALREADY_SENT
  816. */
  817. extern llStatus_t LL_ReadRemoteVersionInfo( uint16 connId );
  818. /*******************************************************************************
  819. * @fn LL_ReadTxPowerLevel
  820. *
  821. * @brief This function is used to read a connection's current transmit
  822. * power level or the maximum transmit power level.
  823. *
  824. * input parameters
  825. *
  826. * @param connId - The LL connection handle.
  827. * @param type - LL_READ_CURRENT_TX_POWER_LEVEL or
  828. * LL_READ_MAX_TX_POWER_LEVEL
  829. * @param *txPower - A signed value from -30..+20, in dBm.
  830. *
  831. * output parameters
  832. *
  833. * @param None.
  834. *
  835. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  836. * LL_STATUS_ERROR_PARAM_OUT_OF_RANGE,
  837. * LL_STATUS_ERROR_INACTIVE_CONNECTION
  838. */
  839. llStatus_t LL_ReadTxPowerLevel( uint8 connId,
  840. uint8 type,
  841. int8 *txPower );
  842. // A1 ROM metal change add
  843. /*******************************************************************************
  844. * @fn LL_SetTxPowerLevel
  845. *
  846. * @brief This function is used to set transmit power level
  847. *
  848. * input parameters
  849. *
  850. * @param txPower - The transmit power level to be set
  851. *
  852. * output parameters
  853. *
  854. * @param None.
  855. *
  856. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  857. * LL_STATUS_ERROR_INACTIVE_CONNECTION
  858. */
  859. llStatus_t LL_SetTxPowerLevel( int8 txPower );
  860. /*******************************************************************************
  861. * @fn LL_ReadChanMap API
  862. *
  863. * @brief This API is called by the HCI to read the channel map that the
  864. * LL controller is using for the LL connection.
  865. *
  866. * input parameters
  867. *
  868. * @param connId - The LL connection handle.
  869. *
  870. * output parameters
  871. *
  872. * @param chanMap - A five byte array containing one bit per data channel
  873. * where a 1 means the channel is "used" and a 0 means
  874. * the channel is "unused".
  875. *
  876. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  877. * LL_STATUS_ERROR_INACTIVE_CONNECTION
  878. */
  879. extern llStatus_t LL_ReadChanMap( uint8 connId,
  880. uint8 *chanMap );
  881. /*******************************************************************************
  882. * @fn LL_ReadRssi API
  883. *
  884. * @brief This API is called by the HCI to request RSSI. If there is an
  885. * active connection for the given connection ID, then the RSSI of
  886. * the last received data packet in the LL will be returned. If a
  887. * receiver Modem Test is running, then the RF RSSI for the last
  888. * received data will be returned. If no valid RSSI value is
  889. * available, then LL_RSSI_NOT_AVAILABLE will be returned.
  890. *
  891. * input parameters
  892. *
  893. * @param connId - The LL connection ID on which to read last RSSI.
  894. *
  895. * output parameters
  896. *
  897. * @param *lastRssi - The last data RSSI received.
  898. * Range: -127dBm..+20dBm, 127=Not Available.
  899. *
  900. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  901. * LL_STATUS_ERROR_INACTIVE_CONNECTION
  902. */
  903. extern llStatus_t LL_ReadRssi( uint16 connId,
  904. int8 *lastRssi );
  905. extern llStatus_t LL_ReadFoff( uint16 connId,
  906. uint16 *foff );
  907. extern llStatus_t LL_ReadCarrSens( uint16 connId,
  908. uint8 *carrSense );
  909. /*******************************************************************************
  910. * @fn LL_Disconnect API
  911. *
  912. * @brief This API is called by the HCI to terminate a LL connection.
  913. *
  914. * input parameters
  915. *
  916. * @param connId - The LL connection ID on which to send this data.
  917. * @param reason - The reason for the Host connection termination.
  918. *
  919. * output parameters
  920. *
  921. * @param None.
  922. *
  923. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  924. * LL_STATUS_ERROR_INACTIVE_CONNECTION
  925. * LL_STATUS_ERROR_CTRL_PROC_ALREADY_ACTIVE
  926. */
  927. extern llStatus_t LL_Disconnect( uint16 connId,
  928. uint8 reason );
  929. /*******************************************************************************
  930. * @fn LL_TxData API
  931. *
  932. * @brief This API is called by the HCI to transmit a buffer of data on a
  933. * given LL connection. If fragmentation is supported, the HCI must
  934. * also indicate whether this is the first Host packet, or a
  935. * continuation Host packet. When fragmentation is not supported,
  936. * then a start packet should always specified. If the device is in
  937. * a connection as a Master and the current connection ID is the
  938. * connection for this data, or is in a connection as a Slave, then
  939. * the data is written to the TX FIFO (even if the radio is
  940. * curerntly active). If this is a Slave connection, and Fast TX is
  941. * enabled and Slave Latency is being used, then the amount of time
  942. * to the next event is checked. If there's at least a connection
  943. * interval plus some overhead, then the next event is re-aligned
  944. * to the next event boundary. Otherwise, in all cases, the buffer
  945. * pointer will be retained for transmission, and the callback
  946. * event LL_TxDataCompleteCback will be generated to the HCI when
  947. * the buffer pointer is no longer needed by the LL.
  948. *
  949. * Note: If the return status is LL_STATUS_ERROR_OUT_OF_TX_MEM,
  950. * then the HCI must not release the buffer until it receives
  951. * the LL_TxDataCompleteCback callback, which indicates the
  952. * LL has copied the transmit buffer.
  953. *
  954. * Note: The HCI should not call this routine if a buffer is still
  955. * pending from a previous call. This is fatal!
  956. *
  957. * Note: If the connection should be terminated within the LL
  958. * before the Host knows, attempts by the HCI to send more
  959. * data (after receiving a LL_TxDataCompleteCback) will
  960. * fail (LL_STATUS_ERROR_INACTIVE_CONNECTION).
  961. *
  962. * input parameters
  963. *
  964. * @param connId - The LL connection ID on which to send this data.
  965. * @param *pBuf - A pointer to the data buffer to transmit.
  966. * @param pktLen - The number of bytes to transmit on this connection.
  967. * @param fragFlag - LL_DATA_FIRST_PKT_HOST_TO_CTRL:
  968. * Indicates buffer is the start of a
  969. * Host-to-Controller packet.
  970. * LL_DATA_CONTINUATION_PKT:
  971. * Indicates buffer is a continuation of a
  972. * Host-to-Controller packet.
  973. *
  974. * output parameters
  975. *
  976. * @param None.
  977. *
  978. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  979. * LL_STATUS_ERROR_INACTIVE_CONNECTION,
  980. * LL_STATUS_ERROR_OUT_OF_TX_MEM,
  981. * LL_STATUS_ERROR_UNEXPECTED_PARAMETER
  982. */
  983. extern llStatus_t LL_TxData( uint16 connId,
  984. uint8 *pBuf,
  985. uint8 pktLen,
  986. uint8 fragFlag );
  987. /*******************************************************************************
  988. * @fn LL_DirectTestTxTest API
  989. *
  990. * @brief This function is used to initiate a BLE PHY level Transmit Test
  991. * in Direct Test Mode where the DUT generates test reference
  992. * packets at fixed intervals. This test will make use of the
  993. * nanoRisc Raw Data Transmit and Receive task.
  994. *
  995. * Note: The BLE device is to transmit at maximum power.
  996. * Note: A LL reset should be issued when done using DTM!
  997. *
  998. * input parameters
  999. *
  1000. * @param txFreq - Tx RF frequency k=0..39, where F=2402+(k*2MHz).
  1001. * @param payloadLen - Number of bytes (0..37)in payload for each packet.
  1002. * @param payloadType - The type of pattern to transmit.
  1003. *
  1004. * output parameters
  1005. *
  1006. * @param None.
  1007. *
  1008. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1009. * LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE
  1010. */
  1011. extern llStatus_t LL_DirectTestTxTest( uint8 txFreq,
  1012. uint8 payloadLen,
  1013. uint8 payloadType );
  1014. /*******************************************************************************
  1015. * @fn LL_DirectTestRxTest API
  1016. *
  1017. * @brief This function is used to initiate a BLE PHY level Receive Test
  1018. * in Direct Test Mode where the DUT receives test reference
  1019. * packets at fixed intervals. This test will make use of the
  1020. * nanoRisc Raw Data Transmit and Receive task. The received
  1021. * packets are verified based on the CRC, and metrics are kept.
  1022. *
  1023. * Note: A LL reset should be issued when done using DTM!
  1024. *
  1025. * input parameters
  1026. *
  1027. * @param rxFreq - Rx RF frequency k=0..39, where F=2402+(k*2MHz).
  1028. *
  1029. * output parameters
  1030. *
  1031. * @param None.
  1032. *
  1033. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1034. * LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE
  1035. */
  1036. extern llStatus_t LL_DirectTestRxTest( uint8 rxFreq );
  1037. /*******************************************************************************
  1038. * @fn LL_DirectTestEnd API
  1039. *
  1040. * @brief This function is used to end the Direct Test Transmit or Direct
  1041. * Test Receive tests executing in Direct Test mode. When the raw
  1042. * task is ended, the LL_DirectTestEndDoneCback callback is called.
  1043. * If a Direct Test mode operation is not currently active, an
  1044. * error is returned.
  1045. *
  1046. * Note: A LL reset is issued upon completion!
  1047. *
  1048. * input parameters
  1049. *
  1050. * @param None.
  1051. *
  1052. * output parameters
  1053. *
  1054. * @param None.
  1055. *
  1056. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE
  1057. */
  1058. extern llStatus_t LL_DirectTestEnd( void );
  1059. /*******************************************************************************
  1060. * @fn LL_SetAdvParam API
  1061. *
  1062. * @brief This API is called by the HCI to set the Advertiser's
  1063. * parameters.
  1064. *
  1065. * input parameters
  1066. * @param advIntervalMin - The minimum Adv interval.
  1067. * @param advIntervalMax - The maximum Adv interval.
  1068. * @param advEvtType - The type of advertisment event.
  1069. * @param ownAddrType - The Adv's address type of public or random.
  1070. * @param directAddrType - Only used for directed advertising.
  1071. * @param *directAddr - Only used for directed advertising (NULL otherwise).
  1072. * @param advChanMap - A byte containing 1 bit per advertising
  1073. * channel. A bit set to 1 means the channel is
  1074. * used. The bit positions define the advertising
  1075. * channels as follows:
  1076. * Bit 0: 37, Bit 1: 38, Bit 2: 39.
  1077. * @param advWlPolicy - The Adv white list filter policy.
  1078. *
  1079. * output parameters
  1080. *
  1081. * @param None.
  1082. *
  1083. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1084. * LL_STATUS_ERROR_NO_ADV_CHAN_FOUND
  1085. */
  1086. extern llStatus_t LL_SetAdvParam( uint16 advIntervalMin,
  1087. uint16 advIntervalMax,
  1088. uint8 advEvtType,
  1089. uint8 ownAddrType,
  1090. uint8 directAddrType,
  1091. uint8 *directAddr,
  1092. uint8 advChanMap,
  1093. uint8 advWlPolicy );
  1094. /*******************************************************************************
  1095. * @fn LL_SetAdvData API
  1096. *
  1097. * @brief This API is called by the HCI to set the Advertiser's data.
  1098. *
  1099. * Note: If the Advertiser is restarted without intervening calls
  1100. * to this routine to make updates, then the previously
  1101. * defined data will be reused.
  1102. *
  1103. * Note: If the data happens to be changed while advertising, then
  1104. * the new data will be sent on the next advertising event.
  1105. *
  1106. * input parameters
  1107. *
  1108. * @param advDataLen - The number of scan response bytes: 0..31.
  1109. * @param advData - Pointer to the advertiser data, or NULL.
  1110. *
  1111. * output parameters
  1112. *
  1113. * @param None.
  1114. *
  1115. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  1116. */
  1117. extern llStatus_t LL_SetAdvData( uint8 advDataLen,
  1118. uint8 *advData );
  1119. /*******************************************************************************
  1120. * @fn LL_SetScanRspData API
  1121. *
  1122. * @brief This API is called by the HCI to set the Advertiser's Scan
  1123. * Response data.
  1124. *
  1125. * Note: If the Advertiser is restarted without intervening calls
  1126. * to this routine to make updates, then the previously
  1127. * defined data will be reused.
  1128. *
  1129. * input parameters
  1130. *
  1131. * @param scanRspLen - The number of scan response bytes: 0..31.
  1132. * @param *scanRspData - Pointer to the scan response data.
  1133. *
  1134. * output parameters
  1135. *
  1136. * @param None.
  1137. *
  1138. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  1139. */
  1140. extern llStatus_t LL_SetScanRspData( uint8 scanRspLen,
  1141. uint8 *scanRspData );
  1142. /*******************************************************************************
  1143. * @fn LL_SetAdvControl API
  1144. *
  1145. * @brief This API is called by the HCI to request the Controller to start
  1146. * or stop advertising.
  1147. *
  1148. * input parameters
  1149. *
  1150. * @param advMode - LL_ADV_MODE_ON or LL_ADV_MODE_OFF.
  1151. *
  1152. * output parameters
  1153. *
  1154. * @param None.
  1155. *
  1156. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_UNEXPECTED_PARAMETER,
  1157. * LL_STATUS_ERROR_BAD_PARAMETER,
  1158. * LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE,
  1159. * LL_STATUS_ERROR_COMMAND_DISALLOWED
  1160. */
  1161. extern llStatus_t LL_SetAdvControl( uint8 advMode );
  1162. /*******************************************************************************
  1163. * @fn LL_ReadAdvChanTxPower
  1164. *
  1165. * @brief This function is used to read the transmit power level used
  1166. * for BLE advertising channel packets. Currently, only two
  1167. * settings are possible, a standard setting of 0 dBm, and a
  1168. * maximum setting of 4 dBm.
  1169. *
  1170. * input parameters
  1171. *
  1172. * @param *txPower - A non-null pointer.
  1173. *
  1174. * output parameters
  1175. *
  1176. * @param *txPower - A signed value from -20..+10, in dBm.
  1177. *
  1178. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_PARAM_OUT_OF_RANGE
  1179. */
  1180. extern llStatus_t LL_ReadAdvChanTxPower( int8 *txPower );
  1181. /*******************************************************************************
  1182. * @fn LL_SetScanParam API
  1183. *
  1184. * @brief This API is called by the HCI to set the Scanner's parameters.
  1185. *
  1186. * input parameters
  1187. *
  1188. * @param scanType - Passive or Active scan type.
  1189. * @param scanInterval - Time between scan events.
  1190. * @param scanWindow - Duration of a scan. When the same as the scan
  1191. * interval, then scan continuously.
  1192. * @param ownAddrType - Address type (Public or Random) to use in the
  1193. * SCAN_REQ packet.
  1194. * @param advWlPolicy - Either allow all Adv packets, or only those that
  1195. * are in the white list.
  1196. *
  1197. * output parameters
  1198. *
  1199. * @param None.
  1200. *
  1201. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  1202. */
  1203. extern llStatus_t LL_SetScanParam( uint8 scanType,
  1204. uint16 scanInterval,
  1205. uint16 scanWindow,
  1206. uint8 ownAddrType,
  1207. uint8 advWlPolicy );
  1208. /*******************************************************************************
  1209. * @fn LL_SetScanControl API
  1210. *
  1211. * @brief This API is called by the HCI to start or stop the Scanner. It
  1212. * also specifies whether the LL will filter duplicate advertising
  1213. * reports to the Host, or generate a report for each packet
  1214. * received.
  1215. *
  1216. * input parameters
  1217. *
  1218. * @param scanMode - LL_SCAN_START or LL_SCAN_STOP.
  1219. * @param filterReports - LL_FILTER_REPORTS_DISABLE or
  1220. * LL_FILTER_REPORTS_ENABLE
  1221. *
  1222. * output parameters
  1223. *
  1224. * @param None.
  1225. *
  1226. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1227. * LL_STATUS_ERROR_UNEXPECTED_PARAMETER,
  1228. * LL_STATUS_ERROR_OUT_OF_TX_MEM,
  1229. * LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE
  1230. */
  1231. extern llStatus_t LL_SetScanControl( uint8 scanMode,
  1232. uint8 filterReports );
  1233. /*******************************************************************************
  1234. * @fn LL_EncLtkReply API
  1235. *
  1236. * @brief This API is called by the HCI to provide the controller with
  1237. * the Long Term Key (LTK) for encryption. This command is
  1238. * actually a reply to the link layer's LL_EncLtkReqCback, which
  1239. * provided the random number and encryption diversifier received
  1240. * from the Master during an encryption setup.
  1241. *
  1242. * Note: The key parameter is byte ordered LSO to MSO.
  1243. *
  1244. * input parameters
  1245. *
  1246. * @param connId - The LL connection ID on which to send this data.
  1247. * @param *key - A 128 bit key to be used to calculate the session key.
  1248. *
  1249. * output parameters
  1250. *
  1251. * @param None.
  1252. *
  1253. * @return LL_STATUS_SUCCESS
  1254. */
  1255. extern llStatus_t LL_EncLtkReply( uint16 connId,
  1256. uint8 *key );
  1257. /*******************************************************************************
  1258. * @fn LL_EncLtkNegReply API
  1259. *
  1260. * @brief This API is called by the HCI to indicate to the controller
  1261. * that the Long Term Key (LTK) for encryption can not be provided.
  1262. * This command is actually a reply to the link layer's
  1263. * LL_EncLtkReqCback, which provided the random number and
  1264. * encryption diversifier received from the Master during an
  1265. * encryption setup. How the LL responds to the negative reply
  1266. * depends on whether this is part of a start encryption or a
  1267. * re-start encryption after a pause. For the former, an
  1268. * encryption request rejection is sent to the peer device. For
  1269. * the latter, the connection is terminated.
  1270. *
  1271. * input parameters
  1272. *
  1273. * @param connId - The LL connection ID on which to send this data.
  1274. *
  1275. * output parameters
  1276. *
  1277. * @param None.
  1278. *
  1279. * @return LL_STATUS_SUCCESS
  1280. */
  1281. extern llStatus_t LL_EncLtkNegReply( uint16 connId );
  1282. /*******************************************************************************
  1283. * @fn LL_CreateConn API
  1284. *
  1285. * @brief This API is called by the HCI to create a connection.
  1286. *
  1287. * input parameters
  1288. *
  1289. * @param scanInterval - The scan interval.
  1290. * @param scanWindow - The scan window.
  1291. * @param initWlPolicy - Filter Adv address directly or using WL.
  1292. * @param peerAddrType - Peer address is Public or Random.
  1293. * @param *peerAddr - The Adv address, or NULL for WL policy.
  1294. * @param ownAddrType - This device's address is Public or Random.
  1295. * @param connIntervalMin - Defines minimum connection interval value.
  1296. * @param connIntervalMax - Defines maximum connection interval value.
  1297. * @param connLatency - The connection's Slave Latency.
  1298. * @param connTimeout - The connection's Supervision Timeout.
  1299. * @param minLength - Info parameter about min length of connection.
  1300. * @param maxLength - Info parameter about max length of connection.
  1301. *
  1302. * output parameters
  1303. *
  1304. * @param None.
  1305. *
  1306. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE,
  1307. * LL_STATUS_ERROR_ILLEGAL_PARAM_COMBINATION,
  1308. * LL_STATUS_ERROR_BAD_PARAMETER
  1309. */
  1310. extern llStatus_t LL_CreateConn( uint16 scanInterval,
  1311. uint16 scanWindow,
  1312. uint8 initWlPolicy,
  1313. uint8 peerAddrType,
  1314. uint8 *peerAddr,
  1315. uint8 ownAddrType,
  1316. uint16 connIntervalMin,
  1317. uint16 connIntervalMax,
  1318. uint16 connLatency,
  1319. uint16 connTimeout,
  1320. uint16 minLength,
  1321. uint16 maxLength );
  1322. /*******************************************************************************
  1323. * @fn LL_CreateConnCancel API
  1324. *
  1325. * @brief This API is called by the HCI to cancel a previously given LL
  1326. * connection creation command that is still pending. This command
  1327. * should only be used after the LL_CreateConn command as been
  1328. * issued, but before the LL_ConnComplete callback.
  1329. *
  1330. * input parameters
  1331. *
  1332. * @param None.
  1333. *
  1334. * output parameters
  1335. *
  1336. * @param None.
  1337. *
  1338. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_COMMAND_DISALLOWED
  1339. */
  1340. extern llStatus_t LL_CreateConnCancel( void );
  1341. /*******************************************************************************
  1342. * @fn LL_ConnActive
  1343. *
  1344. * @brief This API is called by the HCI to check if a connection
  1345. * given by the connection handle is active.
  1346. *
  1347. * input parameters
  1348. *
  1349. * @param connId - Connection handle.
  1350. *
  1351. * output parameters
  1352. *
  1353. * @param None.
  1354. *
  1355. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1356. * LL_STATUS_ERROR_INACTIVE_CONNECTION
  1357. */
  1358. extern llStatus_t LL_ConnActive( uint16 connId );
  1359. /*******************************************************************************
  1360. * @fn LL_ConnUpdate API
  1361. *
  1362. * @brief This API is called by the HCI to update the connection
  1363. * parameters by initiating a connection update control procedure.
  1364. *
  1365. * input parameters
  1366. *
  1367. * @param connId - The connection ID on which to send this data.
  1368. * @param connIntervalMin - Defines minimum connection interval value.
  1369. * @param connIntervalMax - Defines maximum connection interval value.
  1370. * @param connLatency - The connection's Slave Latency.
  1371. * @param connTimeout - The connection's Supervision Timeout.
  1372. * @param minLength - Info parameter about min length of connection.
  1373. * @param maxLength - Info parameter about max length of connection.
  1374. *
  1375. * output parameters
  1376. *
  1377. * @param None.
  1378. *
  1379. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1380. * LL_STATUS_ERROR_INACTIVE_CONNECTION
  1381. * LL_STATUS_ERROR_CTRL_PROC_ALREADY_ACTIVE,
  1382. * LL_STATUS_ERROR_ILLEGAL_PARAM_COMBINATION
  1383. */
  1384. extern llStatus_t LL_ConnUpdate( uint16 connId,
  1385. uint16 connIntervalMin,
  1386. uint16 connIntervalMax,
  1387. uint16 connLatency,
  1388. uint16 connTimeout,
  1389. uint16 minLength,
  1390. uint16 maxLength );
  1391. /*******************************************************************************
  1392. * @fn LL_ChanMapUpdate API
  1393. *
  1394. * @brief This API is called by the HCI to update the Host data channels
  1395. * initiating an Update Data Channel control procedure.
  1396. *
  1397. * Note: While it isn't specified, it is assumed that the Host
  1398. * expects an update channel map on all active connections.
  1399. *
  1400. * Note: This LL currently only supports one connection.
  1401. *
  1402. * input parameters
  1403. *
  1404. * @param chanMap - A five byte array containing one bit per data channel
  1405. * where a 1 means the channel is "used".
  1406. *
  1407. * output parameters
  1408. *
  1409. * @param None.
  1410. *
  1411. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1412. * LL_STATUS_ERROR_ILLEGAL_PARAM_COMBINATION
  1413. */
  1414. extern llStatus_t LL_ChanMapUpdate( uint8 *chanMap );
  1415. /*******************************************************************************
  1416. * @fn LL_StartEncrypt API
  1417. *
  1418. * @brief This API is called by the Master HCI to setup encryption and to
  1419. * update encryption keys in the LL connection. If the connection
  1420. * is already in encryption mode, then this command will first
  1421. * pause the encryption before subsequently running the encryption
  1422. * setup.
  1423. *
  1424. * Note: The parameters are byte ordered LSO to MSO.
  1425. *
  1426. * input parameters
  1427. *
  1428. * @param connId - The LL connection ID on which to send this data.
  1429. * @param *rand - Random vector used in device identification.
  1430. * @param *eDiv - Encrypted diversifier.
  1431. * @param *key - A 128 bit key to be used to calculate the session key.
  1432. *
  1433. * output parameters
  1434. *
  1435. * @param None.
  1436. *
  1437. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_FEATURE_NOT_SUPPORTED
  1438. */
  1439. extern llStatus_t LL_StartEncrypt( uint16 connId,
  1440. uint8 *rand,
  1441. uint8 *eDiv,
  1442. uint8 *ltk );
  1443. /*******************************************************************************
  1444. * @fn LL_ReadRemoteUsedFeatures API
  1445. *
  1446. * @brief This API is called by the Master HCI to initiate a feature
  1447. * setup control process.
  1448. *
  1449. * input parameters
  1450. *
  1451. * @param connId - The LL connection ID on which to send this data.
  1452. *
  1453. * output parameters
  1454. *
  1455. * @param None.
  1456. *
  1457. * @return LL_STATUS_SUCCESS
  1458. */
  1459. extern llStatus_t LL_ReadRemoteUsedFeatures( uint16 connId );
  1460. /*
  1461. ** Vendor Specific Command API
  1462. */
  1463. /*******************************************************************************
  1464. * @fn LL_EXT_SetRxGain Vendor Specific API
  1465. *
  1466. * @brief This function is used to to set the RF RX gain.
  1467. *
  1468. * input parameters
  1469. *
  1470. * @param rxGain - LL_EXT_RX_GAIN_STD, LL_EXT_RX_GAIN_HIGH
  1471. *
  1472. * output parameters
  1473. *
  1474. * @param cmdComplete - Boolean to indicate the command is still pending.
  1475. *
  1476. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  1477. */
  1478. extern llStatus_t LL_EXT_SetRxGain( uint8 rxGain,
  1479. uint8 *cmdComplete );
  1480. /*******************************************************************************
  1481. * @fn LL_EXT_SetTxPower Vendor Specific API
  1482. *
  1483. * @brief This function is used to to set the RF TX power.
  1484. *
  1485. * input parameters
  1486. *
  1487. * @param txPower - LL_EXT_TX_POWER_0_DBM, LL_EXT_TX_POWER_4_DBM
  1488. *
  1489. * output parameters
  1490. *
  1491. * @param cmdComplete - Boolean to indicate the command is still pending.
  1492. *
  1493. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  1494. */
  1495. extern llStatus_t LL_EXT_SetTxPower( uint8 txPower,
  1496. uint8 *cmdComplete );
  1497. /*******************************************************************************
  1498. * @fn LL_EXT_OnePacketPerEvent Vendor Specific API
  1499. *
  1500. * @brief This function is used to enable or disable allowing only one
  1501. * packet per event.
  1502. *
  1503. * input parameters
  1504. *
  1505. * @param control - LL_EXT_ENABLE_ONE_PKT_PER_EVT,
  1506. * LL_EXT_DISABLE_ONE_PKT_PER_EVT
  1507. *
  1508. * output parameters
  1509. *
  1510. * @param None.
  1511. *
  1512. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  1513. */
  1514. extern llStatus_t LL_EXT_OnePacketPerEvent( uint8 control );
  1515. /*******************************************************************************
  1516. * @fn LL_EXT_ClkDivOnHalt Vendor Specific API
  1517. *
  1518. * @brief This function is used to enable or disable dividing down the
  1519. * system clock while halted.
  1520. *
  1521. * Note: This command is disallowed if haltDuringRf is not defined.
  1522. *
  1523. * input parameters
  1524. *
  1525. * @param control - LL_EXT_ENABLE_CLK_DIVIDE_ON_HALT,
  1526. * LL_EXT_DISABLE_CLK_DIVIDE_ON_HALT
  1527. *
  1528. * output parameters
  1529. *
  1530. * @param None.
  1531. *
  1532. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_COMMAND_DISALLOWED
  1533. */
  1534. extern llStatus_t LL_EXT_ClkDivOnHalt( uint8 control );
  1535. /*******************************************************************************
  1536. * @fn LL_EXT_DeclareNvUsage Vendor Specific API
  1537. *
  1538. * @brief This HCI Extension API is used to indicate to the Controller
  1539. * whether or not the Host will be using the NV memory during BLE
  1540. * operations.
  1541. *
  1542. * input parameters
  1543. *
  1544. * @param mode - HCI_EXT_NV_IN_USE, HCI_EXT_NV_NOT_IN_USE
  1545. *
  1546. * output parameters
  1547. *
  1548. * @param None.
  1549. *
  1550. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1551. * LL_STATUS_ERROR_COMMAND_DISALLOWED
  1552. */
  1553. extern llStatus_t LL_EXT_DeclareNvUsage( uint8 mode );
  1554. /*******************************************************************************
  1555. * @fn LL_EXT_Decrypt API
  1556. *
  1557. * @brief This API is called by the HCI to request the LL to decrypt the
  1558. * data in the command using the key given in the command.
  1559. *
  1560. * Note: The parameters are byte ordered MSO to LSO.
  1561. *
  1562. * input parameters
  1563. *
  1564. * @param *key - A 128 bit key to be used to calculate the
  1565. * session key.
  1566. * @param *encryptedData - A 128 bit block that is encrypted.
  1567. *
  1568. * output parameters
  1569. *
  1570. * @param *plaintextData - A 128 bit block that is to be encrypted.
  1571. *
  1572. * @param None.
  1573. *
  1574. * @return LL_STATUS_SUCCESS
  1575. */
  1576. extern llStatus_t LL_EXT_Decrypt( uint8 *key,
  1577. uint8 *encryptedData,
  1578. uint8 *plaintextData );
  1579. /*******************************************************************************
  1580. * @fn LL_EXT_SetLocalSupportedFeatures API
  1581. *
  1582. * @brief This API is called by the HCI to indicate to the Controller
  1583. * which features can or can not be used.
  1584. *
  1585. * Note: Not all features indicated by the Host to the Controller
  1586. * are valid. If invalid, they shall be ignored.
  1587. *
  1588. * input parameters
  1589. *
  1590. * @param featureSet - A pointer to the Feature Set where each bit:
  1591. * 0: Feature shall not be used.
  1592. * 1: Feature can be used.
  1593. *
  1594. * output parameters
  1595. *
  1596. * @param None.
  1597. *
  1598. * @return LL_STATUS_SUCCESS
  1599. */
  1600. extern llStatus_t LL_EXT_SetLocalSupportedFeatures( uint8 *featureSet );
  1601. /*******************************************************************************
  1602. * @fn LL_EXT_SetFastTxResponseTime API
  1603. *
  1604. * @brief This API is used to enable or disable the fast TX response
  1605. * time feature. This can be helpful when a short connection
  1606. * interval is used in combination with slave latency. In such
  1607. * a scenario, the response time for sending the TX data packet
  1608. * can effectively shorten or eliminate slave latency, thereby
  1609. * increasing power consumption. By disabling, this feature
  1610. * trades fast response time for less power consumption.
  1611. *
  1612. * input parameters
  1613. *
  1614. * @param control - LL_EXT_ENABLE_FAST_TX_RESP_TIME,
  1615. * LL_EXT_DISABLE_FAST_TX_RESP_TIME
  1616. *
  1617. * output parameters
  1618. *
  1619. * @param None.
  1620. *
  1621. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_COMMAND_DISALLOWED,
  1622. * LL_STATUS_ERROR_BAD_PARAMETER
  1623. */
  1624. extern llStatus_t LL_EXT_SetFastTxResponseTime( uint8 control );
  1625. /*******************************************************************************
  1626. * @fn LL_EXT_SetSlaveLatencyOverride API
  1627. *
  1628. * @brief This API is used to enable or disable the suspention of slave
  1629. * latency. This can be helpful when the Slave application knows
  1630. * it will soon receive something that needs to be handled without
  1631. * delay.
  1632. *
  1633. * input parameters
  1634. *
  1635. * @param control - LL_EXT_DISABLE_SL_OVERRIDE,
  1636. * LL_EXT_ENABLE_SL_OVERRIDE
  1637. *
  1638. * output parameters
  1639. *
  1640. * @param None.
  1641. *
  1642. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_COMMAND_DISALLOWED,
  1643. * LL_STATUS_ERROR_BAD_PARAMETER
  1644. */
  1645. extern llStatus_t LL_EXT_SetSlaveLatencyOverride( uint8 control );
  1646. /*******************************************************************************
  1647. * @fn LL_EXT_ModemTestTx
  1648. *
  1649. * @brief This API is used start a continuous transmitter modem test,
  1650. * using either a modulated or unmodulated carrier wave tone, at
  1651. * the frequency that corresponds to the specified RF channel. Use
  1652. * LL_EXT_EndModemTest command to end the test.
  1653. *
  1654. * Note: A LL reset will be issued by LL_EXT_EndModemTest!
  1655. * Note: The BLE device will transmit at maximum power.
  1656. * Note: This API can be used to verify this device meets Japan's
  1657. * TELEC regulations.
  1658. *
  1659. * input parameters
  1660. *
  1661. * @param cwMode - LL_EXT_TX_MODULATED_CARRIER,
  1662. * LL_EXT_TX_UNMODULATED_CARRIER
  1663. * txFreq - Transmit RF channel k=0..39, where BLE F=2402+(k*2MHz).
  1664. *
  1665. * output parameters
  1666. *
  1667. * @param None.
  1668. *
  1669. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1670. * LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE
  1671. */
  1672. extern llStatus_t LL_EXT_ModemTestTx( uint8 cwMode,
  1673. uint8 txFreq );
  1674. /*******************************************************************************
  1675. * @fn LL_EXT_ModemHopTestTx
  1676. *
  1677. * @brief This API is used to start a continuous transmitter direct test
  1678. * mode test using a modulated carrier wave and transmitting a
  1679. * 37 byte packet of Pseudo-Random 9-bit data. A packet is
  1680. * transmitted on a different frequency (linearly stepping through
  1681. * all RF channels 0..39) every 625us. Use LL_EXT_EndModemTest
  1682. * command to end the test.
  1683. *
  1684. * Note: A LL reset will be issued by LL_EXT_EndModemTest!
  1685. * Note: The BLE device will transmit at maximum power.
  1686. * Note: This API can be used to verify this device meets Japan's
  1687. * TELEC regulations.
  1688. *
  1689. * input parameters
  1690. *
  1691. * @param None.
  1692. *
  1693. * output parameters
  1694. *
  1695. * @param None.
  1696. *
  1697. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE
  1698. */
  1699. extern llStatus_t LL_EXT_ModemHopTestTx( void );
  1700. /*******************************************************************************
  1701. * @fn LL_EXT_ModemTestRx
  1702. *
  1703. * @brief This API is used to start a continuous receiver modem test
  1704. * using a modulated carrier wave tone, at the frequency that
  1705. * corresponds to the specific RF channel. Any received data is
  1706. * discarded. Receiver gain may be adjusted using the
  1707. * LL_EXT_SetRxGain command. RSSI may be read during this test by
  1708. * using the LL_ReadRssi command. Use LL_EXT_EndModemTest command
  1709. * to end the test.
  1710. *
  1711. * Note: A LL reset will be issued by LL_EXT_EndModemTest!
  1712. * Note: The BLE device will transmit at maximum power.
  1713. *
  1714. * input parameters
  1715. *
  1716. * @param rxFreq - Receiver RF channel k=0..39, where BLE F=2402+(k*2MHz).
  1717. *
  1718. * output parameters
  1719. *
  1720. * @param None.
  1721. *
  1722. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1723. * LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE
  1724. */
  1725. extern llStatus_t LL_EXT_ModemTestRx( uint8 rxFreq );
  1726. /*******************************************************************************
  1727. * @fn LL_EXT_EndModemTest
  1728. *
  1729. * @brief This API is used to shutdown a modem test. A complete link
  1730. * layer reset will take place.
  1731. *
  1732. * input parameters
  1733. *
  1734. * @param None.
  1735. *
  1736. * output parameters
  1737. *
  1738. * @param None.
  1739. *
  1740. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_UNEXPECTED_STATE_ROLE
  1741. */
  1742. extern llStatus_t LL_EXT_EndModemTest( void );
  1743. /*******************************************************************************
  1744. * @fn LL_EXT_SetBDADDR
  1745. *
  1746. * @brief This API is used to set this device's BLE address (BDADDR).
  1747. *
  1748. * Note: This command is only allowed when the device's state is
  1749. * Standby.
  1750. *
  1751. * input parameters
  1752. *
  1753. * @param bdAddr - A pointer to a buffer to hold this device's address.
  1754. * An invalid address (i.e. all FF's) will restore this
  1755. * device's address to the address set at initialization.
  1756. *
  1757. * output parameters
  1758. *
  1759. * @param None.
  1760. *
  1761. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1762. * LL_STATUS_ERROR_COMMAND_DISALLOWED
  1763. */
  1764. extern llStatus_t LL_EXT_SetBDADDR( uint8 *bdAddr );
  1765. /*******************************************************************************
  1766. * @fn LL_EXT_SetSCA
  1767. *
  1768. * @brief This API is used to set this device's Sleep Clock Accuracy.
  1769. *
  1770. * Note: For a slave device, this value is directly used, but only
  1771. * if power management is enabled. For a master device, this
  1772. * value is converted into one of eight ordinal values
  1773. * representing a SCA range, as specified in Table 2.2,
  1774. * Vol. 6, Part B, Section 2.3.3.1 of the Core specification.
  1775. *
  1776. * Note: This command is only allowed when the device is not in a
  1777. * connection.
  1778. *
  1779. * Note: The device's SCA value remains unaffected by a HCI_Reset.
  1780. *
  1781. * input parameters
  1782. *
  1783. * @param scaInPPM - This device's SCA in PPM from 0..500.
  1784. *
  1785. * output parameters
  1786. *
  1787. * @param None.
  1788. *
  1789. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER,
  1790. * LL_STATUS_ERROR_COMMAND_DISALLOWED
  1791. */
  1792. extern llStatus_t LL_EXT_SetSCA( uint16 scaInPPM );
  1793. /*******************************************************************************
  1794. * @fn LL_EXT_SetFreqTune
  1795. *
  1796. * @brief This API is used to set the Frequncy Tuning up or down. If the
  1797. * current setting is already at the max/min value, then no
  1798. * update is performed.
  1799. *
  1800. * Note: This is a Production Test Mode only command!
  1801. *
  1802. * input parameters
  1803. *
  1804. * @param step - LL_EXT_SET_FREQ_TUNE_UP or LL_EXT_SET_FREQ_TUNE_DOWN
  1805. *
  1806. * output parameters
  1807. *
  1808. * @param None.
  1809. *
  1810. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  1811. */
  1812. extern llStatus_t LL_EXT_SetFreqTune( uint8 step );
  1813. /*******************************************************************************
  1814. * @fn LL_EXT_SaveFreqTune
  1815. *
  1816. * @brief This API is used to save the current Frequency Tuning value to
  1817. * flash memory. It is restored on reboot or wake from sleep.
  1818. *
  1819. * Note: This is a Production Test Mode only command!
  1820. *
  1821. * input parameters
  1822. *
  1823. * @param None.
  1824. *
  1825. * output parameters
  1826. *
  1827. * @param None.
  1828. *
  1829. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_COMMAND_DISALLOWED
  1830. */
  1831. extern llStatus_t LL_EXT_SaveFreqTune( void );
  1832. /*******************************************************************************
  1833. * @fn LL_EXT_SetMaxDtmTxPower Vendor Specific API
  1834. *
  1835. * @brief This function is used to set the max RF TX power to be used
  1836. * when using Direct Test Mode.
  1837. *
  1838. * input parameters
  1839. *
  1840. * @param txPower - LL_EXT_TX_POWER_MINUS_23_DBM,
  1841. * LL_EXT_TX_POWER_MINUS_6_DBM,
  1842. * LL_EXT_TX_POWER_0_DBM,
  1843. * LL_EXT_TX_POWER_4_DBM
  1844. *
  1845. * output parameters
  1846. *
  1847. * @param cmdComplete - Boolean to indicate the command is still pending.
  1848. *
  1849. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  1850. */
  1851. extern llStatus_t LL_EXT_SetMaxDtmTxPower( uint8 txPower );
  1852. /*******************************************************************************
  1853. * @fn LL_EXT_DisconnectImmed Vendor Specific API
  1854. *
  1855. * @brief This function is used to disconnect the connection immediately.
  1856. *
  1857. * Note: The connection (if valid) is immediately terminated
  1858. * without notifying the remote device. The Host is still
  1859. * notified.
  1860. *
  1861. * input parameters
  1862. *
  1863. * @param connId - The LL connection ID on which to send this data.
  1864. *
  1865. * output parameters
  1866. *
  1867. * @param None.
  1868. *
  1869. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_INACTIVE_CONNECTION
  1870. */
  1871. extern llStatus_t LL_EXT_DisconnectImmed( uint16 connId );
  1872. /*******************************************************************************
  1873. * @fn LL_EXT_PacketErrorRate Vendor Specific API
  1874. *
  1875. * @brief This function is used to Reset or Read the Packet Error Rate
  1876. * counters for a connection. When Reset, the counters are cleared;
  1877. * when Read, the total number of packets received, the number of
  1878. * packets received with a CRC error, the number of events, and the
  1879. * number of missed events are returned via a callback.
  1880. *
  1881. * Note: The counters are only 16 bits. At the shortest connection
  1882. * interval, this provides a bit over 8 minutes of data.
  1883. *
  1884. * input parameters
  1885. *
  1886. * @param connId - The LL connection ID on which to send this data.
  1887. * @param command - LL_EXT_PER_RESET, LL_EXT_PER_READ
  1888. *
  1889. * output parameters
  1890. *
  1891. * @param None.
  1892. *
  1893. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_INACTIVE_CONNECTION
  1894. */
  1895. extern llStatus_t LL_EXT_PacketErrorRate( uint16 connId, uint8 command );
  1896. /*******************************************************************************
  1897. * @fn LL_EXT_PERbyChan Vendor Specific API
  1898. *
  1899. * @brief This API is called by the HCI to start or end Packet Error Rate
  1900. * by Channel counter accumulation for a connection. If the
  1901. * pointer is not NULL, it is assumed there is sufficient memory
  1902. * for the PER data, per the type perByChan_t. If NULL, then
  1903. * the operation is considered disabled.
  1904. *
  1905. * Note: It is the user's responsibility to make sure there is
  1906. * sufficient memory for the data, and that the counters
  1907. * are cleared prior to first use.
  1908. *
  1909. * Note: The counters are only 16 bits. At the shortest connection
  1910. * interval, this provides a bit over 8 minutes of data.
  1911. *
  1912. * input parameters
  1913. *
  1914. * @param connId - The LL connection ID on which to send this data.
  1915. * @param perByChan - Pointer to PER by Channel data, or NULL.
  1916. *
  1917. * output parameters
  1918. *
  1919. * @param None.
  1920. *
  1921. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_INACTIVE_CONNECTION
  1922. */
  1923. extern llStatus_t LL_EXT_PERbyChan( uint16 connId, perByChan_t *perByChan );
  1924. /*******************************************************************************
  1925. * @fn LL_EXT_HaltDuringRf Vendor Specfic API
  1926. *
  1927. * @brief This function is used to enable or disable halting the
  1928. * CPU during RF. The system defaults to enabled.
  1929. *
  1930. * input parameters
  1931. *
  1932. * @param mode - LL_EXT_HALT_DURING_RF_ENABLE,
  1933. * LL_EXT_HALT_DURING_RF_DISABLE
  1934. *
  1935. * output parameters
  1936. *
  1937. * @param None.
  1938. *
  1939. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_COMMAND_DISALLOWED,
  1940. * LL_STATUS_ERROR_BAD_PARAMETER
  1941. */
  1942. extern llStatus_t LL_EXT_HaltDuringRf( uint8 mode );
  1943. /*******************************************************************************
  1944. * @fn LL_EXT_AdvEventNotice Vendor Specific API
  1945. *
  1946. * @brief This API is called to enable or disable a notification to the
  1947. * specified task using the specified task event whenever a Adv
  1948. * event ends. A non-zero taskEvent value is taken to be "enable",
  1949. * while a zero valued taskEvent is taken to be "disable".
  1950. *
  1951. * input parameters
  1952. *
  1953. * @param taskID - User's task ID.
  1954. * @param taskEvent - User's task event.
  1955. *
  1956. * output parameters
  1957. *
  1958. * @param None.
  1959. *
  1960. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  1961. */
  1962. extern llStatus_t LL_EXT_AdvEventNotice( uint8 taskID, uint16 taskEvent );
  1963. /*******************************************************************************
  1964. * @fn LL_EXT_ConnEventNotice Vendor Specific API
  1965. *
  1966. * @brief This API is called to enable or disable a notification to the
  1967. * specified task using the specified task event whenever a
  1968. * Connection event ends. A non-zero taskEvent value is taken to
  1969. * be "enable", while a zero valued taskEvent is taken to be
  1970. * "disable".
  1971. *
  1972. * Note: Currently, only a Slave connection is supported.
  1973. *
  1974. * input parameters
  1975. *
  1976. * @param taskID - User's task ID.
  1977. * @param taskEvent - User's task event.
  1978. *
  1979. * output parameters
  1980. *
  1981. * @param None.
  1982. *
  1983. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_INACTIVE_CONNECTION,
  1984. * LL_STATUS_ERROR_BAD_PARAMETER
  1985. */
  1986. extern llStatus_t LL_EXT_ConnEventNotice( uint8 taskID, uint16 taskEvent );
  1987. /*******************************************************************************
  1988. * @fn LL_EXT_BuildRevision Vendor Specific API
  1989. *
  1990. * @brief This API is used to to set a user revision number or read the
  1991. * build revision number.
  1992. *
  1993. * input parameters
  1994. *
  1995. * @param mode - LL_EXT_SET_USER_REVISION |
  1996. * LL_EXT_READ_BUILD_REVISION
  1997. * @param userRevNum - A 16 bit value the user can set as their own
  1998. * revision number
  1999. *
  2000. * output parameters
  2001. *
  2002. * @param buildRev - Pointer to returned build revision, if any.
  2003. *
  2004. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  2005. */
  2006. extern llStatus_t LL_EXT_BuildRevision( uint8 mode, uint16 userRevNum, uint8 *buildRev );
  2007. /*******************************************************************************
  2008. * @fn LL_EXT_DelaySleep Vendor Specific API
  2009. *
  2010. * @brief This API is used to to set the sleep delay.
  2011. *
  2012. * input parameters
  2013. *
  2014. * @param delay - 0 .. 1000, in milliseconds.
  2015. *
  2016. * output parameters
  2017. *
  2018. * @param None.
  2019. *
  2020. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  2021. */
  2022. extern llStatus_t LL_EXT_DelaySleep( uint16 delay );
  2023. /*******************************************************************************
  2024. * @fn LL_EXT_ResetSystem Vendor Specific API
  2025. *
  2026. * @brief This API is used to to issue a soft or hard system reset.
  2027. *
  2028. * input parameters
  2029. *
  2030. * @param mode - LL_EXT_RESET_SYSTEM_HARD | LL_EXT_RESET_SYSTEM_SOFT
  2031. *
  2032. * output parameters
  2033. *
  2034. * @param None.
  2035. *
  2036. * @return LL_STATUS_SUCCESS, LL_STATUS_ERROR_BAD_PARAMETER
  2037. */
  2038. extern llStatus_t LL_EXT_ResetSystem( uint8 mode );
  2039. /*******************************************************************************
  2040. * @fn LL_EXT_OverlappedProcessing Vendor Specific API
  2041. *
  2042. * @brief This API is used to enable or disable overlapped processing.
  2043. *
  2044. * input parameters
  2045. *
  2046. * @param mode - LL_EXT_ENABLE_OVERLAPPED_PROCESSING |
  2047. * LL_EXT_DISABLE_OVERLAPPED_PROCESSING
  2048. *
  2049. * output parameters
  2050. *
  2051. * @param None.
  2052. *
  2053. * @return LL_STATUS_SUCCESS, LL_ERROR_CODE_INVALID_HCI_CMD_PARAMS
  2054. */
  2055. extern llStatus_t LL_EXT_OverlappedProcessing( uint8 mode );
  2056. /*******************************************************************************
  2057. * @fn LL_EXT_NumComplPktsLimit Vendor Specific API
  2058. *
  2059. * @brief This API is used to set the minimum number of
  2060. * completed packets which must be met before a Number of
  2061. * Completed Packets event is returned. If the limit is not
  2062. * reach by the end of the connection event, then a Number of
  2063. * Completed Packets event will be returned (if non-zero) based
  2064. * on the flushOnEvt flag.
  2065. *
  2066. * input parameters
  2067. *
  2068. * @param limit - From 1 to LL_MAX_NUM_DATA_BUFFERS.
  2069. * @param flushOnEvt - LL_EXT_DISABLE_NUM_COMPL_PKTS_ON_EVENT |
  2070. * LL_EXT_ENABLE_NUM_COMPL_PKTS_ON_EVENT
  2071. *
  2072. * output parameters
  2073. *
  2074. * @param None.
  2075. *
  2076. * @return LL_STATUS_SUCCESS, LL_ERROR_CODE_INVALID_HCI_CMD_PARAMS
  2077. */
  2078. extern llStatus_t LL_EXT_NumComplPktsLimit( uint8 limit,
  2079. uint8 flushOnEvt );
  2080. /*
  2081. ** LL Callbacks to HCI
  2082. */
  2083. /*******************************************************************************
  2084. * @fn LL_ConnectionCompleteCback Callback
  2085. *
  2086. * @brief This Callback is used by the LL to indicate to the Host that
  2087. * a new connection has been created. For the Slave, this means
  2088. * a CONNECT_REQ message was received from an Initiator. For the
  2089. * Master, this means a CONNECT_REQ message was sent in response
  2090. * to a directed or undirected message addressed to the Initiator.
  2091. *
  2092. * input parameters
  2093. *
  2094. * @param reasonCode - LL_STATUS_SUCCESS or ?
  2095. * @param connId - The LL connection ID for new connection.
  2096. * @param role - LL_LINK_CONNECT_COMPLETE_MASTER or
  2097. * LL_LINK_CONNECT_COMPLETE_SLAVE.
  2098. * @param peerAddrType - Peer address type (public or random).
  2099. * @param peerAddr - Peer address.
  2100. * @param connInterval - Connection interval.
  2101. * @param slaveLatency - The connection's Slave Latency.
  2102. * @param connTimeout - The connection's Supervision Timeout.
  2103. * @param clockAccuracy - The sleep clock accurracy of the Master. Only
  2104. * valid on the Slave. Set to 0x00 for the Master.
  2105. *
  2106. * output parameters
  2107. *
  2108. * @param None.
  2109. *
  2110. * @return None.
  2111. */
  2112. extern void LL_ConnectionCompleteCback( uint8 reasonCode,
  2113. uint16 connId,
  2114. uint8 role,
  2115. uint8 peerAddrType,
  2116. uint8 *peerAddr,
  2117. uint16 connInterval,
  2118. uint16 slaveLatency,
  2119. uint16 connTimeout,
  2120. uint8 clockAccuracy );
  2121. /*******************************************************************************
  2122. * @fn LL_DisconnectCback Callback
  2123. *
  2124. * @brief This Callback is used by the LL to indicate to the Host that
  2125. * the connection has been terminated. The cause is given by the
  2126. * reason code.
  2127. *
  2128. * input parameters
  2129. *
  2130. * @param connId - The LL connection ID.
  2131. * @param reason - The reason the connection was terminated.
  2132. *
  2133. * output parameters
  2134. *
  2135. * @param None.
  2136. *
  2137. * @return None.
  2138. */
  2139. extern void LL_DisconnectCback( uint16 connId,
  2140. uint8 reason );
  2141. /*******************************************************************************
  2142. * @fn LL_ConnParamUpdateCback Callback
  2143. *
  2144. * @brief This Callback is used by the LL to indicate to the Host that
  2145. * the update parameters control procedure has completed. It is
  2146. * always made to the Master's Host when the update request has
  2147. * been sent. It is only made to the Slave's Host when the update
  2148. * results in a change to the connection interval, and/or the
  2149. * connection latency, and/or the connection timeout.
  2150. *
  2151. * input parameters
  2152. *
  2153. * @param connId - The LL connection ID.
  2154. * @param connInterval - Connection interval.
  2155. * @param connLatency - The connection's Slave Latency.
  2156. * @param connTimeout - The connection's Supervision Timeout.
  2157. *
  2158. * output parameters
  2159. *
  2160. * @param None.
  2161. *
  2162. * @return None.
  2163. */
  2164. extern void LL_ConnParamUpdateCback( uint16 connId,
  2165. uint16 connInterval,
  2166. uint16 connLatency,
  2167. uint16 connTimeout );
  2168. /*******************************************************************************
  2169. * @fn LL_ReadRemoteVersionInfoCback Callback
  2170. *
  2171. * @brief This Callback is used by the LL to indicate to the Host the
  2172. * requested peer's Version information.
  2173. *
  2174. * input parameters
  2175. *
  2176. * @param status - Status of callback.
  2177. * @param connId - The LL connection ID.
  2178. * @param verNum - Version of the Bluetooth Controller specification.
  2179. * @param comId - Company identifier of the manufacturer of the
  2180. * Bluetooth Controller.
  2181. * @param subverNum - A unique value for each implementation or revision
  2182. * of an implementation of the Bluetooth Controller.
  2183. *
  2184. * output parameters
  2185. *
  2186. * @param None.
  2187. *
  2188. * @return None.
  2189. */
  2190. extern void LL_ReadRemoteVersionInfoCback( uint8 status,
  2191. uint16 connId,
  2192. uint8 verNum,
  2193. uint16 comId,
  2194. uint16 subverNum );
  2195. /*******************************************************************************
  2196. * @fn LL_EncChangeCback Callback
  2197. *
  2198. * @brief This Callback is used by the LL to indicate to the Host that
  2199. * an encryption change has taken place. This results when
  2200. * the host performs a LL_StartEncrypt when encryption is not
  2201. * already enabled.
  2202. *
  2203. * Note: If the key request was rejected, then encryption will
  2204. * remain off.
  2205. *
  2206. * input parameters
  2207. *
  2208. * @param connId - The LL connection ID for new connection.
  2209. * @param reason - LL_ENC_KEY_REQ_ACCEPTED or LL_ENC_KEY_REQ_REJECTED.
  2210. * @param encEnab - LL_ENCRYPTION_OFF or LL_ENCRYPTION_ON.
  2211. *
  2212. * output parameters
  2213. *
  2214. * @param None.
  2215. *
  2216. * @return None.
  2217. */
  2218. extern void LL_EncChangeCback( uint16 connId,
  2219. uint8 reason,
  2220. uint8 encEnab );
  2221. /*******************************************************************************
  2222. * @fn LL_EncKeyRefreshCback Callback
  2223. *
  2224. * @brief This Callback is used by the LL to indicate to the Host that
  2225. * an encryption key change has taken place. This results when
  2226. * the host performs a LL_StartEncrypt when encryption is already
  2227. * enabled.
  2228. *
  2229. * input parameters
  2230. *
  2231. * @param connId - The LL connection ID for new connection.
  2232. * @param reason - LL_ENC_KEY_REQ_ACCEPTED.
  2233. *
  2234. * output parameters
  2235. *
  2236. * @param None.
  2237. *
  2238. * @return None.
  2239. */
  2240. extern void LL_EncKeyRefreshCback( uint16 connId,
  2241. uint8 reason );
  2242. /*******************************************************************************
  2243. * @fn LL_AdvReportCback Callback
  2244. *
  2245. * @brief This Callback is used by the LL to provide information about
  2246. * advertisers from which an advertising packet was received.
  2247. *
  2248. * input parameters
  2249. *
  2250. * @param eventType - Type of advertisement packet received by Scanner
  2251. * or Initiator, and scan response for Initiator.
  2252. * @param advAddrType - Advertiser address type (public or random).
  2253. * @param advAddr - Advertiser address.
  2254. * @param dataLen - Size in bytes of advertisement packet.
  2255. * @param data - Advertisement data.
  2256. * @param rssi - RSSI value (-127..20dBm), or not available
  2257. *
  2258. * output parameters
  2259. *
  2260. * @param None.
  2261. *
  2262. * @return None.
  2263. */
  2264. extern void LL_AdvReportCback( uint8 eventType,
  2265. uint8 advAddrType,
  2266. uint8 *advAddr,
  2267. uint8 dataLen,
  2268. uint8 *data,
  2269. int8 rssi );
  2270. extern void LL_ExtAdvReportCback( uint8 advEvt,
  2271. uint8 advAddrType,
  2272. uint8 *advAddr,
  2273. uint8 primaryPHY,
  2274. uint8 secondaryPHY,
  2275. uint8 advertisingSID,
  2276. uint8 txPower,
  2277. int8 rssi,
  2278. uint16 periodicAdvertisingInterval,
  2279. uint8 directAddrType,
  2280. uint8 *directAddr,
  2281. uint8 dataLen,
  2282. uint8 *rptData);
  2283. void LL_PrdAdvReportCback(uint16 syncHandle,
  2284. uint8 txPower,
  2285. uint8 rssi,
  2286. uint8 cteType,
  2287. uint8 dataStatus,
  2288. uint8 dataLength,
  2289. uint8 *data
  2290. );
  2291. void LL_PrdAdvSyncEstablishedCback(uint8 status,
  2292. uint16 syncHandle,
  2293. uint8 advertisingSID,
  2294. uint8 advertiserAddressType,
  2295. uint8 *advertiserAddress,
  2296. uint8 advertiserPHY,
  2297. uint16 periodicAdvertisingInterval,
  2298. uint8 advertiserClockAccuracy
  2299. );
  2300. void LL_PrdAdvSyncLostCback(uint16 syncHandle);
  2301. /******************************************************************************
  2302. * fn: LL_ConnectionlessIQReportCback
  2303. *
  2304. * brief: 1、usd by the controller to report IQ Information from the CTE of the
  2305. * received advertising packet
  2306. * 2、report IQ Information from the CTE of a received Test Mode packet
  2307. *
  2308. * date:2020-01-14
  2309. *
  2310. * input parameters:
  2311. * syncHandle : Identifying the periodic advertising train
  2312. * chan_idx : the index of the channel on which the packet has received
  2313. * rssi : rssi of the packet , units 0.1 dBm
  2314. * rssi_antID : Antenna ID
  2315. * cte_type : AOA/AOD CTE Type, AOD with 1us or 2us slots
  2316. * slot_duration : switching and sampling slots with 1us or 2us
  2317. * packet_status : indicates whether the received packet had a valid CRC
  2318. * and if not , whether the controller has determined the
  2319. * position and size of the CTE
  2320. * PE_Cnt : the value of paEventCounter
  2321. * sampCnt : total number of sample pairs
  2322. * ISample : the list of the I Sample of the report packets
  2323. * QSample : the list of the Q Sample of the report packets
  2324. *
  2325. *
  2326. * output parameters:
  2327. *
  2328. * Note: Controller shall not generate this event for packets that have a bad CRC
  2329. *
  2330. * return hciStatus_t
  2331. *
  2332. ******************************************************************************/
  2333. void LL_ConnectionlessIQReportCback( uint16 syncHandle,
  2334. uint8 chan_idx,
  2335. int16 rssi,
  2336. uint8 rssi_antID,
  2337. uint8 cte_type,
  2338. uint8 slot_duration,
  2339. uint8 packet_status,
  2340. uint16 PE_Cnt,
  2341. uint8 sampCnt,
  2342. uint16 *ISample,
  2343. uint16 *QSample);
  2344. /*****************************************************************************************
  2345. * fn: LL_ConnectionIQReportCback
  2346. *
  2347. * date:2020-01-14
  2348. *
  2349. * brief: used by the controller to report the IQ samples from the CTE of a received packet.
  2350. *
  2351. * input parameters:
  2352. * connHandle : identifies the connections that corresponds to the reported information
  2353. * rx_PHY : receiver PHY for the connection 1M or 2M
  2354. * data_chan_idx: the index of data channel on which the data physical channel PDU has received
  2355. * rssi : rssi of the packet , units 0.1 dBm
  2356. * rssi_antID : id of the antenna on which the RSSI is measured
  2357. * cte_type : AOA/AOD CTE Type, AOD with 1us or 2us slots
  2358. * slot_duration: switching and sampling slots with 1us or 2us
  2359. * packet_status: indicates whether the received packet had a valid CRC
  2360. * and if not , whether the controller has determined the
  2361. * position and size of the CTE
  2362. * connEventCounter:the value of connection event counter
  2363. * sampCnt : total number of sample pairs
  2364. * ISample : the list of the I Sample of the report packets
  2365. * QSample : the list of the Q Sample of the report packets
  2366. *
  2367. *
  2368. * output parameters:
  2369. *
  2370. *
  2371. * return hciStatus_t
  2372. *
  2373. *****************************************************************************************/
  2374. void LL_ConnectionIQReportCback( uint16 connHandle,
  2375. uint8 rx_PHY,
  2376. uint8 data_chan_idx,
  2377. int16 rssi,
  2378. uint8 rssi_antID,
  2379. uint8 cte_type,
  2380. uint8 slot_duration,
  2381. uint8 packet_status,
  2382. uint16 connEventCounter,
  2383. uint8 sampCnt,
  2384. uint16 *ISample,
  2385. uint16 *QSample);
  2386. /*****************************************************************************************
  2387. * fn: LL_CTE_Report_FailedCback
  2388. *
  2389. * date:2020-01-14
  2390. *
  2391. * brief: used by the controller to report an issue following a request to a peer device
  2392. * to reply with a packet containing an LL_CTE_RSP PDU and a CTE
  2393. *
  2394. *
  2395. * input parameters:
  2396. * status : received LL_CTE_RSP PDU status
  2397. * connHandle : connection handle
  2398. *
  2399. * output parameters:
  2400. *
  2401. *
  2402. * return hciStatus_t
  2403. *
  2404. *****************************************************************************************/
  2405. void LL_CTE_Report_FailedCback( uint8 status,uint16 connHandle);
  2406. /*******************************************************************************
  2407. * @fn LL_ReadRemoteUsedFeaturesCompleteCback Callback
  2408. *
  2409. * @brief This Callback is used by the LL to indicate to the Host that
  2410. * the Read Remote Feature Support command as completed.
  2411. *
  2412. * input parameters
  2413. *
  2414. * @param status - SUCCESS or control procedure timeout.
  2415. * @param connId - The LL connection ID for new connection.
  2416. * @param featureSet - A pointer to the Feature Set.
  2417. *
  2418. * output parameters
  2419. *
  2420. * @param None.
  2421. *
  2422. * @return None.
  2423. */
  2424. extern void LL_ReadRemoteUsedFeaturesCompleteCback( uint8 status,
  2425. uint16 connId,
  2426. uint8 *featureSet );
  2427. /*******************************************************************************
  2428. * @fn LL_EncLtkReqCback Callback
  2429. *
  2430. * @brief This Callback is used by the LL to provide to the Host the
  2431. * Master's random number and encryption diversifier, and to
  2432. * request the Host's Long Term Key (LTK).
  2433. *
  2434. * input parameters
  2435. *
  2436. * @param connId - The LL connection ID for new connection.
  2437. * @param randNum - Random vector used in device identification.
  2438. * @param encDiv - Encrypted diversifier.
  2439. *
  2440. * output parameters
  2441. *
  2442. * @param None.
  2443. *
  2444. * @return None.
  2445. */
  2446. extern void LL_EncLtkReqCback( uint16 connId,
  2447. uint8 *randNum,
  2448. uint8 *encDiv );
  2449. /*******************************************************************************
  2450. * @fn LL_DirectTestEndDone Callback
  2451. *
  2452. * @brief This Callback is used by the LL to notify the HCI that the
  2453. * Direct Test End command has completed.
  2454. *
  2455. *
  2456. * input parameters
  2457. *
  2458. * @param numPackets - The number of packets received. Zero for transmit.
  2459. * @param mode - LL_DIRECT_TEST_MODE_TX or LL_DIRECT_TEST_MODE_RX.
  2460. *
  2461. * output parameters
  2462. *
  2463. * @param None.
  2464. *
  2465. * @return LL_STATUS_SUCCESS
  2466. */
  2467. extern void LL_DirectTestEndDoneCback( uint16 numPackets,
  2468. uint8 mode );
  2469. /*******************************************************************************
  2470. * @fn LL_DataLengthChange Callback
  2471. *
  2472. *
  2473. */
  2474. extern void LL_DataLengthChangeCback(uint16 connHandle,
  2475. uint16 MaxTxOctets,
  2476. uint16 MaxTxTime,
  2477. uint16 MaxRxOctets,
  2478. uint16 MaxRxTime);
  2479. /*******************************************************************************
  2480. * @fn LL_TxDataCompleteCback Callback
  2481. *
  2482. * @brief This Callback is used by the LL to indicate to the HCI that
  2483. * the HCI's buffer is free for its own use again.
  2484. *
  2485. * input parameters
  2486. *
  2487. * @param connId - The LL connection ID on which to send this data.
  2488. * @param *pBuf - A pointer to the data buffer to transmit, or NULL.
  2489. *
  2490. * output parameters
  2491. *
  2492. * @param None.
  2493. *
  2494. * @return None.
  2495. ******************************************************************************/
  2496. extern void LL_TxDataCompleteCback( uint16 connId,
  2497. uint8 *pBuf );
  2498. /*******************************************************************************
  2499. * @fn LL_RxDataCompleteCback Callback
  2500. *
  2501. * @brief This Callback is used by the LL to indicate to the HCI that
  2502. * data has been received and placed in the buffer provided by
  2503. * the HCI.
  2504. *
  2505. * input parameters
  2506. *
  2507. * @param connId - The LL connection ID on which data was received.
  2508. * @param *pBuf - A pointer to the receive data buffer provided by
  2509. * the HCI.
  2510. * @param len - The number of bytes received on this connection.
  2511. * @param fragFlag - LL_DATA_FIRST_PKT indicates buffer is the start of
  2512. * a Host packet.
  2513. * LL_DATA_CONTINUATION_PKT: Indicates buffer is a
  2514. * continuation of a Host packet.
  2515. * @param rssi - The RSSI of this received packet as a signed byte.
  2516. * Range: -127dBm..+20dBm, 127=Not Available.
  2517. *
  2518. * output parameters
  2519. *
  2520. * @param **pBuf - A double pointer updated to the next receive data
  2521. * buffer, or NULL if no next buffer is available.
  2522. *
  2523. * @return None.
  2524. */
  2525. extern void LL_RxDataCompleteCback( uint16 connId,
  2526. uint8 *ppBuf,
  2527. uint8 len,
  2528. uint8 fragFlag,
  2529. int8 rssi );
  2530. /*******************************************************************************
  2531. * @fn LL_RandCback API
  2532. *
  2533. * @brief This Callback is used by the LL to notify the HCI that the true
  2534. * random number command has been completed.
  2535. *
  2536. * Note: The length is always given by B_RANDOM_NUM_SIZE.
  2537. *
  2538. * input parameters
  2539. *
  2540. * @param *randData - Pointer to buffer to place a random block of data.
  2541. *
  2542. * output parameters
  2543. *
  2544. * @param None.
  2545. *
  2546. * @return None.
  2547. */
  2548. extern void LL_RandCback( uint8 *randData );
  2549. /*******************************************************************************
  2550. * @fn LL_EXT_SetRxGainCback Callback
  2551. *
  2552. * @brief This Callback is used by the LL to notify the HCI that the set
  2553. * RX gain command has been completed.
  2554. *
  2555. * input parameters
  2556. *
  2557. * @param None.
  2558. *
  2559. * output parameters
  2560. *
  2561. * @param None.
  2562. *
  2563. * @return None.
  2564. */
  2565. extern void LL_EXT_SetRxGainCback( void );
  2566. /*******************************************************************************
  2567. * @fn LL_EXT_SetTxPowerCback Callback
  2568. *
  2569. * @brief This Callback is used by the LL to notify the HCI that the set
  2570. * TX power command has been completed.
  2571. *
  2572. * input parameters
  2573. *
  2574. * @param None.
  2575. *
  2576. * output parameters
  2577. *
  2578. * @param None.
  2579. *
  2580. * @return None.
  2581. */
  2582. extern void LL_EXT_SetTxPowerCback( void );
  2583. /*******************************************************************************
  2584. * @fn LL_EXT_PacketErrorRateCback Callback
  2585. *
  2586. * @brief This Callback is used by the LL to notify the HCI that the
  2587. * Packet Error Rate Read command has been completed.
  2588. *
  2589. * Note: The counters are only 16 bits. At the shortest connection
  2590. * interval, this provides a bit over 8 minutes of data.
  2591. *
  2592. * input parameters
  2593. *
  2594. * @param numPkts - Number of Packets received.
  2595. * @param numCrcErr - Number of Packets received with a CRC error.
  2596. * @param numEvents - Number of Connection Events.
  2597. * @param numPkts - Number of Missed Connection Events.
  2598. *
  2599. * output parameters
  2600. *
  2601. * @param None.
  2602. *
  2603. * @return None.
  2604. */
  2605. extern void LL_EXT_PacketErrorRateCback( uint16 numPkts,
  2606. uint16 numCrcErr,
  2607. uint16 numEvents,
  2608. uint16 numMissedEvts );
  2609. /*******************************************************************************
  2610. * @fn LL_EXT_ExtendRfRangeCback Callback
  2611. *
  2612. * @brief This Callback is used by the LL to notify the HCI that the
  2613. * Extend Rf Range command has been completed.
  2614. *
  2615. * input parameters
  2616. *
  2617. * @param None.
  2618. *
  2619. * output parameters
  2620. *
  2621. * @param None.
  2622. *
  2623. * @return None.
  2624. */
  2625. //extern void LL_EXT_ExtendRfRangeCback( void );
  2626. /*******************************************************************************
  2627. * @fn LL_PLUS_PerStats_Init
  2628. *
  2629. * @brief Used to init linklayer per stats
  2630. *
  2631. * input parameters
  2632. *
  2633. * @param None.
  2634. *
  2635. * output parameters
  2636. *
  2637. * @param None.
  2638. *
  2639. * @return None.
  2640. */
  2641. extern void LL_PLUS_PerStats_Init(perStatsByChan_t* p_per);
  2642. /*******************************************************************************
  2643. * @fn LL_PLUS_PerStatsReset
  2644. *
  2645. * @brief Used to reset linklayer per stats
  2646. *
  2647. * input parameters
  2648. *
  2649. * @param None.
  2650. *
  2651. * output parameters
  2652. *
  2653. * @param None.
  2654. *
  2655. * @return None.
  2656. */
  2657. extern void LL_PLUS_PerStatsReset(void);
  2658. /*******************************************************************************
  2659. * @fn LL_PLUS_PerStasReadByChn
  2660. *
  2661. * @brief read per stats by data channel id
  2662. *
  2663. * input parameters
  2664. *
  2665. * @param None.
  2666. *
  2667. * output parameters
  2668. *
  2669. * @param None.
  2670. *
  2671. * @return None.
  2672. */
  2673. extern void LL_PLUS_PerStasReadByChn(uint8 chnId,perStats_t * perStats);
  2674. extern LL_PLUS_AdvDataFilterCB_t LL_PLUS_AdvDataFilterCBack;
  2675. extern void LL_PLUS_SetAdvDataFilterCB(LL_PLUS_AdvDataFilterCB_t AdvDataFilterCBack);
  2676. extern uint8_t* LL_PLUS_GetAdvDataExtendData(void);
  2677. extern void LL_PLUS_SetScanRequestData(uint8 dLen,uint8* pData);
  2678. extern LL_PLUS_ScanRequestFilterCB_t LL_PLUS_ScanRequestFilterCBack;
  2679. extern void LL_PLUS_SetScanRequestFilterCB(LL_PLUS_ScanRequestFilterCB_t ScanRequestFilterCBack);
  2680. extern uint8 LL_PLUS_GetScanRequestExtendData(uint8* pData);
  2681. extern void LL_PLUS_GetScanerAddr(uint8* pData);
  2682. extern void LL_PLUS_SetScanRsqData(uint8 dLen,uint8* pData);
  2683. extern void LL_PLUS_SetScanRsqDataByIndex(uint8 dIdx,uint8 data);
  2684. //DLE
  2685. extern llStatus_t LL_SetDataLengh( uint16 connId,uint16 TxOctets,uint16 TxTime );
  2686. //extern uint8 LL_PLUS_GetLocalPduDataLength(ll_pdu_length_ctrl_t* pduLen);
  2687. extern llStatus_t LL_WriteSuggestedDefaultDataLength(uint16 TxOctets,uint16 TxTime);
  2688. extern void LL_DataLengthChangeCback( uint16 connHandle,
  2689. uint16 MaxTxOctets,
  2690. uint16 MaxTxTime,
  2691. uint16 MaxRxOctets,
  2692. uint16 MaxRxTime);
  2693. //PHY UPDATE
  2694. extern llStatus_t LL_SetDefaultPhyMode( uint16 connId,uint8 allPhy,uint8 txPhy, uint8 rxPhy);
  2695. extern llStatus_t LL_SetPhyMode( uint16 connId,uint8 allPhy,uint8 txPhy, uint8 rxPhy,uint16 phyOptions);
  2696. extern llStatus_t LL_PhyUpdate( uint16 connId );
  2697. extern void LL_PhyUpdateCompleteCback( uint16 connHandle,
  2698. uint8 status,
  2699. uint8 txPhy,
  2700. uint8 rxPhy);
  2701. // Resolving list
  2702. extern llStatus_t LL_AddResolvingListLDevice( uint8 addrType,
  2703. uint8 *devAddr,
  2704. uint8 *peerIrk,
  2705. uint8 *localIrk);
  2706. extern llStatus_t LL_RemoveResolvingListDevice( uint8 *devAddr,
  2707. uint8 addrType );
  2708. extern llStatus_t LL_ClearResolvingList( void );
  2709. extern llStatus_t LL_ReadResolvingListSize( uint8 *numEntries );
  2710. extern llStatus_t LL_SetAddressResolutionEnable( uint8 enable );
  2711. extern llStatus_t LL_SetResolvablePrivateAddressTimeout( uint16 rpaTimeout );
  2712. extern llStatus_t LL_PLUS_DisableSlaveLatency(uint8 connId);
  2713. extern llStatus_t LL_PLUS_EnableSlaveLatency(uint8 connId);
  2714. // extended advertisement
  2715. llStatus_t LL_InitExtendedAdv( extAdvInfo_t *extAdvInfo,
  2716. uint8 extAdvNumber,
  2717. uint16 advSetMaxLen);
  2718. llStatus_t LL_SetExtAdvSetRandomAddress( uint8 adv_handle,
  2719. uint8* random_address);
  2720. llStatus_t LL_SetExtAdvParam( uint8 adv_handle,
  2721. uint16 adv_event_properties,
  2722. uint32 primary_advertising_interval_Min, // 3 octets
  2723. uint32 primary_advertising_interval_Max, // 3 octets
  2724. uint8 primary_advertising_channel_map,
  2725. uint8 own_address_type,
  2726. uint8 peer_address_type,
  2727. uint8 *peer_address,
  2728. uint8 advertising_filter_policy,
  2729. uint8 advertising_tx_power,
  2730. uint8 primary_advertising_PHY,
  2731. uint8 secondary_advertising_max_skip,
  2732. uint8 secondary_advertising_PHY,
  2733. uint8 advertising_SID,
  2734. uint8 scan_request_notification_enable,
  2735. uint8 *selectTxPwr);
  2736. llStatus_t LL_SetExtAdvData( uint8 adv_handle,
  2737. uint8 operation,
  2738. uint8 fragment_preference,
  2739. uint8 advertising_data_length,
  2740. uint8 *advertising_data);
  2741. llStatus_t LL_SetExtScanRspData( uint8 adv_handle,
  2742. uint8 operation,
  2743. uint8 fragment_preference,
  2744. uint8 scan_rsp_data_length,
  2745. uint8 *scan_rsp_data);
  2746. llStatus_t LL_SetExtAdvEnable(uint8 enable,
  2747. uint8 number_of_sets,
  2748. uint8 *advertising_handle,
  2749. uint16 *duration,
  2750. uint8 *max_extended_advertising_events);
  2751. llStatus_t LL_ReadMaximumAdvDataLength( uint16 *length );
  2752. llStatus_t LL_ReadNumberOfSupportAdvSet( uint8 *number );
  2753. llStatus_t LL_RemoveAdvSet( uint8 adv_handle);
  2754. llStatus_t LL_ClearAdvSets(void);
  2755. llStatus_t LL_SetExtendedScanParameters(uint8 own_address_type,
  2756. uint8 scanning_filter_policy,
  2757. uint8 scanning_PHYs,
  2758. uint8 *scan_type,
  2759. uint16 *scan_interval,
  2760. uint16 *scan_window);
  2761. llStatus_t LL_SetExtendedScanEnable(uint8 enable,
  2762. uint8 filter_duplicates,
  2763. uint16 duration,
  2764. uint16 period);
  2765. llStatus_t LL_ExtendedCreateConnection(uint8 initiator_filter_policy,
  2766. uint8 own_address_type,
  2767. uint8 peer_address_type,
  2768. uint8* peer_address,
  2769. uint8 initiating_PHYs,
  2770. uint16 *scan_interval,
  2771. uint16 *scan_window,
  2772. uint16 *conn_interval_min,
  2773. uint16 *conn_interval_max,
  2774. uint16 *conn_latency,
  2775. uint16 *supervision_timeout,
  2776. uint16 *minimum_CE_length,
  2777. uint16 *maximum_CE_length);
  2778. // extended adv
  2779. void llSetupAdvExtIndPDU(extAdvInfo_t *pAdvInfo, periodicAdvInfo_t *pPrdAdv);
  2780. void llSetupAuxAdvIndPDU(extAdvInfo_t *pAdvInfo, periodicAdvInfo_t *pPrdAdv);
  2781. void llSetupAuxChainIndPDU(extAdvInfo_t *pAdvInfo, periodicAdvInfo_t *pPrdAdv);
  2782. void llSetupAuxSyncIndPDU(extAdvInfo_t *pAdvInfo, periodicAdvInfo_t *pPrdAdv);
  2783. void llSetupAuxConnectReqPDU(void);
  2784. void llSetupAuxConnectRspPDU(extAdvInfo_t *pAdvInfo);
  2785. void llSetupAuxScanRspPDU(extAdvInfo_t *pAdvInfo);
  2786. /*******************************************************************************
  2787. * @fn LL_InitConnectContext
  2788. *
  2789. * @brief This function initialize the LL connection-orient context
  2790. *
  2791. * input parameters
  2792. *
  2793. * @param pConnContext - connection-orient context, the memory is allocated by application
  2794. * maxConnNum - the size of connect-orient context
  2795. * maxPktPerEventTx/Rx - number of packets transmit/receive per connection event
  2796. *
  2797. * output parameters
  2798. *
  2799. * @param None.
  2800. *
  2801. * @return None.
  2802. */
  2803. llStatus_t LL_InitConnectContext(llConnState_t *pConnContext,
  2804. uint8 *pConnBuffer,
  2805. uint8 maxConnNum,
  2806. uint8 maxPktPerEventTx,
  2807. uint8 maxPktPerEventRx,
  2808. uint8 blePktVersion);
  2809. // extended scan
  2810. llStatus_t LL_InitExtendedScan(uint8 *scanDataBuffer,
  2811. uint16 scanDataBufferLength);
  2812. llStatus_t LL_InitPeriodicAdv(extAdvInfo_t *extAdvInfo,
  2813. periodicAdvInfo_t *periodicAdvInfo,
  2814. uint8 periodicAdvSetNumber,
  2815. uint16 advSetMaxLen);
  2816. // Periodic Adv
  2817. llStatus_t LL_SetPeriodicAdvParameter(uint8 adv_handle,
  2818. uint16 interval_min,
  2819. uint16 interval_max,
  2820. uint16 adv_event_properties);
  2821. llStatus_t LL_SetPeriodicAdvData(uint8 adv_handle,
  2822. uint8 operation,
  2823. uint8 advertising_data_length,
  2824. uint8 *advertising_data);
  2825. llStatus_t LL_SetPeriodicAdvEnable(uint8 enable,
  2826. uint8 advertising_handle);
  2827. // periodic scan
  2828. llStatus_t LL_PeriodicAdvertisingCreateSync(uint8 options,
  2829. uint8 advertising_SID,
  2830. uint8 advertiser_Address_Type,
  2831. uint8 *advertiser_Address,
  2832. uint16 skip,
  2833. uint16 sync_Timeout,
  2834. uint8 sync_CTE_Type);
  2835. llStatus_t LL_PeriodicAdvertisingCreateSyncCancel(void);
  2836. llStatus_t LL_PeriodicAdvertisingTerminateSync( uint16 sync_handle);
  2837. /*****************************************************************************************
  2838. * fn: LL_ConnectionlessCTE_TransmitParamCmd
  2839. *
  2840. * date:2020-01-15
  2841. *
  2842. * brief: set CTE Parameters in any periodic advertising
  2843. * 1、CTE Type
  2844. * 2、CTE Length
  2845. * 3、CTE antenna switching pattern
  2846. *
  2847. * input parameters:
  2848. * advertising handle : Identify advertising set 0x0-0xEF
  2849. * CTE_Length : CTE Length in 8us 0x2-0x14
  2850. * CTE_Type : 0:AOA CTE , 1:AoD CTE with 1us,2:AoD CTE with 2us,
  2851. * CTE_Count : how many CTE packet in each PA event 0x1-0x10
  2852. * Switch_Pattern_LEN : number of Antenna IDs in the pattern
  2853. * : AOD CTE, AOA shall be ignored
  2854. * : 0x2-0x4B
  2855. * Antenna_IDs[i] : List of Antenna IDs in the pattern
  2856. * : AOD CTE, AOA shall be ignored
  2857. *
  2858. * output parameters:
  2859. * Status :LL_STATUS_SUCCESS or other error codes
  2860. *
  2861. *
  2862. * return LL_STATUS_SUCCESS or other error codes
  2863. *
  2864. *****************************************************************************************/
  2865. llStatus_t LL_ConnectionlessCTE_TransmitParam( uint8 advertising_handle,
  2866. uint8 len,
  2867. uint8 type,
  2868. uint8 count,
  2869. uint8 Pattern_LEN,
  2870. uint8 *AnaIDs);
  2871. /*****************************************************************************************
  2872. * fn: LL_ConnectionlessCTE_TransmitEnable
  2873. *
  2874. * date:2020-01-16
  2875. *
  2876. * brief: Controller enable or disable CTE in PA
  2877. *
  2878. * input parameters:
  2879. * advertising handle : Identify advertising set in which CTE is enable or disable
  2880. * : 0x0-0xEF
  2881. * enable : 0 : disable , 1: enable
  2882. *
  2883. *
  2884. * output parameters:
  2885. * Status :LL_STATUS_SUCCESS or other error codes
  2886. *
  2887. *
  2888. * return LL_STATUS_SUCCESS or other error codes
  2889. *
  2890. *****************************************************************************************/
  2891. llStatus_t LL_ConnectionlessCTE_TransmitEnable( uint8 advertising_handle,
  2892. uint8 enable);
  2893. /*****************************************************************************************
  2894. * fn: LL_ConnectionlessIQ_SampleEnable
  2895. *
  2896. * date:2020-01-17
  2897. *
  2898. * brief: Controller enable or disable capturing IQ Samples from the CTE of PA pcakets
  2899. *
  2900. * input parameters:
  2901. * sync_handle : periodic advertising handle
  2902. * Range:0x0 - 0x0EFF
  2903. * slot_Duration : switching and sampling slot 0x1:1us,0x2:2us,Other:RFU
  2904. * enable : 0x0:IQ Sampling disable, 0x1:IQ Sampling enable
  2905. * MaxSampledCTEs : max number of CTE in each PA event that the controller
  2906. * should collect and report
  2907. * Range : 0x0-0x10
  2908. * 0x0 : sample and report all available CTE
  2909. * pattern_len : number of Antenna IDs in the pattern
  2910. * Range:0x2 - 0x4B
  2911. * AnaIDs : list of Antenna IDs in the pattern
  2912. *
  2913. *
  2914. * output parameters:
  2915. * status : LL_STATUS_SUCCESS or other error codes
  2916. * sync_handle : Periodic advertising handle
  2917. *
  2918. *
  2919. * return LL_STATUS_SUCCESS or other error codes
  2920. *
  2921. *****************************************************************************************/
  2922. llStatus_t LL_ConnectionlessIQ_SampleEnable( uint16 sync_handle,
  2923. uint8 enable,
  2924. uint8 slot_Duration,
  2925. uint8 MaxSampledCTEs,
  2926. uint8 pattern_len,
  2927. uint8 *AnaIDs);
  2928. /*****************************************************************************************
  2929. * fn: LL_Set_ConnectionCTE_ReceiveParam
  2930. *
  2931. * date:2020-01-19
  2932. *
  2933. * brief: enable or disable sampling received CTE fields on the connection
  2934. * set antenna switching pattern
  2935. * set switching and sampling slot durations
  2936. *
  2937. * input parameters:
  2938. * connHandle : connection handle Range 0x0 - 0x0EFF
  2939. * enable : sampling enable 0:disable , 1:enable
  2940. * slot_Duration : switching and sampling slot 0:1us, 1: 2us
  2941. * pattern_len : the number of Antenna IDs in the pattern
  2942. * Range: 0x2-0x4B
  2943. * AnaIDs : list of Antenna IDs in the pattern
  2944. *
  2945. *
  2946. * output parameters:
  2947. * Status : LL_STATUS_SUCCESS or other error codes
  2948. * connHandle : Connection Handle
  2949. *
  2950. *
  2951. * return llStatus_t
  2952. *
  2953. *****************************************************************************************/
  2954. llStatus_t LL_Set_ConnectionCTE_ReceiveParam( uint16 connHandle,
  2955. uint8 enable,
  2956. uint8 slot_Duration,
  2957. uint8 pattern_len,
  2958. uint8 *AnaIDs);
  2959. /*****************************************************************************************
  2960. * fn: LL_Connection_CTE_Request_Enable
  2961. *
  2962. * date:2020-01-19
  2963. *
  2964. * brief: request Controller to start or stop initiating the CTE request
  2965. * procedure on connection
  2966. *
  2967. * input parameters:
  2968. * connHandle : connection Handle
  2969. * Range:0x0 - 0x0EFF
  2970. * enable : Enable or disable CTE request for the connection
  2971. * 0:disable,1:enable
  2972. * Interval : define whether the CTE request procedure is initiated
  2973. * only once or periodically.
  2974. * Range:0x0 - 0xFFFF
  2975. * 0x0 : Initiate the CTE request procedure once
  2976. * 0x1 - 0xFFFF : Requested interval for initiating the CTE
  2977. * procedure in number of connection events
  2978. * Range:
  2979. * len : minimum length of the CTE in 8us units
  2980. * Range: 0x2 - 0x14
  2981. * type : indicate the type of CTE that the controller shall
  2982. * request from the remote device
  2983. * 0x0:AOA CTE
  2984. * 0x1:AOD CTE with 1us
  2985. * 0x2:AOD CTE with 2us
  2986. *
  2987. *
  2988. * output parameters:
  2989. * Status : 0x0 : command succeed , 0x1 - 0xff : other error code
  2990. * connHandle : connection handle
  2991. *
  2992. *
  2993. * return llStatus_t
  2994. *
  2995. *****************************************************************************************/
  2996. llStatus_t LL_Connection_CTE_Request_Enable( uint16 connHandle,
  2997. uint8 enable,
  2998. uint16 Interval,
  2999. uint8 len,
  3000. uint8 type);
  3001. /*****************************************************************************************
  3002. * fn: LL_Set_ConnectionCTE_TransmitParam
  3003. *
  3004. * date:2000-01-19
  3005. *
  3006. * brief: used to set the antenna switching pattern and permitted CTE type
  3007. *
  3008. * input parameters:
  3009. * connHandle : connection Handle, Range: 0x0 - 0x0EFF
  3010. * type : bit set for CTE type , bit 0 : AOA CTE response,
  3011. * bit 1 : AOD CTE response with 1us slots
  3012. * bit 2 : AOD CTE response with 2us slots
  3013. * pattern_len : the number of Antenna IDs in the pattern
  3014. * AnaIDs : list of Antenna IDs in the pattern
  3015. *
  3016. *
  3017. * output parameters:
  3018. * Status : 0 : success, other error code
  3019. * ConnHandle : connection handle
  3020. *
  3021. *
  3022. * return llStatus_t
  3023. *
  3024. *****************************************************************************************/
  3025. llStatus_t LL_Set_ConnectionCTE_TransmitParam( uint16 connHandle,
  3026. uint8 type,
  3027. uint8 pattern_len,
  3028. uint8 *AnaIDs);
  3029. /*****************************************************************************************
  3030. * fn: LL_Connection_CTE_Response_Enable
  3031. *
  3032. * date:2020-01-19
  3033. *
  3034. * brief: request the controller to respond to LL_CTE_REQ with LL_CTE_RSP on the
  3035. * specified connection
  3036. *
  3037. * input parameters:
  3038. * connHandle : connection Handle
  3039. * Range:0x0 - 0x0EFF
  3040. * enable : enable or disable CTE response for the connection
  3041. *
  3042. *
  3043. * output parameters:
  3044. * status : 0x0 : command succeed , 0x1 - 0xff : other error code
  3045. * connHandle : connection handle
  3046. *
  3047. *
  3048. *
  3049. * return llStatus_t
  3050. *
  3051. *****************************************************************************************/
  3052. llStatus_t LL_Connection_CTE_Response_Enable( uint16 connHandle,uint8 enable);
  3053. /*****************************************************************************************
  3054. * fn: HCI_LE_READ_Anatenna_InfoCmd
  3055. *
  3056. * date:2020-01-19
  3057. *
  3058. * brief: Host read the switching rates, the sampling reate, the number of antennae,
  3059. * and the maxumum length of a transmitted CTE supported by the controller
  3060. *
  3061. * input parameters:
  3062. * None
  3063. *
  3064. *
  3065. * output parameters:
  3066. * status : 0x0 : command succeed , 0x1 - 0xff : other error code
  3067. * switch_sample_rate : bit number indicate supported switching and sampling rate
  3068. * bit 0 : 1us switching AOD transmission
  3069. * bit 1 : 1us sampling AOD reception
  3070. * bit 2 : 1us switching and sampling AOA reception
  3071. * Antenna_len : number of Antennae supported by the controller
  3072. * MAX_Pattern_len : MAX length of antenna switching pattern spooorted by the controller
  3073. * MAX_CTE_LEN : MAX length or a transmitted CTE supported in 8us units
  3074. *
  3075. *
  3076. * return llStatus_t
  3077. *
  3078. *****************************************************************************************/
  3079. llStatus_t LL_READ_Anatenna_Info( uint8 *param );
  3080. void LL_EXT_Init_IQ_pBuff(uint16 *ibuf,uint16 *qbuf);
  3081. #ifdef __cplusplus
  3082. }
  3083. #endif
  3084. #endif /* LL_H */