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的函数了, ...
随机推荐
- apache开源项目--OpenMeetings
OpenMeetings是一个多语言可定制的视频会议和协作系统.它支持音频.视频,能让你查看每个与会者的桌面.OpenMeetings还包含一个白板,通过白板可以导入各种格式的图片和涂鸦. 在线演示: ...
- oracle server配置:监听程序未启动或数据库服务未注册到该监听程序
第一次安装oracle时,时完全没有任何问题的, 但是当我去配置oracle_home时,误按之下进入了Database Configuration Assistant, 然后配置已有的一个数据库,就 ...
- android——创建camera应用(译)
只是选择相机部分来翻译.下面是主要内容 有些开发者可能需要Camera的接口,来定制自己程序的外观和特殊功能.创建自定义的Camera界面比使用using an Intent需要编写更多的代码,但是 ...
- windows版本git的下载地址
最后编辑时间 2016年09月01日13:13 首先需要下载msysgit,下载最新版本即可 https://git-for-windows.github.io/ 这个是源代码 https://git ...
- [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]ExI.5.6
Let $A$ be a nilpotent operator. Show how to obtain, from aJordan basis for $A$, aJordan basis of $\ ...
- C# 创建WebServices及调用方法
发布WebServices 1.创建 ASP.NET Web 服务应用程序 SayHelloWebServices 这里需要说明一下,由于.NET Framework4.0取消了WebService ...
- DDraw绘图
微软已经提供了GDI+绘图方式,但是GDI+绘图较慢,另外微软提供了效率更高的DirectDraw绘图方式.DirectDraw提供硬件加速功能. 首先需要确保电脑上的Ddraw硬件加速功能已经打开, ...
- iOS7适配之设计篇
(注:文章简要翻译自 Apple <iOS 7 UI Transition Guide>,由于该文档为开发者预览版,并非最终文档,所以 iOS7 正式上线可能有部分不同) 准备工作 iOS ...
- SQL Server优化相关的工具脚本
SQL Server性能优化的一些常用脚本,适用于SQL Server 2008,更高的版本某些系统表的字段有所不同,建议参考MSDN. 死锁相关 /************************* ...
- Android反编译基础(apktoos)--广工图书馆APK
更多精彩内容 :http://www.chenchuangfeng.com QQ:375061590 ------------------------------------------------- ...