Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions esp_sysview/src/SEGGER/SEGGER_SYSVIEW.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ typedef struct {
U32 DisabledEvents;
const SEGGER_SYSVIEW_OS_API *pOSAPI;
SEGGER_SYSVIEW_SEND_SYS_DESC_FUNC *pfSendSysDesc;
SEGGER_SYSVIEW_SendPacket_Dump *pfSendPacketCallback;
} SEGGER_SYSVIEW_GLOBALS;

/*********************************************************************
Expand Down Expand Up @@ -898,6 +899,10 @@ static void _SendPacket(U8 *pStartPacket, U8 *pEndPacket, unsigned int EventId)
//
TimeStamp = SEGGER_SYSVIEW_GET_TIMESTAMP();
Delta = TimeStamp - _SYSVIEW_Globals.LastTxTimeStamp;
// Call SendPacketCallback if it is set
if (_SYSVIEW_Globals.pfSendPacketCallback) {
_SYSVIEW_Globals.pfSendPacketCallback(pStartPacket, pEndPacket, EventId, TimeStamp);
}
MAKE_DELTA_32BIT(Delta);
ENCODE_U32(pEndPacket, Delta);
#if (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1)
Expand Down Expand Up @@ -1471,6 +1476,7 @@ void SEGGER_SYSVIEW_Init(U32 SysFreq, U32 CPUFreq, const SEGGER_SYSVIEW_OS_API *
_SYSVIEW_Globals.SysFreq = SysFreq;
_SYSVIEW_Globals.CPUFreq = CPUFreq;
_SYSVIEW_Globals.pfSendSysDesc = pfSendSysDesc;
_SYSVIEW_Globals.pfSendPacketDumpCallback = NULL;
_SYSVIEW_Globals.EnableState = 0;
_SYSVIEW_Globals.PacketCount = 0;
#else // (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1)
Expand All @@ -1488,6 +1494,7 @@ void SEGGER_SYSVIEW_Init(U32 SysFreq, U32 CPUFreq, const SEGGER_SYSVIEW_OS_API *
_SYSVIEW_Globals.SysFreq = SysFreq;
_SYSVIEW_Globals.CPUFreq = CPUFreq;
_SYSVIEW_Globals.pfSendSysDesc = pfSendSysDesc;
_SYSVIEW_Globals.pfSendPacketCallback = NULL;
_SYSVIEW_Globals.EnableState = 0;
#endif // (SEGGER_SYSVIEW_POST_MORTEM_MODE == 1)
}
Expand Down Expand Up @@ -3736,5 +3743,21 @@ int SEGGER_SYSVIEW_IsStarted(void)
return _SYSVIEW_Globals.EnableState;
}

/*********************************************************************
*
* SEGGER_SYSVIEW_SetSendPacketDumpCallback()
*
* Function description
* Set the callback function for sending packet dump.
*
* Parameters
* pfSendPacketDumpCallback - Pointer to the callback function.
*/
void SEGGER_SYSVIEW_SetSendPacketCallback(SEGGER_SYSVIEW_SendPacket_Dump *pfSendPacketCallback)
{
_SYSVIEW_Globals.pfSendPacketCallback = pfSendPacketCallback;
return;
}


/*************************** End of file ****************************/
16 changes: 16 additions & 0 deletions esp_sysview/src/SEGGER/SEGGER_SYSVIEW.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,22 @@ struct SEGGER_SYSVIEW_MODULE_STRUCT {

typedef void (SEGGER_SYSVIEW_SEND_SYS_DESC_FUNC)(void);

/*
* The callback function for sending packets
* @param pStartPacket: the start of the packet
* @param pEndPacket: the end of the packet
* @param EventId: the event id
* @param Timestamp: the timestamp
*/
typedef void (SEGGER_SYSVIEW_SendPacket_Dump)(U8 *pStartPacket, U8 *pEndPacket, unsigned int EventId, U32 Timestamp);

/*
* Set the callback function for sending packets
* Use this function to subscribe and unsubscribe from the packet sending process
* @param pfSendPacketCallback: the callback function
*/
void SEGGER_SYSVIEW_SetSendPacketCallback(SEGGER_SYSVIEW_SendPacket_Dump *pfSendPacketCallback);


/*********************************************************************
*
Expand Down
Loading