forked from gatsby/df_datalink
*api update: update get/update payload api
This commit is contained in:
@@ -210,6 +210,7 @@ void SysMonitor_UpdateSendPayloadFLJRaw(uint8_t *buff)
|
|||||||
buffIndx = GetWritable(sysMonitorInst->sendPLCtrl);
|
buffIndx = GetWritable(sysMonitorInst->sendPLCtrl);
|
||||||
sysMonitorInst->sendPLCtrl.wBusy = buffIndx;
|
sysMonitorInst->sendPLCtrl.wBusy = buffIndx;
|
||||||
memcpy(sysMonitorInst->sendPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ);
|
memcpy(sysMonitorInst->sendPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ);
|
||||||
|
sysMonitorInst->sendPL[buffIndx].dataId_flj++;
|
||||||
sysMonitorInst->sendPLCtrl.latest = buffIndx;
|
sysMonitorInst->sendPLCtrl.latest = buffIndx;
|
||||||
sysMonitorInst->sendPLCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->sendPLCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
@@ -217,7 +218,7 @@ void SysMonitor_UpdateSendPayloadFLJRaw(uint8_t *buff)
|
|||||||
/**
|
/**
|
||||||
* Get send FLJ payload as raw data.
|
* 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);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
@@ -227,7 +228,11 @@ void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff)
|
|||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->sendPLCtrl);
|
buffIndx = GetReadable(sysMonitorInst->sendPLCtrl);
|
||||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndx;
|
sysMonitorInst->sendPLCtrl.rBusy = buffIndx;
|
||||||
|
if (sysMonitorInst->sendPL[buffIndx].dataId_flj != DATA_ID_NONE)
|
||||||
|
{
|
||||||
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
|
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
|
||||||
|
}
|
||||||
|
*id = sysMonitorInst->sendPL[buffIndx].dataId_flj;
|
||||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->sendPLCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,6 +246,7 @@ void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff)
|
|||||||
buffIndx = GetWritable(sysMonitorInst->sendPLCtrl);
|
buffIndx = GetWritable(sysMonitorInst->sendPLCtrl);
|
||||||
sysMonitorInst->sendPLCtrl.wBusy = buffIndx;
|
sysMonitorInst->sendPLCtrl.wBusy = buffIndx;
|
||||||
memcpy(sysMonitorInst->sendPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ);
|
memcpy(sysMonitorInst->sendPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ);
|
||||||
|
sysMonitorInst->sendPL[buffIndx].dataId_lj++;
|
||||||
sysMonitorInst->sendPLCtrl.latest = buffIndx;
|
sysMonitorInst->sendPLCtrl.latest = buffIndx;
|
||||||
sysMonitorInst->sendPLCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->sendPLCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
@@ -248,7 +254,7 @@ void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff)
|
|||||||
/**
|
/**
|
||||||
* Get send LJ payload as raw data.
|
* 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);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
@@ -258,7 +264,11 @@ void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff)
|
|||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->sendPLCtrl);
|
buffIndx = GetReadable(sysMonitorInst->sendPLCtrl);
|
||||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndx;
|
sysMonitorInst->sendPLCtrl.rBusy = buffIndx;
|
||||||
|
if (sysMonitorInst->sendPL[buffIndx].dataId_lj != DATA_ID_NONE)
|
||||||
|
{
|
||||||
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
|
memcpy(buff, sysMonitorInst->sendPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
|
||||||
|
}
|
||||||
|
*id = sysMonitorInst->sendPL[buffIndx].dataId_lj;
|
||||||
sysMonitorInst->sendPLCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->sendPLCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,6 +283,7 @@ void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff)
|
|||||||
buffIndx = GetWritable(sysMonitorInst->recvPLCtrl);
|
buffIndx = GetWritable(sysMonitorInst->recvPLCtrl);
|
||||||
sysMonitorInst->recvPLCtrl.wBusy = buffIndx;
|
sysMonitorInst->recvPLCtrl.wBusy = buffIndx;
|
||||||
memcpy(sysMonitorInst->recvPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ);
|
memcpy(sysMonitorInst->recvPL[buffIndx].data_flj, buff, sizeof(uint8_t) * PAYLOAD_FLJ);
|
||||||
|
sysMonitorInst->recvPL[buffIndx].dataId_flj++;
|
||||||
sysMonitorInst->recvPLCtrl.latest = buffIndx;
|
sysMonitorInst->recvPLCtrl.latest = buffIndx;
|
||||||
sysMonitorInst->recvPLCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->recvPLCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
@@ -280,7 +291,7 @@ void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff)
|
|||||||
/**
|
/**
|
||||||
* Get send FLJ payload as raw data.
|
* 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);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
@@ -290,7 +301,11 @@ void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff)
|
|||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->recvPLCtrl);
|
buffIndx = GetReadable(sysMonitorInst->recvPLCtrl);
|
||||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndx;
|
sysMonitorInst->recvPLCtrl.rBusy = buffIndx;
|
||||||
|
if (sysMonitorInst->recvPL[buffIndx].dataId_flj != DATA_ID_NONE)
|
||||||
|
{
|
||||||
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
|
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_flj, sizeof(uint8_t) * PAYLOAD_FLJ);
|
||||||
|
}
|
||||||
|
*id = sysMonitorInst->recvPL[buffIndx].dataId_flj;
|
||||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->recvPLCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,6 +319,7 @@ void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff)
|
|||||||
buffIndx = GetWritable(sysMonitorInst->recvPLCtrl);
|
buffIndx = GetWritable(sysMonitorInst->recvPLCtrl);
|
||||||
sysMonitorInst->recvPLCtrl.wBusy = buffIndx;
|
sysMonitorInst->recvPLCtrl.wBusy = buffIndx;
|
||||||
memcpy(sysMonitorInst->recvPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ);
|
memcpy(sysMonitorInst->recvPL[buffIndx].data_lj, buff, sizeof(uint8_t) * PAYLOAD_LJ);
|
||||||
|
sysMonitorInst->recvPL[buffIndx].dataId_lj++;
|
||||||
sysMonitorInst->recvPLCtrl.latest = buffIndx;
|
sysMonitorInst->recvPLCtrl.latest = buffIndx;
|
||||||
sysMonitorInst->recvPLCtrl.wBusy = BUFF_NONE;
|
sysMonitorInst->recvPLCtrl.wBusy = BUFF_NONE;
|
||||||
}
|
}
|
||||||
@@ -311,7 +327,7 @@ void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff)
|
|||||||
/**
|
/**
|
||||||
* Get send LJ payload as raw data.
|
* 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);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
@@ -321,7 +337,11 @@ void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff)
|
|||||||
else
|
else
|
||||||
buffIndx = GetReadable(sysMonitorInst->recvPLCtrl);
|
buffIndx = GetReadable(sysMonitorInst->recvPLCtrl);
|
||||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndx;
|
sysMonitorInst->recvPLCtrl.rBusy = buffIndx;
|
||||||
|
if (sysMonitorInst->recvPL[buffIndx].dataId_lj != DATA_ID_NONE)
|
||||||
|
{
|
||||||
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
|
memcpy(buff, sysMonitorInst->recvPL[buffIndx].data_lj, sizeof(uint8_t) * PAYLOAD_LJ);
|
||||||
|
}
|
||||||
|
*id = sysMonitorInst->recvPL[buffIndx].dataId_lj;
|
||||||
sysMonitorInst->recvPLCtrl.rBusy = buffIndex_old;
|
sysMonitorInst->recvPLCtrl.rBusy = buffIndex_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#define PAYLOAD_FLJ 78
|
#define PAYLOAD_FLJ 78
|
||||||
#define PAYLOAD_LJ 168
|
#define PAYLOAD_LJ 168
|
||||||
|
|
||||||
|
#define DATA_ID_NONE UINT32_MAX
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
// FIXME: To Complete
|
// FIXME: To Complete
|
||||||
@@ -54,7 +56,9 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
uint32_t dataId_lj;
|
||||||
uint8_t data_lj[PAYLOAD_LJ];
|
uint8_t data_lj[PAYLOAD_LJ];
|
||||||
|
uint32_t dataId_flj;
|
||||||
uint8_t data_flj[PAYLOAD_FLJ];
|
uint8_t data_flj[PAYLOAD_FLJ];
|
||||||
} PAYLOAD;
|
} PAYLOAD;
|
||||||
|
|
||||||
@@ -131,10 +135,10 @@ void SysMonitor_UpdateSendPayloadFLJRaw(uint8_t *buff);
|
|||||||
void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff);
|
void SysMonitor_UpdateRecvPayloadFLJRaw(uint8_t *buff);
|
||||||
void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff);
|
void SysMonitor_UpdateSendPayloadLJRaw(uint8_t *buff);
|
||||||
void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff);
|
void SysMonitor_UpdateRecvPayloadLJRaw(uint8_t *buff);
|
||||||
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff);
|
void SysMonitor_GetSendPayloadFLJRaw(uint8_t *buff, uint32_t *id);
|
||||||
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff);
|
void SysMonitor_GetRecvPayloadFLJRaw(uint8_t *buff, uint32_t *id);
|
||||||
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff);
|
void SysMonitor_GetSendPayloadLJRaw(uint8_t *buff, uint32_t *id);
|
||||||
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff);
|
void SysMonitor_GetRecvPayloadLJRaw(uint8_t *buff, uint32_t *id);
|
||||||
|
|
||||||
void SysMonitor_UpdateSendSlotLog(SLOTLOG *log);
|
void SysMonitor_UpdateSendSlotLog(SLOTLOG *log);
|
||||||
void SysMonitor_UpdateRecvSlotLog(SLOTLOG *log);
|
void SysMonitor_UpdateRecvSlotLog(SLOTLOG *log);
|
||||||
|
|||||||
Reference in New Issue
Block a user