@@ -129,8 +129,7 @@ class HCIDriver : public cordio::CordioHCIDriver
129
129
static uint8_t randCnt;
130
130
131
131
/* if event is a command complete event */
132
- if (*pMsg == HCI_CMD_CMPL_EVT)
133
- {
132
+ if (*pMsg == HCI_CMD_CMPL_EVT) {
134
133
#if (PRINT_HCI_DATA == 1)
135
134
tr_debug (" Command complete event\r\n " );
136
135
tr_debug (" Command >> " );
@@ -279,12 +278,9 @@ class HCIDriver : public cordio::CordioHCIDriver
279
278
break ;
280
279
281
280
case HCI_OPCODE_LE_WRITE_DEF_DATA_LEN:
282
- if (hciCoreCb.extResetSeq )
283
- {
281
+ if (hciCoreCb.extResetSeq ) {
284
282
HciReadLocalVerInfoCmd ();
285
- }
286
- else
287
- {
283
+ } else {
288
284
/* initialize extended parameters */
289
285
hciCoreCb.maxAdvDataLen = 0 ;
290
286
hciCoreCb.numSupAdvSets = 0 ;
@@ -299,8 +295,7 @@ class HCIDriver : public cordio::CordioHCIDriver
299
295
case HCI_OPCODE_LE_READ_NUM_SUP_ADV_SETS:
300
296
case HCI_OPCODE_LE_READ_PER_ADV_LIST_SIZE:
301
297
// handle extended command
302
- if (hciCoreCb.extResetSeq )
303
- {
298
+ if (hciCoreCb.extResetSeq ) {
304
299
/* send next extended command in sequence */
305
300
(*hciCoreCb.extResetSeq )(pMsg, opcode);
306
301
}
@@ -392,51 +387,41 @@ class HCIDriver : public cordio::CordioHCIDriver
392
387
hciCmdSend (pBuf);
393
388
}
394
389
395
- void hciCoreReadResolvingListSize (void )
396
- {
390
+ void hciCoreReadResolvingListSize (void ) {
397
391
/* if LL Privacy is supported by Controller and included */
398
392
if ((hciCoreCb.leSupFeat & HCI_LE_SUP_FEAT_PRIVACY) &&
399
- (hciLeSupFeatCfg & HCI_LE_SUP_FEAT_PRIVACY))
400
- {
393
+ (hciLeSupFeatCfg & HCI_LE_SUP_FEAT_PRIVACY)) {
401
394
/* send next command in sequence */
402
395
HciLeReadResolvingListSize ();
403
- }
404
- else
405
- {
396
+ } else {
406
397
hciCoreCb.resListSize = 0 ;
407
398
408
399
/* send next command in sequence */
409
400
hciCoreReadMaxDataLen ();
410
401
}
411
402
}
412
403
413
- void hciCoreReadMaxDataLen (void )
414
- {
404
+ void hciCoreReadMaxDataLen (void ) {
415
405
/* if LE Data Packet Length Extensions is supported by Controller and included */
416
406
if ((hciCoreCb.leSupFeat & HCI_LE_SUP_FEAT_DATA_LEN_EXT) &&
417
- (hciLeSupFeatCfg & HCI_LE_SUP_FEAT_DATA_LEN_EXT))
418
- {
407
+ (hciLeSupFeatCfg & HCI_LE_SUP_FEAT_DATA_LEN_EXT)) {
419
408
/* send next command in sequence */
420
409
HciLeReadMaxDataLen ();
421
- }
422
- else
423
- {
410
+ } else {
424
411
/* send next command in sequence */
425
412
HciLeRandCmd ();
426
413
}
427
414
}
428
415
};
429
416
430
- ble::vendor::cordio::buf_pool_desc_t ble::vendor::stm32wb::HCIDriver::get_buffer_pool_description ()
431
- {
417
+ ble::vendor::cordio::buf_pool_desc_t ble::vendor::stm32wb::HCIDriver::get_buffer_pool_description () {
432
418
// Use default buffer pool
433
419
return ble::vendor::cordio::CordioHCIDriver::get_default_buffer_pool_description ();
434
420
}
435
421
436
422
437
423
438
- class TransportDriver : public cordio ::CordioHCITransportDriver
439
- {
424
+ class TransportDriver : public cordio ::CordioHCITransportDriver {
440
425
public:
441
426
TransportDriver (TL_CmdPacket_t *BleCmdBuffer, TL_CmdPacket_t *SystemCmdBuffer, uint8_t *EvtPool, uint8_t *SystemSpareEvtBuffer, uint8_t *BleSpareEvtBuffer, uint8_t *HciAclDataBuffer) {
442
427
@@ -453,8 +438,7 @@ class TransportDriver : public cordio::CordioHCITransportDriver
453
438
/* *
454
439
* @see CordioHCITransportDriver::initialize
455
440
*/
456
- virtual void initialize ()
457
- {
441
+ virtual void initialize () {
458
442
init_debug ();
459
443
stm32wb_reset ();
460
444
transport_init ();
@@ -468,8 +452,7 @@ class TransportDriver : public cordio::CordioHCITransportDriver
468
452
/* *
469
453
* @see CordioHCITransportDriver::write
470
454
*/
471
- virtual uint16_t write (uint8_t type, uint16_t len, uint8_t *pData)
472
- {
455
+ virtual uint16_t write (uint8_t type, uint16_t len, uint8_t *pData) {
473
456
return mbox_write (type, len, pData);
474
457
}
475
458
@@ -523,12 +506,11 @@ class TransportDriver : public cordio::CordioHCITransportDriver
523
506
}
524
507
525
508
uint16_t mbox_write (uint8_t type, uint16_t len, uint8_t *pData) {
526
- // Note:
527
- // 01 command
528
- // type 02 ACL DATA not yet supported
529
- // type 03 SCO Voice
530
- // type 04 event - sens remontant
531
- // BleCmdBuffer.cmdserial.cmd.cmdcode = opcode;
509
+ // Note: Until enum is avalable
510
+ // type 01 Command
511
+ // type 02 ACL DATA
512
+ // type 03 SCO Voice (not supported)
513
+ // type 04 event - uplink (not suported)
532
514
#if (PRINT_HCI_DATA == 1)
533
515
tr_debug (" mbox_write type:%d, len:%d\r\n " , type, len);
534
516
#endif
@@ -578,8 +560,7 @@ class TransportDriver : public cordio::CordioHCITransportDriver
578
560
return len;
579
561
}
580
562
581
- void stm32wb_reset (void )
582
- {
563
+ void stm32wb_reset (void ) {
583
564
// Reset IPCC
584
565
LL_AHB3_GRP1_EnableClock (LL_AHB3_GRP1_PERIPH_IPCC);
585
566
@@ -689,7 +670,7 @@ ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver() {
689
670
HciAclDataBuffer
690
671
);
691
672
692
- static ble::vendor::stm32wb::HCIDriver hci_driver (
673
+ static ble::vendor::stm32wb::HCIDriver hci_driver (
693
674
transport_driver /* other hci driver parameters */
694
675
);
695
676
@@ -775,35 +756,30 @@ static bool sysevt_wait( void) {
775
756
}
776
757
}
777
758
778
- static void syscmd_status_not ( SHCI_TL_CmdStatus_t status )
779
- {
759
+ static void syscmd_status_not ( SHCI_TL_CmdStatus_t status ) {
780
760
tr_debug (" syscmd_status_not, status:%d\r\n " , status);
781
761
return ;
782
762
}
783
763
784
- void shci_notify_asynch_evt (void * pdata)
785
- {
764
+ void shci_notify_asynch_evt (void * pdata) {
786
765
/* Need to parse data in future version */
787
766
shci_user_evt_proc ();
788
767
return ;
789
768
}
790
769
791
- void shci_cmd_resp_release (uint32_t flag)
792
- {
770
+ void shci_cmd_resp_release (uint32_t flag) {
793
771
sys_resp_sem.release ();
794
772
return ;
795
773
}
796
774
797
- void shci_cmd_resp_wait (uint32_t timeout)
798
- {
775
+ void shci_cmd_resp_wait (uint32_t timeout) {
799
776
/* TO DO: manage timeouts if we can return an error */
800
777
if (sys_resp_sem.wait (timeout) < 1 ) {
801
778
tr_error (" shci_cmd_resp_wait timed out\r\n " );
802
779
}
803
780
}
804
781
805
- void shci_register_io_bus (tSHciIO* fops)
806
- {
782
+ void shci_register_io_bus (tSHciIO* fops) {
807
783
/* Register IO bus services */
808
784
fops->Init = TL_SYS_Init;
809
785
fops->Send = TL_SYS_SendCmd;
@@ -812,8 +788,7 @@ void shci_register_io_bus(tSHciIO* fops)
812
788
/* *
813
789
* Few utilities functions
814
790
*/
815
- static void init_debug ( void )
816
- {
791
+ static void init_debug ( void ) {
817
792
tr_debug (" WB init_debug: " );
818
793
#if (CFG_DEBUGGER_SUPPORTED == 1)
819
794
tr_debug (" ENABLED\r\n " );
@@ -856,8 +831,7 @@ static void init_debug( void )
856
831
}
857
832
858
833
/* This function fills in a BD address table */
859
- bool get_bd_address ( uint8_t * bd_addr )
860
- {
834
+ bool get_bd_address ( uint8_t * bd_addr ) {
861
835
uint8_t *otp_addr;
862
836
uint32_t udn;
863
837
uint32_t company_id;
@@ -866,8 +840,7 @@ bool get_bd_address( uint8_t* bd_addr )
866
840
867
841
udn = LL_FLASH_GetUDN ();
868
842
869
- if (udn != 0xFFFFFFFF )
870
- {
843
+ if (udn != 0xFFFFFFFF ) {
871
844
tr_debug (" Found UDN: 0x%8lX\r\n " , udn);
872
845
873
846
company_id = LL_FLASH_GetSTCompanyID ();
@@ -881,17 +854,12 @@ bool get_bd_address( uint8_t* bd_addr )
881
854
bd_addr[5 ] = (uint8_t )( (company_id & 0x0000FF00 ) >> 8 );
882
855
883
856
bd_found = true ;
884
- }
885
- else
886
- {
857
+ } else {
887
858
otp_addr = OTP_Read (0 );
888
- if (otp_addr)
889
- {
859
+ if (otp_addr) {
890
860
memcpy (bd_addr, ((OTP_ID0_t*)otp_addr)->bd_address , CONFIG_DATA_PUBADDR_LEN);
891
861
bd_found = false ;
892
- }
893
- else
894
- {
862
+ } else {
895
863
tr_debug (" Cannot find BD ADDRESS to program - will leave hw default\r\n " );
896
864
bd_found = true ;
897
865
}
0 commit comments