
U-boot中有一个用来保存很多有用信息的全局结构体 --gd_t(global data缩写),其中包括了bd变量,可以说gd_t结构体包括了u-boot中所有重要全局变量。最后传递给内核的参数,都是从gd和bd中来的,如上 述的setup_memory_tags函数的作用就是用bd中的值来初始化RAM相应的tag。
对于ARM平台这个结构体的定义大致如下:
include/asm-arm/global_data.h
typedef struct global_data {
bd_t *bd
unsigned long flags
unsigned long baudrate
unsigned long have_console/* serial_init() was called */
unsigned long reloc_off/* Relocation Offset */
unsigned long env_addr/* Address of Environment struct */
unsigned long env_valid/* Checksum of Environment valid? */
unsigned long fb_base/* base address of frame buffer */
void **jt/* jump table */
} gd_t
在U-boot中使用gd结构之前要用先用宏DECLARE_GLOBAL_DATA_PTR来声明。这个宏的定义如下:
include/asm-arm/global_data.h
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
从这个宏的定义可以看出,gd是一个保存在ARM的r8寄存器中的gd_t结构体的指针。
说明:本文的版本为U-boot-1.3.4、Linux-2.6.28,平台是ARM。
function singplay() {var self = this
this.prefix = "sing_play__fm_"
this.playIndex = -1
this.listIndex = { PlayList: 0, MusicBox: 1 }
this.isLogin = false
this.countMusicbox = -1
this.cookieList = { PlayList: this.prefix + "0", MusicBox: this.prefix + "1" }
this.cookie
this.agent
this.init()
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)