HPM APP
HPMicro Application solution
monitor_profile.h File Reference
#include <stdio.h>
#include <stdint.h>
#include "monitor_kconfig.h"

Go to the source code of this file.

Macros

#define MONITOR_PROFILE_VERSION   (2)
 
#define MONITOR_START_CMD   (0x4850)
 
#define MONITOR_MAGIC_CMD   (0x4D44)
 
#define MONITOR_END_CMD   (0xA55A)
 
#define MONITOR_CMD_HOST_MASK   (0x8000)
 
#define MONITOR_PAYLOAD_MAXSIZE   (MONITOR_PROFILE_MAXSIZE - sizeof(monitor_profile_t))
 
#define MONITOR_PROFILE_MIN_SIZE   (sizeof(monitor_profile_t) - 4)
 
#define MONITOR_PAYLOAD_DATA_OFFSET   ((MONITOR_PROFILE_MIN_SIZE-2)+(sizeof(monitor_payload_t)-4)+(sizeof(data_payload_t)-4))
 
#define MONITOR_RESULT_ACK_MASK   (0x8000)
 
#define MONITOR_PROFILE_CRC_OFFSET   (14)
 
#define MONITOR_PAYLOAD_CH_MASK   (0xFFFF0000)
 
#define MONITOR_PAYLOAD_CH_DATA(ch)   (ch & ~MONITOR_PAYLOAD_CH_MASK)
 

Typedefs

typedef struct __attribute__ aligned
 

Enumerations

enum  DEVICE_CMD {
  CMD_INVALID = 0x0000 , CMD_CONNECT = 0x0001 , CMD_GETINFO = 0x0002 , CMD_GETVALUE = 0x00A0 ,
  CMD_SETVALUE = 0x00A1 , CMD_NOTIFY = 0x0A00 , CMD_STREAM = 0x0B00 , CMD_BUFFER = 0x0C00 ,
  CMD_TRIGGER = 0x0D00
}
 
enum  DATA_TYPE {
  TYPE_BOOL = 0x0 , TYPE_UINT8 = 0x01 , TYPE_INT8 = 0x02 , TYPE_UINT16 = 0x03 ,
  TYPE_INT16 = 0x04 , TYPE_UINT32 = 0x05 , TYPE_INT32 = 0x06 , TYPE_UINT64 = 0x07 ,
  TYPE_INT64 = 0x08 , TYPE_FLOAT = 0x09 , TYPE_DOUBLE = 0x0A , TYPE_STRUCT = 0x0B ,
  TYPE_ARRAY_STRUCT = 0x0C , TYPE_ARRAY_UINT8 = 0x0D , TYPE_ARRAY_INT8 = 0x0E , TYPE_ARRAY_UINT16 = 0x0F ,
  TYPE_ARRAY_INT16 = 0x10 , TYPE_ARRAY_UINT32 = 0x11 , TYPE_ARRAY_INT32 = 0x12 , TYPE_ARRAY_UINT64 = 0x13 ,
  TYPE_ARRAY_INT64 = 0x14 , TYPE_ARRAY_FLOAT = 0x15 , TYPE_ARRAY_DOUBLE = 0x16 , TYPE_UNKNOWN = 0xA0
}
 
enum  MONITOR_RESULT {
  RESULT_BAD = 0x0001 , RESULT_HEAD_ERR = 0x0002 , RESULT_VER_ERR = 0x0003 , RESULT_CRC_ERR = 0x0004 ,
  RESULT_PAYLOAD_ERR = 0x0005 , RESULT_GET_ERR = 0x0006 , RESULT_SET_ERR = 0x0007 , RESULT_DATA_LEN_ERR = 0x0008 ,
  RESULT_DATA_TYPE_ERR = 0x0009 , RESULT_PRFILE_OVERFLOW = 0x000A , RESULT_CMD_ERR = 0x000B , RESULT_CONFIG_ERR = 0x000C ,
  RESULT_RUNNING_ERR = 0x000D , RESULT_SUCCESS = 0x00FF , RESULT_ON = 0x02FF , RESULT_OFF = 0x01FF ,
  RESULT_LOSS = 0x0FFF
}
 
enum  TRIGGER_MODE {
  TRIGGER_MODE_EDGE_BOTH = 0 , TRIGGER_MODE_EDGE_RISING , TRIGGER_MODE_EDGE_FALLING , TRIGGER_MODE_LEVEL_LOW ,
  TRIGGER_MODE_LEVEL_HIGH
}
 
enum  TRIGGER_EXPR { TRIGGER_EXPR_AND = 0 , TRIGGER_EXPR_OR }
 

Functions

 aligned (1))) data_payload_t
 
uint16_t monitor_get_value (uint8_t type, uint32_t addr, uint8_t *data)
 
uint16_t monitor_set_value (uint8_t type, uint32_t addr, uint8_t *data)
 
bool payload_is_channel_type (uint32_t value)
 
int monitor_type_convert_byte (DATA_TYPE type)
 
uint32_t monitor_profile_crc32 (uint8_t *data)
 
void monitor_profile_set_header (uint8_t *data)
 
void monitor_profile_set_end (uint8_t *data)
 
void monitor_profile_set_crc32 (uint8_t *data, uint32_t crc32)
 
uint32_t monitor_profile_get_crc32 (uint8_t *data)
 
uint16_t monitor_profile_get_index (uint8_t *data)
 
void monitor_profile_set_index (uint8_t *data, uint16_t index)
 
uint16_t monitor_profile_get_cmd (uint8_t *data)
 
void monitor_profile_set_cmd (uint8_t *data, uint16_t cmd)
 
uint16_t monitor_profile_get_result (uint8_t *data)
 
void monitor_profile_set_result (uint8_t *data, uint16_t result)
 
uint32_t monitor_profile_get_timing (uint8_t *data)
 
void monitor_profile_set_timing (uint8_t *data, uint32_t tick_us)
 
uint32_t monitor_profile_get_length (uint8_t *data)
 
void monitor_profile_set_length (uint8_t *data, uint32_t length)
 
monitor_payload_t * monitor_profile_get_payload (uint8_t *data)
 
monitor_info_t * monitor_profile_get_monitorinfo (uint8_t *data)
 
uint16_t monitor_profile_payload_process (uint16_t cmd, uint8_t *data, uint32_t length)
 
uint16_t monitor_profile_info_process (uint8_t *data)
 
uint16_t monitor_profile_cmd_process (uint16_t cmd, uint16_t parse_result, uint8_t *data, uint32_t length)
 
uint16_t monitor_profile_parse (uint8_t *data, uint32_t length, uint32_t *drop_offset, uint32_t *expect_length)
 
const monitor_var_info_tmonitor_ch_info_find_by_name (const char *name)
 
const monitor_var_info_tmonitor_ch_info_find_by_channel (uint8_t channel)
 
uint32_t monitor_ch_info_get_registry_count (void)
 
void monitor_ch_info_print_registry (void)
 

Variables

const uint32_t d7d75a2a6eebafc3d2ec0a0be089e05322057c4c308d648b374b362ea7eff5fa
 
const uint64_t be8443a5d67825271edb6f6bee202d6125a38e6aa8f2acbd54652d113af8793b
 

Macro Definition Documentation

◆ MONITOR_CMD_HOST_MASK

#define MONITOR_CMD_HOST_MASK   (0x8000)

◆ MONITOR_END_CMD

#define MONITOR_END_CMD   (0xA55A)

◆ MONITOR_MAGIC_CMD

#define MONITOR_MAGIC_CMD   (0x4D44)

◆ MONITOR_PAYLOAD_CH_DATA

#define MONITOR_PAYLOAD_CH_DATA (   ch)    (ch & ~MONITOR_PAYLOAD_CH_MASK)

◆ MONITOR_PAYLOAD_CH_MASK

#define MONITOR_PAYLOAD_CH_MASK   (0xFFFF0000)

◆ MONITOR_PAYLOAD_DATA_OFFSET

#define MONITOR_PAYLOAD_DATA_OFFSET   ((MONITOR_PROFILE_MIN_SIZE-2)+(sizeof(monitor_payload_t)-4)+(sizeof(data_payload_t)-4))

◆ MONITOR_PAYLOAD_MAXSIZE

#define MONITOR_PAYLOAD_MAXSIZE   (MONITOR_PROFILE_MAXSIZE - sizeof(monitor_profile_t))

◆ MONITOR_PROFILE_CRC_OFFSET

#define MONITOR_PROFILE_CRC_OFFSET   (14)

◆ MONITOR_PROFILE_MIN_SIZE

#define MONITOR_PROFILE_MIN_SIZE   (sizeof(monitor_profile_t) - 4)

◆ MONITOR_PROFILE_VERSION

#define MONITOR_PROFILE_VERSION   (2)

◆ MONITOR_RESULT_ACK_MASK

#define MONITOR_RESULT_ACK_MASK   (0x8000)

◆ MONITOR_START_CMD

#define MONITOR_START_CMD   (0x4850)

Typedef Documentation

◆ aligned

Enumeration Type Documentation

◆ DATA_TYPE

enum DATA_TYPE
Enumerator
TYPE_BOOL 
TYPE_UINT8 
TYPE_INT8 
TYPE_UINT16 
TYPE_INT16 
TYPE_UINT32 
TYPE_INT32 
TYPE_UINT64 
TYPE_INT64 
TYPE_FLOAT 
TYPE_DOUBLE 
TYPE_STRUCT 
TYPE_ARRAY_STRUCT 
TYPE_ARRAY_UINT8 
TYPE_ARRAY_INT8 
TYPE_ARRAY_UINT16 
TYPE_ARRAY_INT16 
TYPE_ARRAY_UINT32 
TYPE_ARRAY_INT32 
TYPE_ARRAY_UINT64 
TYPE_ARRAY_INT64 
TYPE_ARRAY_FLOAT 
TYPE_ARRAY_DOUBLE 
TYPE_UNKNOWN 

◆ DEVICE_CMD

enum DEVICE_CMD
Enumerator
CMD_INVALID 
CMD_CONNECT 
CMD_GETINFO 
CMD_GETVALUE 
CMD_SETVALUE 
CMD_NOTIFY 
CMD_STREAM 
CMD_BUFFER 
CMD_TRIGGER 

◆ MONITOR_RESULT

Enumerator
RESULT_BAD 
RESULT_HEAD_ERR 
RESULT_VER_ERR 
RESULT_CRC_ERR 
RESULT_PAYLOAD_ERR 
RESULT_GET_ERR 
RESULT_SET_ERR 
RESULT_DATA_LEN_ERR 
RESULT_DATA_TYPE_ERR 
RESULT_PRFILE_OVERFLOW 
RESULT_CMD_ERR 
RESULT_CONFIG_ERR 
RESULT_RUNNING_ERR 
RESULT_SUCCESS 
RESULT_ON 
RESULT_OFF 
RESULT_LOSS 

◆ TRIGGER_EXPR

Enumerator
TRIGGER_EXPR_AND 
TRIGGER_EXPR_OR 

◆ TRIGGER_MODE

Enumerator
TRIGGER_MODE_EDGE_BOTH 
TRIGGER_MODE_EDGE_RISING 
TRIGGER_MODE_EDGE_FALLING 
TRIGGER_MODE_LEVEL_LOW 
TRIGGER_MODE_LEVEL_HIGH 

Function Documentation

◆ aligned()

aligned ( )

◆ monitor_ch_info_find_by_channel()

const monitor_var_info_t* monitor_ch_info_find_by_channel ( uint8_t  channel)

◆ monitor_ch_info_find_by_name()

const monitor_var_info_t* monitor_ch_info_find_by_name ( const char *  name)

◆ monitor_ch_info_get_registry_count()

uint32_t monitor_ch_info_get_registry_count ( void  )

◆ monitor_ch_info_print_registry()

void monitor_ch_info_print_registry ( void  )

◆ monitor_get_value()

uint16_t monitor_get_value ( uint8_t  type,
uint32_t  addr,
uint8_t *  data 
)

◆ monitor_profile_cmd_process()

uint16_t monitor_profile_cmd_process ( uint16_t  cmd,
uint16_t  parse_result,
uint8_t *  data,
uint32_t  length 
)

◆ monitor_profile_crc32()

uint32_t monitor_profile_crc32 ( uint8_t *  data)

◆ monitor_profile_get_cmd()

uint16_t monitor_profile_get_cmd ( uint8_t *  data)

◆ monitor_profile_get_crc32()

uint32_t monitor_profile_get_crc32 ( uint8_t *  data)

◆ monitor_profile_get_index()

uint16_t monitor_profile_get_index ( uint8_t *  data)

◆ monitor_profile_get_length()

uint32_t monitor_profile_get_length ( uint8_t *  data)

◆ monitor_profile_get_monitorinfo()

monitor_info_t* monitor_profile_get_monitorinfo ( uint8_t *  data)

◆ monitor_profile_get_payload()

monitor_payload_t* monitor_profile_get_payload ( uint8_t *  data)

◆ monitor_profile_get_result()

uint16_t monitor_profile_get_result ( uint8_t *  data)

◆ monitor_profile_get_timing()

uint32_t monitor_profile_get_timing ( uint8_t *  data)

◆ monitor_profile_info_process()

uint16_t monitor_profile_info_process ( uint8_t *  data)

◆ monitor_profile_parse()

uint16_t monitor_profile_parse ( uint8_t *  data,
uint32_t  length,
uint32_t *  drop_offset,
uint32_t *  expect_length 
)

◆ monitor_profile_payload_process()

uint16_t monitor_profile_payload_process ( uint16_t  cmd,
uint8_t *  data,
uint32_t  length 
)

◆ monitor_profile_set_cmd()

void monitor_profile_set_cmd ( uint8_t *  data,
uint16_t  cmd 
)

◆ monitor_profile_set_crc32()

void monitor_profile_set_crc32 ( uint8_t *  data,
uint32_t  crc32 
)

◆ monitor_profile_set_end()

void monitor_profile_set_end ( uint8_t *  data)

◆ monitor_profile_set_header()

void monitor_profile_set_header ( uint8_t *  data)

◆ monitor_profile_set_index()

void monitor_profile_set_index ( uint8_t *  data,
uint16_t  index 
)

◆ monitor_profile_set_length()

void monitor_profile_set_length ( uint8_t *  data,
uint32_t  length 
)

◆ monitor_profile_set_result()

void monitor_profile_set_result ( uint8_t *  data,
uint16_t  result 
)

◆ monitor_profile_set_timing()

void monitor_profile_set_timing ( uint8_t *  data,
uint32_t  tick_us 
)

◆ monitor_set_value()

uint16_t monitor_set_value ( uint8_t  type,
uint32_t  addr,
uint8_t *  data 
)

◆ monitor_type_convert_byte()

int monitor_type_convert_byte ( DATA_TYPE  type)

◆ payload_is_channel_type()

bool payload_is_channel_type ( uint32_t  value)

Variable Documentation

◆ be8443a5d67825271edb6f6bee202d6125a38e6aa8f2acbd54652d113af8793b

const uint64_t be8443a5d67825271edb6f6bee202d6125a38e6aa8f2acbd54652d113af8793b
extern

◆ d7d75a2a6eebafc3d2ec0a0be089e05322057c4c308d648b374b362ea7eff5fa

const uint32_t d7d75a2a6eebafc3d2ec0a0be089e05322057c4c308d648b374b362ea7eff5fa
extern