*api update: update get/update payload api

This commit is contained in:
Gatsby Van
2024-01-29 18:49:24 +08:00
parent 2f0ee92e33
commit 017886bf00
2 changed files with 36 additions and 12 deletions
+28 -8
View File
@@ -210,6 +210,7 @@ void SysMonitor_UpdateSendPayloadFLJRaw(uint8_t *buff)
buffIndx = GetWritable(sysMonitorInst->sendPLCtrl);
sysMonitorInst->sendPLCtrl.wBusy = buffIndx;
memcpy(sysMonitorInst->sendPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ);
sysMonitorInst->sendPL[buffIndx].dataId_flj++;
sysMonitorInst->sendPLCtrl.latest = buffIndx;
sysMonitorInst->sendPLCtrl.wBusy = BUFF_NONE;
}
@@ -217,7 +218,7 @@ void SysMonitor_UpdateSendPayloadFLJRaw(uint8_t *buff)
/**
* Get send FLJ payload as raw data.
*/
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff)
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff, uint32_t *id)
{
ASSERT(sysMonitorInst != NULL);
uint8_t buffIndx, buffIndex_old;
@@ -227,7 +228,11 @@ void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff)
else
buffIndx = GetReadable(sysMonitorInst->sendPLCtrl);
sysMonitorInst->sendPLCtrl.rBusy = buffIndx;
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
if (sysMonitorInst->sendPL[buffIndx].dataId_flj != DATA_ID_NONE)
{
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
}
*id = sysMonitorInst->sendPL[buffIndx].dataId_flj;
sysMonitorInst->sendPLCtrl.rBusy = buffIndex_old;
}
@@ -241,6 +246,7 @@ void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff)
buffIndx = GetWritable(sysMonitorInst->sendPLCtrl);
sysMonitorInst->sendPLCtrl.wBusy = buffIndx;
memcpy(sysMonitorInst->sendPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ);
sysMonitorInst->sendPL[buffIndx].dataId_lj++;
sysMonitorInst->sendPLCtrl.latest = buffIndx;
sysMonitorInst->sendPLCtrl.wBusy = BUFF_NONE;
}
@@ -248,7 +254,7 @@ void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff)
/**
* Get send LJ payload as raw data.
*/
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff)
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff, uint32_t *id)
{
ASSERT(sysMonitorInst != NULL);
uint8_t buffIndx, buffIndex_old;
@@ -258,7 +264,11 @@ void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff)
else
buffIndx = GetReadable(sysMonitorInst->sendPLCtrl);
sysMonitorInst->sendPLCtrl.rBusy = buffIndx;
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
if (sysMonitorInst->sendPL[buffIndx].dataId_lj != DATA_ID_NONE)
{
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
}
*id = sysMonitorInst->sendPL[buffIndx].dataId_lj;
sysMonitorInst->sendPLCtrl.rBusy = buffIndex_old;
}
@@ -273,6 +283,7 @@ void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff)
buffIndx = GetWritable(sysMonitorInst->recvPLCtrl);
sysMonitorInst->recvPLCtrl.wBusy = buffIndx;
memcpy(sysMonitorInst->recvPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ);
sysMonitorInst->recvPL[buffIndx].dataId_flj++;
sysMonitorInst->recvPLCtrl.latest = buffIndx;
sysMonitorInst->recvPLCtrl.wBusy = BUFF_NONE;
}
@@ -280,7 +291,7 @@ void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff)
/**
* Get send FLJ payload as raw data.
*/
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff)
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff, uint32_t *id)
{
ASSERT(sysMonitorInst != NULL);
uint8_t buffIndx, buffIndex_old;
@@ -290,7 +301,11 @@ void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff)
else
buffIndx = GetReadable(sysMonitorInst->recvPLCtrl);
sysMonitorInst->recvPLCtrl.rBusy = buffIndx;
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
if (sysMonitorInst->recvPL[buffIndx].dataId_flj != DATA_ID_NONE)
{
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
}
*id = sysMonitorInst->recvPL[buffIndx].dataId_flj;
sysMonitorInst->recvPLCtrl.rBusy = buffIndex_old;
}
@@ -304,6 +319,7 @@ void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff)
buffIndx = GetWritable(sysMonitorInst->recvPLCtrl);
sysMonitorInst->recvPLCtrl.wBusy = buffIndx;
memcpy(sysMonitorInst->recvPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ);
sysMonitorInst->recvPL[buffIndx].dataId_lj++;
sysMonitorInst->recvPLCtrl.latest = buffIndx;
sysMonitorInst->recvPLCtrl.wBusy = BUFF_NONE;
}
@@ -311,7 +327,7 @@ void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff)
/**
* Get send LJ payload as raw data.
*/
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff)
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff, uint32_t *id)
{
ASSERT(sysMonitorInst != NULL);
uint8_t buffIndx, buffIndex_old;
@@ -321,7 +337,11 @@ void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff)
else
buffIndx = GetReadable(sysMonitorInst->recvPLCtrl);
sysMonitorInst->recvPLCtrl.rBusy = buffIndx;
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
if (sysMonitorInst->recvPL[buffIndx].dataId_lj != DATA_ID_NONE)
{
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
}
*id = sysMonitorInst->recvPL[buffIndx].dataId_lj;
sysMonitorInst->recvPLCtrl.rBusy = buffIndex_old;
}
+8 -4
View File
@@ -7,6 +7,8 @@
#define PAYLOAD_FLJ 78
#define PAYLOAD_LJ 168
#define DATA_ID_NONE UINT32_MAX
typedef struct
{
// FIXME: To Complete
@@ -54,7 +56,9 @@ typedef struct
typedef struct
{
uint32_t dataId_lj;
uint8_t data_lj[PAYLOAD_LJ];
uint32_t dataId_flj;
uint8_t data_flj[PAYLOAD_FLJ];
} PAYLOAD;
@@ -131,10 +135,10 @@ void SysMonitor_UpdateSendPayloadFLJRaw(uint8_t *buff);
void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff);
void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff);
void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff);
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff);
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff);
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff);
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff);
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff, uint32_t *id);
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff, uint32_t *id);
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff, uint32_t *id);
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff, uint32_t *id);
void SysMonitor_UpdateSendSlotLog(SLOTLOG *log);
void SysMonitor_UpdateRecvSlotLog(SLOTLOG *log);