Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
card10
firmware
Commits
5ae9e3a2
Commit
5ae9e3a2
authored
5 years ago
by
schneider
Browse files
Options
Downloads
Patches
Plain Diff
hack: write hci layer log file
parent
9ae70996
No related branches found
No related tags found
No related merge requests found
Pipeline
#4584
failed
4 years ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
epicardium/ble/ble.c
+63
-0
63 additions, 0 deletions
epicardium/ble/ble.c
epicardium/ble/ble_main.c
+3
-0
3 additions, 0 deletions
epicardium/ble/ble_main.c
lib/sdk/Libraries/BTLE/wsf/include/wsf_trace.h
+23
-8
23 additions, 8 deletions
lib/sdk/Libraries/BTLE/wsf/include/wsf_trace.h
with
89 additions
and
8 deletions
epicardium/ble/ble.c
+
63
−
0
View file @
5ae9e3a2
...
...
@@ -12,6 +12,7 @@
#include
"FreeRTOS.h"
#include
"timers.h"
#include
<machine/endian.h>
#include
<stdio.h>
#include
<string.h>
#include
<stdbool.h>
...
...
@@ -44,6 +45,8 @@ static StaticTimer_t x;
static
TimerHandle_t
timerWakeup
=
NULL
;
static
int
lasttick
=
0
;
static
int
log_fd
;
/*! \brief Stack initialization for app. */
extern
void
StackInit
(
void
);
extern
void
AppInit
(
void
);
...
...
@@ -70,6 +73,57 @@ static bool_t myTrace(const uint8_t *pBuf, uint32_t len)
return
FALSE
;
}
struct
packet_header
{
uint32_t
original_length
;
uint32_t
included_length
;
uint32_t
packet_flags
;
uint32_t
cumulative_drops
;
uint32_t
timestamp_us_h
;
uint32_t
timestamp_us_l
;
};
void
WsfPDump
(
wsfPDumpType_t
pdType
,
uint16_t
length
,
uint8_t
*
pBuffer
)
{
uint32_t
direction
;
uint8_t
type
;
switch
(
pdType
)
{
case
WSF_PDUMP_TYPE_HCI_CMD
:
direction
=
0
;
type
=
0x01
;
break
;
case
WSF_PDUMP_TYPE_HCI_EVT
:
direction
=
1
;
type
=
0x04
;
break
;
case
WSF_PDUMP_TYPE_HCI_TX_ACL
:
direction
=
0
;
type
=
0x02
;
break
;
case
WSF_PDUMP_TYPE_HCI_RX_ACL
:
direction
=
1
;
type
=
0x02
;
break
;
default:
break
;
}
int
tick
=
xTaskGetTickCount
();
uint64_t
timestamp_us
=
tick
*
1000
;
struct
packet_header
header
=
{
.
original_length
=
__htonl
(
length
+
1
),
.
included_length
=
__htonl
(
length
+
1
),
.
packet_flags
=
__htonl
(
direction
),
.
cumulative_drops
=
__htonl
(
0
),
.
timestamp_us_h
=
__htonl
(
timestamp_us
>>
32
),
.
timestamp_us_l
=
__htonl
(
timestamp_us
&
0xFFFFFFFF
)
};
epic_file_write
(
log_fd
,
&
header
,
sizeof
(
header
));
epic_file_write
(
log_fd
,
&
type
,
sizeof
(
type
));
epic_file_write
(
log_fd
,
pBuffer
,
length
);
}
/*************************************************************************************************/
static
void
WsfInit
(
void
)
{
...
...
@@ -238,6 +292,13 @@ static void scheduleTimer(void)
APP_TRACE_INFO0
(
"No timer running"
);
}
}
static
const
uint8_t
log_header
[]
=
{
'b'
,
't'
,
's'
,
'n'
,
'o'
,
'o'
,
'p'
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0x03
,
0xea
};
void
ble_log_flush
(
void
)
{
epic_file_flush
(
log_fd
);
}
/*************************************************************************************************/
void
vBleTask
(
void
*
pvParameters
)
{
...
...
@@ -248,6 +309,8 @@ void vBleTask(void *pvParameters)
*/
vTaskDelay
(
pdMS_TO_TICKS
(
500
));
log_fd
=
epic_file_open
(
"ble.log"
,
"w"
);
epic_file_write
(
log_fd
,
log_header
,
sizeof
(
log_header
));
/* We are going to execute FreeRTOS functions from callbacks
* coming from this interrupt. Its priority needs to be
* reduced to allow this. */
...
...
This diff is collapsed.
Click to expand it.
epicardium/ble/ble_main.c
+
3
−
0
View file @
5ae9e3a2
...
...
@@ -369,6 +369,7 @@ static void bleSetup(bleMsg_t *pMsg)
* \return None.
*/
/*************************************************************************************************/
void
ble_log_flush
(
void
);
static
void
bleProcMsg
(
bleMsg_t
*
pMsg
)
{
uint8_t
uiEvent
=
APP_UI_NONE
;
...
...
@@ -397,6 +398,8 @@ static void bleProcMsg(bleMsg_t *pMsg)
case
DM_ADV_START_IND
:
LOG_INFO
(
"ble"
,
"Advertisement started"
);
uiEvent
=
APP_UI_ADV_START
;
ble_log_flush
();
break
;
case
DM_ADV_STOP_IND
:
...
...
This diff is collapsed.
Click to expand it.
lib/sdk/Libraries/BTLE/wsf/include/wsf_trace.h
+
23
−
8
View file @
5ae9e3a2
...
...
@@ -293,14 +293,10 @@ bool_t WsfTokenService(void);
/*! \brief 3 argument HCI error trace. */
#define HCI_TRACE_ERR3(msg, var1, var2, var3) WSF_TRACE3("HCI", "ERR", msg, var1, var2, var3)
/*! \brief HCI PDUMP on command. */
#define HCI_PDUMP_CMD(len, pBuf)
/*! \brief HCI PDUMP on event. */
#define HCI_PDUMP_EVT(len, pBuf)
/*! \brief HCI PDUMP on transmitted ACL message. */
#define HCI_PDUMP_TX_ACL(len, pBuf)
/*! \brief HCI PDUMP on Received ACL message. */
#define HCI_PDUMP_RX_ACL(len, pBuf)
#define HCI_PDUMP_CMD(len, pBuf) WsfPDump(WSF_PDUMP_TYPE_HCI_CMD, len, pBuf)
#define HCI_PDUMP_EVT(len, pBuf) WsfPDump(WSF_PDUMP_TYPE_HCI_EVT, len, pBuf)
#define HCI_PDUMP_TX_ACL(len, pBuf) WsfPDump(WSF_PDUMP_TYPE_HCI_TX_ACL, len, pBuf)
#define HCI_PDUMP_RX_ACL(len, pBuf) WsfPDump(WSF_PDUMP_TYPE_HCI_RX_ACL, len, pBuf)
/*! \brief 0 argument DM info trace. */
#define DM_TRACE_INFO0(msg) WSF_TRACE0("DM", "INFO", msg)
...
...
@@ -622,6 +618,25 @@ bool_t WsfTokenService(void);
#define LL_TRACE_ENABLE(ena)
#endif
/*! Protocol types */
typedef
enum
{
WSF_PDUMP_TYPE_HCI_CMD
=
(
1
<<
0
),
WSF_PDUMP_TYPE_HCI_EVT
=
(
1
<<
1
),
WSF_PDUMP_TYPE_HCI_TX_ACL
=
(
1
<<
2
),
WSF_PDUMP_TYPE_HCI_RX_ACL
=
(
1
<<
3
),
WSF_PDUMP_TYPE_HCI_TX_ISO
=
(
1
<<
4
),
WSF_PDUMP_TYPE_HCI_RX_ISO
=
(
1
<<
5
),
WSF_PDUMP_TYPE_NONE
=
0
,
WSF_PDUMP_TYPE_ALL
=
0xFFFF
}
wsfPDumpType_t
;
/**************************************************************************************************
Function Prototypes
**************************************************************************************************/
void
WsfPDump
(
wsfPDumpType_t
pdType
,
uint16_t
length
,
uint8_t
*
pBuffer
);
/*! \} */
/* WSF_TRACE_API */
#ifdef __cplusplus
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment