Dbus
概述
DBus(debug bus)是调试总线,用于测试芯片内部信号
功能特性
DBus 主要支持如下特性:
包含4个总线域,acore、bcore、dcore以及pmm
配置相对灵活,支持32个gpio同时采集32位总线数据
资源依赖
GPIO
用法流程
1 /**
2 * @brief 初始化设定的待获取的总线信号
3 *
4 * @param conf 参考wq_dbus_config_t
5 * @return 获取成功或者失败
6 */
7 void wq_dbus_general_init(const wq_dbus_config_t* conf);
配置参数
wq_dbus_config
1 typedef struct {
2 WQ_DBUS_DOMAIN dbus_domain; /*!< dbus域 */
3 uint8_t dbus_group; /*!< 调试总线所在组号 */
4 uint8_t dbus_sel; /*!< 调试总线片选号 */
5 uint8_t dbus_sub_sel; /*!< 调试总线内部信号选择信号 */
6 uint8_t dbus_gpio_cnt; /*!< gpio组数量 */
7 uint32_t dbus_mask; /*!< 32个gpio使能bit */
8 uint8_t dbus_gpio[DBUS_GPIO_CNT_MAX]; /*!< gpio组 */
9 } wq_dbus_config_t;
读取信号值
wq_dbus_read()
1 /**
2 * @brief 根据总线信息,读取信号值
3 *
4 * @param group 调试总线所在组号
5 * @param dbus_sel 调试总线片选号
6 * @param sub_dbus_sel 调试总线内部信号选择信号
7 * @return 32位信号值
8 */
9 uint32_t wq_dbus_read();
10 uint32_t wq_dbus_read_status0(void);
11 uint32_t wq_dbus_read_status1(void);
举例说明
例子
wq_dbus_config_sample()
1 void wq_dbus_config_sample(void)
2 {
3 /* configure parameters based on chip_debug_signal_list.xls*/
4 wq_dbus_config_t conf;
5 conf.dbus_domain = WQ_DBUS_BCORE;
6 conf.dbus_group = 4;
7 conf.dbus_sel = 7;
8 conf.dbus_sub_sel = 0;
9 conf.dbus_gpio_cnt = 8;
10 for(uint8_t i=0; i < conf.dbus_gpio_cnt; i++){
11 conf.dbus_gpio[i] = WQ_GPIO_46 + i;
12 }
13 conf.dbus_mask = 0x000000FF;
14
15 /* config debug bus initilize */
16 wq_dbus_general_init(&conf);
17
18 /* get current dbus value */
19 printf("dbus value:%d\n", wq_dbus_read());
20 }
例子
wq_dbus_config_sample_scarab()
1 static void debugbus_sample_test(void)
2 {
3 wq_dbus_config_t wq_dbus_conf = {
4 .dbus_domain = WQ_DBUS_BCORE,
5 .dbus_group = 1,
6 //.dbus_sel = 6,
7 //.dbus_sub_sel = 0,
8 .dbus_gpio_cnt = 8,
9 .dbus_mask = 0x000000FF,
10 .dbus_gpio[0] = WQ_GPIO_06,
11 .dbus_gpio[1] = WQ_GPIO_07,
12 .dbus_gpio[2] = WQ_GPIO_14,
13 .dbus_gpio[3] = WQ_GPIO_15,
14 .dbus_gpio[4] = WQ_GPIO_16,
15 .dbus_gpio[5] = WQ_GPIO_17,
16 .dbus_gpio[6] = WQ_GPIO_18,
17 .dbus_gpio[7] = WQ_GPIO_19,
18 };
19
20 wq_dbus_general_init(&wq_dbus_conf);
21 }
注意事项
若使用pmm gpio01观察pmm调试总线时,寄存器pmm_gpio01_obs_en和pmm_gpio01_obs_frc若之前有更改使用,需要恢复成默认配置。
API 介绍
This section introduces the DBUS module's enum, structure, functions and how to use this driver.
Defines
-
DBUS_GPIO_CNT_MAX
Typedefs
-
typedef struct wq_dbus_conf wq_dbus_config_t
Enums
Functions
-
void wq_dbus_general_init(const wq_dbus_config_t *conf)
This function is to initialise the dbus general driver.
map chipstatus[32] to gpio. eg. dbus_sel = 1, mask = 0x5 (0b101), gpio[2] = {3,6}, gpio_cnt =2, means: internal signal 1 -> gpio 3 internal signal 3 -> gpio 6
- 参数:
conf -- dbus config refer to wq_dbus_config_t
-
uint32_t wq_dbus_read(void)
This function is read dbus data by dbus info.
- 返回:
debug bus signals value which be selected by "deb_bus_sel0"
-
struct wq_dbus_conf
Public Members
-
WQ_DBUS_DOMAIN dbus_domain
-
uint8_t dbus_group
debug bus group select
-
uint8_t dbus_group_exp
debug bus group exp select
-
uint8_t dbus_sel
chipstatus[sel], dbus_sel ~ dbus_sel+31 will be maped out
-
uint8_t dbus_sub_sel
system debug bus group select
-
uint8_t dbus_gpio_cnt
gpio array cnt
-
uint32_t dbus_mask
bitmap of 32 channel, bit0 is lsb
-
uint8_t dbus_gpio[DBUS_GPIO_CNT_MAX]
gpio array
-
WQ_DBUS_DOMAIN dbus_domain