📄 dm_dbghistory.c
字号:
*
* INPUT PARAMETERS: two dummy parameters.
*
* RETURNS: VOID
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE: VOID DM_DbgHistoryIncrementControl (PVOID dummy1, PCHAR dummy2);
*
*******************************************************************************
*/
VOID DM_DbgHistoryIncrementControl (PVOID dummy1, PCHAR dummy2)
{
if (currDbgCtrl == DM_DBG_NUM_ASSIGNED)
currDbgCtrl = 0;
else
currDbgCtrl++;
DM_DbgHistoryDisplayCurrControl (NULL,NULL);
}
/*
*******************************************************************************
*
* FUNCTION: DM_DbgHistoryDecrementControl
*
* DESCRIPTION: This function selects the previous debug switch in the dbg. history
* switches table. The selected debug switch will be displayed on
* the screen.
*
* INPUT PARAMETERS: two dummy parameters.
*
* RETURNS: VOID
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE: VOID DM_DbgHistoryDecrementControl (PVOID dummy1, PCHAR dummy2);
*
*******************************************************************************
*/
VOID DM_DbgHistoryDecrementControl (PVOID dummy1, PCHAR dummy2)
{
if (currDbgCtrl == 0 )
currDbgCtrl = DM_DBG_NUM_ASSIGNED - 1;
else
currDbgCtrl--;
DM_DbgHistoryDisplayCurrControl (NULL,NULL);
}
/*
*******************************************************************************
*
* FUNCTION: DM_DbgHistoryPrintAllControls
*
* DESCRIPTION: This function displays the status all of the debug switches
* from the dbg. history switches table: name of the switch and
* enabled/disabled.
*
* INPUT PARAMETERS: two dummy parameters.
*
* RETURNS: VOID
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE: VOID DM_DbgHistoryPrintAllControls (PVOID dummy1, PCHAR dummy2);
*
*******************************************************************************
*/
VOID DM_DbgHistoryPrintAllControls (PVOID dummy1, PCHAR dummy2)
{
INT i;
INT localDbgCtrl = currDbgCtrl;
currDbgCtrl = 0;
for (i = 0; i < DM_DBG_NUM_ASSIGNED; i++, currDbgCtrl++)
{
DM_DbgHistoryDisplayCurrControl (NULL,NULL);
}
currDbgCtrl = localDbgCtrl;
}
/*
*******************************************************************************
*
* FUNCTION: DM_DbgCaptureHistory
*
* DESCRIPTION: This function loges the data into the debug history buffer
* if the switch for the specific device from the dbg. history switches
* table is enabled. Three pieces of data will be stored in the debug
* history buffer: a time stamp (the number of ticks from OST timer),
* a name of the variable or the register, the data from the variable or
* the register.
*
* INPUT PARAMETERS: PCHAR messageP - a pointer to the name of the variable/register that needs
* to be stored in the debug history buffer,
* PUINT dataP - a pointer to the the variable/register that needs
* to be stored in the debug history buffer,
* DM_ControlDbgHistoryT dbgCtrl - the name of the debug switch from
* the dbg. history switches table.
*
* RETURNS: VOID
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS: The function DM_DbgCaptureHistory was added to the procedure(s)
* where the user wants to get the debugging information from.
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE: VOID DM_DbgCaptureHistory (PCHAR messageP,
* PUINT dataP,
* DM_ControlDbgHistoryT dbgCtrl);
*
*******************************************************************************
*/
VOID DM_DbgCaptureHistory (PCHAR messageP,
PUINT dataP,
DM_ControlDbgHistoryT dbgCtrl)
{
if (DM_DbgHistoryCheckEnabled (dbgCtrl))
{
if (dbgBuffP > &dbgBuff[DM_CONTROL_DEBUG_TOTAL - 1])
{
// Set pointer to the beginning of the buffer
dbgBuffP = dbgBuff;
}
dbgBuffP->data = *dataP;
dbgBuffP->messageP = messageP;
// Get the time stamp
dbgBuffP->param = DM_DbgHistoryGetTimeStamp ();
dbgBuffP++;
}
}
/*
*******************************************************************************
*
* FUNCTION: DM_DbgDumpHistory
*
* DESCRIPTION: This function dumps the contains of the debug history buffer.
* Each of the debug history transactions includes:
* a time stamp (the number of ticks from OST timer),
* a name of the variable or the register,
* the data from the variable/register.
*
* INPUT PARAMETERS: two dummy parameters.
*
* RETURNS: VOID
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE: VOID DM_DbgDumpHistory (PVOID dummy1, PCHAR dummy2);
*
*******************************************************************************
*/
VOID DM_DbgDumpHistory (PVOID dummy1, PCHAR dummy2)
{
INT i;
UINT total = dbgBuffP - &dbgBuff[0];
DbgItemT * buffP = dbgBuff;
if (dbgBuffP > &dbgBuff[DM_CONTROL_DEBUG_TOTAL - 1])
total = DM_CONTROL_DEBUG_TOTAL;
printf("Total Debug Messages: %d\r\n", total);
for (i = 0; i < total; i++, buffP++)
{
printf("%08x : %s : %08x\r\n",
buffP->param,
buffP->messageP,
buffP->data);
}
}
/*
*******************************************************************************
*
* FUNCTION: DM_DbgClearHistory
*
* DESCRIPTION: This function clears the contains of the debug history buffer.
*
* INPUT PARAMETERS: two dummy parameters.
*
* RETURNS: VOID
*
* GLOBAL EFFECTS:
*
* ASSUMPTIONS:
*
* CALLS:
*
* CALLED BY:
*
* PROTOTYPE: VOID DM_DbgClearHistory (PVOID dummy1, PCHAR dummy2);
*
*******************************************************************************
*/
VOID DM_DbgClearHistory (PVOID dummy1, PCHAR dummy2)
{
memset (dbgBuff, 0, DM_CONTROL_DEBUG_TOTAL);
dbgBuffP = dbgBuff;
}
VOID DM_DbgHistoryControlToggleSelected (PVOID dummy1, PCHAR controlNameP)
{
INT i;
if (controlNameP == NULL)
{
printf ("Error! No Debug History Switch specified\r\n");
return;
}
for (i = 0; i < DM_DBG_NUM_ASSIGNED; ++i)
{
if (strcmp(DM_ControlDbgHistoryTable[i].dbgCntrlName, controlNameP) == 0)
{
DM_ControlDbgHistoryTable[i].dbgEnable ^= 1;
currDbgCtrl = i;
DM_DbgHistoryDisplayCurrControl (NULL,NULL);
break;
}
}
if (i == DM_DBG_NUM_ASSIGNED)
{
printf ("Error! Debug History Switch not found\r\n");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -