Exynos4412 Uboot 移植(六)—— 相关知识补充

来源:互联网 发布:windows无法启动怎么办 编辑:程序博客网 时间:2024/04/30 15:55

Uboot版本:u-boot-2013.01


一、gd结构体的定义与使用

gd_t 和 bd_t 是u-boot中两个重要的数据结构,在初始化操作很多都要靠这两个数据结构来保存或传递。

gd_t 定义在/u-boot-2013.01/arch/arm/include/asm/global_data.h

bd_t 定义在 ./include/asm-arm/u-boot.h

1、gd_t : global data数据结构定义

位于文件/u-boot-2013.01/arch/arm/include/asm/global_data.h 中。其成员主要是一些全局的系统初始化参数。

当使用gd_t 时需用宏定义进行声明DECLARE_GLOBAL_DATA_PTR


从这个宏的定义可以看出,gd是一个保存在ARM的r8寄存器中的gd_t结构体的指针。指定占用寄存器R8

typedefstructglobal_data {bd_t*bd;//struct board_info指针,保存开发板信息unsigned longflags;//指示标志,如设备已经初始化标志等unsigned intbaudrate;//串口波特率unsigned longhave_console;//串口初始化标志#ifdef CONFIG_PRE_CONSOLE_BUFFERunsigned longprecon_buf_idx;/* Pre-Console buffer index */#endifunsigned longenv_addr;/* Address  of Environment struct */unsigned longenv_valid;/* Checksum of Environment valid? */unsigned longfb_base;/* base address of frame buffer */#ifdef CONFIG_FSL_ESDHCunsigned longsdhc_clk;#endif#ifdef CONFIG_AT91FAMILY/* "static data" needed by at91's clock.c */unsigned longcpu_clk_rate_hz;unsigned longmain_clk_rate_hz;unsigned longmck_rate_hz;unsigned longplla_rate_hz;unsigned longpllb_rate_hz;unsigned longat91_pllb_usb_init;#endif#ifdef CONFIG_ARM/* "static data" needed by most of timer.c on ARM platforms */unsigned longtimer_rate_hz;unsigned longtbl;unsigned longtbu;unsigned long longtimer_reset_value;unsigned longlastinc;#endif#ifdef CONFIG_IXP425unsigned longtimestamp;#endifunsigned longrelocaddr;/* Start address of U-Boot in RAM */phys_size_tram_size;/* RAM size */unsigned longmon_len;/* monitor len */unsigned longirq_sp;/* irq stack pointer */unsigned longstart_addr_sp;/* start_addr_stackpointer */unsigned longreloc_off;#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))unsigned longtlb_addr;unsigned longtlb_size;#endifconst void*fdt_blob;/* Our device tree, NULL if none */void**jt;/* jump table */charenv_buf[32];/* buffer for getenv() before reloc. */#if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)unsigned longpost_log_word; /* Record POST activities */unsigned longpost_log_res; /* success of POST test */unsigned longpost_init_f_time; /* When post_init_f started */#endif} gd_t;


2.、bd_t :board info数据结构定义

位于文件u-boot-2013.01/arch/arm/include/asm/u-boot.h。保存板子参数。

typedef struct bd_info {unsigned intbi_baudrate;/* 串口波特率 */    ulong        bi_arch_number;/* 开发板机器ID */    ulong        bi_boot_params;/* 启动参数 */unsigned longbi_arm_freq; /* arm frequency */unsigned longbi_dsp_freq; /* dsp core frequency */unsigned longbi_ddr_freq; /* ddr frequency */    struct/* RAM configuration */    {ulong start;ulong size;    }bi_dram[CONFIG_NR_DRAM_BANKS];} bd_t;


1 0
原创粉丝点击