浅析s3c24xx_console_init和s3c24xx_serial_init

最近在研究s3c2440窜口驱动程序代码是,有点困惑,s3c24xx_console_init和s3c24xx_serial_init都是是窜口输出信息,有什么异同点呢?

于是通过实验来解此惑(有点摧残开发板)

s3c24xx_console_init
这是一个的控制台初始化函数,将s3c平台的窜口驱动程序写入__con_callinit_start 和__con_callinit_end之间,此时console_init()函数才能调用相应的窜口驱动程序完成显示任务。
  *s3c24xx_console_init调用s3c24xx_serial_initconsole(__drv, __inf)来完成窜口控制台的初始化工作。
当我注释掉return s3c24xx_serial_init(&s3c2440_serial_drv,...)函数后,输出结果如下:
Linux version 2.6.29.4-FriendlyARM (liunx@liunx-desktop) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #13 Sun Dec 6 22:31:58 CST 2009
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: FriendlyARM Mini2440 development board
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0
irq: clearing subpending status 00000007
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 62748KB available (1780K code, 243K data, 96K init)
SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
yaffs Dec  4 2009 18:26:14 Installing.
msgmni has been set to 122
io scheduler noop registered (default)
Console: switching to colour frame buffer device 30x20
fb0: s3c2410fb frame buffer device
backlight    initialized
loop: module loaded
Linux video capture interface: v2.00
initializing s3c2440 camera interface......
s3c2440 camif init done
Loading OV9650 driver.........
SCCB address 0x60, manufacture ID 0xFFFF, expect 0x7FA2
SCCB address 0x60, manufacture ID 0xFFFF, expect 0x7FA2
No OV9650 found!!!
Driver 'sd' needs updating - please use bus_type methods
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x000000000000-0x000000060000 : "supervivi"
0x000000060000-0x000000260000 : "Kernel"
0x000000260000-0x000040260000 : "root"
mtd: partition "root" extends beyond the end of device "NAND 64MiB 3,3V 8-bit" -- size truncated to 0x3da0000
0x000000000000-0x000040000000 : "nand"
mtd: partition "nand" extends beyond the end of device "NAND 64MiB 3,3V 8-bit" -- size truncated to 0x4000000
mice: PS/2 mouse device common for all mice
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 96K
Warning: unable to open an initial console.
--------------------------------------------------------
恢复后,输出如下:
Please press Enter to activate this console.
-/bin/sh: id: not found
[root@FriendlyARM /]#
能够开启控制台。

当注释掉s3c24xx_console_init(...)函数后,仍然显示输出,但无控制台提示或警告
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs_read_super: isCheckpointed 0
VFS: Mounted root (yaffs filesystem) on device 31:2.
Freeing init memory: 96K
================

当同时注释掉这两个函数后,无输出:
NOW, Booting Linux......
Uncompressing Linux................................................................ done, booting the kernel.
。。。
下面研究一下这两个函数的关系:
*rest_init()函数完成剩下的驱动的初始化工作,其中包括窜口完全的初始化,所以,console_init()函数只是简单利用窜口输出信息,当我终止rest_init()函数的运行,并注释掉/drivers/serial/s3c2440.c中的s3c24xx_console_init()函数后,无输出。


恢复后,输出如下:
Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Next, let's enter into the rest_init()function
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
从中可以看出,S3C2440:...后的初始化工作都交由rest_init()函数来完成,而s3c24xx_serial_init函数正是在rest_init()的队伍里,s3c24xx_console_init()的功绩正是用来及早的从窜口输出信息,方便debug.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值