@@ -26,8 +26,10 @@ volatile bool sys_resp;
26
26
volatile bool acl_data; /* true : data acknowledged by the BLE */
27
27
volatile bool data_available;
28
28
29
- /* this one is for printing
30
- #define DEBUG */
29
+ /* this one is for printing */
30
+ #define DEBUG
31
+ #define PRINT_HCI_DATA
32
+
31
33
/* this must be defined */
32
34
#define CONFIG_DEBUG
33
35
@@ -141,19 +143,18 @@ __enable_irq();
141
143
default :
142
144
// should not happen - let's block to check
143
145
#if defined(DEBUG)
144
- printf (" BLE TL evt_received, wrong type:%d" , hcievt->evtserial .type );
146
+ printf (" BLE TL evt_received, wrong type:%d\r\n " , hcievt->evtserial .type );
145
147
#endif /* DEBUG */
146
148
break ;
147
149
}
148
150
149
151
if (_write_index > BLE_MODULE_SHARED_MEM_BUFFER_SIZE) {
150
152
#if defined(DEBUG)
151
- printf (" Error: data read overflow" );
153
+ printf (" Error: data read overflow\r\n " );
152
154
#endif /* DEBUG */
153
155
data_available = true ;
154
156
}
155
157
156
-
157
158
/* In case Event belongs to the Evt Pool we need to inform */
158
159
if (((uint8_t *)hcievt >= EvtPool) && ((uint8_t *)hcievt < (EvtPool + POOL_SIZE))) {
159
160
/* Free the message from shared memory */
@@ -663,10 +664,11 @@ static int bt_ipm_set_power(void)
663
664
/* if event is a command complete event */
664
665
if (*pMsg == HCI_CMD_CMPL_EVT) {
665
666
/* "Command Complete Event Command" */
666
- #if (PRINT_HCI_DATA)
667
+ #if defined (PRINT_HCI_DATA)
667
668
for (uint8_t i = 0; i < 20; i++) {
668
- tr_debug (" %02X", *((uint8_t *)pMsg + i));
669
+ printf (" %02X", *((uint8_t *)pMsg + i));
669
670
}
671
+ printf("\r\n");
670
672
#endif
671
673
/* parse parameters */
672
674
pMsg += HCI_EVT_HDR_LEN;
@@ -841,7 +843,7 @@ static int bt_ipm_set_power(void)
841
843
842
844
default:
843
845
#if defined(DEBUG)
844
- printf("Complete Event in reset seq with unknown opcode =0x%4X", opcode);
846
+ printf("Complete Event in reset seq with unknown opcode =0x%4X\r\n ", opcode);
845
847
#endif /* DEBUG */
846
848
break;
847
849
}
@@ -855,7 +857,7 @@ static int bt_ipm_set_power(void)
855
857
pMsg++; /* skip num packets */
856
858
BSTREAM_TO_UINT16(opcode, pMsg);
857
859
#if defined(DEBUG)
858
- printf("Command Status event, status:%d, opcode=0x%4X", status, opcode);
860
+ printf("Command Status event, status:%d, opcode=0x%4X\r\n ", status, opcode);
859
861
#endif /* DEBUG */
860
862
} else {
861
863
/**
@@ -866,11 +868,11 @@ static int bt_ipm_set_power(void)
866
868
pMsg += HCI_EVT_HDR_LEN;
867
869
BSTREAM_TO_UINT16(opcode, pMsg);
868
870
#if defined(DEBUG)
869
- printf("Vendor specific event, opcode=0x%4X", opcode);
871
+ printf("Vendor specific event, opcode=0x%4X\r\n ", opcode);
870
872
#endif /* DEBUG */
871
873
} else {
872
874
#if defined(DEBUG)
873
- printf("Unknown event %d!", pMsg[0]);
875
+ printf("Unknown event %d!\r\n ", pMsg[0]);
874
876
#endif /* DEBUG */
875
877
}
876
878
}
@@ -888,9 +890,7 @@ static int bt_ipm_set_power(void)
888
890
// type 02 ACL DATA
889
891
// type 03 SCO Voice (not supported)
890
892
// type 04 event - uplink (not suported)
891
- #if defined(DEBUG)
892
- printf (" mbox_write type:%d, len:%d" , type, len);
893
- #endif /* DEBUG */
893
+
894
894
/* TO DO : MANAGE ACL DATA CASE in separate buffer */
895
895
switch (type) {
896
896
case 1 :// BLE command
@@ -900,23 +900,26 @@ static int bt_ipm_set_power(void)
900
900
/* We're tracing here the command, after copy in shared mem but before
901
901
* * M0 trigger. */
902
902
#if defined(DEBUG)
903
- printf (" TX>> BLE CMD" );
904
- #endif /* DEBUG */
905
- #if (PRINT_HCI_DATA)
906
- /* Trace the buffer including Type (+1 on lngth) */
907
- tr_debug (" Type %#x" , bleCmdBuf->cmdserial .type );
908
- tr_debug (" Cmd %#x" , bleCmdBuf->cmdserial .cmd .cmdcode );
909
- tr_debug (" Len %#x" , bleCmdBuf->cmdserial .cmd .plen );
903
+ #if !defined(PRINT_HCI_DATA)
904
+ printf (" mbox_write type:%d, len:%d\r\n " , type, len);
905
+ #else /* Trace the buffer including Type (+1 on lngth) */
906
+ printf (" TX>> BLE CMD : " );
907
+ printf (" Type %#x" , bleCmdBuf->cmdserial .type );
908
+ printf (" Cmd %#x" , bleCmdBuf->cmdserial .cmd .cmdcode );
909
+ printf (" Len %#d" , bleCmdBuf->cmdserial .cmd .plen );
910
+ printf (" :" );
910
911
for (uint8_t i = 0 ; i < bleCmdBuf->cmdserial .cmd .plen ; i++) {
911
- tr_debug ( " %02X" , *(((uint8_t *)&bleCmdBuf->cmdserial .cmd .payload ) + i));
912
+ printf ( " %02X" , *(((uint8_t *)&bleCmdBuf->cmdserial .cmd .payload ) + i));
912
913
}
914
+ printf (" \r\n " );
913
915
#endif /* PRINT_HCI_DATA */
916
+ #endif /* DEBUG */
914
917
TL_BLE_SendCmd (NULL , 0 ); // unused parameters for now
915
918
break ;
916
919
case 2 :// ACL DATA
917
920
if (!acl_data) {
918
921
#if defined(DEBUG)
919
- printf (" ERROR: previous ACL message not ACK'd" );
922
+ printf (" ERROR: previous ACL message not ACK'd\r\n " );
920
923
#endif /* DEBUG */
921
924
/* return number of bytes sent, 0 in this error case */
922
925
return 0 ;
@@ -925,13 +928,16 @@ static int bt_ipm_set_power(void)
925
928
&((TL_AclDataPacket_t *)HciAclDataBuffer)->AclDataSerial , pData, len);
926
929
TL_BLE_SendAclData (NULL , 0 ); // unused parameters for now
927
930
#if defined(DEBUG)
928
- printf (" TX>> BLE ACL" );
929
- #endif /* DEBUG */
930
- #if PRINT_HCI_DATA
931
+ #if !defined(PRINT_HCI_DATA)
932
+ printf (" mbox_write type:%d, len:%d \r\n " , type, len);
933
+ #else
934
+ printf (" TX>> BLE ACL : " );
931
935
for (uint8_t i = 0 ; i < len + 1 + 8 ; i++) {
932
- tr_debug ( " %02x" , *(((uint8_t *) aclDataBuffer ) + i));
936
+ printf ( " %02x " , *(((uint8_t *) HciAclDataBuffer ) + i));
933
937
}
934
- #endif
938
+ printf (" \r\n " );
939
+ #endif /* PRINT_HCI_DATA */
940
+ #endif /* DEBUG */
935
941
break ;
936
942
}
937
943
return len;
@@ -948,7 +954,7 @@ static void init_debug(void)
948
954
949
955
#if defined(CONFIG_DEBUG)
950
956
#if defined(DEBUG)
951
- printf (" init_debug ENABLED" );
957
+ printf (" init_debug ENABLED\r\n " );
952
958
#endif /* DEBUG */
953
959
/* *
954
960
* Keep debugger enabled while in any low power mode
@@ -963,7 +969,7 @@ static void init_debug(void)
963
969
964
970
#else
965
971
#if defined(DEBUG)
966
- printf (" init_debug DISABLED" );
972
+ printf (" init_debug DISABLED\n\r " );
967
973
#endif /* DEBUG */
968
974
GPIO_InitTypeDef gpio_config = {0 };
969
975
0 commit comments