一、函数说明
函数功能: 完成设备的初始化
函数位置: common/devices.c
二、程序分析
1 int devices_init (void) 2 { 3 #ifndef CONFIG_ARM /* already relocated for current ARM implementation */ 4 ulong relocation_offset = gd->reloc_off; 5 int i; 6 7 /* relocate device name pointers */ 8 for (i = 0; i < (sizeof (stdio_names) / sizeof (char *)); ++i) { 9 stdio_names[i] = (char *) (((ulong) stdio_names[i]) + 10 relocation_offset); 11 }//重定位设备输入输出设备名字指针 12 #endif 13 14 /* Initialize the list */ 15 devlist = ListCreate (sizeof (device_t));//初始化列表 16 17 if (devlist == NULL) { 18 eputs ("Cannot initialize the list of devices!\n"); 19 return -1; 20 } 21 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) 22 i2c_init (CFG_I2C_SPEED, CFG_I2C_SLAVE); 23 #endif 24 #ifdef CONFIG_LCD 25 drv_lcd_init (); 26 #endif 27 #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) 28 drv_video_init (); 29 #endif 30 #ifdef CONFIG_KEYBOARD 31 drv_keyboard_init (); 32 #endif 33 #ifdef CONFIG_LOGBUFFER 34 drv_logbuff_init (); 35 #endif 36 drv_system_init (); 37 #ifdef CONFIG_SERIAL_MULTI 38 serial_devices_init (); 39 #endif 40 #ifdef CONFIG_USB_TTY 41 drv_usbtty_init (); 42 #endif 43 #ifdef CONFIG_NETCONSOLE 44 drv_nc_init (); 45 #endif 46 47 return (0); 48 }