uboot中gd的定义和使用
近期在做uboot中nand启动相关的工作,遇到一个问题一直纠结着。如今最终明确了这个问题,想想还有好多兄弟在某个黑暗的角落里或者某台电脑前纠结着呢,所以赶紧写下来以供查阅。
uboot version 2014.4
/* Architecture-specific global data */
struct arch_global_data {
#if defined(CONFIG_FSL_ESDHC)
u32 sdhc_clk;
#endif
#ifdef CONFIG_AT91FAMILY
/* "static data" needed by at91's clock.c */
unsigned long
cpu_clk_rate_hz;
unsigned long
main_clk_rate_hz;
unsigned long
mck_rate_hz;
unsigned long
plla_rate_hz;
unsigned long
pllb_rate_hz;
unsigned long
at91_pllb_usb_init;
#endif
/* "static data" needed by most of timer.c on ARM platforms */
unsigned long timer_rate_hz;
unsigned long tbu;
unsigned long tbl;
unsigned long lastinc;
unsigned long long timer_reset_value;
#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
unsigned long tlb_addr;
unsigned long tlb_size;
#endif
#ifdef CONFIG_OMAP
struct omap_boot_parameters omap_boot_params;
#endif
};
#include <asm-generic/global_data.h>
#ifdef CONFIG_ARM64
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
#else
#define DECLARE_GLOBAL_DATA_PTR
register volatile gd_t *gd asm ("r9")
#endif
从这里看到了gd的定义,而且能够知道气质这个结构体的定义是在:#include <asm-generic/global_data.h>这个文件夹下。
那么就去这个文件夹下加入一个私有变量使得在兴许的使用过程中更加方便吧!!!!!!!!!!!
typedef struct global_data {
bd_t *bd;
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 */
#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 */
#ifdef CONFIG_PRE_CONSOLE_BUFFER
unsigned long precon_buf_idx;
/* Pre-Console buffer index */
#endif
#ifdef CONFIG_MODEM_SUPPORT
unsigned long do_mdm_init;
unsigned long be_quiet;
#endif
unsigned long env_addr;
/* Address of Environment struct */
unsigned long env_valid;
/* Checksum of Environment valid? */
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 device
*dm_root; /* Root instance for Driver Model */
struct list_head uclass_root;
/* Head of core tree */
#endif
const void *fdt_blob;
/* Our device tree, NULL if none */
void *new_fdt;
/* Relocated FDT */
unsigned long fdt_size;
/* Space reserved for relocated FDT */
void **jt;
/* jump table */
char env_buf[32];
/* buffer for getenv() before reloc. */
#ifdef CONFIG_TRACE
void *trace_buff;
/* The trace buffer */
#endif
#if defined(CONFIG_SYS_I2C)
int cur_i2c_bus;
/* current used i2c bus */
#endif
unsigned long timebase_h;
unsigned long timebase_l;
struct arch_global_data arch;
/* architecture-specific data */
#ifdef CONFIG_xxxxx //此处随便x
void *priv;
/* point to the private data */
#endif
} gd_t;
在使用的过程中包括头文件,就能够使用了。
uboot中gd的定义和使用的更多相关文章
- tiny4412 串口驱动分析一 --- u-boot中的串口驱动
作者:彭东林 邮箱:pengdonglin137@163.com 开发板:tiny4412ADK+S700 4GB Flash 主机:Wind7 64位 虚拟机:Vmware+Ubuntu12_04 ...
- Uboot中start.S源码的指令级的详尽解析【转】
本文转载自:http://www.crifan.com/files/doc/docbook/uboot_starts_analysis/release/html/uboot_starts_analys ...
- uboot中添加FIQ中断及相关问题
本文主要说明了在uboot中添加FIQ中断时遇到的问题以及对应的解决办法. 首先交代一下项目的软硬件环境.硬件方面,使用s3c2440作为主控芯片,外接串口.网卡等设备.软件方面,主控芯片上电后运行u ...
- u-boot中nandflash初始化流程分析(转)
u-boot中nandflash初始化流程分析(转) 原文地址http://zhuairlunjj.blog.163.com/blog/static/80050945201092011249136/ ...
- u-boot中分区和内核MTD分区关系
一.u-boot中环境变量与uImage中MTD的分区关系 分区只是内核的概念,就是说A-B地址放内核,C-D地址放文件系统,(也就是规定哪个地址区间放内核或者文件系统)等等. 一般我们只需要分3-4 ...
- uboot-tiny4412启动流程(下)----如何将自己的裸板测试程序加入uboot中启动测试
今天在工作上搞了一天高通的芯片uboot程序,目的是希望将一个裸板的程序移植到uboot中,并且开机让它运行.这个芯片是NXP4330,目前是高通的一个芯片,基于ARM-contexA9架构,那么就跟 ...
- 基于335X平台的UBOOT中交换芯片驱动移植
基于335X平台的UBOOT中交换芯片驱动移植 一.软硬件平台资料 1.开发板:创龙AM3359核心板,网口采用RMII形式. 2.UBOOT版本:U-Boot-2016.05,采用FDT和DM. 3 ...
- uboot中的快捷菜单的制作说明 【转】
转自:http://blog.chinaunix.net/uid-22030783-id-366971.html 在uboot中加入快捷操作菜单的方法非常简单,在论坛发布的uboot201003V ...
- 七、在U-boot中让LCD显示图片
1. 增加Nandflash读取代码 因为要显示图片,而图片明显是放在Nandflash中比较合适,因此需要有能够操作Nandflash的函数.在U-boot中已经有能操作Nandflash的函数了, ...
随机推荐
- Unity3D如何获取对象和子对象
在Unity3d中获取游戏对象有三种方法: 一:获取对象 1.通过对象名称获取:objCube=GameObject.Find("Cube"); private var objCu ...
- c#字符串及数组操作
字符串操作(取当前时间)string time=convert.tostring(DateTime.Today).split( new char []{' '}); textbox1.text= ...
- HDU 1533 Going Home (最小费用流)
题意: 一个矩阵n*m,其中有k个房子和k个人,k个人分别必须走到任意一个房子中(匹配),但是权值就是长度(非欧拉距离),求匹配完的权之和. 思路: 建图方法是,首先将k个人和k个房子分别抽出来到集合 ...
- memcached性能监控
在上文“在Windows .NET平台下使用Memcached”中,我给大家介绍了如何在Windows平台上部署Memecached服务端,如何在.NET平台中应用Memcached,详细介绍了两种流 ...
- [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.4.1
Let $x,y,z$ be linearly independent vectors in $\scrH$. Find a necessary and sufficient condition th ...
- 不区分大小写匹配字符串,并在不改变被匹配字符串的前提下添加html标签
问题描述:最近在搭建一个开源平台网站,在做一个简单搜索的功能,需要将搜索到的结果中被匹配的字符串添加不一样的颜色,但是又不破坏被匹配的字符串. 使用的方法是替换被匹配的字符串加上font标签.但是搜索 ...
- VTL说明文档
关于这个指南 这个指南是针对Velocity模版语言(VTL)的说明.更多其它的信息,请参考Velocity用户指南(http://velocity.apache.org/engine/release ...
- 4.4 CUDA prefix sum一步一步优化
1. Prefix Sum 前缀求和由一个二元操作符和一个输入向量组成,虽然名字叫求和,但操作符不一定是加法.先解释一下,以加法为例: 第一行是输入,第二行是对应的输出.可以看到,Output[1] ...
- [转]常用的130个vim命令
原帖地址:http://www.oschina.net/news/43167/130-essential-vim-commands 从 1970 年开始,vi 和 vim 就成为了程序员最喜爱的文本编 ...
- A Tour of Go Methods
Go does not have classes. However, you can define methods on struct types. The method receiver appea ...