Skip to content

Commit d50f6e2

Browse files
LMESTM0xc0170
authored andcommitted
STM32WB: fix some styling in HCI driver
1 parent 9c32d31 commit d50f6e2

File tree

1 file changed

+32
-64
lines changed

1 file changed

+32
-64
lines changed

features/FEATURE_BLE/targets/TARGET_STM/TARGET_NUCLEO_WB55RG/stm32wb_HCIDriver.cpp

Lines changed: 32 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ class HCIDriver : public cordio::CordioHCIDriver
129129
static uint8_t randCnt;
130130

131131
/* if event is a command complete event */
132-
if (*pMsg == HCI_CMD_CMPL_EVT)
133-
{
132+
if (*pMsg == HCI_CMD_CMPL_EVT) {
134133
#if (PRINT_HCI_DATA == 1)
135134
tr_debug("Command complete event\r\n");
136135
tr_debug("Command >> ");
@@ -279,12 +278,9 @@ class HCIDriver : public cordio::CordioHCIDriver
279278
break;
280279

281280
case HCI_OPCODE_LE_WRITE_DEF_DATA_LEN:
282-
if (hciCoreCb.extResetSeq)
283-
{
281+
if (hciCoreCb.extResetSeq) {
284282
HciReadLocalVerInfoCmd();
285-
}
286-
else
287-
{
283+
} else {
288284
/* initialize extended parameters */
289285
hciCoreCb.maxAdvDataLen = 0;
290286
hciCoreCb.numSupAdvSets = 0;
@@ -299,8 +295,7 @@ class HCIDriver : public cordio::CordioHCIDriver
299295
case HCI_OPCODE_LE_READ_NUM_SUP_ADV_SETS:
300296
case HCI_OPCODE_LE_READ_PER_ADV_LIST_SIZE:
301297
// handle extended command
302-
if (hciCoreCb.extResetSeq)
303-
{
298+
if (hciCoreCb.extResetSeq) {
304299
/* send next extended command in sequence */
305300
(*hciCoreCb.extResetSeq)(pMsg, opcode);
306301
}
@@ -392,51 +387,41 @@ class HCIDriver : public cordio::CordioHCIDriver
392387
hciCmdSend(pBuf);
393388
}
394389

395-
void hciCoreReadResolvingListSize(void)
396-
{
390+
void hciCoreReadResolvingListSize(void) {
397391
/* if LL Privacy is supported by Controller and included */
398392
if ((hciCoreCb.leSupFeat & HCI_LE_SUP_FEAT_PRIVACY) &&
399-
(hciLeSupFeatCfg & HCI_LE_SUP_FEAT_PRIVACY))
400-
{
393+
(hciLeSupFeatCfg & HCI_LE_SUP_FEAT_PRIVACY)) {
401394
/* send next command in sequence */
402395
HciLeReadResolvingListSize();
403-
}
404-
else
405-
{
396+
} else {
406397
hciCoreCb.resListSize = 0;
407398

408399
/* send next command in sequence */
409400
hciCoreReadMaxDataLen();
410401
}
411402
}
412403

413-
void hciCoreReadMaxDataLen(void)
414-
{
404+
void hciCoreReadMaxDataLen(void) {
415405
/* if LE Data Packet Length Extensions is supported by Controller and included */
416406
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)) {
419408
/* send next command in sequence */
420409
HciLeReadMaxDataLen();
421-
}
422-
else
423-
{
410+
} else {
424411
/* send next command in sequence */
425412
HciLeRandCmd();
426413
}
427414
}
428415
};
429416

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() {
432418
// Use default buffer pool
433419
return ble::vendor::cordio::CordioHCIDriver::get_default_buffer_pool_description();
434420
}
435421

436422

437423

438-
class TransportDriver : public cordio::CordioHCITransportDriver
439-
{
424+
class TransportDriver : public cordio::CordioHCITransportDriver {
440425
public:
441426
TransportDriver(TL_CmdPacket_t *BleCmdBuffer, TL_CmdPacket_t *SystemCmdBuffer, uint8_t *EvtPool, uint8_t *SystemSpareEvtBuffer, uint8_t *BleSpareEvtBuffer, uint8_t *HciAclDataBuffer) {
442427

@@ -453,8 +438,7 @@ class TransportDriver : public cordio::CordioHCITransportDriver
453438
/**
454439
* @see CordioHCITransportDriver::initialize
455440
*/
456-
virtual void initialize()
457-
{
441+
virtual void initialize() {
458442
init_debug();
459443
stm32wb_reset();
460444
transport_init();
@@ -468,8 +452,7 @@ class TransportDriver : public cordio::CordioHCITransportDriver
468452
/**
469453
* @see CordioHCITransportDriver::write
470454
*/
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) {
473456
return mbox_write(type, len, pData);
474457
}
475458

@@ -523,12 +506,11 @@ class TransportDriver : public cordio::CordioHCITransportDriver
523506
}
524507

525508
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)
532514
#if (PRINT_HCI_DATA == 1)
533515
tr_debug("mbox_write type:%d, len:%d\r\n", type, len);
534516
#endif
@@ -578,8 +560,7 @@ class TransportDriver : public cordio::CordioHCITransportDriver
578560
return len;
579561
}
580562

581-
void stm32wb_reset(void)
582-
{
563+
void stm32wb_reset(void) {
583564
// Reset IPCC
584565
LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_IPCC);
585566

@@ -689,7 +670,7 @@ ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver() {
689670
HciAclDataBuffer
690671
);
691672

692-
static ble::vendor::stm32wb::HCIDriver hci_driver(
673+
static ble::vendor::stm32wb::HCIDriver hci_driver (
693674
transport_driver /* other hci driver parameters */
694675
);
695676

@@ -775,35 +756,30 @@ static bool sysevt_wait( void) {
775756
}
776757
}
777758

778-
static void syscmd_status_not( SHCI_TL_CmdStatus_t status )
779-
{
759+
static void syscmd_status_not( SHCI_TL_CmdStatus_t status ) {
780760
tr_debug("syscmd_status_not, status:%d\r\n", status);
781761
return;
782762
}
783763

784-
void shci_notify_asynch_evt(void* pdata)
785-
{
764+
void shci_notify_asynch_evt(void* pdata) {
786765
/* Need to parse data in future version */
787766
shci_user_evt_proc();
788767
return;
789768
}
790769

791-
void shci_cmd_resp_release(uint32_t flag)
792-
{
770+
void shci_cmd_resp_release(uint32_t flag) {
793771
sys_resp_sem.release();
794772
return;
795773
}
796774

797-
void shci_cmd_resp_wait(uint32_t timeout)
798-
{
775+
void shci_cmd_resp_wait(uint32_t timeout) {
799776
/* TO DO: manage timeouts if we can return an error */
800777
if(sys_resp_sem.wait(timeout) < 1) {
801778
tr_error("shci_cmd_resp_wait timed out\r\n");
802779
}
803780
}
804781

805-
void shci_register_io_bus(tSHciIO* fops)
806-
{
782+
void shci_register_io_bus(tSHciIO* fops) {
807783
/* Register IO bus services */
808784
fops->Init = TL_SYS_Init;
809785
fops->Send = TL_SYS_SendCmd;
@@ -812,8 +788,7 @@ void shci_register_io_bus(tSHciIO* fops)
812788
/**
813789
* Few utilities functions
814790
*/
815-
static void init_debug( void )
816-
{
791+
static void init_debug( void ) {
817792
tr_debug("WB init_debug: ");
818793
#if (CFG_DEBUGGER_SUPPORTED == 1)
819794
tr_debug("ENABLED\r\n");
@@ -856,8 +831,7 @@ static void init_debug( void )
856831
}
857832

858833
/* 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 ) {
861835
uint8_t *otp_addr;
862836
uint32_t udn;
863837
uint32_t company_id;
@@ -866,8 +840,7 @@ bool get_bd_address( uint8_t* bd_addr )
866840

867841
udn = LL_FLASH_GetUDN();
868842

869-
if(udn != 0xFFFFFFFF)
870-
{
843+
if(udn != 0xFFFFFFFF) {
871844
tr_debug("Found UDN: 0x%8lX\r\n", udn);
872845

873846
company_id = LL_FLASH_GetSTCompanyID();
@@ -881,17 +854,12 @@ bool get_bd_address( uint8_t* bd_addr )
881854
bd_addr[5] = (uint8_t)( (company_id & 0x0000FF00) >> 8 );
882855

883856
bd_found = true;
884-
}
885-
else
886-
{
857+
} else {
887858
otp_addr = OTP_Read(0);
888-
if(otp_addr)
889-
{
859+
if(otp_addr) {
890860
memcpy(bd_addr, ((OTP_ID0_t*)otp_addr)->bd_address, CONFIG_DATA_PUBADDR_LEN);
891861
bd_found = false;
892-
}
893-
else
894-
{
862+
} else {
895863
tr_debug("Cannot find BD ADDRESS to program - will leave hw default\r\n");
896864
bd_found = true;
897865
}

0 commit comments

Comments
 (0)