uboot全局数据gd_t、bd_t和device_t
gd_t定义在include/asm-arm/global_data.h
33 /* Keep it *SMALL* and remember to set CFG_GBL_DATA_SIZE > sizeof(gd_t)
34 */
36 typedef struct global_data {
37 bd_t *bd;
38 unsigned long flags;
39 unsigned long baudrate;
40 unsigned long have_console; /* serial_init() was called */
41 unsigned long reloc_off; /* Relocation Offset */
42 unsigned long env_addr; /* Address of Environment struct */
43 unsigned long env_valid; /* Checksum of Environment valid? */
44 unsigned long fb_base; /* base address of frame buffer */
45 #ifdef CONFIG_VFD
46 unsigned char vfd_type; /* display type */
47 #endif
48 #if 0
49 unsigned long cpu_clk; /* CPU clock in Hz! */
50 unsigned long bus_clk;
51 phys_size_t ram_size; /* RAM size */
52 unsigned long reset_status; /* reset status register at boot */
53 #endif
54 void **jt; /* jump table */
55 } gd_t;
67 #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
这个声明告诉编译器使用寄存器r8来存储gd_t类型的指针gd,即这个定义声明了一个指针,并且指明了它的存储位置。
register表示变量放在机器的寄存器
volatile用于指定变量的值可以由外部过程异步修改。
并且这个指针在start_armboot()(board.c)中被初始化:
/* Pointer is writable since we allocated a register for it */
gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t));
这样,gd就指向的一个可用的内存地址了。
-------------------------------------------------------------------------------------------------------------
bd_t定义于include/asm-arm/u-boot.h
39 typedef struct bd_info {
40 int bi_baudrate; /* serial console baudrate */
41 unsigned long bi_ip_addr; /* IP Address */
42 unsigned char bi_enetaddr[6]; /* Ethernet adress */
43 struct environment_s *bi_env;
44 ulong bi_arch_number; /* unique id for this board */
45 ulong bi_boot_params; /* where this board expects params */
46 struct /* RAM configuration */
47 {
48 ulong start;
49 ulong size;
50 } bi_dram[CONFIG_NR_DRAM_BANKS];
51 #ifdef CONFIG_HAS_ETH1
52 /* second onboard ethernet port */
53 unsigned char bi_enet1addr[6];
54 #endif
55 } bd_t;
56
57 #define bi_env_data bi_env->data
58 #define bi_env_crc bi_env->crc
------------------------------------------------------------------------------------------------
device_t定义于include/devices.h,是对串口设备文件的描述。
29 /*
30 * CONSOLE DEVICES
31 */
32
33 #define DEV_FLAGS_INPUT 0x00000001 /* Device can be used as input console */
34 #define DEV_FLAGS_OUTPUT 0x00000002 /* Device can be used as output console */
35 #define DEV_FLAGS_SYSTEM 0x80000000 /* Device is a system device */
36 #define DEV_EXT_VIDEO 0x00000001 /* Video extensions supported */
37
38 /* Device information */
39 typedef struct {
40 int flags; /* Device flags: input/output/system */
41 int ext; /* Supported extensions */
42 char name[16]; /* Device name */
43
44 /* GENERAL functions */
45
46 int (*start) (void); /* To start the device */
47 int (*stop) (void); /* To stop the device */
48
49 /* OUTPUT functions */
50
51 void (*putc) (const char c); /* To put a char */
52 void (*puts) (const char *s); /* To put a string (accelerator) */
53
54 /* INPUT functions */
55
56 int (*tstc) (void); /* To test if a char is ready... */
57 int (*getc) (void); /* To get that char */
58
59 /* Other functions */
60
61 void *priv; /* Private extensions */
62 } device_t;
uboot全局数据gd_t、bd_t和device_t的更多相关文章
- gd_t , bd_t 结构分析
在分析板级初始化函数board_init_f 和 board_init_r 之前,先来看一下在uboot中颇为重要的 gd_t, bd_t 结构 bd_t 所对应的定义bd_info 在 arch/a ...
- 我这么玩Web Api(二):数据验证,全局数据验证与单元测试
目录 一.模型状态 - ModelState 二.数据注解 - Data Annotations 三.自定义数据注解 四.全局数据验证 五.单元测试 一.模型状态 - ModelState 我理解 ...
- android中共享全局数据的方法
转自:http://blog.csdn.net/ameyume/article/details/6100756 我们在平时的开发中,有时候可能会需要一些全局数据,来让应用中的所有Activity和Vi ...
- 全局数据 GetGlobalDataSet
/// <summary> /// 获取全局数据 /// </summary> /// <returns></returns> public DataS ...
- CAD通过扩展记录实体向数据库读写用户自定义的全局数据(com接口VB语言)
VB代码实现如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...
- 微信小程序全局数据globalData的使用问题
如果在A页面设置全局属性,但在B页面无法使用的话,可能是这个问题: app.js globalData: { helpPage:0, }, A页面 A(e) { getApp().globalData ...
- u-boot分析——struct gd_t与struct bd_t
gd_t和bd_t是u-boot中两个重要的数据结构,在初始化操作很多都要靠这两个数据结构来保存或传递.分别定义在./include/asm/global_data.h和./include/asm/u ...
- u-boot include目录 gd_t结构体 如何关联芯片指定的目录
1 u-boot /u-boot-2018.07-fmxx/include/config.h /* Automatically generated - do not edit */#define CO ...
- 扩展EF的Fluent API中的 OnModelCreating方法 实现全局数据过滤器
1.生成过滤的表达式目录树 protected virtual Expression<Func<TEntity, bool>> CreateFilterExpression&l ...
随机推荐
- HawkHost退款流程详解
http://www.senzw.com/newsfile/2011928115323.htmlHawkhost提供30天退款保证,退款流程也比较简单,下面为大家介绍一下整个退款流程. 首先登录客户中 ...
- Python学习笔记014——迭代器 Iterator
1 迭代器的定义 凡是能被next()函数调用并不断返回一个值的对象均称之为迭代器(Iterator) 2 迭代器的说明 Python中的Iterator对象表示的是一个数据流,被函数next()函数 ...
- selenium + python 怎样才能滚到页面的底部?
可以用 execute_script方法来处理这个. 调用原生javascript的API,这样你想滚到哪里就能滚到哪里. 下面的代码演示了如何滚到页面的最下面: driver.execute_s ...
- android使用JsonWriter拼json字符串
JsonWriter使用 Example: 拼一个如下的json格式String { [ { "id": 912345678901, ...
- (二)RocketMq入门之消息发送和接收
一.消息产生.发送 public class Producer { public static void main(String[] args) throws MQClientException { ...
- 转:ASP.NET MVC 将IList<T>导出Excel文档的泛型类
/// <summary> /// 提供将泛型集合数据导出Excel文档. /// </summary> /// <typeparam name="T" ...
- linux中init.d文件夹的说明
一.简单说明 /etc/init.d 是 /etc/rc.d/init.d 的软链接(soft link).可以通过 ll 命令查看. ls -ld /etc/init.d lrwxrwxrwx. r ...
- 使用cat命令添加或附加多行文本
覆盖原有文本: cat>test<<EOF the 1 line the 2 line the 3 line EOF 追加的原有文本尾部: cat>>test<&l ...
- 解决:IIS APPPOOL\DefaultAppPool 登录失败的问题
为大家介绍下解决IIS APPPOOL\DefaultAppPool 登录失败的方法,有遇到类似问题的朋友参考下. 添加ASP.NET网站时,选择添加"添加应用程序"连接sql s ...
- webBench&ad网站并发测试工具
webBench 测试工具使用,网站上线前压力测试工具. ad测试工具