simplified message handling, switch from XOR checksum to CRC8 with polynomial 0x97.
0x97 allows for detection of all 1-3 bit errors in a message of up to 119 bytes (see https://www.faa.gov/aircraft/air_cert/design_approvals/air_software/media/TC-14-49.pdf)
This commit is contained in:
@@ -18,31 +18,23 @@
|
|||||||
#include <gwenhywfar/debug.h>
|
#include <gwenhywfar/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define AQH_MSG_OFFS_CLAIMADDR_UID 0
|
||||||
|
#define AQH_MSG_OFFS_CLAIMADDR_ADDR 4
|
||||||
|
|
||||||
|
#define AQH_MSG_CLAIMADDR_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_CLAIMADDR_ADDR+1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t AQH_ClaimAddrMsg_GetUid(const GWEN_MSG *msg)
|
uint32_t AQH_ClaimAddrMsg_GetUid(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_CLAIM_ADDRESS) &&
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_CLAIMADDR_UID, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_CLAIMADDR_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_CLAIMADDR_UID;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_ClaimAddrMsg_GetAddress(const GWEN_MSG *msg)
|
uint8_t AQH_ClaimAddrMsg_GetAddress(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_CLAIM_ADDRESS) &&
|
return AQH_NodeMsg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_CLAIMADDR_ADDR, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_CLAIMADDR_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_CLAIMADDR_ADDR;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_CLAIMADDR_UID 0
|
|
||||||
#define AQH_MSG_OFFS_CLAIMADDR_ADDR 4
|
|
||||||
|
|
||||||
#define AQH_MSG_CLAIMADDR_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_CLAIMADDR_ADDR+1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHOME_API uint32_t AQH_ClaimAddrMsg_GetUid(const GWEN_MSG *msg);
|
AQHOME_API uint32_t AQH_ClaimAddrMsg_GetUid(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint8_t AQH_ClaimAddrMsg_GetAddress(const GWEN_MSG *msg);
|
AQHOME_API uint8_t AQH_ClaimAddrMsg_GetAddress(const GWEN_MSG *msg);
|
||||||
AQHOME_API void AQH_ClaimAddrMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_ClaimAddrMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|||||||
@@ -19,30 +19,23 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define AQH_MSG_OFFS_DENYADDR_UID 0
|
||||||
|
#define AQH_MSG_OFFS_DENYADDR_ADDR 4
|
||||||
|
|
||||||
|
#define AQH_MSG_DENYADDR_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DENYADDR_ADDR+1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t AQH_DenyAddrMsg_GetUid(const GWEN_MSG *msg)
|
uint32_t AQH_DenyAddrMsg_GetUid(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_DENY_ADDRESS) &&
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DENYADDR_UID, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DENYADDR_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DENYADDR_UID;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_DenyAddrMsg_GetAddress(const GWEN_MSG *msg)
|
uint8_t AQH_DenyAddrMsg_GetAddress(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_DENY_ADDRESS) &&
|
return AQH_NodeMsg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DENYADDR_ADDR, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DENYADDR_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DENYADDR_ADDR;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_DENYADDR_UID 0
|
|
||||||
#define AQH_MSG_OFFS_DENYADDR_ADDR 4
|
|
||||||
|
|
||||||
#define AQH_MSG_DENYADDR_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DENYADDR_ADDR+1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHOME_API uint32_t AQH_DenyAddrMsg_GetUid(const GWEN_MSG *msg);
|
AQHOME_API uint32_t AQH_DenyAddrMsg_GetUid(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint8_t AQH_DenyAddrMsg_GetAddress(const GWEN_MSG *msg);
|
AQHOME_API uint8_t AQH_DenyAddrMsg_GetAddress(const GWEN_MSG *msg);
|
||||||
AQHOME_API void AQH_DenyAddrMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_DenyAddrMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|||||||
@@ -18,82 +18,47 @@
|
|||||||
#include <gwenhywfar/debug.h>
|
#include <gwenhywfar/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define AQH_MSG_OFFS_DEVICE_UID 0 /* 4 bytes */
|
||||||
|
#define AQH_MSG_OFFS_DEVICE_FWTYPE 4 /* 2 bytes */
|
||||||
|
#define AQH_MSG_OFFS_DEVICE_FWLOW 6 /* 1 byte */
|
||||||
|
#define AQH_MSG_OFFS_DEVICE_FWHIGH 7 /* 1 byte */
|
||||||
|
#define AQH_MSG_OFFS_DEVICE_MODULES 8 /* 2 byte */
|
||||||
|
|
||||||
|
#define AQH_MSG_DEVICE_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_MODULES+2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t AQH_DeviceMsg_GetUid(const GWEN_MSG *msg)
|
uint32_t AQH_DeviceMsg_GetUid(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DEVICE_MINSIZE) {
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_UID, 0);
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_UID;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t AQH_DeviceMsg_GetFirmwareType(const GWEN_MSG *msg)
|
uint16_t AQH_DeviceMsg_GetFirmwareType(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DEVICE_MINSIZE) {
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_FWTYPE, 0);
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_FWTYPE;
|
|
||||||
return (uint16_t)((ptr[0])+(ptr[1]<<8));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_DeviceMsg_GetFirmwareLow(const GWEN_MSG *msg)
|
uint8_t AQH_DeviceMsg_GetFirmwareLow(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DEVICE_MINSIZE) {
|
return AQH_NodeMsg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_FWLOW, 0);
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_FWLOW;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_DeviceMsg_GetFirmwareHigh(const GWEN_MSG *msg)
|
uint8_t AQH_DeviceMsg_GetFirmwareHigh(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DEVICE_MINSIZE) {
|
return AQH_NodeMsg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_FWHIGH, 0);
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_FWHIGH;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_DeviceMsg_GetModuleMaskLow(const GWEN_MSG *msg)
|
uint16_t AQH_DeviceMsg_GetModuleMask(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DEVICE_MINSIZE) {
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_MODULES, 0);
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_MODULESLOW;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_DeviceMsg_GetModuleMaskHigh(const GWEN_MSG *msg)
|
|
||||||
{
|
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DEVICE_MINSIZE) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_MODULESHIGH;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +68,7 @@ void AQH_DeviceMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const ch
|
|||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DEVICE_MINSIZE) {
|
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_DEVICE_MINSIZE) {
|
||||||
uint16_t modules;
|
uint16_t modules;
|
||||||
|
|
||||||
modules=(AQH_DeviceMsg_GetModuleMaskHigh(msg)<<8) | AQH_DeviceMsg_GetModuleMaskLow(msg);
|
modules=AQH_DeviceMsg_GetModuleMask(msg);
|
||||||
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: DEVICE %s (uid=0x%08x, fw type=%d, fw ver=%d.%d, mods=0x%04x",
|
GWEN_Buffer_AppendArgs(dbuf, "0x%02x->0x%02x: DEVICE %s (uid=0x%08x, fw type=%d, fw ver=%d.%d, mods=0x%04x",
|
||||||
AQH_NodeMsg_GetSourceAddress(msg),
|
AQH_NodeMsg_GetSourceAddress(msg),
|
||||||
AQH_NodeMsg_GetDestAddress(msg),
|
AQH_NodeMsg_GetDestAddress(msg),
|
||||||
|
|||||||
@@ -18,15 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_DEVICE_UID 0 /* 4 bytes */
|
|
||||||
#define AQH_MSG_OFFS_DEVICE_FWTYPE 4 /* 2 bytes */
|
|
||||||
#define AQH_MSG_OFFS_DEVICE_FWLOW 6 /* 1 byte */
|
|
||||||
#define AQH_MSG_OFFS_DEVICE_FWHIGH 7 /* 1 byte */
|
|
||||||
#define AQH_MSG_OFFS_DEVICE_MODULESLOW 8 /* 1 byte */
|
|
||||||
#define AQH_MSG_OFFS_DEVICE_MODULESHIGH 9 /* 1 byte */
|
|
||||||
|
|
||||||
#define AQH_MSG_DEVICE_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_DEVICE_MODULESHIGH+1)
|
|
||||||
|
|
||||||
#define AQH_MSG_DEVICE_MASK_TIMER 0x02
|
#define AQH_MSG_DEVICE_MASK_TIMER 0x02
|
||||||
#define AQH_MSG_DEVICE_MASK_COM 0x04
|
#define AQH_MSG_DEVICE_MASK_COM 0x04
|
||||||
#define AQH_MSG_DEVICE_MASK_LED 0x08
|
#define AQH_MSG_DEVICE_MASK_LED 0x08
|
||||||
@@ -40,8 +31,7 @@ AQHOME_API uint32_t AQH_DeviceMsg_GetUid(const GWEN_MSG *msg);
|
|||||||
AQHOME_API uint16_t AQH_DeviceMsg_GetFirmwareType(const GWEN_MSG *msg);
|
AQHOME_API uint16_t AQH_DeviceMsg_GetFirmwareType(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint8_t AQH_DeviceMsg_GetFirmwareLow(const GWEN_MSG *msg);
|
AQHOME_API uint8_t AQH_DeviceMsg_GetFirmwareLow(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint8_t AQH_DeviceMsg_GetFirmwareHigh(const GWEN_MSG *msg);
|
AQHOME_API uint8_t AQH_DeviceMsg_GetFirmwareHigh(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint8_t AQH_DeviceMsg_GetModuleMaskLow(const GWEN_MSG *msg);
|
AQHOME_API uint16_t AQH_DeviceMsg_GetModuleMask(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint8_t AQH_DeviceMsg_GetModuleMaskHigh(const GWEN_MSG *msg);
|
|
||||||
|
|
||||||
|
|
||||||
AQHOME_API void AQH_DeviceMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_DeviceMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|||||||
@@ -18,31 +18,23 @@
|
|||||||
#include <gwenhywfar/debug.h>
|
#include <gwenhywfar/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define AQH_MSG_OFFS_HAVEADDR_UID 0
|
||||||
|
#define AQH_MSG_OFFS_HAVEADDR_ADDR 4
|
||||||
|
|
||||||
|
#define AQH_MSG_HAVEADDR_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_HAVEADDR_ADDR+1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t AQH_HaveAddrMsg_GetUid(const GWEN_MSG *msg)
|
uint32_t AQH_HaveAddrMsg_GetUid(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_HAVE_ADDRESS) &&
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_HAVEADDR_UID, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_HAVEADDR_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_HAVEADDR_UID;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_HaveAddrMsg_GetAddress(const GWEN_MSG *msg)
|
uint8_t AQH_HaveAddrMsg_GetAddress(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_HAVE_ADDRESS) &&
|
return AQH_NodeMsg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_HAVEADDR_ADDR, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_HAVEADDR_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_HAVEADDR_ADDR;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_HAVEADDR_UID 0
|
|
||||||
#define AQH_MSG_OFFS_HAVEADDR_ADDR 4
|
|
||||||
|
|
||||||
#define AQH_MSG_HAVEADDR_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_HAVEADDR_ADDR+1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHOME_API uint32_t AQH_HaveAddrMsg_GetUid(const GWEN_MSG *msg);
|
AQHOME_API uint32_t AQH_HaveAddrMsg_GetUid(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint8_t AQH_HaveAddrMsg_GetAddress(const GWEN_MSG *msg);
|
AQHOME_API uint8_t AQH_HaveAddrMsg_GetAddress(const GWEN_MSG *msg);
|
||||||
AQHOME_API void AQH_HaveAddrMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_HaveAddrMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|||||||
@@ -19,16 +19,15 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define AQH_MSG_OFFS_NEEDADDR_UID 0
|
||||||
|
|
||||||
|
#define AQH_MSG_NEEDADDR_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_NEEDADDR_UID+4)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t AQH_NeedAddrMsg_GetUid(const GWEN_MSG *msg)
|
uint32_t AQH_NeedAddrMsg_GetUid(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_NEED_ADDRESS) &&
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_NEEDADDR_UID, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_NEEDADDR_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_NEEDADDR_UID;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_NEEDADDR_UID 0
|
|
||||||
|
|
||||||
#define AQH_MSG_NEEDADDR_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_NEEDADDR_UID+4)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHOME_API uint32_t AQH_NeedAddrMsg_GetUid(const GWEN_MSG *msg);
|
AQHOME_API uint32_t AQH_NeedAddrMsg_GetUid(const GWEN_MSG *msg);
|
||||||
AQHOME_API void AQH_NeedAddrMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_NeedAddrMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|
||||||
|
|||||||
@@ -16,10 +16,15 @@
|
|||||||
#include <gwenhywfar/debug.h>
|
#include <gwenhywfar/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define COM_USE_CRC8 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef COM_USE_CRC8
|
||||||
|
static uint8_t _calcCrc8Checksum(const uint8_t *ptr, uint8_t len);
|
||||||
|
#else
|
||||||
static uint8_t _calcXorChecksum(const uint8_t *ptr, uint8_t len);
|
static uint8_t _calcXorChecksum(const uint8_t *ptr, uint8_t len);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_NodeMsg_GetDestAddress(const GWEN_MSG *msg)
|
uint8_t AQH_NodeMsg_GetDestAddress(const GWEN_MSG *msg)
|
||||||
@@ -104,8 +109,13 @@ int AQH_NodeMsg_IsMsgComplete(const GWEN_MSG *msg)
|
|||||||
|
|
||||||
int AQH_NodeMsg_IsChecksumValid(const GWEN_MSG *msg)
|
int AQH_NodeMsg_IsChecksumValid(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (msg && AQH_NodeMsg_IsMsgComplete(msg))
|
if (msg && AQH_NodeMsg_IsMsgComplete(msg)) {
|
||||||
|
#ifdef COM_USE_CRC8
|
||||||
|
return (_calcCrc8Checksum(GWEN_Msg_GetConstBuffer(msg), GWEN_Msg_GetBytesInBuffer(msg))==0)?1:0;
|
||||||
|
#else
|
||||||
return (_calcXorChecksum(GWEN_Msg_GetConstBuffer(msg), GWEN_Msg_GetBytesInBuffer(msg))==0)?1:0;
|
return (_calcXorChecksum(GWEN_Msg_GetConstBuffer(msg), GWEN_Msg_GetBytesInBuffer(msg))==0)?1:0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +126,11 @@ int AQH_NodeMsg_AddChecksum(GWEN_MSG *msg)
|
|||||||
if (msg) {
|
if (msg) {
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
|
#ifdef COM_USE_CRC8
|
||||||
|
rv=GWEN_Msg_AddByte(msg, _calcCrc8Checksum(GWEN_Msg_GetConstBuffer(msg), GWEN_Msg_GetBytesInBuffer(msg)));
|
||||||
|
#else
|
||||||
rv=GWEN_Msg_AddByte(msg, _calcXorChecksum(GWEN_Msg_GetConstBuffer(msg), GWEN_Msg_GetBytesInBuffer(msg)));
|
rv=GWEN_Msg_AddByte(msg, _calcXorChecksum(GWEN_Msg_GetConstBuffer(msg), GWEN_Msg_GetBytesInBuffer(msg)));
|
||||||
|
#endif
|
||||||
if (rv<0) {
|
if (rv<0) {
|
||||||
DBG_INFO(NULL, "here (%d)", rv);
|
DBG_INFO(NULL, "here (%d)", rv);
|
||||||
return rv;
|
return rv;
|
||||||
@@ -128,6 +142,45 @@ int AQH_NodeMsg_AddChecksum(GWEN_MSG *msg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t AQH_NodeMsg_GetUint32At(const GWEN_MSG *msg, int offs, int defaultValue)
|
||||||
|
{
|
||||||
|
if ((GWEN_Msg_GetBytesInBuffer(msg)>=offs+4)) {
|
||||||
|
const uint8_t *ptr;
|
||||||
|
|
||||||
|
ptr=GWEN_Msg_GetConstBuffer(msg)+offs;
|
||||||
|
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t AQH_NodeMsg_GetUint16At(const GWEN_MSG *msg, int offs, int defaultValue)
|
||||||
|
{
|
||||||
|
if ((GWEN_Msg_GetBytesInBuffer(msg)>=offs+2)) {
|
||||||
|
const uint8_t *ptr;
|
||||||
|
|
||||||
|
ptr=GWEN_Msg_GetConstBuffer(msg)+offs;
|
||||||
|
return (uint16_t)(ptr[0])+(ptr[1]<<8);
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint8_t AQH_NodeMsg_GetUint8At(const GWEN_MSG *msg, int offs, int defaultValue)
|
||||||
|
{
|
||||||
|
if ((GWEN_Msg_GetBytesInBuffer(msg)>=offs+1)) {
|
||||||
|
const uint8_t *ptr;
|
||||||
|
|
||||||
|
ptr=GWEN_Msg_GetConstBuffer(msg)+offs;
|
||||||
|
return ptr[0];
|
||||||
|
}
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void AQH_NodeMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
|
void AQH_NodeMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText)
|
||||||
{
|
{
|
||||||
GWEN_Buffer_AppendArgs(dbuf,
|
GWEN_Buffer_AppendArgs(dbuf,
|
||||||
@@ -171,20 +224,7 @@ uint32_t AQH_NodeMsg_GetMsgGroup(uint8_t msgType)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t _calcXorChecksum(const uint8_t *ptr, uint8_t len)
|
#ifdef COM_USE_CRC8
|
||||||
{
|
|
||||||
int i;
|
|
||||||
uint8_t x=0;
|
|
||||||
|
|
||||||
for (i=0; i<len; i++, ptr++) {
|
|
||||||
x^=*ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t _calcCrc8Checksum(const uint8_t *ptr, uint8_t len)
|
uint8_t _calcCrc8Checksum(const uint8_t *ptr, uint8_t len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -204,6 +244,21 @@ uint8_t _calcCrc8Checksum(const uint8_t *ptr, uint8_t len)
|
|||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
uint8_t _calcXorChecksum(const uint8_t *ptr, uint8_t len)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
uint8_t x=0;
|
||||||
|
|
||||||
|
for (i=0; i<len; i++, ptr++) {
|
||||||
|
x^=*ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include <gwenhywfar/buffer.h>
|
#include <gwenhywfar/buffer.h>
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MAXMSGSIZE 16
|
#define AQH_MAXMSGSIZE 24
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_ALL_DEST_ADDRESS 0
|
#define AQH_MSG_OFFS_ALL_DEST_ADDRESS 0
|
||||||
@@ -69,6 +69,10 @@ AQHOME_API int AQH_NodeMsg_IsMsgComplete(const GWEN_MSG *msg);
|
|||||||
AQHOME_API int AQH_NodeMsg_IsChecksumValid(const GWEN_MSG *msg);
|
AQHOME_API int AQH_NodeMsg_IsChecksumValid(const GWEN_MSG *msg);
|
||||||
AQHOME_API int AQH_NodeMsg_AddChecksum(GWEN_MSG *msg);
|
AQHOME_API int AQH_NodeMsg_AddChecksum(GWEN_MSG *msg);
|
||||||
|
|
||||||
|
AQHOME_API uint32_t AQH_NodeMsg_GetUint32At(const GWEN_MSG *msg, int offs, int defaultValue);
|
||||||
|
AQHOME_API uint16_t AQH_NodeMsg_GetUint16At(const GWEN_MSG *msg, int offs, int defaultValue);
|
||||||
|
AQHOME_API uint8_t AQH_NodeMsg_GetUint8At(const GWEN_MSG *msg, int offs, int defaultValue);
|
||||||
|
|
||||||
AQHOME_API void AQH_NodeMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_NodeMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|
||||||
AQHOME_API uint32_t AQH_NodeMsg_GetMsgGroup(uint8_t msgType);
|
AQHOME_API uint32_t AQH_NodeMsg_GetMsgGroup(uint8_t msgType);
|
||||||
|
|||||||
@@ -18,17 +18,15 @@
|
|||||||
#include <gwenhywfar/debug.h>
|
#include <gwenhywfar/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define AQH_MSG_OFFS_PING_TIMESTAMP 0
|
||||||
|
|
||||||
|
#define AQH_MSG_PING_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_PING_TIMESTAMP+4)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t AQH_PingMsg_GetTimestamp(const GWEN_MSG *msg)
|
uint32_t AQH_PingMsg_GetTimestamp(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_PING) &&
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_PING_TIMESTAMP, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_PING_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_PING_TIMESTAMP;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_PING_TIMESTAMP 0
|
|
||||||
|
|
||||||
#define AQH_MSG_PING_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_PING_TIMESTAMP+4)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHOME_API uint32_t AQH_PingMsg_GetTimestamp(const GWEN_MSG *msg);
|
AQHOME_API uint32_t AQH_PingMsg_GetTimestamp(const GWEN_MSG *msg);
|
||||||
AQHOME_API void AQH_PingMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_PingMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|
||||||
|
|||||||
@@ -18,17 +18,15 @@
|
|||||||
#include <gwenhywfar/debug.h>
|
#include <gwenhywfar/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define AQH_MSG_OFFS_PONG_TIMESTAMP 0
|
||||||
|
|
||||||
|
#define AQH_MSG_PONG_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_PONG_TIMESTAMP+4)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t AQH_PongMsg_GetTimestamp(const GWEN_MSG *msg)
|
uint32_t AQH_PongMsg_GetTimestamp(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_PONG) &&
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_PONG_TIMESTAMP, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_PONG_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_PONG_TIMESTAMP;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_PONG_TIMESTAMP 0
|
|
||||||
|
|
||||||
#define AQH_MSG_PONG_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_PONG_TIMESTAMP+4)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQHOME_API uint32_t AQH_PongMsg_GetTimestamp(const GWEN_MSG *msg);
|
AQHOME_API uint32_t AQH_PongMsg_GetTimestamp(const GWEN_MSG *msg);
|
||||||
AQHOME_API void AQH_PongMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_PongMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_RECVSTATS_UID 0
|
#define AQH_MSG_OFFS_RECVSTATS_UID 0
|
||||||
#define AQH_MSG_OFFS_RECVSTATS_PACKETSIN 4
|
#define AQH_MSG_OFFS_RECVSTATS_PACKETSIN 4
|
||||||
#define AQH_MSG_OFFS_RECVSTATS_CRCERRORS 6
|
#define AQH_MSG_OFFS_RECVSTATS_CRCERRORS 6
|
||||||
#define AQH_MSG_OFFS_RECVSTATS_IOERRORS 8
|
#define AQH_MSG_OFFS_RECVSTATS_IOERRORS 8
|
||||||
|
#define AQH_MSG_OFFS_RECVSTATS_NOBUFFER 10
|
||||||
|
#define AQH_MSG_OFFS_RECVSTATS_HANDLED 12
|
||||||
|
#define AQH_MSG_OFFS_RECVSTATS_MISSED 14
|
||||||
|
|
||||||
#define AQH_MSG_RECVSTATS_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_IOERRORS+2)
|
#define AQH_MSG_RECVSTATS_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_IOERRORS+2)
|
||||||
|
|
||||||
@@ -30,52 +33,49 @@
|
|||||||
|
|
||||||
uint32_t AQH_RecvStatsMsg_GetUid(const GWEN_MSG *msg)
|
uint32_t AQH_RecvStatsMsg_GetUid(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_RECVSTATS_MINSIZE) {
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_UID, 0);
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_UID;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t AQH_RecvStatsMsg_GetPacketsIn(const GWEN_MSG *msg)
|
uint16_t AQH_RecvStatsMsg_GetPacketsIn(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_RECVSTATS_MINSIZE) {
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_PACKETSIN, 0);
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_PACKETSIN;
|
|
||||||
return (uint16_t)(ptr[0])+(ptr[1]<<8);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t AQH_RecvStatsMsg_GetCrcErrors(const GWEN_MSG *msg)
|
uint16_t AQH_RecvStatsMsg_GetCrcErrors(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_RECVSTATS_MINSIZE) {
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_CRCERRORS, 0);
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_CRCERRORS;
|
|
||||||
return (uint16_t)(ptr[0])+(ptr[1]<<8);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t AQH_RecvStatsMsg_GetIoErrors(const GWEN_MSG *msg)
|
uint16_t AQH_RecvStatsMsg_GetIoErrors(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_RECVSTATS_MINSIZE) {
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_IOERRORS, 0);
|
||||||
const uint8_t *ptr;
|
}
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_IOERRORS;
|
|
||||||
return (uint16_t)(ptr[0])+(ptr[1]<<8);
|
|
||||||
}
|
uint16_t AQH_RecvStatsMsg_GetNoBufferErrors(const GWEN_MSG *msg)
|
||||||
return 0;
|
{
|
||||||
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_NOBUFFER, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t AQH_RecvStatsMsg_GetHandled(const GWEN_MSG *msg)
|
||||||
|
{
|
||||||
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_HANDLED, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
uint16_t AQH_RecvStatsMsg_GetMissed(const GWEN_MSG *msg)
|
||||||
|
{
|
||||||
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_RECVSTATS_MISSED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -85,14 +85,17 @@ void AQH_RecvStatsMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const
|
|||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_COMRECVSTATS) &&
|
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_COMRECVSTATS) &&
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_RECVSTATS_MINSIZE)) {
|
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_RECVSTATS_MINSIZE)) {
|
||||||
GWEN_Buffer_AppendArgs(dbuf,
|
GWEN_Buffer_AppendArgs(dbuf,
|
||||||
"0x%02x->0x%02x: RECVSTATS %s (uid=0x%08x, in=%d, crc errors=%d, io errors=%d)\n",
|
"0x%02x->0x%02x: RECVSTATS %s (uid=0x%08x, in=%d, crc errs=%d, io errs=%d, nobuf errs=%d, handled=%d, missed=%d)\n",
|
||||||
AQH_NodeMsg_GetSourceAddress(msg),
|
AQH_NodeMsg_GetSourceAddress(msg),
|
||||||
AQH_NodeMsg_GetDestAddress(msg),
|
AQH_NodeMsg_GetDestAddress(msg),
|
||||||
sText,
|
sText,
|
||||||
(unsigned int) AQH_RecvStatsMsg_GetUid(msg),
|
(unsigned int) AQH_RecvStatsMsg_GetUid(msg),
|
||||||
AQH_RecvStatsMsg_GetPacketsIn(msg),
|
AQH_RecvStatsMsg_GetPacketsIn(msg),
|
||||||
AQH_RecvStatsMsg_GetCrcErrors(msg),
|
AQH_RecvStatsMsg_GetCrcErrors(msg),
|
||||||
AQH_RecvStatsMsg_GetIoErrors(msg));
|
AQH_RecvStatsMsg_GetIoErrors(msg),
|
||||||
|
AQH_RecvStatsMsg_GetNoBufferErrors(msg),
|
||||||
|
AQH_RecvStatsMsg_GetHandled(msg),
|
||||||
|
AQH_RecvStatsMsg_GetMissed(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ AQHOME_API uint32_t AQH_RecvStatsMsg_GetUid(const GWEN_MSG *msg);
|
|||||||
AQHOME_API uint16_t AQH_RecvStatsMsg_GetPacketsIn(const GWEN_MSG *msg);
|
AQHOME_API uint16_t AQH_RecvStatsMsg_GetPacketsIn(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint16_t AQH_RecvStatsMsg_GetCrcErrors(const GWEN_MSG *msg);
|
AQHOME_API uint16_t AQH_RecvStatsMsg_GetCrcErrors(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint16_t AQH_RecvStatsMsg_GetIoErrors(const GWEN_MSG *msg);
|
AQHOME_API uint16_t AQH_RecvStatsMsg_GetIoErrors(const GWEN_MSG *msg);
|
||||||
|
AQHOME_API uint16_t AQH_RecvStatsMsg_GetNoBufferErrors(const GWEN_MSG *msg);
|
||||||
|
AQHOME_API uint16_t AQH_RecvStatsMsg_GetHandled(const GWEN_MSG *msg);
|
||||||
|
AQHOME_API uint16_t AQH_RecvStatsMsg_GetMissed(const GWEN_MSG *msg);
|
||||||
|
|
||||||
|
|
||||||
AQHOME_API void AQH_RecvStatsMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_RecvStatsMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#define AQH_MSG_OFFS_SENDSTATS_PACKETSOUT 4
|
#define AQH_MSG_OFFS_SENDSTATS_PACKETSOUT 4
|
||||||
#define AQH_MSG_OFFS_SENDSTATS_COLLISIONS 6
|
#define AQH_MSG_OFFS_SENDSTATS_COLLISIONS 6
|
||||||
#define AQH_MSG_OFFS_SENDSTATS_ABORTED 8
|
#define AQH_MSG_OFFS_SENDSTATS_ABORTED 8
|
||||||
|
#define AQH_MSG_OFFS_SENDSTATS_NOBUFFER 10
|
||||||
|
|
||||||
#define AQH_MSG_SENDSTATS_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_ABORTED+2)
|
#define AQH_MSG_SENDSTATS_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_ABORTED+2)
|
||||||
|
|
||||||
@@ -29,56 +30,35 @@
|
|||||||
|
|
||||||
uint32_t AQH_SendStatsMsg_GetUid(const GWEN_MSG *msg)
|
uint32_t AQH_SendStatsMsg_GetUid(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_COMSENDSTATS) &&
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_UID, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_SENDSTATS_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_UID;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t AQH_SendStatsMsg_GetPacketsOut(const GWEN_MSG *msg)
|
uint16_t AQH_SendStatsMsg_GetPacketsOut(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_COMSENDSTATS) &&
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_PACKETSOUT, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_SENDSTATS_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_PACKETSOUT;
|
|
||||||
return (uint16_t)(ptr[0])+(ptr[1]<<8);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t AQH_SendStatsMsg_GetCollisions(const GWEN_MSG *msg)
|
uint16_t AQH_SendStatsMsg_GetCollisions(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_COMSENDSTATS) &&
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_COLLISIONS, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_SENDSTATS_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_COLLISIONS;
|
|
||||||
return (uint16_t)(ptr[0])+(ptr[1]<<8);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint16_t AQH_SendStatsMsg_GetAborted(const GWEN_MSG *msg)
|
uint16_t AQH_SendStatsMsg_GetAborted(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_COMSENDSTATS) &&
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_ABORTED, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_SENDSTATS_MINSIZE)) {
|
}
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_ABORTED;
|
|
||||||
return (uint16_t)(ptr[0])+(ptr[1]<<8);
|
|
||||||
}
|
uint16_t AQH_SendStatsMsg_GetNoBufferErrors(const GWEN_MSG *msg)
|
||||||
return 0;
|
{
|
||||||
|
return AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_SENDSTATS_NOBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -88,14 +68,15 @@ void AQH_SendStatsMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const
|
|||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_COMSENDSTATS) &&
|
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_COMSENDSTATS) &&
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_SENDSTATS_MINSIZE)) {
|
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_SENDSTATS_MINSIZE)) {
|
||||||
GWEN_Buffer_AppendArgs(dbuf,
|
GWEN_Buffer_AppendArgs(dbuf,
|
||||||
"0x%02x->0x%02x: SENDSTATS %s (uid=0x%08x, out=%d, collisions=%d, aborted=%d)\n",
|
"0x%02x->0x%02x: SENDSTATS %s (uid=0x%08x, out=%d, collisions=%d, aborted=%d, no buffer=%d)\n",
|
||||||
AQH_NodeMsg_GetSourceAddress(msg),
|
AQH_NodeMsg_GetSourceAddress(msg),
|
||||||
AQH_NodeMsg_GetDestAddress(msg),
|
AQH_NodeMsg_GetDestAddress(msg),
|
||||||
sText,
|
sText,
|
||||||
(unsigned int) AQH_SendStatsMsg_GetUid(msg),
|
(unsigned int) AQH_SendStatsMsg_GetUid(msg),
|
||||||
AQH_SendStatsMsg_GetPacketsOut(msg),
|
AQH_SendStatsMsg_GetPacketsOut(msg),
|
||||||
AQH_SendStatsMsg_GetCollisions(msg),
|
AQH_SendStatsMsg_GetCollisions(msg),
|
||||||
AQH_SendStatsMsg_GetAborted(msg));
|
AQH_SendStatsMsg_GetAborted(msg),
|
||||||
|
AQH_SendStatsMsg_GetNoBufferErrors(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ AQHOME_API uint32_t AQH_SendStatsMsg_GetUid(const GWEN_MSG *msg);
|
|||||||
AQHOME_API uint16_t AQH_SendStatsMsg_GetPacketsOut(const GWEN_MSG *msg);
|
AQHOME_API uint16_t AQH_SendStatsMsg_GetPacketsOut(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint16_t AQH_SendStatsMsg_GetCollisions(const GWEN_MSG *msg);
|
AQHOME_API uint16_t AQH_SendStatsMsg_GetCollisions(const GWEN_MSG *msg);
|
||||||
AQHOME_API uint16_t AQH_SendStatsMsg_GetAborted(const GWEN_MSG *msg);
|
AQHOME_API uint16_t AQH_SendStatsMsg_GetAborted(const GWEN_MSG *msg);
|
||||||
|
AQHOME_API uint16_t AQH_SendStatsMsg_GetNoBufferErrors(const GWEN_MSG *msg);
|
||||||
|
|
||||||
|
|
||||||
AQHOME_API void AQH_SendStatsMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
AQHOME_API void AQH_SendStatsMsg_DumpToBuffer(const GWEN_MSG *msg, GWEN_BUFFER *dbuf, const char *sText);
|
||||||
|
|||||||
@@ -22,42 +22,21 @@
|
|||||||
|
|
||||||
uint32_t AQH_ValueMsg_GetTimestamp(const GWEN_MSG *msg)
|
uint32_t AQH_ValueMsg_GetTimestamp(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_VALUE) &&
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE_TIMESTAMP, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE_TIMESTAMP;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_ValueMsg_GetValueId(const GWEN_MSG *msg)
|
uint8_t AQH_ValueMsg_GetValueId(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_VALUE) &&
|
return AQH_NodeMsg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE_VALUEID, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE_VALUEID;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_ValueMsg_GetValueType(const GWEN_MSG *msg)
|
uint8_t AQH_ValueMsg_GetValueType(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_VALUE) &&
|
return AQH_NodeMsg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE_VALUETYPE, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE_VALUETYPE;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,72 +19,47 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define AQH_MSG_OFFS_VALUE2_UID 0
|
||||||
|
#define AQH_MSG_OFFS_VALUE2_VALUEID 4
|
||||||
|
#define AQH_MSG_OFFS_VALUE2_VALUETYPE 5
|
||||||
|
#define AQH_MSG_OFFS_VALUE2_VALUE 6
|
||||||
|
#define AQH_MSG_OFFS_VALUE2_DENOM 8
|
||||||
|
|
||||||
|
#define AQH_MSG_VALUE2_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_DENOM+2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint32_t AQH_Value2Msg_GetUid(const GWEN_MSG *msg)
|
uint32_t AQH_Value2Msg_GetUid(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_VALUE2) &&
|
return AQH_NodeMsg_GetUint32At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_UID, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE2_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_TIMESTAMP;
|
|
||||||
return (uint32_t)(ptr[0])+(ptr[1]<<8)+(ptr[2]<<16)+(ptr[3]<<24);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_Value2Msg_GetValueId(const GWEN_MSG *msg)
|
uint8_t AQH_Value2Msg_GetValueId(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_VALUE2) &&
|
return AQH_NodeMsg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_VALUEID, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE2_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_VALUEID;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t AQH_Value2Msg_GetValueType(const GWEN_MSG *msg)
|
uint8_t AQH_Value2Msg_GetValueType(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_VALUE2) &&
|
return AQH_NodeMsg_GetUint8At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_VALUETYPE, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE2_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_VALUETYPE;
|
|
||||||
return ptr[0];
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int16_t AQH_Value2Msg_GetValueNom(const GWEN_MSG *msg)
|
int16_t AQH_Value2Msg_GetValueNom(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if ((AQH_NodeMsg_GetMsgType(msg)==AQH_MSG_TYPE_VALUE2) &&
|
return (int16_t) AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_VALUE, 0);
|
||||||
(GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE2_MINSIZE)) {
|
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_VALUE;
|
|
||||||
return (int16_t)((uint16_t)((ptr[0])+(ptr[1]<<8)));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int16_t AQH_Value2Msg_GetValueDenom(const GWEN_MSG *msg)
|
int16_t AQH_Value2Msg_GetValueDenom(const GWEN_MSG *msg)
|
||||||
{
|
{
|
||||||
if (GWEN_Msg_GetBytesInBuffer(msg)>=AQH_MSG_VALUE2_MINSIZE) {
|
return (int16_t) AQH_NodeMsg_GetUint16At(msg, AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_DENOM, 0);
|
||||||
const uint8_t *ptr;
|
|
||||||
|
|
||||||
ptr=GWEN_Msg_GetConstBuffer(msg)+AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_DENOM;
|
|
||||||
return (int16_t)((uint16_t)((ptr[0])+(ptr[1]<<8)));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,6 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define AQH_MSG_OFFS_VALUE2_TIMESTAMP 0
|
|
||||||
#define AQH_MSG_OFFS_VALUE2_VALUEID 4
|
|
||||||
#define AQH_MSG_OFFS_VALUE2_VALUETYPE 5
|
|
||||||
#define AQH_MSG_OFFS_VALUE2_VALUE 6
|
|
||||||
#define AQH_MSG_OFFS_VALUE2_DENOM 8
|
|
||||||
|
|
||||||
#define AQH_MSG_VALUE2_MINSIZE (AQH_MSG_OFFS_ALL_DATA_BEGIN+AQH_MSG_OFFS_VALUE2_DENOM+2)
|
|
||||||
|
|
||||||
#define AQH_MSG_VALUE2_TYPE_TEMP 1
|
#define AQH_MSG_VALUE2_TYPE_TEMP 1
|
||||||
#define AQH_MSG_VALUE2_TYPE_HUMIDITY 2
|
#define AQH_MSG_VALUE2_TYPE_HUMIDITY 2
|
||||||
|
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ void _handleMsgDevice(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_MSG_ENDPOINT *ep, const
|
|||||||
if (ni) {
|
if (ni) {
|
||||||
AQH_NodeInfo_SetFirmwareType(ni, AQH_DeviceMsg_GetFirmwareType(msg));
|
AQH_NodeInfo_SetFirmwareType(ni, AQH_DeviceMsg_GetFirmwareType(msg));
|
||||||
AQH_NodeInfo_SetFirmwareVersion(ni, (AQH_DeviceMsg_GetFirmwareHigh(msg)<<8) | AQH_DeviceMsg_GetFirmwareLow(msg));
|
AQH_NodeInfo_SetFirmwareVersion(ni, (AQH_DeviceMsg_GetFirmwareHigh(msg)<<8) | AQH_DeviceMsg_GetFirmwareLow(msg));
|
||||||
AQH_NodeInfo_SetModules(ni, (AQH_DeviceMsg_GetModuleMaskHigh(msg)<<8) | AQH_DeviceMsg_GetModuleMaskLow(msg));
|
AQH_NodeInfo_SetModules(ni, AQH_DeviceMsg_GetModuleMask(msg));
|
||||||
AQH_NodeDb_SetModified(xmgr->nodeDb);
|
AQH_NodeDb_SetModified(xmgr->nodeDb);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -198,6 +198,7 @@ Offset Length Meaning
|
|||||||
8 2 packets out
|
8 2 packets out
|
||||||
10 2 collisions
|
10 2 collisions
|
||||||
12 2 aborted
|
12 2 aborted
|
||||||
|
14 2 no buffer errors
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -215,5 +216,9 @@ Offset Length Meaning
|
|||||||
8 2 packets in
|
8 2 packets in
|
||||||
10 2 crc errors
|
10 2 crc errors
|
||||||
12 2 io errors
|
12 2 io errors
|
||||||
|
14 2 no buffer errors
|
||||||
|
16 2 handled packets
|
||||||
|
18 2 missed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
10
avr/com.asm
10
avr/com.asm
@@ -63,13 +63,15 @@ comDataBegin:
|
|||||||
|
|
||||||
comStatsRecvErrs: .byte 2
|
comStatsRecvErrs: .byte 2
|
||||||
comStatsRecvCrcErrs: .byte 2
|
comStatsRecvCrcErrs: .byte 2
|
||||||
comStatsCollisions: .byte 2
|
|
||||||
comStatsMissed: .byte 2
|
comStatsMissed: .byte 2
|
||||||
comStatsAborted: .byte 2
|
|
||||||
comStatsIgnored: .byte 2
|
comStatsIgnored: .byte 2
|
||||||
comStatsHandled: .byte 2
|
comStatsHandled: .byte 2
|
||||||
|
|
||||||
comStatsNoBuffer: .byte 2
|
comStatsCollisions: .byte 2
|
||||||
|
comStatsAborted: .byte 2
|
||||||
|
|
||||||
|
comStatsSendNoBuffer: .byte 2
|
||||||
|
comStatsRecvNoBuffer: .byte 2
|
||||||
|
|
||||||
comRecvBuffersReadPos: .byte 1
|
comRecvBuffersReadPos: .byte 1
|
||||||
comRecvBuffersWritePos: .byte 1
|
comRecvBuffersWritePos: .byte 1
|
||||||
@@ -223,6 +225,8 @@ COM_AllocBufferAndGetXY:
|
|||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
COM_AllocBufferAndGetXY_error:
|
COM_AllocBufferAndGetXY_error:
|
||||||
|
ldi xl, LOW(comStatsSendNoBuffer)
|
||||||
|
ldi xh, HIGH(comStatsSendNoBuffer)
|
||||||
clc
|
clc
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#define COM_USE_CRC8 1
|
||||||
|
#define COM_CRC_POLYNOMIAL 0x97
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; ***************************************************************************
|
; ***************************************************************************
|
||||||
; code
|
; code
|
||||||
|
|
||||||
@@ -14,15 +20,20 @@
|
|||||||
; - X : pointer to packet buffer
|
; - X : pointer to packet buffer
|
||||||
; OUT:
|
; OUT:
|
||||||
; - CFLAG: set if okay, clear otherwise
|
; - CFLAG: set if okay, clear otherwise
|
||||||
; MODIFIED REGS: R16, R17, R18, X
|
; MODIFIED REGS: R16, R17, R18, R19, X
|
||||||
|
|
||||||
comCalcAndAddChecksumByte:
|
comCalcAndAddChecksumByte:
|
||||||
adiw xh:xl, COM_MSG_OFFS_MSGLEN
|
adiw xh:xl, COM_MSG_OFFS_MSGLEN
|
||||||
ld r18, X ; read msg len
|
ld r18, X ; read msg len
|
||||||
inc r18 ; account for dest address
|
inc r18 ; account for dest address
|
||||||
inc r18 ; account for msg len bytes
|
inc r18 ; account for msg len byte
|
||||||
sbiw xh:xl, COM_MSG_OFFS_MSGLEN
|
sbiw xh:xl, COM_MSG_OFFS_MSGLEN
|
||||||
|
#ifdef COM_USE_CRC8
|
||||||
|
ldi r19, COM_CRC_POLYNOMIAL
|
||||||
|
rcall cproCalcCrc8 ; (R16, R17, R18, R20, X)
|
||||||
|
#else
|
||||||
rcall cproCalcXor ; (R16, R17, R18, X)
|
rcall cproCalcXor ; (R16, R17, R18, X)
|
||||||
|
#endif
|
||||||
st X, r16 ; add checksum byte
|
st X, r16 ; add checksum byte
|
||||||
sec
|
sec
|
||||||
ret
|
ret
|
||||||
@@ -36,15 +47,20 @@ comCalcAndAddChecksumByte:
|
|||||||
; - X : pointer to packet buffer
|
; - X : pointer to packet buffer
|
||||||
; OUT:
|
; OUT:
|
||||||
; - CFLAG: set if okay, clear otherwise
|
; - CFLAG: set if okay, clear otherwise
|
||||||
; MODIFIED REGS: R16, R17, R18, X
|
; MODIFIED REGS: R16, R17, R18, R19, R20, X
|
||||||
|
|
||||||
cproCheckMessageInBuffer:
|
cproCheckMessageInBuffer:
|
||||||
adiw xh:xl, COM_MSG_OFFS_MSGLEN
|
adiw xh:xl, COM_MSG_OFFS_MSGLEN
|
||||||
ld r18, X ; read msg len
|
ld r18, X ; read msg len
|
||||||
inc r18 ; account for dest address
|
inc r18 ; account for dest address
|
||||||
inc r18 ; account for msg len bytes
|
inc r18 ; account for msg len byte
|
||||||
sbiw xh:xl, COM_MSG_OFFS_MSGLEN
|
sbiw xh:xl, COM_MSG_OFFS_MSGLEN
|
||||||
|
#ifdef COM_USE_CRC8
|
||||||
|
ldi r19, COM_CRC_POLYNOMIAL
|
||||||
|
rcall cproCalcCrc8 ; (R16, R17, R18, R20, X)
|
||||||
|
#else
|
||||||
rcall cproCalcXor ; (R16, R17, R18, X)
|
rcall cproCalcXor ; (R16, R17, R18, X)
|
||||||
|
#endif
|
||||||
ld r17, X
|
ld r17, X
|
||||||
cp r16,r17 ; should be equal
|
cp r16,r17 ; should be equal
|
||||||
brne cproCheckMessageInBuffer_error
|
brne cproCheckMessageInBuffer_error
|
||||||
|
|||||||
@@ -21,8 +21,8 @@
|
|||||||
comReceivePacketHandleBuffer:
|
comReceivePacketHandleBuffer:
|
||||||
rcall COM_BufferAlloc
|
rcall COM_BufferAlloc
|
||||||
brcs comReceivePacketHandleBuffer_haveBuffer
|
brcs comReceivePacketHandleBuffer_haveBuffer
|
||||||
ldi xl, LOW(comStatsNoBuffer)
|
ldi xl, LOW(comStatsRecvNoBuffer)
|
||||||
ldi xh, HIGH(comStatsNoBuffer)
|
ldi xh, HIGH(comStatsRecvNoBuffer)
|
||||||
rjmp comReceivePacketHandleBuffer_errorWithCounter
|
rjmp comReceivePacketHandleBuffer_errorWithCounter
|
||||||
|
|
||||||
comReceivePacketHandleBuffer_haveBuffer:
|
comReceivePacketHandleBuffer_haveBuffer:
|
||||||
@@ -72,7 +72,7 @@ comReceivePacketHandleBuffer_notforme:
|
|||||||
; OUT:
|
; OUT:
|
||||||
; - CFLAG: set if okay, clear otherwise
|
; - CFLAG: set if okay, clear otherwise
|
||||||
; - R16: error code if CFLAG cleared
|
; - R16: error code if CFLAG cleared
|
||||||
; MODIFIED REGISTERS: r16, r17, r18, X (r20, r21, r22)
|
; MODIFIED REGISTERS: r16, r17, r18, X (r19, r20, r21, r22)
|
||||||
|
|
||||||
comReceivePacketToXandCheck:
|
comReceivePacketToXandCheck:
|
||||||
push xh
|
push xh
|
||||||
@@ -81,7 +81,7 @@ comReceivePacketToXandCheck:
|
|||||||
pop xl
|
pop xl
|
||||||
pop xh
|
pop xh
|
||||||
brcc comReceivePacketToXandCheck_error
|
brcc comReceivePacketToXandCheck_error
|
||||||
rcall cproCheckMessageInBuffer ; (R16, R17, R18, X)
|
rcall cproCheckMessageInBuffer ; (R16, R17, R18, R19, R20, X)
|
||||||
ldi r16, COM_ERR_CHECKSUM
|
ldi r16, COM_ERR_CHECKSUM
|
||||||
brcc comReceivePacketToXandCheck_error
|
brcc comReceivePacketToXandCheck_error
|
||||||
sec
|
sec
|
||||||
|
|||||||
@@ -31,12 +31,12 @@
|
|||||||
.equ CPRO_PAYLOAD_FLAGS_SECONDS = 0x01
|
.equ CPRO_PAYLOAD_FLAGS_SECONDS = 0x01
|
||||||
.equ CPRO_PAYLOAD_FLAGS_UID = 0x02
|
.equ CPRO_PAYLOAD_FLAGS_UID = 0x02
|
||||||
.equ CPRO_PAYLOAD_FLAGS_RESERVED1 = 0x04
|
.equ CPRO_PAYLOAD_FLAGS_RESERVED1 = 0x04
|
||||||
.equ CPRO_PAYLOAD_FLAGS_RESERVED2 = 0x08
|
.equ CPRO_PAYLOAD_FLAGS_NUM0 = 0x08
|
||||||
.equ CPRO_PAYLOAD_FLAGS_RESERVED3 = 0x10
|
.equ CPRO_PAYLOAD_FLAGS_NUM1 = 0x10
|
||||||
.equ CPRO_PAYLOAD_FLAGS_NUM0 = 0x20
|
.equ CPRO_PAYLOAD_FLAGS_NUM2 = 0x20
|
||||||
.equ CPRO_PAYLOAD_FLAGS_NUM1 = 0x40
|
.equ CPRO_PAYLOAD_FLAGS_NUM3 = 0x40
|
||||||
.equ CPRO_PAYLOAD_FLAGS_NUM3 = 0x80
|
.equ CPRO_PAYLOAD_FLAGS_NUM4 = 0x80
|
||||||
.equ CPRO_PAYLOAD_FLAGS_SHIFT_NUM = 5
|
.equ CPRO_PAYLOAD_FLAGS_SHIFT_NUM = 3
|
||||||
|
|
||||||
|
|
||||||
.equ CPRO_PACKET_HAVEADDR_OFFS_ADDRESS = COM_MSG_OFFS_PAYLOAD+4
|
.equ CPRO_PACKET_HAVEADDR_OFFS_ADDRESS = COM_MSG_OFFS_PAYLOAD+4
|
||||||
@@ -244,7 +244,7 @@ cproEnqueueMsgWithCmdAndSrcAddr:
|
|||||||
pop r20
|
pop r20
|
||||||
pop xl
|
pop xl
|
||||||
pop xh
|
pop xh
|
||||||
rcall comCalcAndAddChecksumByte
|
rcall comCalcAndAddChecksumByte ; (R16, R17, R18, R19, X)
|
||||||
|
|
||||||
; mark buffer as enqueued with PRIO given in R20
|
; mark buffer as enqueued with PRIO given in R20
|
||||||
rcall COM_EnqueuePacket ; (R15, R16)
|
rcall COM_EnqueuePacket ; (R15, R16)
|
||||||
@@ -331,9 +331,7 @@ cproCalcPayloadSize_l1:
|
|||||||
brcc cproCalcPayloadSize_l2
|
brcc cproCalcPayloadSize_l2
|
||||||
add r4, r17 ; add 4 bytes
|
add r4, r17 ; add 4 bytes
|
||||||
cproCalcPayloadSize_l2:
|
cproCalcPayloadSize_l2:
|
||||||
lsr r16
|
lsr r16 ; shift out reserved1, after this R16 contains CPRO_PAYLOAD_FLAGS_NUM0-4
|
||||||
lsr r16
|
|
||||||
lsr r16 ; after this R16 contains CPRO_PAYLOAD_FLAGS_NUM0-3
|
|
||||||
add r16, r4 ; add previous bytes to R16
|
add r16, r4 ; add previous bytes to R16
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ cproEnqueueAddressPacket:
|
|||||||
st X+, r6 ; 5: value id
|
st X+, r6 ; 5: value id
|
||||||
pop xl
|
pop xl
|
||||||
pop xh
|
pop xh
|
||||||
rcall comCalcAndAddChecksumByte
|
rcall comCalcAndAddChecksumByte ; (R16, R17, R18, R19, X)
|
||||||
|
|
||||||
; mark buffer as enqueued with PRIO "important" (higher retry count)
|
; mark buffer as enqueued with PRIO "important" (higher retry count)
|
||||||
ldi r20, COM_BUFFER_PRIO_IMPORTANT
|
ldi r20, COM_BUFFER_PRIO_IMPORTANT
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ CPRO_EnqueueDevice:
|
|||||||
st X+, r17 ; 11: modules mask low
|
st X+, r17 ; 11: modules mask low
|
||||||
pop xl
|
pop xl
|
||||||
pop xh
|
pop xh
|
||||||
rcall comCalcAndAddChecksumByte
|
rcall comCalcAndAddChecksumByte ; (R16, R17, R18, R19, X)
|
||||||
|
|
||||||
; mark buffer as enqueued with PRIO "normal" (slightly limited number of retries)
|
; mark buffer as enqueued with PRIO "normal" (slightly limited number of retries)
|
||||||
ldi r20, COM_BUFFER_PRIO_NORMAL
|
ldi r20, COM_BUFFER_PRIO_NORMAL
|
||||||
|
|||||||
@@ -23,26 +23,30 @@ CPRO_EnqueueComSendStats:
|
|||||||
pop r16
|
pop r16
|
||||||
brcc CPRO_EnqueueComSendStats_error
|
brcc CPRO_EnqueueComSendStats_error
|
||||||
|
|
||||||
ldi r17, CPRO_PAYLOAD_FLAGS_UID | (6<<CPRO_PAYLOAD_FLAGS_SHIFT_NUM) ; seconds + 6 bytes payload
|
ldi r17, CPRO_PAYLOAD_FLAGS_UID | (8<<CPRO_PAYLOAD_FLAGS_SHIFT_NUM) ; seconds + 8 bytes payload
|
||||||
ldi r18, CPRO_CMD_COMSENDSTATS
|
ldi r18, CPRO_CMD_COMSENDSTATS
|
||||||
push xh
|
push xh
|
||||||
push xl
|
push xl
|
||||||
rcall cproBeginMsgWithVariablePayload ; (R3, R4, R16, R17, R18, R19, R20, R21, X)
|
rcall cproBeginMsgWithVariablePayload ; (R3, R4, R16, R17, R18, R19, R20, R21, X)
|
||||||
lds r16, comStatsPacketsOut ; 6: packets out
|
lds r16, comStatsPacketsOut ; packets out
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsPacketsOut+1
|
lds r16, comStatsPacketsOut+1
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsCollisions ; 8: collisions
|
lds r16, comStatsCollisions ; collisions
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsCollisions+1
|
lds r16, comStatsCollisions+1
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsAborted ; 10: aborted
|
lds r16, comStatsAborted ; aborted
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsAborted+1
|
lds r16, comStatsAborted+1
|
||||||
st X+, r16
|
st X+, r16
|
||||||
|
lds r16, comStatsSendNoBuffer ; sendNoBuffer
|
||||||
|
st X+, r16
|
||||||
|
lds r16, comStatsSendNoBuffer+1
|
||||||
|
st X+, r16
|
||||||
pop xl
|
pop xl
|
||||||
pop xh
|
pop xh
|
||||||
rcall comCalcAndAddChecksumByte
|
rcall comCalcAndAddChecksumByte ; (R16, R17, R18, R19, X)
|
||||||
|
|
||||||
; mark buffer as enqueued with PRIO "important" (higher retry count)
|
; mark buffer as enqueued with PRIO "important" (higher retry count)
|
||||||
ldi r20, COM_BUFFER_PRIO_IMPORTANT
|
ldi r20, COM_BUFFER_PRIO_IMPORTANT
|
||||||
@@ -78,26 +82,38 @@ CPRO_EnqueueComRecvStats:
|
|||||||
pop r16
|
pop r16
|
||||||
brcc CPRO_EnqueueComRecvStats_error
|
brcc CPRO_EnqueueComRecvStats_error
|
||||||
|
|
||||||
ldi r17, CPRO_PAYLOAD_FLAGS_UID | (6<<CPRO_PAYLOAD_FLAGS_SHIFT_NUM) ; seconds + 6 bytes payload
|
ldi r17, CPRO_PAYLOAD_FLAGS_UID | (12<<CPRO_PAYLOAD_FLAGS_SHIFT_NUM) ; seconds + 6 bytes payload
|
||||||
ldi r18, CPRO_CMD_COMRECVSTATS
|
ldi r18, CPRO_CMD_COMRECVSTATS
|
||||||
push xh
|
push xh
|
||||||
push xl
|
push xl
|
||||||
rcall cproBeginMsgWithVariablePayload ; (R3, R4, R16, R17, R18, R19, R20, R21, X)
|
rcall cproBeginMsgWithVariablePayload ; (R3, R4, R16, R17, R18, R19, R20, R21, X)
|
||||||
lds r16, comStatsPacketsIn ; 6: packets in
|
lds r16, comStatsPacketsIn ; packets in
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsPacketsIn+1
|
lds r16, comStatsPacketsIn+1
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsRecvCrcErrs ; 8: CRC errors
|
lds r16, comStatsRecvCrcErrs ; CRC errors
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsRecvCrcErrs+1
|
lds r16, comStatsRecvCrcErrs+1
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsRecvErrs ; 10: IO errors
|
lds r16, comStatsRecvErrs ; IO errors
|
||||||
st X+, r16
|
st X+, r16
|
||||||
lds r16, comStatsRecvErrs+1
|
lds r16, comStatsRecvErrs+1
|
||||||
st X+, r16
|
st X+, r16
|
||||||
|
lds r16, comStatsRecvNoBuffer ; no buffer
|
||||||
|
st X+, r16
|
||||||
|
lds r16, comStatsRecvNoBuffer+1
|
||||||
|
st X+, r16
|
||||||
|
lds r16, comStatsHandled ; handled
|
||||||
|
st X+, r16
|
||||||
|
lds r16, comStatsHandled+1
|
||||||
|
st X+, r16
|
||||||
|
lds r16, comStatsMissed ; missed
|
||||||
|
st X+, r16
|
||||||
|
lds r16, comStatsMissed+1
|
||||||
|
st X+, r16
|
||||||
pop xl
|
pop xl
|
||||||
pop xh
|
pop xh
|
||||||
rcall comCalcAndAddChecksumByte
|
rcall comCalcAndAddChecksumByte ; (R16, R17, R18, R19, X)
|
||||||
|
|
||||||
; mark buffer as enqueued with PRIO "important" (higher retry count)
|
; mark buffer as enqueued with PRIO "important" (higher retry count)
|
||||||
ldi r20, COM_BUFFER_PRIO_IMPORTANT
|
ldi r20, COM_BUFFER_PRIO_IMPORTANT
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ CPRO_EnqueueValue:
|
|||||||
st X+, r11 ; 11: high denom
|
st X+, r11 ; 11: high denom
|
||||||
pop xl
|
pop xl
|
||||||
pop xh
|
pop xh
|
||||||
rcall comCalcAndAddChecksumByte
|
rcall comCalcAndAddChecksumByte ; (R16, R17, R18, R19, X)
|
||||||
|
|
||||||
; mark buffer as enqueued with PRIO "normal" (slightly limited number of retries)
|
; mark buffer as enqueued with PRIO "normal" (slightly limited number of retries)
|
||||||
ldi r20, COM_BUFFER_PRIO_NORMAL
|
ldi r20, COM_BUFFER_PRIO_NORMAL
|
||||||
|
|||||||
Reference in New Issue
Block a user