📄 linux设备驱动程序学习(3-补)-linux中的循环缓冲区 - linux设备驱动程序 - tekkaman ninja.htm
字号:
style="COLOR: #0000cc">#</SPAN>cat <SPAN
style="COLOR: #0000cc">/</SPAN>proc<SPAN
style="COLOR: #0000cc">/</SPAN>devices<BR>Character
devices<SPAN
style="COLOR: #0000cc">:</SPAN><BR> 1
mem<BR> 2 pty<BR> 3
ttyp<BR> 4 <SPAN
style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>vc<SPAN
style="COLOR: #0000cc">/</SPAN>0<BR> 4
tty<BR> 4 ttyS<BR> 5 <SPAN
style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>tty<BR> 5
<SPAN style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>console<BR> 5
<SPAN style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>ptmx<BR> 7
vcs<BR> 10 misc<BR> 13
input<BR> 14 sound<BR> 81
video4linux<BR> 89 i2c<BR> 90
mtd<BR>116 alsa<BR>128 ptm<BR>136 pts<BR>153
spi<BR>180 usb<BR>189 usb_device<BR>204
s3c2410_serial<BR><FONT color=#ff0000>252
scull_kfifo</FONT><BR>253 usb_endpoint<BR>254
rtc<BR><BR>Block devices<SPAN
style="COLOR: #0000cc">:</SPAN><BR> 1
ramdisk<BR>256 rfd<BR> 7
loop<BR> 31 mtdblock<BR> 93
nftl<BR> 96 inftl<BR>179 mmc<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN>mknod <SPAN
style="COLOR: #0000cc">-</SPAN>m 666 <SPAN
style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>scull_kfifo c 252
0<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN>echo 1234567890
<SPAN style="COLOR: #0000cc">></SPAN> <SPAN
style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>scull_kfifo<BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 11
bytes<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN><SPAN
style="COLOR: #0000cc">/</SPAN>tmp<SPAN
style="COLOR: #0000cc">/</SPAN>scull_kfifo_test<BR>scull_kfifo<SPAN
style="COLOR: #0000cc">:</SPAN> the module can
<SPAN style="COLOR: #0000ff">not</SPAN>
lseek!<BR>please input the command <SPAN
style="COLOR: #0000cc">:</SPAN>1<BR>scull_kfifo<SPAN
style="COLOR: #0000cc">:</SPAN> ioctl
SCULL_KFIFO_SIZE len<SPAN
style="COLOR: #0000cc">=</SPAN>11<BR>please
input the command <SPAN
style="COLOR: #0000cc">:</SPAN>2<BR>scull_kfifo<SPAN
style="COLOR: #0000cc">:</SPAN>
SCULL_KFIFO_RESET code<SPAN
style="COLOR: #0000cc">=</SPAN>0<BR>please input
the command <SPAN
style="COLOR: #0000cc">:</SPAN>1<BR>scull_kfifo<SPAN
style="COLOR: #0000cc">:</SPAN> ioctl
SCULL_KFIFO_SIZE len<SPAN
style="COLOR: #0000cc">=</SPAN>0<BR>please input
the command <SPAN
style="COLOR: #0000cc">:</SPAN>q<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN>echo
123456789012345678901234567890 <SPAN
style="COLOR: #0000cc">></SPAN> <SPAN
style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>scull_kfifo
</FONT></SPAN></CODE></P>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: #000000"><FONT face=新宋体><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 31
bytes<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN>echo
123456789012345678901234567890 <SPAN
style="COLOR: #0000cc">></SPAN> <SPAN
style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>scull_kfifo
</FONT></SPAN></CODE></P>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: #000000"><FONT face=新宋体><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 31
bytes<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN>echo 1234567890
<SPAN style="COLOR: #0000cc">></SPAN> <SPAN
style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>scull_kfifo</FONT></SPAN></CODE></P>
<P
style="MARGIN: 5px; LINE-HEIGHT: 150%"><CODE><SPAN
style="COLOR: #000000"><FONT
face=新宋体> <SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 2
bytes<BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 0
bytes<BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 0
bytes<BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 0
bytes<BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 0
bytes<BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 0
bytes<BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 0
bytes<BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 0
bytes<BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 0
bytes<BR>printk<SPAN
style="COLOR: #0000cc">:</SPAN> 204310 <SPAN
style="COLOR: #ff0000">messages</SPAN>
suppressed<SPAN
style="COLOR: #0000cc">.</SPAN><BR><SPAN
style="COLOR: #ff00ff">"sh"</SPAN> did <SPAN
style="COLOR: #ff0000">write</SPAN> 0
bytes<BR><BR>1234567890<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN><SPAN
style="COLOR: #0000cc">/</SPAN>tmp<SPAN
style="COLOR: #0000cc">/</SPAN>scull_kfifo_test<BR>scull_kfifo<SPAN
style="COLOR: #0000cc">:</SPAN> the module can
<SPAN style="COLOR: #0000ff">not</SPAN>
lseek!<BR>please input the command <SPAN
style="COLOR: #0000cc">:</SPAN>1<BR>scull_kfifo<SPAN
style="COLOR: #0000cc">:</SPAN> ioctl
SCULL_KFIFO_SIZE len<SPAN
style="COLOR: #0000cc">=</SPAN>64<BR>please
input the command <SPAN
style="COLOR: #0000cc">:</SPAN>q<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN>cat <SPAN
style="COLOR: #0000cc">/</SPAN>dev<SPAN
style="COLOR: #0000cc">/</SPAN>scull_kfifo<BR>printk<SPAN
style="COLOR: #0000cc">:</SPAN> 1493677 <SPAN
style="COLOR: #ff0000">messages</SPAN>
suppressed<SPAN
style="COLOR: #0000cc">.</SPAN><BR><SPAN
style="COLOR: #ff00ff">"cat"</SPAN> did <SPAN
style="COLOR: #ff0000">read</SPAN> 64
bytes<BR>1234<SPAN
style="COLOR: #ff00ff">"cat"</SPAN> reading<SPAN
style="COLOR: #0000cc">:</SPAN> going to <SPAN
style="COLOR: #ff0000">sleep</SPAN><BR>56789012345678901234567890<BR>123456789012345678901234567890<BR>12<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN><SPAN
style="COLOR: #0000cc">/</SPAN>tmp<SPAN
style="COLOR: #0000cc">/</SPAN>scull_kfifo_test<BR>scull_kfifo<SPAN
style="COLOR: #0000cc">:</SPAN> the module can
<SPAN style="COLOR: #0000ff">not</SPAN>
lseek!<BR>please input the command <SPAN
style="COLOR: #0000cc">:</SPAN>2<BR>scull_kfifo<SPAN
style="COLOR: #0000cc">:</SPAN>
SCULL_KFIFO_RESET code<SPAN
style="COLOR: #0000cc">=</SPAN>0<BR>please input
the command <SPAN
style="COLOR: #0000cc">:</SPAN>q<BR><SPAN
style="COLOR: #0000cc">[</SPAN>Tekkaman2440@SBC2440V4<SPAN
style="COLOR: #0000cc">]</SPAN><SPAN
style="COLOR: #0000cc">#</SPAN>rmmod
scull_kfifo<BR><SPAN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -