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

转载自http://blog.csdn.net/zqixiao_09/article/details/50819648

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

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. typedef struct  global_data {  
  2.     bd_t        *bd;//struct board_info指针,保存开发板信息  
  3.     unsigned long   flags;//指示标志,如设备已经初始化标志等  
  4.     unsigned int    baudrate;//串口波特率  
  5.     unsigned long   have_console;   //串口初始化标志  
  6. #ifdef CONFIG_PRE_CONSOLE_BUFFER  
  7.     unsigned long   precon_buf_idx; /* Pre-Console buffer index */  
  8. #endif  
  9.     unsigned long   env_addr;   /* Address  of Environment struct */  
  10.     unsigned long   env_valid;  /* Checksum of Environment valid? */  
  11.     unsigned long   fb_base;    /* base address of frame buffer */  
  12. #ifdef CONFIG_FSL_ESDHC  
  13.     unsigned long   sdhc_clk;  
  14. #endif  
  15. #ifdef CONFIG_AT91FAMILY  
  16.     /* "static data" needed by at91's clock.c */  
  17.     unsigned long   cpu_clk_rate_hz;  
  18.     unsigned long   main_clk_rate_hz;  
  19.     unsigned long   mck_rate_hz;  
  20.     unsigned long   plla_rate_hz;  
  21.     unsigned long   pllb_rate_hz;  
  22.     unsigned long   at91_pllb_usb_init;  
  23. #endif  
  24. #ifdef CONFIG_ARM  
  25.     /* "static data" needed by most of timer.c on ARM platforms */  
  26.     unsigned long   timer_rate_hz;  
  27.     unsigned long   tbl;  
  28.     unsigned long   tbu;  
  29.     unsigned long long  timer_reset_value;  
  30.     unsigned long   lastinc;  
  31. #endif  
  32. #ifdef CONFIG_IXP425  
  33.     unsigned long   timestamp;  
  34. #endif  
  35.     unsigned long   relocaddr;  /* Start address of U-Boot in RAM */  
  36.     phys_size_t ram_size;   /* RAM size */  
  37.     unsigned long   mon_len;    /* monitor len */  
  38.     unsigned long   irq_sp;     /* irq stack pointer */  
  39.     unsigned long   start_addr_sp;  /* start_addr_stackpointer */  
  40.     unsigned long   reloc_off;  
  41. #if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))  
  42.     unsigned long   tlb_addr;  
  43.     unsigned long   tlb_size;  
  44. #endif  
  45.     const void  *fdt_blob;  /* Our device tree, NULL if none */  
  46.     void        **jt;       /* jump table */  
  47.     char        env_buf[32];    /* buffer for getenv() before reloc. */  
  48. #if defined(CONFIG_POST) || defined(CONFIG_LOGBUFFER)  
  49.     unsigned long   post_log_word; /* Record POST activities */  
  50.     unsigned long   post_log_res; /* success of POST test */  
  51.     unsigned long   post_init_f_time; /* When post_init_f started */  
  52. #endif  
  53. } gd_t;  


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

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

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. typedef struct bd_info {  
  2.     unsigned int    bi_baudrate;    /* 串口波特率 */  
  3.     ulong           bi_arch_number; /* 开发板机器ID */  
  4.     ulong           bi_boot_params; /* 启动参数 */  
  5.     unsigned long   bi_arm_freq; /* arm frequency */  
  6.     unsigned long   bi_dsp_freq; /* dsp core frequency */  
  7.     unsigned long   bi_ddr_freq; /* ddr frequency */  
  8.     struct              /* RAM configuration */  
  9.     {  
  10.     ulong start;  
  11.     ulong size;  
  12.     }           bi_dram[CONFIG_NR_DRAM_BANKS];  
  13. } bd_t;  

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值