Rockchip | Rockchip U-Boot调试热键HOTKEY
Posted Neutionwei
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Rockchip | Rockchip U-Boot调试热键HOTKEY相关的知识,希望对你有一定的参考价值。
一、源代码
1、头文件
./arch/arm/include/asm/arch-rockchip/hotkey.h
:
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* (C) Copyright 2019 Rockchip Electronics Co., Ltd
*/
#ifndef _ROCKCHIP_HOTKEY_H_
#define _ROCKCHIP_HOTKEY_H_
enum hotkey_t {
HK_INVAL,
HK_BROM_DNL,
HK_CLI_OS_PRE,
HK_CLI_OS_GO,
HK_CMDLINE,
HK_FASTBOOT,
HK_FDT,
HK_INITCALL,
HK_REGULATOR,
HK_ROCKUSB_DNL,
HK_SYSMEM,
};
bool is_hotkey(enum hotkey_t id);
void hotkey_run(enum hotkey_t id);
#endif
2、C文件
./arch/arm/mach-rockchip/hotkey.c
:
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
*/
#include <common.h>
#include <bidram.h>
#include <cli.h>
#include <console.h>
#include <sysmem.h>
#include <asm/arch/hotkey.h>
DECLARE_GLOBAL_DATA_PTR;
#define CTRL_A 0x01 /* shell(cli) on BOOTM_STATE_OS_PREP */
#define CTRL_B 0x02 /* bootrom mode */
#define CTRL_D 0x04 /* download mde */
#define CTRL_F 0x06 /* fastboot mode */
#define CTRL_I 0x09 /* inicall debug for kernel */
#define CTRL_M 0x0d /* memory(sysmem/bidram) */
#define CTRL_P 0x10 /* parameter(cmdline) dump */
#define CTRL_R 0x12 /* regulator initial state dump */
#define CTRL_S 0x13 /* shell(cli) on BOOTM_STATE_OS_GO */
#define CTRL_T 0x14 /* print fdt */
bool is_hotkey(enum hotkey_t id)
{
switch (id) {
case HK_CMDLINE:
return gd->console_evt == CTRL_P;
case HK_INITCALL:
return gd->console_evt == CTRL_I;
case HK_REGULATOR:
return gd->console_evt == CTRL_R;
case HK_SYSMEM:
return gd->console_evt == CTRL_M;
case HK_BROM_DNL:
return gd->console_evt == CTRL_B;
#ifndef CONFIG_CONSOLE_DISABLE_CLI
case HK_ROCKUSB_DNL:
return gd->console_evt == CTRL_D;
case HK_FASTBOOT:
return gd->console_evt == CTRL_F;
#endif
default:
break;
}
return false;
}
void hotkey_run(enum hotkey_t id)
{
switch ((id)) {
case HK_SYSMEM:
if (gd->console_evt == CTRL_M) {
bidram_dump();
sysmem_dump();
}
break;
case HK_CMDLINE:
if (gd->console_evt == CTRL_P)
printf("cmdline: %s\\n", env_get("bootargs"));
break;
case HK_INITCALL:
if (gd->console_evt == CTRL_I)
env_update("bootargs", "initcall_debug debug");
break;
case HK_FDT:
if (gd->console_evt == CTRL_T)
run_command("fdt print", 0);
break;
case HK_CLI_OS_PRE:
if (gd->console_evt == CTRL_A)
cli_loop();
break;
case HK_CLI_OS_GO:
if (gd->console_evt == CTRL_S)
cli_loop();
break;
default:
break;
}
}
二、各热键操作
操作 | 热键 |
---|---|
CTRL_A | HK_CLI_OS_PRE |
CTRL_B | HK_BROM_DNL |
CTRL_D | HK_ROCKUSB_DNL |
CTRL_F | HK_FASTBOOT |
CTRL_I | HK_INITCALL |
CTRL_M | HK_SYSMEM |
CTRL_P | HK_CMDLINE |
CTRL_R | HK_REGULATOR |
CTRL_S | HK_CLI_OS_GO |
CTRL_T | HK_FDT |
以上是关于Rockchip | Rockchip U-Boot调试热键HOTKEY的主要内容,如果未能解决你的问题,请参考以下文章
Rockchip | Rockchip Graphics与Display
Rockchip | Rockchip平台SD卡启动idbloader.img打包
Rockchip | Rockchip原始固件与RK固件格式