forked from rainbow-cnay/rtl8821cu-nvidia-jetson-nano
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrtw_bt_mp.c
executable file
·1575 lines (1415 loc) · 49.8 KB
/
rtw_bt_mp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*****************************************************************************/
#include <drv_types.h>
#include <rtw_bt_mp.h>
#if defined(CONFIG_RTL8723B)
#include <rtl8723b_hal.h>
#endif
#if defined(CONFIG_RTL8723B) || defined(CONFIG_RTL8821A)
void MPh2c_timeout_handle(void *FunctionContext)
{
PADAPTER pAdapter;
PMPT_CONTEXT pMptCtx;
RTW_INFO("[MPT], MPh2c_timeout_handle\n");
pAdapter = (PADAPTER)FunctionContext;
pMptCtx = &pAdapter->mppriv.mpt_ctx;
pMptCtx->bMPh2c_timeout = _TRUE;
if ((_FALSE == pMptCtx->MptH2cRspEvent)
|| ((_TRUE == pMptCtx->MptH2cRspEvent)
&& (_FALSE == pMptCtx->MptBtC2hEvent)))
_rtw_up_sema(&pMptCtx->MPh2c_Sema);
}
u32 WaitC2Hevent(PADAPTER pAdapter, u8 *C2H_event, u32 delay_time)
{
PMPT_CONTEXT pMptCtx = &(pAdapter->mppriv.mpt_ctx);
pMptCtx->bMPh2c_timeout = _FALSE;
if (pAdapter->registrypriv.mp_mode == 0) {
RTW_INFO("[MPT], Error!! WaitC2Hevent mp_mode == 0!!\n");
return _FALSE;
}
_set_timer(&pMptCtx->MPh2c_timeout_timer, delay_time);
_rtw_down_sema(&pMptCtx->MPh2c_Sema);
if (pMptCtx->bMPh2c_timeout == _TRUE) {
*C2H_event = _FALSE;
return _FALSE;
}
/* for safty, cancel timer here again */
_cancel_timer_ex(&pMptCtx->MPh2c_timeout_timer);
return _TRUE;
}
BT_CTRL_STATUS
mptbt_CheckC2hFrame(
PADAPTER Adapter,
PBT_H2C pH2c,
PBT_EXT_C2H pExtC2h
)
{
BT_CTRL_STATUS c2hStatus = BT_STATUS_C2H_SUCCESS;
/* RTW_INFO("[MPT], MPT rsp C2H hex: %x %x %x %x %x %x\n"), pExtC2h , pExtC2h+1 ,pExtC2h+2 ,pExtC2h+3 ,pExtC2h+4 ,pExtC2h+5); */
RTW_INFO("[MPT], statusCode = 0x%x\n", pExtC2h->statusCode);
RTW_INFO("[MPT], retLen = %d\n", pExtC2h->retLen);
RTW_INFO("[MPT], opCodeVer : req/rsp=%d/%d\n", pH2c->opCodeVer, pExtC2h->opCodeVer);
RTW_INFO("[MPT], reqNum : req/rsp=%d/%d\n", pH2c->reqNum, pExtC2h->reqNum);
if (pExtC2h->reqNum != pH2c->reqNum) {
c2hStatus = BT_STATUS_C2H_REQNUM_MISMATCH;
RTW_INFO("[MPT], Error!! C2H reqNum Mismatch!!\n");
} else if (pExtC2h->opCodeVer != pH2c->opCodeVer) {
c2hStatus = BT_STATUS_OPCODE_L_VERSION_MISMATCH;
RTW_INFO("[MPT], Error!! OPCode version L mismatch!!\n");
}
return c2hStatus;
}
BT_CTRL_STATUS
mptbt_SendH2c(
PADAPTER Adapter,
PBT_H2C pH2c,
u2Byte h2cCmdLen
)
{
/* KIRQL OldIrql = KeGetCurrentIrql(); */
BT_CTRL_STATUS h2cStatus = BT_STATUS_H2C_SUCCESS;
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
u1Byte i;
RTW_INFO("[MPT], mptbt_SendH2c()=========>\n");
/* PlatformResetEvent(&pMptCtx->MptH2cRspEvent); */
/* PlatformResetEvent(&pMptCtx->MptBtC2hEvent); */
/* if(OldIrql == PASSIVE_LEVEL)
* { */
/* RTPRINT_DATA(FMPBT, FMPBT_H2C_CONTENT, ("[MPT], MPT H2C hex:\n"), pH2c, h2cCmdLen); */
for (i = 0; i < BT_H2C_MAX_RETRY; i++) {
RTW_INFO("[MPT], Send H2C command to wifi!!!\n");
pMptCtx->MptH2cRspEvent = _FALSE;
pMptCtx->MptBtC2hEvent = _FALSE;
#if defined(CONFIG_RTL8723B)
rtl8723b_set_FwBtMpOper_cmd(Adapter, pH2c->opCode, pH2c->opCodeVer, pH2c->reqNum, pH2c->buf);
#endif
pMptCtx->h2cReqNum++;
pMptCtx->h2cReqNum %= 16;
if (WaitC2Hevent(Adapter, &pMptCtx->MptH2cRspEvent, 100)) {
RTW_INFO("[MPT], Received WiFi MptH2cRspEvent!!!\n");
if (WaitC2Hevent(Adapter, &pMptCtx->MptBtC2hEvent, 400)) {
RTW_INFO("[MPT], Received MptBtC2hEvent!!!\n");
break;
} else {
RTW_INFO("[MPT], Error!!BT MptBtC2hEvent timeout!!\n");
h2cStatus = BT_STATUS_H2C_BT_NO_RSP;
}
} else {
RTW_INFO("[MPT], Error!!WiFi MptH2cRspEvent timeout!!\n");
h2cStatus = BT_STATUS_H2C_TIMTOUT;
}
}
/* }
* else
* {
* RT_ASSERT(FALSE, ("[MPT], mptbt_SendH2c() can only run under PASSIVE_LEVEL!!\n"));
* h2cStatus = BT_STATUS_WRONG_LEVEL;
* } */
RTW_INFO("[MPT], mptbt_SendH2c()<=========\n");
return h2cStatus;
}
BT_CTRL_STATUS
mptbt_CheckBtRspStatus(
PADAPTER Adapter,
PBT_EXT_C2H pExtC2h
)
{
BT_CTRL_STATUS retStatus = BT_OP_STATUS_SUCCESS;
switch (pExtC2h->statusCode) {
case BT_OP_STATUS_SUCCESS:
retStatus = BT_STATUS_BT_OP_SUCCESS;
RTW_INFO("[MPT], BT status : BT_STATUS_SUCCESS\n");
break;
case BT_OP_STATUS_VERSION_MISMATCH:
retStatus = BT_STATUS_OPCODE_L_VERSION_MISMATCH;
RTW_INFO("[MPT], BT status : BT_STATUS_OPCODE_L_VERSION_MISMATCH\n");
break;
case BT_OP_STATUS_UNKNOWN_OPCODE:
retStatus = BT_STATUS_UNKNOWN_OPCODE_L;
RTW_INFO("[MPT], BT status : BT_STATUS_UNKNOWN_OPCODE_L\n");
break;
case BT_OP_STATUS_ERROR_PARAMETER:
retStatus = BT_STATUS_PARAMETER_FORMAT_ERROR_L;
RTW_INFO("[MPT], BT status : BT_STATUS_PARAMETER_FORMAT_ERROR_L\n");
break;
default:
retStatus = BT_STATUS_UNKNOWN_STATUS_L;
RTW_INFO("[MPT], BT status : BT_STATUS_UNKNOWN_STATUS_L\n");
break;
}
return retStatus;
}
BT_CTRL_STATUS
mptbt_BtFwOpCodeProcess(
PADAPTER Adapter,
u1Byte btFwOpCode,
u1Byte opCodeVer,
pu1Byte pH2cPar,
u1Byte h2cParaLen
)
{
u1Byte H2C_Parameter[6] = {0};
PBT_H2C pH2c = (PBT_H2C)&H2C_Parameter[0];
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
u2Byte paraLen = 0, i;
BT_CTRL_STATUS h2cStatus = BT_STATUS_H2C_SUCCESS, c2hStatus = BT_STATUS_C2H_SUCCESS;
BT_CTRL_STATUS retStatus = BT_STATUS_H2C_BT_NO_RSP;
if (Adapter->registrypriv.mp_mode == 0) {
RTW_INFO("[MPT], Error!! mptbt_BtFwOpCodeProces mp_mode == 0!!\n");
return _FALSE;
}
pH2c->opCode = btFwOpCode;
pH2c->opCodeVer = opCodeVer;
pH2c->reqNum = pMptCtx->h2cReqNum;
/* PlatformMoveMemory(&pH2c->buf[0], pH2cPar, h2cParaLen); */
/* _rtw_memcpy(&pH2c->buf[0], pH2cPar, h2cParaLen); */
_rtw_memcpy(pH2c->buf, pH2cPar, h2cParaLen);
RTW_INFO("[MPT], pH2c->opCode=%d\n", pH2c->opCode);
RTW_INFO("[MPT], pH2c->opCodeVer=%d\n", pH2c->opCodeVer);
RTW_INFO("[MPT], pH2c->reqNum=%d\n", pH2c->reqNum);
RTW_INFO("[MPT], h2c parameter length=%d\n", h2cParaLen);
for (i = 0; i < h2cParaLen; i++)
RTW_INFO("[MPT], parameter[%d]=0x%02x\n", i, pH2c->buf[i]);
h2cStatus = mptbt_SendH2c(Adapter, pH2c, h2cParaLen + 2);
if (BT_STATUS_H2C_SUCCESS == h2cStatus) {
/* if reach here, it means H2C get the correct c2h response, */
c2hStatus = mptbt_CheckC2hFrame(Adapter, pH2c, pExtC2h);
if (BT_STATUS_C2H_SUCCESS == c2hStatus)
retStatus = mptbt_CheckBtRspStatus(Adapter, pExtC2h);
else {
RTW_INFO("[MPT], Error!! C2H failed for pH2c->opCode=%d\n", pH2c->opCode);
/* check c2h status error, return error status code to upper layer. */
retStatus = c2hStatus;
}
} else {
RTW_INFO("[MPT], Error!! H2C failed for pH2c->opCode=%d\n", pH2c->opCode);
/* check h2c status error, return error status code to upper layer. */
retStatus = h2cStatus;
}
return retStatus;
}
u2Byte
mptbt_BtReady(
PADAPTER Adapter,
PBT_REQ_CMD pBtReq,
PBT_RSP_CMD pBtRsp
)
{
u1Byte h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0;
u2Byte paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode;
u1Byte btOpcodeVer = 0;
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
u1Byte i;
u1Byte btFwVer = 0, bdAddr[6] = {0};
u2Byte btRealFwVer = 0;
pu2Byte pu2Tmp = NULL;
/* */
/* check upper layer parameters */
/* */
/* 1. check upper layer opcode version */
if (pBtReq->opCodeVer != 1) {
RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");
pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
return paraLen;
}
pBtRsp->pParamStart[0] = MP_BT_NOT_READY;
paraLen = 10;
/* */
/* execute lower layer opcodes */
/* */
/* Get BT FW version */
/* fill h2c parameters */
btOpcode = BT_LO_OP_GET_BT_VERSION;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* ckeck bt return status. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
} else {
pu2Tmp = (pu2Byte)&pExtC2h->buf[0];
btRealFwVer = *pu2Tmp;
btFwVer = pExtC2h->buf[1];
RTW_INFO("[MPT], btRealFwVer=0x%x, btFwVer=0x%x\n", btRealFwVer, btFwVer);
}
/* Get BD Address */
/* fill h2c parameters */
btOpcode = BT_LO_OP_GET_BD_ADDR_L;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* ckeck bt return status. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
} else {
bdAddr[5] = pExtC2h->buf[0];
bdAddr[4] = pExtC2h->buf[1];
bdAddr[3] = pExtC2h->buf[2];
}
/* fill h2c parameters */
btOpcode = BT_LO_OP_GET_BD_ADDR_H;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* ckeck bt return status. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
} else {
bdAddr[2] = pExtC2h->buf[0];
bdAddr[1] = pExtC2h->buf[1];
bdAddr[0] = pExtC2h->buf[2];
}
RTW_INFO("[MPT], Local BDAddr:");
for (i = 0; i < 6; i++)
RTW_INFO(" 0x%x ", bdAddr[i]);
pBtRsp->status = BT_STATUS_SUCCESS;
pBtRsp->pParamStart[0] = MP_BT_READY;
pu2Tmp = (pu2Byte)&pBtRsp->pParamStart[1];
*pu2Tmp = btRealFwVer;
pBtRsp->pParamStart[3] = btFwVer;
for (i = 0; i < 6; i++)
pBtRsp->pParamStart[4 + i] = bdAddr[5 - i];
return paraLen;
}
void mptbt_close_WiFiRF(PADAPTER Adapter)
{
phy_set_bb_reg(Adapter, 0x824, 0xF, 0x0);
phy_set_bb_reg(Adapter, 0x824, 0x700000, 0x0);
phy_set_rf_reg(Adapter, RF_PATH_A, 0x0, 0xF0000, 0x0);
}
void mptbt_open_WiFiRF(PADAPTER Adapter)
{
phy_set_bb_reg(Adapter, 0x824, 0x700000, 0x3);
phy_set_bb_reg(Adapter, 0x824, 0xF, 0x2);
phy_set_rf_reg(Adapter, RF_PATH_A, 0x0, 0xF0000, 0x3);
}
u4Byte mptbt_switch_RF(PADAPTER Adapter, u1Byte Enter)
{
u2Byte tmp_2byte = 0;
/* Enter test mode */
if (Enter) {
/* 1>. close WiFi RF */
mptbt_close_WiFiRF(Adapter);
/* 2>. change ant switch to BT */
tmp_2byte = rtw_read16(Adapter, 0x860);
tmp_2byte = tmp_2byte | BIT(9);
tmp_2byte = tmp_2byte & (~BIT(8));
rtw_write16(Adapter, 0x860, tmp_2byte);
rtw_write16(Adapter, 0x870, 0x300);
} else {
/* 1>. Open WiFi RF */
mptbt_open_WiFiRF(Adapter);
/* 2>. change ant switch back */
tmp_2byte = rtw_read16(Adapter, 0x860);
tmp_2byte = tmp_2byte | BIT(8);
tmp_2byte = tmp_2byte & (~BIT(9));
rtw_write16(Adapter, 0x860, tmp_2byte);
rtw_write16(Adapter, 0x870, 0x300);
}
return 0;
}
u2Byte
mptbt_BtSetMode(
PADAPTER Adapter,
PBT_REQ_CMD pBtReq,
PBT_RSP_CMD pBtRsp
)
{
u1Byte h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0;
u2Byte paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode;
u1Byte btOpcodeVer = 0;
u1Byte btModeToSet = 0;
/* */
/* check upper layer parameters */
/* */
/* 1. check upper layer opcode version */
if (pBtReq->opCodeVer != 1) {
RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");
pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
return paraLen;
}
/* 2. check upper layer parameter length */
if (1 == pBtReq->paraLength) {
btModeToSet = pBtReq->pParamStart[0];
RTW_INFO("[MPT], BtTestMode=%d\n", btModeToSet);
} else {
RTW_INFO("[MPT], Error!! wrong parameter length=%d (should be 1)\n", pBtReq->paraLength);
pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
return paraLen;
}
/* */
/* execute lower layer opcodes */
/* */
/* 1. fill h2c parameters */
/* check bt mode */
btOpcode = BT_LO_OP_SET_BT_MODE;
if (btModeToSet >= MP_BT_MODE_MAX) {
pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
} else {
mptbt_switch_RF(Adapter, 1);
h2cParaBuf[0] = btModeToSet;
h2cParaLen = 1;
/* 2. execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
}
/* 3. construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS == retStatus)
pBtRsp->status = BT_STATUS_SUCCESS;
else {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
}
return paraLen;
}
VOID
MPTBT_FwC2hBtMpCtrl(
PADAPTER Adapter,
pu1Byte tmpBuf,
u1Byte length
)
{
u32 i;
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)tmpBuf;
if (GET_HAL_DATA(Adapter)->bBTFWReady == _FALSE || Adapter->registrypriv.mp_mode == 0) {
/* RTW_INFO("Ignore C2H BT MP Info since not in MP mode\n"); */
return;
}
if (length > 32 || length < 3) {
RTW_INFO("\n [MPT], pExtC2h->buf hex: length=%d > 32 || < 3\n", length);
return;
}
/* cancel_timeout for h2c handle */
_cancel_timer_ex(&pMptCtx->MPh2c_timeout_timer);
for (i = 0; i < length; i++)
RTW_INFO("[MPT], %s, buf[%d]=0x%02x ", __FUNCTION__, i, tmpBuf[i]);
RTW_INFO("[MPT], pExtC2h->extendId=0x%x\n", pExtC2h->extendId);
switch (pExtC2h->extendId) {
case EXT_C2H_WIFI_FW_ACTIVE_RSP:
RTW_INFO("[MPT], EXT_C2H_WIFI_FW_ACTIVE_RSP\n");
#if 0
RTW_INFO("[MPT], pExtC2h->buf hex:\n");
for (i = 0; i < (length - 3); i++)
RTW_INFO(" 0x%x ", pExtC2h->buf[i]);
#endif
if ((_FALSE == pMptCtx->bMPh2c_timeout)
&& (_FALSE == pMptCtx->MptH2cRspEvent)) {
pMptCtx->MptH2cRspEvent = _TRUE;
_rtw_up_sema(&pMptCtx->MPh2c_Sema);
}
break;
case EXT_C2H_TRIG_BY_BT_FW:
RTW_INFO("[MPT], EXT_C2H_TRIG_BY_BT_FW\n");
_rtw_memcpy(&pMptCtx->c2hBuf[0], tmpBuf, length);
RTW_INFO("[MPT], pExtC2h->statusCode=0x%x\n", pExtC2h->statusCode);
RTW_INFO("[MPT], pExtC2h->retLen=0x%x\n", pExtC2h->retLen);
RTW_INFO("[MPT], pExtC2h->opCodeVer=0x%x\n", pExtC2h->opCodeVer);
RTW_INFO("[MPT], pExtC2h->reqNum=0x%x\n", pExtC2h->reqNum);
for (i = 0; i < (length - 3); i++)
RTW_INFO("[MPT], pExtC2h->buf[%d]=0x%02x\n", i, pExtC2h->buf[i]);
if ((_FALSE == pMptCtx->bMPh2c_timeout)
&& (_TRUE == pMptCtx->MptH2cRspEvent)
&& (_FALSE == pMptCtx->MptBtC2hEvent)) {
pMptCtx->MptBtC2hEvent = _TRUE;
_rtw_up_sema(&pMptCtx->MPh2c_Sema);
}
break;
default:
RTW_INFO("[MPT], EXT_C2H Target not found,pExtC2h->extendId =%d ,pExtC2h->reqNum=%d\n", pExtC2h->extendId, pExtC2h->reqNum);
break;
}
}
u2Byte
mptbt_BtGetGeneral(
IN PADAPTER Adapter,
IN PBT_REQ_CMD pBtReq,
IN PBT_RSP_CMD pBtRsp
)
{
PMPT_CONTEXT pMptCtx = &(Adapter->mppriv.mpt_ctx);
PBT_EXT_C2H pExtC2h = (PBT_EXT_C2H)&pMptCtx->c2hBuf[0];
u1Byte h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0;
u2Byte paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode, bdAddr[6] = {0};
u1Byte btOpcodeVer = 0;
u1Byte getType = 0, i;
u2Byte getParaLen = 0, validParaLen = 0;
u1Byte regType = 0, reportType = 0;
u4Byte regAddr = 0, regValue = 0;
pu4Byte pu4Tmp;
pu2Byte pu2Tmp;
pu1Byte pu1Tmp;
/* */
/* check upper layer parameters */
/* */
/* check upper layer opcode version */
if (pBtReq->opCodeVer != 1) {
RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");
pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
return paraLen;
}
/* check upper layer parameter length */
if (pBtReq->paraLength < 1) {
RTW_INFO("[MPT], Error!! wrong parameter length=%d (should larger than 1)\n", pBtReq->paraLength);
pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
return paraLen;
}
getParaLen = pBtReq->paraLength - 1;
getType = pBtReq->pParamStart[0];
RTW_INFO("[MPT], getType=%d, getParaLen=%d\n", getType, getParaLen);
/* check parameter first */
switch (getType) {
case BT_GGET_REG:
RTW_INFO("[MPT], [BT_GGET_REG]\n");
validParaLen = 5;
if (getParaLen == validParaLen) {
btOpcode = BT_LO_OP_READ_REG;
regType = pBtReq->pParamStart[1];
pu4Tmp = (pu4Byte)&pBtReq->pParamStart[2];
regAddr = *pu4Tmp;
RTW_INFO("[MPT], BT_GGET_REG regType=0x%02x, regAddr=0x%08x!!\n",
regType, regAddr);
if (regType >= BT_REG_MAX) {
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
} else {
if (((BT_REG_RF == regType) && (regAddr > 0x7f)) ||
((BT_REG_MODEM == regType) && (regAddr > 0x1ff)) ||
((BT_REG_BLUEWIZE == regType) && (regAddr > 0xfff)) ||
((BT_REG_VENDOR == regType) && (regAddr > 0xfff)) ||
((BT_REG_LE == regType) && (regAddr > 0xfff))) {
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
}
}
}
break;
case BT_GGET_STATUS:
RTW_INFO("[MPT], [BT_GGET_STATUS]\n");
validParaLen = 0;
break;
case BT_GGET_REPORT:
RTW_INFO("[MPT], [BT_GGET_REPORT]\n");
validParaLen = 1;
if (getParaLen == validParaLen) {
reportType = pBtReq->pParamStart[1];
RTW_INFO("[MPT], BT_GGET_REPORT reportType=0x%x!!\n", reportType);
if (reportType >= BT_REPORT_MAX) {
pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
}
}
break;
default: {
RTW_INFO("[MPT], Error!! getType=%d, out of range\n", getType);
pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
}
break;
}
if (getParaLen != validParaLen) {
RTW_INFO("[MPT], Error!! wrong parameter length=%d for BT_GET_GEN_CMD cmd id=0x%x, paraLen should=0x%x\n",
getParaLen, getType, validParaLen);
pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
return paraLen;
}
/* */
/* execute lower layer opcodes */
/* */
if (BT_GGET_REG == getType) {
/* fill h2c parameters */
/* here we should write reg value first then write the address, adviced by Austin */
btOpcode = BT_LO_OP_READ_REG;
h2cParaBuf[0] = regType;
h2cParaBuf[1] = pBtReq->pParamStart[2];
h2cParaBuf[2] = pBtReq->pParamStart[3];
h2cParaLen = 3;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
pu2Tmp = (pu2Byte)&pExtC2h->buf[0];
regValue = *pu2Tmp;
RTW_INFO("[MPT], read reg regType=0x%02x, regAddr=0x%08x, regValue=0x%04x\n",
regType, regAddr, regValue);
pu4Tmp = (pu4Byte)&pBtRsp->pParamStart[0];
*pu4Tmp = regValue;
paraLen = 4;
} else if (BT_GGET_STATUS == getType) {
btOpcode = BT_LO_OP_GET_BT_STATUS;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
pBtRsp->pParamStart[0] = pExtC2h->buf[0];
pBtRsp->pParamStart[1] = pExtC2h->buf[1];
RTW_INFO("[MPT], read bt status, testMode=0x%x, testStatus=0x%x\n",
pBtRsp->pParamStart[0], pBtRsp->pParamStart[1]);
paraLen = 2;
} else if (BT_GGET_REPORT == getType) {
switch (reportType) {
case BT_REPORT_RX_PACKET_CNT: {
RTW_INFO("[MPT], [Rx Packet Counts]\n");
btOpcode = BT_LO_OP_GET_RX_PKT_CNT_L;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
pBtRsp->pParamStart[0] = pExtC2h->buf[0];
pBtRsp->pParamStart[1] = pExtC2h->buf[1];
btOpcode = BT_LO_OP_GET_RX_PKT_CNT_H;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
pBtRsp->pParamStart[2] = pExtC2h->buf[0];
pBtRsp->pParamStart[3] = pExtC2h->buf[1];
paraLen = 4;
}
break;
case BT_REPORT_RX_ERROR_BITS: {
RTW_INFO("[MPT], [Rx Error Bits]\n");
btOpcode = BT_LO_OP_GET_RX_ERROR_BITS_L;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
pBtRsp->pParamStart[0] = pExtC2h->buf[0];
pBtRsp->pParamStart[1] = pExtC2h->buf[1];
btOpcode = BT_LO_OP_GET_RX_ERROR_BITS_H;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
pBtRsp->pParamStart[2] = pExtC2h->buf[0];
pBtRsp->pParamStart[3] = pExtC2h->buf[1];
paraLen = 4;
}
break;
case BT_REPORT_RSSI: {
RTW_INFO("[MPT], [RSSI]\n");
btOpcode = BT_LO_OP_GET_RSSI;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
pBtRsp->pParamStart[0] = pExtC2h->buf[0];
pBtRsp->pParamStart[1] = pExtC2h->buf[1];
paraLen = 2;
}
break;
case BT_REPORT_CFO_HDR_QUALITY: {
RTW_INFO("[MPT], [CFO & Header Quality]\n");
btOpcode = BT_LO_OP_GET_CFO_HDR_QUALITY_L;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
pBtRsp->pParamStart[0] = pExtC2h->buf[0];
pBtRsp->pParamStart[1] = pExtC2h->buf[1];
btOpcode = BT_LO_OP_GET_CFO_HDR_QUALITY_H;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
pBtRsp->pParamStart[2] = pExtC2h->buf[0];
pBtRsp->pParamStart[3] = pExtC2h->buf[1];
paraLen = 4;
}
break;
case BT_REPORT_CONNECT_TARGET_BD_ADDR: {
RTW_INFO("[MPT], [Connected Target BD ADDR]\n");
btOpcode = BT_LO_OP_GET_TARGET_BD_ADDR_L;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
bdAddr[5] = pExtC2h->buf[0];
bdAddr[4] = pExtC2h->buf[1];
bdAddr[3] = pExtC2h->buf[2];
btOpcode = BT_LO_OP_GET_TARGET_BD_ADDR_H;
h2cParaLen = 0;
/* execute h2c and check respond c2h from bt fw is correct or not */
retStatus = mptbt_BtFwOpCodeProcess(Adapter, btOpcode, btOpcodeVer, &h2cParaBuf[0], h2cParaLen);
/* construct respond status code and data. */
if (BT_STATUS_BT_OP_SUCCESS != retStatus) {
pBtRsp->status = ((btOpcode << 8) | retStatus);
RTW_INFO("[MPT], Error!! status code=0x%x\n", pBtRsp->status);
return paraLen;
}
bdAddr[2] = pExtC2h->buf[0];
bdAddr[1] = pExtC2h->buf[1];
bdAddr[0] = pExtC2h->buf[2];
RTW_INFO("[MPT], Connected Target BDAddr:%s", bdAddr);
for (i = 0; i < 6; i++)
pBtRsp->pParamStart[i] = bdAddr[5 - i];
paraLen = 6;
}
break;
default:
pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
break;
}
}
pBtRsp->status = BT_STATUS_SUCCESS;
return paraLen;
}
u2Byte
mptbt_BtSetGeneral(
IN PADAPTER Adapter,
IN PBT_REQ_CMD pBtReq,
IN PBT_RSP_CMD pBtRsp
)
{
u1Byte h2cParaBuf[6] = {0};
u1Byte h2cParaLen = 0;
u2Byte paraLen = 0;
u1Byte retStatus = BT_STATUS_BT_OP_SUCCESS;
u1Byte btOpcode;
u1Byte btOpcodeVer = 0;
u1Byte setType = 0;
u2Byte setParaLen = 0, validParaLen = 0;
u1Byte regType = 0, bdAddr[6] = {0}, calVal = 0;
u4Byte regAddr = 0, regValue = 0;
pu4Byte pu4Tmp;
pu2Byte pu2Tmp;
pu1Byte pu1Tmp;
/* */
/* check upper layer parameters */
/* */
/* check upper layer opcode version */
if (pBtReq->opCodeVer != 1) {
RTW_INFO("[MPT], Error!! Upper OP code version not match!!!\n");
pBtRsp->status = BT_STATUS_OPCODE_U_VERSION_MISMATCH;
return paraLen;
}
/* check upper layer parameter length */
if (pBtReq->paraLength < 1) {
RTW_INFO("[MPT], Error!! wrong parameter length=%d (should larger than 1)\n", pBtReq->paraLength);
pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
return paraLen;
}
setParaLen = pBtReq->paraLength - 1;
setType = pBtReq->pParamStart[0];
RTW_INFO("[MPT], setType=%d, setParaLen=%d\n", setType, setParaLen);
/* check parameter first */
switch (setType) {
case BT_GSET_REG:
RTW_INFO("[MPT], [BT_GSET_REG]\n");
validParaLen = 9;
if (setParaLen == validParaLen) {
btOpcode = BT_LO_OP_WRITE_REG_VALUE;
regType = pBtReq->pParamStart[1];
pu4Tmp = (pu4Byte)&pBtReq->pParamStart[2];
regAddr = *pu4Tmp;
pu4Tmp = (pu4Byte)&pBtReq->pParamStart[6];
regValue = *pu4Tmp;
RTW_INFO("[MPT], BT_GSET_REG regType=0x%x, regAddr=0x%x, regValue=0x%x!!\n",
regType, regAddr, regValue);
if (regType >= BT_REG_MAX) {
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
} else {
if (((BT_REG_RF == regType) && (regAddr > 0x7f)) ||
((BT_REG_MODEM == regType) && (regAddr > 0x1ff)) ||
((BT_REG_BLUEWIZE == regType) && (regAddr > 0xfff)) ||
((BT_REG_VENDOR == regType) && (regAddr > 0xfff)) ||
((BT_REG_LE == regType) && (regAddr > 0xfff))) {
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
}
}
}
break;
case BT_GSET_RESET:
RTW_INFO("[MPT], [BT_GSET_RESET]\n");
validParaLen = 0;
break;
case BT_GSET_TARGET_BD_ADDR:
RTW_INFO("[MPT], [BT_GSET_TARGET_BD_ADDR]\n");
validParaLen = 6;
if (setParaLen == validParaLen) {
btOpcode = BT_LO_OP_SET_TARGET_BD_ADDR_H;
if ((pBtReq->pParamStart[1] == 0) &&
(pBtReq->pParamStart[2] == 0) &&
(pBtReq->pParamStart[3] == 0) &&
(pBtReq->pParamStart[4] == 0) &&
(pBtReq->pParamStart[5] == 0) &&
(pBtReq->pParamStart[6] == 0)) {
RTW_INFO("[MPT], Error!! targetBDAddr=all zero\n");
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
}
if ((pBtReq->pParamStart[1] == 0xff) &&
(pBtReq->pParamStart[2] == 0xff) &&
(pBtReq->pParamStart[3] == 0xff) &&
(pBtReq->pParamStart[4] == 0xff) &&
(pBtReq->pParamStart[5] == 0xff) &&
(pBtReq->pParamStart[6] == 0xff)) {
RTW_INFO("[MPT], Error!! targetBDAddr=all 0xf\n");
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
}
bdAddr[0] = pBtReq->pParamStart[6];
bdAddr[1] = pBtReq->pParamStart[5];
bdAddr[2] = pBtReq->pParamStart[4];
bdAddr[3] = pBtReq->pParamStart[3];
bdAddr[4] = pBtReq->pParamStart[2];
bdAddr[5] = pBtReq->pParamStart[1];
RTW_INFO("[MPT], target BDAddr:%x,%x,%x,%x,%x,%x\n",
bdAddr[0], bdAddr[1], bdAddr[2], bdAddr[3], bdAddr[4], bdAddr[5]);
}
break;
case BT_GSET_TX_PWR_FINETUNE:
RTW_INFO("[MPT], [BT_GSET_TX_PWR_FINETUNE]\n");
validParaLen = 1;
if (setParaLen == validParaLen) {
btOpcode = BT_LO_OP_SET_TX_POWER_CALIBRATION;
calVal = pBtReq->pParamStart[1];
if ((calVal < 1) || (calVal > 9)) {
pBtRsp->status = (btOpcode << 8) | BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
}
RTW_INFO("[MPT], calVal=%d\n", calVal);
}
break;
case BT_SET_TRACKING_INTERVAL:
RTW_INFO("[MPT], [BT_SET_TRACKING_INTERVAL] setParaLen =%d\n", setParaLen);
validParaLen = 1;
if (setParaLen == validParaLen)
calVal = pBtReq->pParamStart[1];
break;
case BT_SET_THERMAL_METER:
RTW_INFO("[MPT], [BT_SET_THERMAL_METER] setParaLen =%d\n", setParaLen);
validParaLen = 1;
if (setParaLen == validParaLen)
calVal = pBtReq->pParamStart[1];
break;
case BT_ENABLE_CFO_TRACKING:
RTW_INFO("[MPT], [BT_ENABLE_CFO_TRACKING] setParaLen =%d\n", setParaLen);
validParaLen = 1;
if (setParaLen == validParaLen)
calVal = pBtReq->pParamStart[1];
break;
case BT_GSET_UPDATE_BT_PATCH:
break;
default: {
RTW_INFO("[MPT], Error!! setType=%d, out of range\n", setType);
pBtRsp->status = BT_STATUS_PARAMETER_OUT_OF_RANGE_U;
return paraLen;
}
break;
}
if (setParaLen != validParaLen) {
RTW_INFO("[MPT], Error!! wrong parameter length=%d for BT_SET_GEN_CMD cmd id=0x%x, paraLen should=0x%x\n",
setParaLen, setType, validParaLen);
pBtRsp->status = BT_STATUS_PARAMETER_FORMAT_ERROR_U;
return paraLen;
}
/* */
/* execute lower layer opcodes */
/* */
if (BT_GSET_REG == setType) {
/* fill h2c parameters */
/* here we should write reg value first then write the address, adviced by Austin */
btOpcode = BT_LO_OP_WRITE_REG_VALUE;
h2cParaBuf[0] = pBtReq->pParamStart[6];
h2cParaBuf[1] = pBtReq->pParamStart[7];
h2cParaBuf[2] = pBtReq->pParamStart[8];