u-boot分析——struct gd_t与struct bd_t
gd_t和bd_t是u-boot中两个重要的数据结构,在初始化操作很多都要靠这两个数据结构来保存或传递.分别定义在./include/asm/global_data.h和./include/asm/u_boot.h
1. gd_t : global data数据结构定义,位于文件 include/asm-arm/global_data.h。其成员主要是一些全局的系统初始化参数。需要用到时用宏定义: DECLARE_GLOBAL_DATA_PTR,指定占用寄存器R8。
/*
* The following data structure is placed in some memory wich is
* available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
* some locked parts of the data cache) to allow for a minimum set of
* global variables during system initialization (until we have set
* up the memory controller so that we can use RAM).
*
* Keep it *SMALL* and remember to set CFG_GBL_DATA_SIZE > sizeof(gd_t)
* CFG_GBL_DATA_SIZE在config文件中定义,start.S中会根据这个值分配栈空间给global_data
*/
typedef struct global_data {
bd_t *bd; // struct board_info指针,保存板子信息
unsigned long flags; // 指示标志,如设备已经初始化标志等
unsigned long baudrate; // 串口波特率
unsigned long have_console; // 串口初始化标志
unsigned long reloc_off; // ?? 重定位偏移,即实际定向位置与连接指定之差
unsigned long env_addr; // Address of Environment struct ,环境参数地址
unsigned long env_valid; // 环境参数CRC检验有效标志
unsigned long fb_base; // frame buffer的基址
#ifdef CONFIG_VFD
unsigned char vfd_type; /* display type */
#endif
#if 0
unsigned long cpu_clk; /* CPU clock in Hz! */
unsigned long bus_clk;
unsigned long ram_size; /* RAM size */
unsigned long reset_status; /* reset status register at boot */
#endif
void **jt; /* jump table */
} gd_t;
/*
* Global Data Flags
*/
#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
#define GD_FLG_SILENT 0x00004 /* Silent mode */
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
2. bd_t : board info数据结构定义,位于文件 include/asm-arm/u-boot.h。保存板子参数。
typedef struct bd_info {
int bi_baudrate; // 串口波特率
unsigned long bi_ip_addr; // IP地址
unsigned char bi_enetaddr[6]; // MAC地址
struct environment_s *bi_env;
ulong bi_arch_number; // 板子ID号
ulong bi_boot_params; // 启动参数
struct // DRAM BANKS配置,起始地址与长度
{
ulong start;
ulong size;
} bi_dram[CONFIG_NR_DRAM_BANKS];
#ifdef CONFIG_HAS_ETH1
unsigned char bi_enet1addr[6]; // 如果有第二块网卡,指定MAC地址
#endif
} bd_t;
u-boot分析——struct gd_t与struct bd_t的更多相关文章
- [转载]彻底弄清struct和typedef struct
struct和typedef struct 分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int ...
- struct和typedef struct彻底明白了
struct和typedef struct 分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int ...
- struct和typedef struct
转自:http://www.cnblogs.com/qyaizs/articles/2039101.html struct和typedef struct 分三块来讲述: 1 首先://注意在C和C++ ...
- struct 与 typedef struct
1. 基本解释 typedef为C语言的关键字,作用是为一种数据类型定义一个新名字.这里的数据类型包括内部数据类型(int,char等)和自定义的数据类型(struct等). 在编程中使用typede ...
- (转载)struct 与typdef struct的区别
(转载)http://blog.csdn.net/piratejk/article/details/3491226 1. 基本解释 typedef为C语言的关键字,作用是为一种数据类型定义一个新名字. ...
- struct和typedef struct的用法
我首先想到的去MSDN上看看sturct到底是什么东西,虽然平时都在用,但是每次用的时候都搞不清楚到底这两个东西有什么区别,既然微软有MSDN,我们为什么不好好利用呢,下面是摘自MSDN中的一段话: ...
- 细说 struct和typedef struct
细说 struct和typedef struct 参考原文:http://www.cnblogs.com/qyaizs/articles/2039101.html,有些小改动~ 1 首先://注意在C ...
- C++/C中的struct和typedef struct用法和区别
struct和typedef struct 分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int ...
- struct inode 和 struct file
1.struct inode──字符设备驱动相关的重要结构介绍 内核中用inode结构表示具体的文件,而用file结构表示打开的文件描述符.Linux2.6.27内核中,inode结构体具体定义如下: ...
随机推荐
- VC++ win32 多线程 一边画圆一边画矩形
// WinThreadTest.cpp : Defines the entry point for the application. // #include "stdafx.h" ...
- SIM卡厂商的识别方法
ICCID(SIM卡号码)的定义应该是: 1-6位:国际移动运营商识别码(IMSI),898600为中国移动,898601为中国联通 7-20位:移动和联通的定义是不同的. 中国移动: 第7.8 ...
- Microsoft Accelerator for Windows Azure Alum Azuqua 今天启动
云最大的一个优势就是,它使开发人员比以往任何时候都更迅速.更灵活.在 Windows Azure 中开发应用程序时,工程师无需考虑架设服务器.规划容量或进行日常维护.相反,他们可以专注于提出假设 ...
- c++ cout 保留小数点位
需要头文件 <iomanip> 输出时需要用 fixed 和 setprecision() fixed代表输出浮点数,setprecision()设置精度. #include <io ...
- UITextField align left margin
如果我们想让我们的UITextField输入的字体偏移几个像素,我们常常用空格来代替,有时候我们不想用空格的话怎么办? #import <UIKit/UIKit.h> @interface ...
- Linux BFS简介
1. 什么是BFS 这里的BFS可不是广度优先算法,本文介绍的BFS是Linux的一个非Linux mainline调度算法.根据作者的描述BFS能够极大的提高低端设备(这里的低端设备的定义为:CPU ...
- WPF 自定义TextBox
1.TextBox前加图标. 效果: <TextBox Width="300" Height="30" Style="{StaticResour ...
- RADOS工作原理
转:http://www.csdn.net/article/2014-04-08/2819192-ceph-swift-on-openstack-m/2 Ceph的工作原理及流程 本节将对Ceph的工 ...
- iPhone APP 扫码下载
移动互联网发展迅速,各种APP的开发都太疯狂了,一般稍大点儿的应用,都会准备多个版本,比如:iPhone版.iPad版.Android版,我们姑且称之为:终端适配. 业务做的再大点儿的,APP还会考虑 ...
- photoshop使用注意事项
CMYK 与 RGB 任何网络图片都会以RGB模式显示图片: 数码图片以RGB模式被捕捉,因此应在RGB模式下编辑: 大部分工具和滤镜只能在RGB模式下使用: RGB模式和CMYK模式之间不能实现无损 ...