HPM SDK
HPMicro Software Development Kit
hpm_mcl_debug.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef HPM_MCL_DEBUG_H
8 #define HPM_MCL_DEBUG_H
9 
10 #include "hpm_mcl_common.h"
11 
12 #define MCL_DEBUG_FIFO MCL_USER_DEFINED_DEBUG_FIFO
13 
18 typedef struct {
19  void (*write_buf)(uint8_t *byte, uint16_t num);
21 
22 #define MCL_DEBUG_DATA_TYPE_SET(num, size) (((num) << 8) | (size))
23 #define MCL_DEBUG_DATA_TYPE_GET_SIZE(type) ((type) & 0xff)
24 
29 typedef enum {
35 
40 typedef struct {
42  union {
43  float *f32;
44  int16_t *i16;
45  int32_t *i32;
46  int8_t *i8;
47  uint8_t *addr;
48  } data;
49  uint8_t cnt;
52 
57 typedef struct {
59 } mcl_debug_t;
60 
66 void hpm_mcl_debug_init(mcl_debug_t *debug);
67 
75 
84 void hpm_mcl_debug_update_data(mcl_debug_t *debug, uint8_t chn, void *data, mcl_debug_data_type_t type);
85 
86 #endif
mcl_debug_data_type_t
Types of debug data.
Definition: hpm_mcl_debug.h:29
@ mcl_debug_data_i16
Definition: hpm_mcl_debug.h:31
@ mcl_debug_data_i32
Definition: hpm_mcl_debug.h:32
@ mcl_debug_data_f32
Definition: hpm_mcl_debug.h:33
@ mcl_debug_data_i8
Definition: hpm_mcl_debug.h:30
void hpm_mcl_debug_init(mcl_debug_t *debug)
init debug data struct
Definition: hpm_mcl_debug.c:11
void hpm_mcl_debug_send_scope(mcl_debug_t *debug)
Sends data in the buffer to the outside, Depending on how the callback function works,...
Definition: hpm_mcl_debug.c:16
void hpm_mcl_debug_update_data(mcl_debug_t *debug, uint8_t chn, void *data, mcl_debug_data_type_t type)
Update debug data.
Definition: hpm_mcl_debug.c:21
#define MCL_DEBUG_DATA_TYPE_SET(num, size)
Definition: hpm_mcl_debug.h:22
callback function
Definition: hpm_mcl_debug.h:18
debug config
Definition: hpm_mcl_debug.h:40
mcl_debug_callback_t callback
Definition: hpm_mcl_debug.h:41
uint8_t cnt
Definition: hpm_mcl_debug.h:49
uint8_t * addr
Definition: hpm_mcl_debug.h:47
mcl_debug_data_type_t data_type
Definition: hpm_mcl_debug.h:50
int32_t * i32
Definition: hpm_mcl_debug.h:45
float * f32
Definition: hpm_mcl_debug.h:43
int16_t * i16
Definition: hpm_mcl_debug.h:44
int8_t * i8
Definition: hpm_mcl_debug.h:46
debug data
Definition: hpm_mcl_debug.h:57
mcl_debug_cfg_t cfg
Definition: hpm_mcl_debug.h:58