@@ -143,6 +143,19 @@ __disable_irq();
143
143
_write_index += len;
144
144
// TODO: control the _rxbuff cannot overflow
145
145
__enable_irq ();
146
+ #if defined(DEBUG)
147
+ printf (" RX<< EVT " );
148
+ #if defined(PRINT_HCI_DATA)
149
+ printf (" Type %#x" , hcievt->evtserial .type );
150
+ printf (" evt %#x" , hcievt->evtserial .evt .evtcode );
151
+ printf (" Len %#d" , hcievt->evtserial .evt .plen );
152
+ printf (" :" );
153
+ for (uint8_t i = 0 ; i < hcievt->evtserial .evt .plen ; i++) {
154
+ printf (" %02X" , hcievt->evtserial .evt .payload [i]);
155
+ }
156
+ #endif /* PRINT_HCI_DATA */
157
+ printf (" \r\n " );
158
+ #endif /* DEBUG */
146
159
}
147
160
break ;
148
161
case TL_ACL_DATA_PKT_TYPE: {
@@ -154,24 +167,37 @@ __disable_irq();
154
167
_write_index += len;
155
168
// TODO: control the _rxbuff cannot overflow
156
169
__enable_irq ();
170
+
171
+ #if defined(DEBUG)
172
+ printf (" RX<< ACL " );
173
+ #if defined(PRINT_HCI_DATA)
174
+ printf (" Type %#x" , acl->type );
175
+ printf (" evt %#x" , acl->handle );
176
+ printf (" Len %#d" , acl->length );
177
+ printf (" :" );
178
+ for (uint8_t i = 0 ; i < acl->length ; i++) {
179
+ printf (" %02X" , acl->acl_data [i]);
180
+ }
181
+ #endif /* PRINT_HCI_DATA */
182
+ printf (" \r\n " );
183
+ #endif /* DEBUG */
157
184
}
158
185
break ;
159
186
default :
160
187
// should not happen - let's block to check
161
188
#if defined(DEBUG)
162
- printf (" BLE TL evt_received, wrong type:%d" , hcievt->evtserial .type );
189
+ printf (" BLE TL evt_received, wrong type:%d\r\n " , hcievt->evtserial .type );
163
190
#endif /* DEBUG */
164
191
break ;
165
192
}
166
193
167
194
if (_write_index > BLE_MODULE_SHARED_MEM_BUFFER_SIZE) {
168
195
#if defined(DEBUG)
169
- printf (" Error: data read overflow" );
196
+ printf (" Error: data read overflow\r\n " );
170
197
#endif /* DEBUG */
171
198
data_available = true ;
172
199
}
173
200
174
-
175
201
/* In case Event belongs to the Evt Pool we need to inform */
176
202
if (((uint8_t *)hcievt >= EvtPool) && ((uint8_t *)hcievt < (EvtPool + POOL_SIZE))) {
177
203
/* Free the message from shared memory */
@@ -312,18 +338,18 @@ int HCISharedMemTransportClass::begin()
312
338
WirelessFwInfo_t wireless_info_instance;
313
339
WirelessFwInfo_t *p_wireless_info = &wireless_info_instance;
314
340
SHCI_GetWirelessFwInfo (p_wireless_info);
315
- /*
316
- * tr_info("WIRELESS COPROCESSOR FW VERSION ID = %d.%d.%d", p_wireless_info->VersionMajor, p_wireless_info->VersionMinor, p_wireless_info->VersionSub);
317
- * tr_info("WIRELESS COPROCESSOR FW STACK TYPE = %d", p_wireless_info->StackType);
318
- */
319
-
320
-
341
+ #if defined(DEBUG)
342
+ printf (" WB copro FW version = %d.%d.%d\r\n " , p_wireless_info->VersionMajor , p_wireless_info->VersionMinor , p_wireless_info->VersionSub );
343
+ #endif
321
344
/* Now start BLE service on firmware side, using Vendor specific
322
345
* command on the System Channel
323
346
*/
324
347
stm32wb_start_ble ();
325
348
326
- /* "IPM Channel Open Completed" */
349
+ /* IPM Channel is now open */
350
+ #if defined(DEBUG)
351
+ printf (" IPM Channel Open Completed\r\n " );
352
+ #endif
327
353
328
354
/* Once reset complete event is received we will need
329
355
* to send a few more commands:
@@ -667,9 +693,7 @@ static int bt_ipm_set_power(void)
667
693
// type 02 ACL DATA
668
694
// type 03 SCO Voice (not supported)
669
695
// type 04 event - uplink (not suported)
670
- #if defined(DEBUG)
671
- printf (" mbox_write type:%d, len:%d" , type, len);
672
- #endif /* DEBUG */
696
+
673
697
/* TO DO : MANAGE ACL DATA CASE in separate buffer */
674
698
switch (type) {
675
699
case 1 :// BLE command
@@ -679,23 +703,25 @@ static int bt_ipm_set_power(void)
679
703
/* We're tracing here the command, after copy in shared mem but before
680
704
* * M0 trigger. */
681
705
#if defined(DEBUG)
682
- printf (" TX>> BLE CMD" );
683
- #if (PRINT_HCI_DATA)
706
+ printf (" TX>> CMD " );
707
+ #if defined (PRINT_HCI_DATA)
684
708
/* Trace the buffer including Type (+1 on lngth) */
685
- tr_debug (" Type %#x" , bleCmdBuf->cmdserial .type );
686
- tr_debug (" Cmd %#x" , bleCmdBuf->cmdserial .cmd .cmdcode );
687
- tr_debug (" Len %#x" , bleCmdBuf->cmdserial .cmd .plen );
709
+ printf (" Type %#x" , bleCmdBuf->cmdserial .type );
710
+ printf (" Cmd %#x" , bleCmdBuf->cmdserial .cmd .cmdcode );
711
+ printf (" Len %#d" , bleCmdBuf->cmdserial .cmd .plen );
712
+ printf (" :" );
688
713
for (uint8_t i = 0 ; i < bleCmdBuf->cmdserial .cmd .plen ; i++) {
689
- tr_debug ( " %02X" , *(((uint8_t *)&bleCmdBuf->cmdserial .cmd .payload ) + i));
714
+ printf ( " %02X" , *(((uint8_t *)&bleCmdBuf->cmdserial .cmd .payload ) + i));
690
715
}
691
716
#endif /* PRINT_HCI_DATA */
717
+ printf (" \r\n " );
692
718
#endif /* DEBUG */
693
719
TL_BLE_SendCmd (NULL , 0 ); // unused parameters for now
694
720
break ;
695
721
case 2 :// ACL DATA
696
722
if (acl_data) {
697
723
#if defined(DEBUG)
698
- printf (" ERROR: previous ACL message not ACK'd" );
724
+ printf (" ERROR: previous ACL message not ACK'd\r\n " );
699
725
#endif /* DEBUG */
700
726
/* return number of bytes sent, 0 in this error case */
701
727
return 0 ;
@@ -704,13 +730,13 @@ static int bt_ipm_set_power(void)
704
730
aclDataSerial->type = type; // for now this param is overwritten in TL_BLE_SendCmd
705
731
memcpy (HciAclDataBuffer + + sizeof (TL_PacketHeader_t) + sizeof (type), pData, len);
706
732
#if defined(DEBUG)
707
- printf (" TX>> BLE ACL" );
708
- #if PRINT_HCI_DATA
733
+ printf (" TX>> ACL " );
734
+ #if defined( PRINT_HCI_DATA)
709
735
for (uint8_t i = 0 ; i < len + 1 + 8 ; i++) {
710
- tr_debug ( " %02x" , *(((uint8_t *) aclDataBuffer ) + i));
736
+ printf ( " %02x " , *(((uint8_t *) HciAclDataBuffer ) + i));
711
737
}
712
- printf (" \r\n " );
713
738
#endif /* PRINT_HCI_DATA */
739
+ printf (" \r\n " );
714
740
#endif /* DEBUG */
715
741
TL_BLE_SendAclData (NULL , 0 ); // unused parameters for now
716
742
acl_data = true ;
@@ -730,7 +756,7 @@ static void init_debug(void)
730
756
731
757
#if defined(CONFIG_DEBUG)
732
758
#if defined(DEBUG)
733
- printf (" init_debug ENABLED" );
759
+ printf (" init_debug ENABLED\r\n " );
734
760
#endif /* DEBUG */
735
761
/* *
736
762
* Keep debugger enabled while in any low power mode
@@ -745,7 +771,7 @@ static void init_debug(void)
745
771
746
772
#else
747
773
#if defined(DEBUG)
748
- printf (" init_debug DISABLED" );
774
+ printf (" init_debug DISABLED\n\r " );
749
775
#endif /* DEBUG */
750
776
GPIO_InitTypeDef gpio_config = {0 };
751
777
0 commit comments