U-Boot学习:[0]global_data 和 bd_info

本文基于U-Boot 2017.03-rc2-gc7a25b3-dirty版本,深入解析global_data和bd_info的数据结构。global_data结构定义在include/asm-generic/global_data.h,其声明在arm架构中位于arch/arm/include/asm/global_data.h,并通过DECLARE_GLOBAL_DATA_PTR宏声明。bd_info结构在include/asm-generic/u-boot.h中定义。文章还提供了作者的多个在线博客和GitHub链接。
摘要由CSDN通过智能技术生成

U-Boot学习:[0]global_data 和 bd_info

基于U-Boot 2017.03-rc2-gc7a25b3-dirty 源码分析


global_data

global_data 数据结构

global_data 数据结构的定义位于源码目录:

include/asm-generic/global_data.h

typedef struct global_data {
    bd_t *bd;       //struct board_info指针,保存板子信息
    unsigned long flags;        //指示标志,如设备已经初始化标志等
    unsigned int baudrate;       //串口波特率
    unsigned long cpu_clk;      /* CPU clock in Hz!     */
    unsigned long bus_clk;
    /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
    unsigned long pci_clk;
    unsigned long mem_clk;
#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO)
    unsigned long fb_base;      /* Base address of framebuffer mem frame buffer的基址 */
#endif
#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)
    unsigned long post_log_word;    /* Record POST activities */
    unsigned long post_log_res; /* success of POST test */
    unsigned long post_init_f_time; /* When post_init_f started */
#endif
#ifdef CONFIG_BOARD_TYPES
    unsigned long board_type;
#endif
    unsigned long have_console; /* serial_init() was called 串口初始化标志 */
#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
    unsigned long precon_buf_idx;   /* Pre-Console buffer index */
#endif
    unsigned long env_addr;     /* Address  of Environment struct 环境参数地址 */
    unsigned long env_valid;    /* Checksum of Environment valid? 环境参数CRC检验有效标志 */

    unsigned long ram_top;      /* Top address of RAM used by U-Boot */
    unsigned long relocaddr;    /* Start address of U-Boot in RAM */
    phys_size_t ram_size;       /* RAM size */
    unsigned long mon_len;      /* monitor len */
    unsigned long irq_sp;       /* irq stack pointer */
    unsigned long start_addr_sp;    /* start_addr_stackpointer */
    unsigned long reloc_off;
    struct global_data *new_gd; /* relocated global data */

#ifdef CONFIG_DM
    struct udevice  *dm_root;   /* Root instance for Driver Model */
    struct udevice  *dm_root_f; /* Pre-relocation root instance */
    struct list_head uclass_root;   /* Head of core tree */
#endif
#ifdef CONFIG_TIMER
    struct udevice  *timer;     /* Timer instance for Driver Model */
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值