Files
kunlun/inc/driver/iot_busmon.h
2024-09-28 14:24:04 +08:00

109 lines
3.3 KiB
C
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
#ifndef IOT_BUSMON_H
#define IOT_BUSMON_H
#include "busmon.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief snapshot_rw_mode - snapshot监视类型
*/
enum snapshot_rw_mode
{
SNAPSHOT_MONITOR_READ, /* snapshot监视读操作 */
SNAPSHOT_MONITOR_WRITE /* snapshot监视写操作 */
};
/**
* @brief SnapshotConfig - snapshot配置参数
*/
typedef struct _snapshot_config_t
{
uint16_t cpu; /* 需要监视的CPU(0/1) */
uint16_t rw_mode; /* 需要监视的类型(读(0)/写(1)) */
uint32_t mask; /* 需要使能的触发类型 */
uint32_t instruction_low_limit; /* 指令总线区域读写监测下边界 */
uint32_t instruction_high_limit; /* 指令总线区域读写监测上边界 */
uint32_t data_low_limit; /* 数据总线区域读写监测下边界 */
uint32_t data_high_limit; /* 数据总线区域读写监测上边界 */
uint32_t assert; /* 监视到触发时assert */
}snapshot_config_t;
/**
* @brief iot_snapshot_run_check - 检测snapshot是否被中断调用
* snapshot被中断调用是因为开启了 SNAPSHOT_MONITOR_DEBUG
* @return 0:snapshot未被调用 1:snapshot被调用
*/
uint8_t iot_snapshot_run_check();
/**
* @brief iot_snapshot_monitor_init - 初始化snapshot
*/
void iot_snapshot_monitor_init();
/**
* @brief iot_snapshot_monitor_config - 配置snapshot
* @param config : snapshot配置参数
*/
void IRAM_ATTR iot_snapshot_monitor_config(snapshot_config_t *config);
/**
* @brief iot_snapshot_monitor_enable - 使能snapshot
* 调用该函数后snapshot开始工作
*/
void IRAM_ATTR iot_snapshot_monitor_enable();
/**
* @brief iot_snapshot_monitor_disable - 禁止snapshot
* 调用该函数后snapshot停止工作
*/
void IRAM_ATTR iot_snapshot_monitor_disable();
/**
* @brief iot_snapshot_monitor_get_status - 获取snapshot的触发状态
* @return: 0 snapshot没有捕获到触发 非0 snapshot捕获到触发位为1的值对应触发的类型
*/
uint32_t IRAM_ATTR iot_snapshot_monitor_get_status();
void iot_busmon_init();
void iot_busmon_cap();
void IRAM_ATTR iot_busmon_enable();
void IRAM_ATTR iot_busmon_disable();
uint8_t iot_busmon_callback(uint8_t mst,iot_isr_callback *callback,
uint32_t bus_mon_laddr, uint32_t bus_mon_haddr,
enum BUS_RANGE_MODE bus_mon_range) ;
#ifdef __cplusplus
}
#endif
#endif