redesign logging process
This commit is contained in:
+141
-169
@@ -89,6 +89,9 @@ void SysMonitor_Destroy(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @System Info
|
// @System Info
|
||||||
|
/**
|
||||||
|
* Update system info.
|
||||||
|
*/
|
||||||
void SysMonitor_UpdateSysinfo(const SYSINFO *info)
|
void SysMonitor_UpdateSysinfo(const SYSINFO *info)
|
||||||
{
|
{
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
@@ -99,6 +102,9 @@ void SysMonitor_UpdateSysinfo(const SYSINFO *info)
|
|||||||
sysMonitorInst->sysInfoCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->sysInfoCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update system info by raw data.
|
||||||
|
*/
|
||||||
void SysMonitor_UpdateSysinfoRaw(const uint8_t *buff)
|
void SysMonitor_UpdateSysinfoRaw(const uint8_t *buff)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
@@ -142,6 +148,9 @@ void SysMonitor_UpdateSysinfoRaw(const uint8_t *buff)
|
|||||||
sysMonitorInst->sysInfoCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->sysInfoCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get system info.
|
||||||
|
*/
|
||||||
void SysMonitor_GetSysinfo(SYSINFO *info)
|
void SysMonitor_GetSysinfo(SYSINFO *info)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
@@ -156,6 +165,9 @@ void SysMonitor_GetSysinfo(SYSINFO *info)
|
|||||||
sysMonitorInst->sysInfoCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->sysInfoCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get system info as raw data.
|
||||||
|
*/
|
||||||
void SysMonitor_GetSysinfoRaw(uint8_t *buff)
|
void SysMonitor_GetSysinfoRaw(uint8_t *buff)
|
||||||
{
|
{
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
@@ -201,7 +213,8 @@ void SysMonitor_GetSysinfoRaw(uint8_t *buff)
|
|||||||
memcpy(buff, &(infoEntry->roll), sizeof(infoEntry->roll));
|
memcpy(buff, &(infoEntry->roll), sizeof(infoEntry->roll));
|
||||||
sysMonitorInst->sysInfoCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->sysInfoCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
// @Send Payload
|
|
||||||
|
// @Send Payload
|
||||||
/**
|
/**
|
||||||
* Update send payload by raw data.
|
* Update send payload by raw data.
|
||||||
*/
|
*/
|
||||||
@@ -209,36 +222,36 @@ void SysMonitor_UpdateSendPayloadRaw(const uint8_t *buff, size_t len)
|
|||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->sendPLCtrl);
|
buffIndx = GetWritable(sysMonitorInst->sendCtrl);
|
||||||
sysMonitorInst->sendPLCtrl.wBusy = buffIndx;
|
sysMonitorInst->sendCtrl.wBusy = buffIndx;
|
||||||
memcpy(sysMonitorInst->sendPL[buffIndx].data, buff, len);
|
memcpy(sysMonitorInst->send[buffIndx].data, buff, len);
|
||||||
sysMonitorInst->sendPL[buffIndx].dataId++;
|
sysMonitorInst->send[buffIndx].dataId++;
|
||||||
sysMonitorInst->sendPLCtrl.latest = buffIndx;
|
sysMonitorInst->sendCtrl.latest = buffIndx;
|
||||||
sysMonitorInst->sendPLCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->sendCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get send payload as raw data.
|
* Get the latest send payload as raw data.
|
||||||
*/
|
*/
|
||||||
void SysMonitor_GetSendPayloadRaw(uint8_t *buff, uint32_t *id, size_t len)
|
void SysMonitor_GetSendPayloadRaw(uint8_t *buff, uint32_t *id, size_t len)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->sendPLCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->sendCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
buffIndx = buffIndex_old; // Keep it busy
|
buffIndx = buffIndex_old; // Keep it busy
|
||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->sendPLCtrl);
|
buffIndx = GetReadable(sysMonitorInst->sendCtrl);
|
||||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndx;
|
sysMonitorInst->sendCtrl.rBusy = buffIndx;
|
||||||
if (sysMonitorInst->sendPL[buffIndx].dataId != DATA_ID_NONE)
|
if (sysMonitorInst->send[buffIndx].dataId != DATA_ID_NONE)
|
||||||
{
|
{
|
||||||
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data, len);
|
memcpy(buff, sysMonitorInst->send[buffIndx].data, len);
|
||||||
}
|
}
|
||||||
*id = sysMonitorInst->sendPL[buffIndx].dataId;
|
*id = sysMonitorInst->send[buffIndx].dataId;
|
||||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->sendCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Receive Payload
|
// @Receive Payload
|
||||||
/**
|
/**
|
||||||
* Update receive payload by raw data.
|
* Update receive payload by raw data.
|
||||||
*/
|
*/
|
||||||
@@ -246,226 +259,141 @@ void SysMonitor_UpdateRecvPayloadRaw(const uint8_t *buff, size_t len)
|
|||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->recvPLCtrl);
|
buffIndx = GetWritable(sysMonitorInst->recvCtrl);
|
||||||
sysMonitorInst->recvPLCtrl.wBusy = buffIndx;
|
sysMonitorInst->recvCtrl.wBusy = buffIndx;
|
||||||
memcpy(sysMonitorInst->recvPL[buffIndx].data, buff, len);
|
memcpy(sysMonitorInst->recv[buffIndx].data, buff, len);
|
||||||
sysMonitorInst->recvPL[buffIndx].dataId++;
|
sysMonitorInst->recv[buffIndx].dataId++;
|
||||||
sysMonitorInst->recvPLCtrl.latest = buffIndx;
|
sysMonitorInst->recvCtrl.latest = buffIndx;
|
||||||
sysMonitorInst->recvPLCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->recvCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get send payload as raw data.
|
* Get the latest receive payload as raw data.
|
||||||
*/
|
*/
|
||||||
void SysMonitor_GetRecvPayloadRaw(uint8_t *buff, uint32_t *id, size_t len)
|
void SysMonitor_GetRecvPayloadRaw(uint8_t *buff, uint32_t *id, size_t len)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->recvPLCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->recvCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
buffIndx = buffIndex_old; // Keep it busy
|
buffIndx = buffIndex_old; // Keep it busy
|
||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->recvPLCtrl);
|
buffIndx = GetReadable(sysMonitorInst->recvCtrl);
|
||||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndx;
|
sysMonitorInst->recvCtrl.rBusy = buffIndx;
|
||||||
if (sysMonitorInst->recvPL[buffIndx].dataId != DATA_ID_NONE)
|
if (sysMonitorInst->recv[buffIndx].dataId != DATA_ID_NONE)
|
||||||
{
|
{
|
||||||
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data, len);
|
memcpy(buff, sysMonitorInst->recv[buffIndx].data, len);
|
||||||
}
|
}
|
||||||
*id = sysMonitorInst->recvPL[buffIndx].dataId;
|
*id = sysMonitorInst->recv[buffIndx].dataId;
|
||||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->recvCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Send Slot log
|
// @Link layer log
|
||||||
/**
|
/**
|
||||||
* Log send slot information
|
* Update link layer log
|
||||||
*/
|
*/
|
||||||
void SysMonitor_UpdateSendSlotLog(const SLOTLOG *log)
|
void SysMonitor_UpdateLinklayerLog(const LINKLOG *log)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->sendLogCtrl);
|
buffIndx = GetWritable(sysMonitorInst->linkLogCtrl);
|
||||||
sysMonitorInst->sendLogCtrl.wBusy = buffIndx;
|
sysMonitorInst->linkLogCtrl.wBusy = buffIndx;
|
||||||
memcpy(&(sysMonitorInst->sendLog[buffIndx]), log, sizeof(SLOTLOG));
|
memcpy(&(sysMonitorInst->linkLog[buffIndx]), log, sizeof(LINKLOG));
|
||||||
sysMonitorInst->sendLogCtrl.latest = buffIndx;
|
sysMonitorInst->linkLogCtrl.latest = buffIndx;
|
||||||
sysMonitorInst->sendLogCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->linkLogCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the latest send slot log
|
* Get the latest link layer log
|
||||||
*/
|
*/
|
||||||
void SysMonitor_GetSendSlotLog(SLOTLOG *log)
|
void SysMonitor_GetLinklayerLog(LINKLOG *log)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->sendLogCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->linkLogCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
buffIndx = buffIndex_old; // Keep it busy
|
buffIndx = buffIndex_old; // Keep it busy
|
||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->sendLogCtrl);
|
buffIndx = GetReadable(sysMonitorInst->linkLogCtrl);
|
||||||
sysMonitorInst->sendLogCtrl.rBusy = buffIndx;
|
sysMonitorInst->linkLogCtrl.rBusy = buffIndx;
|
||||||
memcpy(log, &(sysMonitorInst->sendLog[buffIndx]), sizeof(SLOTLOG));
|
memcpy(log, &(sysMonitorInst->linkLog[buffIndx]), sizeof(LINKLOG));
|
||||||
sysMonitorInst->sendLogCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->linkLogCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the latest send slot log as raw data
|
* Get the latest link layer log as raw data
|
||||||
*/
|
*/
|
||||||
void SysMonitor_GetSendSlotLogRaw(uint8_t *buff)
|
void SysMonitor_GetLinklayerLogRaw(uint8_t *buff)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->sendLogCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->linkLogCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
buffIndx = buffIndex_old; // Keep it busy
|
buffIndx = buffIndex_old; // Keep it busy
|
||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->sendLogCtrl);
|
buffIndx = GetReadable(sysMonitorInst->linkLogCtrl);
|
||||||
sysMonitorInst->sendLogCtrl.rBusy = buffIndx;
|
sysMonitorInst->linkLogCtrl.rBusy = buffIndx;
|
||||||
|
|
||||||
// Encapsulate log
|
// Encapsulate log
|
||||||
SLOTLOG *logEntry = &(sysMonitorInst->sendLog[buffIndx]);
|
LINKLOG *logEntry = &(sysMonitorInst->linkLog[buffIndx]);
|
||||||
memcpy(buff, &(logEntry->tuNo), sizeof(logEntry->tuNo));
|
|
||||||
buff += sizeof(logEntry->tuNo);
|
// TODO:
|
||||||
memcpy(buff, &(logEntry->slotNo), sizeof(logEntry->slotNo));
|
|
||||||
buff += sizeof(logEntry->slotNo);
|
sysMonitorInst->linkLogCtrl.rBusy = buffIndex_old;
|
||||||
memcpy(buff, &(logEntry->frameType), sizeof(logEntry->frameType));
|
|
||||||
buff += sizeof(logEntry->frameType);
|
|
||||||
memcpy(buff, &(logEntry->payload), sizeof(logEntry->payload));
|
|
||||||
buff += sizeof(logEntry->payload);
|
|
||||||
memcpy(buff, &(logEntry->tmStamp), sizeof(logEntry->tmStamp));
|
|
||||||
buff += sizeof(logEntry->tmStamp);
|
|
||||||
memcpy(buff, &(logEntry->tmDevi), sizeof(logEntry->tmDevi));
|
|
||||||
buff += sizeof(logEntry->tmDevi);
|
|
||||||
memcpy(buff, &(logEntry->freqDevi), sizeof(logEntry->freqDevi));
|
|
||||||
sysMonitorInst->sendLogCtrl.rBusy = buffIndex_old;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Receive Slot log
|
// @Physical layer log
|
||||||
/**
|
/**
|
||||||
* Log receive slot information
|
* Update physical layer log
|
||||||
*/
|
*/
|
||||||
void SysMonitor_UpdateRecvSlotLog(const SLOTLOG *log)
|
void SysMonitor_UpdatePhysicalLayerLog(const PHYLOG *log)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->recvLogCtrl);
|
buffIndx = GetWritable(sysMonitorInst->phyLogCtrl);
|
||||||
sysMonitorInst->recvLogCtrl.wBusy = buffIndx;
|
sysMonitorInst->phyLogCtrl.wBusy = buffIndx;
|
||||||
memcpy(&(sysMonitorInst->recvLog[buffIndx]), log, sizeof(SLOTLOG));
|
memcpy(&(sysMonitorInst->phyLog[buffIndx]), log, sizeof(PHYLOG));
|
||||||
sysMonitorInst->recvLogCtrl.latest = buffIndx;
|
sysMonitorInst->phyLogCtrl.latest = buffIndx;
|
||||||
sysMonitorInst->recvLogCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->phyLogCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the latest receive slot information
|
* Get the latest physical layer log
|
||||||
*/
|
*/
|
||||||
void SysMonitor_GetRecvSlotLog(SLOTLOG *log)
|
void SysMonitor_GetPhysicalLayerLog(PHYLOG *log)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->recvLogCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->phyLogCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
buffIndx = buffIndex_old; // Keep it busy
|
buffIndx = buffIndex_old; // Keep it busy
|
||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->recvLogCtrl);
|
buffIndx = GetReadable(sysMonitorInst->phyLogCtrl);
|
||||||
sysMonitorInst->recvLogCtrl.rBusy = buffIndx;
|
sysMonitorInst->phyLogCtrl.rBusy = buffIndx;
|
||||||
memcpy(log, &(sysMonitorInst->recvLog[buffIndx]), sizeof(SLOTLOG));
|
memcpy(log, &(sysMonitorInst->phyLog[buffIndx]), sizeof(PHYLOG));
|
||||||
sysMonitorInst->recvLogCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->phyLogCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the latest receive slot information as raw data
|
* Get the latest physical layer log as raw data
|
||||||
*/
|
*/
|
||||||
void SysMonitor_GetRecvSlotLogRaw(uint8_t *buff)
|
void SysMonitor_GetPhysicalLayerLogRaw(uint8_t *buff)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->recvLogCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->phyLogCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
buffIndx = buffIndex_old; // Keep it busy
|
buffIndx = buffIndex_old; // Keep it busy
|
||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->recvLogCtrl);
|
buffIndx = GetReadable(sysMonitorInst->phyLogCtrl);
|
||||||
sysMonitorInst->recvLogCtrl.rBusy = buffIndx;
|
sysMonitorInst->phyLogCtrl.rBusy = buffIndx;
|
||||||
|
|
||||||
// Encapsulate log
|
// Encapsulate log
|
||||||
SLOTLOG *logEntry = &(sysMonitorInst->recvLog[buffIndx]);
|
PHYLOG *logEntry = &(sysMonitorInst->phyLog[buffIndx]);
|
||||||
memcpy(buff, &(logEntry->tuNo), sizeof(logEntry->tuNo));
|
|
||||||
buff += sizeof(logEntry->tuNo);
|
|
||||||
memcpy(buff, &(logEntry->slotNo), sizeof(logEntry->slotNo));
|
|
||||||
buff += sizeof(logEntry->slotNo);
|
|
||||||
memcpy(buff, &(logEntry->frameType), sizeof(logEntry->frameType));
|
|
||||||
buff += sizeof(logEntry->frameType);
|
|
||||||
memcpy(buff, &(logEntry->payload), sizeof(logEntry->payload));
|
|
||||||
buff += sizeof(logEntry->payload);
|
|
||||||
memcpy(buff, &(logEntry->tmStamp), sizeof(logEntry->tmStamp));
|
|
||||||
buff += sizeof(logEntry->tmStamp);
|
|
||||||
memcpy(buff, &(logEntry->tmDevi), sizeof(logEntry->tmDevi));
|
|
||||||
buff += sizeof(logEntry->tmDevi);
|
|
||||||
memcpy(buff, &(logEntry->freqDevi), sizeof(logEntry->freqDevi));
|
|
||||||
sysMonitorInst->recvLogCtrl.rBusy = buffIndex_old;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Protocol log
|
// TODO:
|
||||||
/**
|
|
||||||
* Log protocol running status.
|
|
||||||
*/
|
|
||||||
void SysMonitor_UpdateProtocolLog(const PRTCLLOG *log)
|
|
||||||
{
|
|
||||||
ASSERT(sysMonitorInst != NULL);
|
|
||||||
uint8_t buffIndx;
|
|
||||||
buffIndx = GetWritable(sysMonitorInst->protocolLogCtrl);
|
|
||||||
sysMonitorInst->protocolLogCtrl.wBusy = buffIndx;
|
|
||||||
memcpy(&(sysMonitorInst->protocolLog[buffIndx]), log, sizeof(PRTCLLOG));
|
|
||||||
sysMonitorInst->protocolLogCtrl.latest = buffIndx;
|
|
||||||
sysMonitorInst->protocolLogCtrl.wBusy = BUFF_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
sysMonitorInst->phyLogCtrl.rBusy = buffIndex_old;
|
||||||
* Get the protocol running log.
|
|
||||||
*/
|
|
||||||
void SysMonitor_GetProtocolLog(PRTCLLOG *log)
|
|
||||||
{
|
|
||||||
ASSERT(sysMonitorInst != NULL);
|
|
||||||
uint8_t buffIndx, buffIndex_old;
|
|
||||||
buffIndex_old = sysMonitorInst->protocolLogCtrl.rBusy;
|
|
||||||
if (buffIndex_old != BUFF_NONE)
|
|
||||||
buffIndx = buffIndex_old; // Keep it busy
|
|
||||||
else
|
|
||||||
buffIndx = GetReadable(sysMonitorInst->protocolLogCtrl);
|
|
||||||
sysMonitorInst->protocolLogCtrl.rBusy = buffIndx;
|
|
||||||
memcpy(log, &(sysMonitorInst->protocolLog[buffIndx]), sizeof(PRTCLLOG));
|
|
||||||
sysMonitorInst->protocolLogCtrl.rBusy = buffIndex_old;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the protocol running log as raw data.
|
|
||||||
*/
|
|
||||||
void SysMonitor_GetProtocolLogRaw(uint8_t *buff)
|
|
||||||
{
|
|
||||||
ASSERT(sysMonitorInst != NULL);
|
|
||||||
uint8_t buffIndx, buffIndex_old;
|
|
||||||
buffIndex_old = sysMonitorInst->protocolLogCtrl.rBusy;
|
|
||||||
if (buffIndex_old != BUFF_NONE)
|
|
||||||
buffIndx = buffIndex_old; // Keep it busy
|
|
||||||
else
|
|
||||||
buffIndx = GetReadable(sysMonitorInst->protocolLogCtrl);
|
|
||||||
sysMonitorInst->protocolLogCtrl.rBusy = buffIndx;
|
|
||||||
|
|
||||||
// Encapsulate log
|
|
||||||
PRTCLLOG *logEntry = &(sysMonitorInst->protocolLog[buffIndx]);
|
|
||||||
memcpy(buff, &(logEntry->tmSys), sizeof(logEntry->tmSys));
|
|
||||||
buff += sizeof(logEntry->tmSys);
|
|
||||||
memcpy(buff, &(logEntry->phySt), sizeof(logEntry->phySt));
|
|
||||||
buff += sizeof(logEntry->phySt);
|
|
||||||
memcpy(buff, &(logEntry->tmLocal), sizeof(logEntry->tmLocal));
|
|
||||||
buff += sizeof(logEntry->tmLocal);
|
|
||||||
memcpy(buff, &(logEntry->beamNo), sizeof(logEntry->beamNo));
|
|
||||||
buff += sizeof(logEntry->beamNo);
|
|
||||||
memcpy(buff, &(logEntry->beamWidth), sizeof(logEntry->beamWidth));
|
|
||||||
buff += sizeof(logEntry->beamWidth);
|
|
||||||
memcpy(buff, &(logEntry->stage), sizeof(logEntry->stage));
|
|
||||||
buff += sizeof(logEntry->stage);
|
|
||||||
memcpy(buff, &(logEntry->recvCnt), sizeof(logEntry->recvCnt));
|
|
||||||
buff += sizeof(logEntry->recvCnt);
|
|
||||||
sysMonitorInst->protocolLogCtrl.rBusy = buffIndex_old;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Hardware state
|
// @Hardware state
|
||||||
@@ -500,6 +428,51 @@ void SysMonitor_GetHardwareStatus(HWSTATE *state)
|
|||||||
sysMonitorInst->hwStateCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->hwStateCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the latest hardware running status as raw data.
|
||||||
|
*/
|
||||||
|
void SysMonitor_GetHardwareStatusRaw(uint8_t *buff)
|
||||||
|
{
|
||||||
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
uint8_t buffIndx, buffIndex_old;
|
||||||
|
buffIndex_old = sysMonitorInst->hwStateCtrl.rBusy;
|
||||||
|
if (buffIndex_old != BUFF_NONE)
|
||||||
|
buffIndx = buffIndex_old; // Keep it busy
|
||||||
|
else
|
||||||
|
buffIndx = GetReadable(sysMonitorInst->hwStateCtrl);
|
||||||
|
sysMonitorInst->hwStateCtrl.rBusy = buffIndx;
|
||||||
|
|
||||||
|
// Encapsulate log
|
||||||
|
HWSTATE *logEntry = &(sysMonitorInst->hwState[buffIndx]);
|
||||||
|
|
||||||
|
memcpy(buff, &(logEntry->spPsVolt), sizeof(logEntry->spPsVolt));
|
||||||
|
buff += sizeof(logEntry->spPsVolt);
|
||||||
|
memcpy(buff, &(logEntry->spPsAuxVolt), sizeof(logEntry->spPsAuxVolt));
|
||||||
|
buff += sizeof(logEntry->spPsAuxVolt);
|
||||||
|
memcpy(buff, &(logEntry->spDdrVolt), sizeof(logEntry->spDdrVolt));
|
||||||
|
buff += sizeof(logEntry->spDdrVolt);
|
||||||
|
memcpy(buff, &(logEntry->spPlVolt), sizeof(logEntry->spPlVolt));
|
||||||
|
buff += sizeof(logEntry->spPlVolt);
|
||||||
|
memcpy(buff, &(logEntry->spPlAuxVolt), sizeof(logEntry->spPlAuxVolt));
|
||||||
|
buff += sizeof(logEntry->spPlAuxVolt);
|
||||||
|
memcpy(buff, &(logEntry->spBramVolt), sizeof(logEntry->spBramVolt));
|
||||||
|
buff += sizeof(logEntry->spBramVolt);
|
||||||
|
memcpy(buff, &(logEntry->spTemp), sizeof(logEntry->spTemp));
|
||||||
|
buff += sizeof(logEntry->spTemp);
|
||||||
|
memcpy(buff, &(logEntry->antVolt), sizeof(logEntry->antVolt));
|
||||||
|
buff += sizeof(logEntry->antVolt);
|
||||||
|
memcpy(buff, &(logEntry->antTemp), sizeof(logEntry->antTemp));
|
||||||
|
buff += sizeof(logEntry->antTemp);
|
||||||
|
memcpy(buff, &(logEntry->antPll), sizeof(logEntry->antPll));
|
||||||
|
buff += sizeof(logEntry->antPll);
|
||||||
|
memcpy(buff, &(logEntry->antMgc0), sizeof(logEntry->antMgc0));
|
||||||
|
buff += sizeof(logEntry->antMgc0);
|
||||||
|
memcpy(buff, &(logEntry->antMgc1), sizeof(logEntry->antMgc1));
|
||||||
|
buff += sizeof(logEntry->antMgc1);
|
||||||
|
|
||||||
|
sysMonitorInst->hwStateCtrl.rBusy = buffIndex_old;
|
||||||
|
}
|
||||||
|
|
||||||
// @System log
|
// @System log
|
||||||
/**
|
/**
|
||||||
* Get the latest system running log.
|
* Get the latest system running log.
|
||||||
@@ -507,9 +480,8 @@ void SysMonitor_GetHardwareStatus(HWSTATE *state)
|
|||||||
void SysMonitor_GetSyslog(SYSLOG *log)
|
void SysMonitor_GetSyslog(SYSLOG *log)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
SysMonitor_GetSendSlotLog(&(log->sendLog));
|
SysMonitor_GetLinklayerLog(&(log->linkLog));
|
||||||
SysMonitor_GetRecvSlotLog(&(log->recvLog));
|
SysMonitor_GetPhysicalLayerLog(&(log->phyLog));
|
||||||
SysMonitor_GetProtocolLog(&(log->protocolLog));
|
|
||||||
SysMonitor_GetHardwareStatus(&(log->hwSate));
|
SysMonitor_GetHardwareStatus(&(log->hwSate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,9 +491,9 @@ void SysMonitor_GetSyslog(SYSLOG *log)
|
|||||||
void SysMonitor_GetSyslogRaw(uint8_t *buff)
|
void SysMonitor_GetSyslogRaw(uint8_t *buff)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
SysMonitor_GetSendSlotLogRaw(buff);
|
SysMonitor_GetLinklayerLogRaw(buff);
|
||||||
buff += SLOTLOG_PACK_LEN;
|
buff += SLOTLOG_PACK_LEN;
|
||||||
SysMonitor_GetRecvSlotLogRaw(buff);
|
SysMonitor_GetPhysicalLayerLogRaw(buff);
|
||||||
buff += SLOTLOG_PACK_LEN;
|
buff += SLOTLOG_PACK_LEN;
|
||||||
SysMonitor_GetProtocolLogRaw(buff);
|
SysMonitor_GetHardwareStatusRaw(buff);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user