自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

paomadi的专栏

微信:MHB360

  • 博客(87)
  • 资源 (36)
  • 收藏
  • 关注

原创 三轴陀螺仪MPU3050驱动解析

MPU3050是invensense公司的三轴陀螺仪芯片,三轴陀螺仪最大的作用就是“测量角速度,以判别物体的运动状态,所以也称为运动传感器.下图是MPU3050的系统框图,芯片有1个中断引脚,可以通过i2c来控制,获取x Gyro,y Gyro,z Gyro设备驱动中用mpu3050_sensor结构体来描述MPU3050设备对象(对象中包含i2c客户端及输入设备来处理获取的x,y,z轴数据的传递

2014-03-28 22:39:43 10502 1

原创 三轴加速度传感器bma150驱动解析

BMA150 博世 三轴加速度传感器SPI(4线,3线),i2c,中断引脚频响+/- 2g,4g,8g;带宽25~1500hz,中断触发内部加速度求值低功耗,快速唤醒包含数据寄存器,控制寄存器,状态寄存器,设置寄存器及EEPROM寄存器读写使用i2c接口,所以需要驱动i2c设备数据需要获取xyz值,所以可以添加成input设备用一个bma150_data数据对象来描

2014-03-27 12:14:50 7666

原创 exec函数族

exec函数族的作用是根据指定的文件名找到可执行文件,并用它来取代调用进程的内容,换句话说,就是在调用进程内部执行一个可执行文件exec函数族共6个函数:1.int execl(const char *path, const char *arg0, ... /*, (char *)0 */);path:路径arg0,arg1,...,argn:参数#include in

2014-01-23 16:07:17 2803

原创 linux网络设备—mdio总线

一.结构体struct mii_bus { const char *name; //总线名 char id[MII_BUS_ID_SIZE]; //id void *priv; //私有数据 int (*read)(struct mii_bus *bus, int phy_id, int regnum); //读方法 int (*write)(struct mii_bus

2013-11-14 09:38:28 10336 2

原创 linux网络设备—PHY

一.结构体1.PHY设备struct phy_device { struct phy_driver *drv; //PHY设备驱动 struct mii_bus *bus; //对应的MII总线 struct device dev; //设备文件 u32 phy_id; //PHY ID enum phy_state state; //PHY状态 u32 dev_f

2013-11-14 09:37:58 10877 5

原创 动态域名ddns开源客户端inadyn的移植

一.交叉编译http://inatech.eu/inadyn/readme.html下载inadyn.v1.96.2.zip解压cd inadyn修改makefileCOMPILE=gcc -Wall -pedantic -c $(ARCH_SPECIFIC_CFLAGS) $(CFLAGS) -o "$(OUTDIR)/$(*F).o" $(CFG_INC) "$<"L

2013-11-09 09:26:22 7216 1

原创 深入解析linux下rtc架构

一.描述rtc相关结构体1.rtc设备struct rtc_device //rtc设备{ struct device dev; //设备文件 struct module *owner; //所有者 int id; //次设备号 char name[RTC_DEVICE_NAME_SIZE]; //rtc设备名 const struct

2013-10-26 16:24:45 6525

原创 web服务器goahead的移植

1.网上下载goahead-3.1.1-0-src.tgz包2.解压tar -zxvf goahead-3.1.1-0-src.tgz3.编译cd goahead-3.1.1-0make CC=arm-none-linux-gnueabi-gcc ARCH=arm在linux-arm-default/bin中可以找到goahead4.测试修改运行./goahead测

2013-10-22 12:46:56 5708

原创 嵌入式ntp服务器的移植

一.交叉编译1.官网下载http://www.ntp.org/点击download选项页我的版本是ntp-4.2.6p5.tar.gz2.解压tar -zxvf ntp-4.2.6p5.tar.gz3.进入解压目录配置./configure --host=arm-linux CC=arm-none-linux-gnueabi-gcc或者指定安装路径./configu

2013-09-11 13:19:37 5827

原创 uvc摄像头代码解析7

13.uvc视频初始化

2013-09-11 12:59:04 8242 3

原创 uvc摄像头代码解析6

10.扫描视频设备链和注册视频设备10.1 uvc视频链struct uvc_video_chain { //uvc视频链 struct uvc_device *dev; //uvc设备 struct list_head list; //uvc视频链链表头 struct list_head entities; //uvc实体链表头 struct uvc_entit

2013-09-11 12:57:34 8329 4

原创 uvc摄像头代码解析5

8.初始化uvc控制8.1 重要结构体struct uvc_control { //uvc控制 struct uvc_entity *entity; //uvc实体 struct uvc_control_info info; //uvc控制信息 __u8 index; //索引值 __u8 dirty:1, loaded:1, modified:1,

2013-09-11 12:56:36 9909 1

原创 uvc摄像头代码解析4

7.uvc_parse_format7.1 uvc格式描述符struct uvc_format_desc { //uvc格式描述符char *name; //uvc格式描述符名字__u8 guid[16];//全局唯一ID__u32 fcc; //压缩格式};7.2 uvc解析1个格式描述符static int uvc_parse_format(st

2013-08-30 10:50:07 9056 2

原创 uvc摄像头代码解析3

6.uvc解析uvc视频流6.1 重要结构体6.1.1 uvc数据流

2013-08-30 10:49:20 7449 1

原创 uvc摄像头代码解析2

1.uvc驱动模块入口module_init(uvc_init); //1.模块入口2.初始化函数static int __init uvc_init(void) // 2.初始化函数{ int result; result = usb_register(&uvc_driver.driver); // 3.注册usb设备驱动(usb摄像头设备) if (result =

2013-08-26 10:32:56 11860 4

原创 uvc摄像头代码解析1

一.FAQ1.判断自己的摄像头是否支持uvc标准输入lsusb //列出usb设备Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 001 Device 003: ID 0c45:62f1 Microdia //摄像头Bus 002 Device 001: ID 1d6b:0002 L

2013-08-26 09:34:20 11224 3

原创 ini文件解析c库(iniparser)

一.交叉编译ini解析库1.官方网站http://ndevilla.free.fr/iniparser下载iniparser-3.1.tar.gz2.解压tar -zxvf iniparser-3.1.tar.gz cd tar -zxvf iniparser3.修改makefileCC = gcc 修改为--> CC = arm-none-linux-gnueabi

2013-07-27 22:01:26 13245 1

原创 ffmpeg,live555,mplayer交叉编译

一.ffmpeg的编译1.从官网http://ffmpeg.org/下载 ffmpeg-2.0.tar.gz2.解压tar -zxvf ffmpeg-2.0.tar.gz 3.配置生成makefile./configure --enable-cross-compile --cross-prefix=arm-none-linux-gnueabi- --arch=arm --tar

2013-07-25 15:11:57 5949

原创 tcpdump交叉编译及使用

第一步.下载官方网站:http://www.tcpdump.org/需要下载libpcap包和tcpdump包我下载的版本是:libpcap-1.4.0.tar.gz和tcpdump-4.4.0.tar.gz第二步.编译libpcap包2.1 解压tar -zxvf libpcap-1.4.0.tar.gz2.2 进入解压目录cd libpcap-1.4.0/2.3

2013-07-23 22:34:25 10050

原创 lsof交叉编译

一.交叉编译1 下载网上搜索lsof-4.80.tar.gz2.解压tar -zxvf lsof-4.80.tar.gzcd lsof_4.80tar -xvf lsof_4.80_src.tar 3.根据/lsof-4.80/lsof_4.80_src/00XCONFIG文件设置环境变量export LSOF_CC="/opt/GCC/bin/arm-none-l

2013-07-23 19:50:50 6404

原创 web服务器thttpd的移植

1.官网下载http://www.acme.com/software/thttpd/ 版本thttpd-2.25b.tar.gz2.解压 tar -zxvf thttpd-2.25b.tar.gz3../configure4.修改makefileCC = gcc -> CC = arm-none-linux-gnueabi-gcc总共有3个makefile要改压缩根

2013-07-23 13:45:23 2943 1

原创 web服务器boa的移植

1.下载官方网站http://www.boa.org/我下载的是0.94.13版本2.解压tar -zxvf boa-0.94.13.tar.gz3.进入src目录./configure配置一下生成makefile文件4.修改makefileCC = gcc CPP = gcc -E改为CC = arm-none-linux-gnueabi-gcc

2013-07-21 14:24:32 4037

原创 嵌入式linux下u盘升级的设计

一.内核配置,配置使其支持u盘make menu_config    Device Drivers --->        [*]USB support -->               USB Mass Storage supportu盘底层依赖scsi,所以scsi的配置也要配置好二.设计更新代码我是这么设计的:写个应用程序存放在文件系统的/bin目录下,取名up

2013-07-11 15:26:21 5103 1

原创 MTD设备驱动--NAND flash

前面的文章MTD设备驱动(http://blog.csdn.net/paomadi/article/details/9262307)讲了mtd设备的架构组织其中讲述了调用int add_mtd_partitions(struct mtd_info *master,const struct mtd_partition *parts,int nbparts) 该函数一个作用是mtd_info

2013-07-08 13:02:23 3268

原创 MTD设备驱动

MTD(memory technology device):内存技术设备是linux用于描述ROM,NAND,NOR等内存设备的子系统的抽象MTD设备可以按块读写也可以按字节读写,也就是说MTD设备既可以是块设备也可以是字符设备一.MTD设备基础1.关键结构体对象在MTD中用mtd_info来描述一个内存设备struct mtd_info { u_char type;

2013-07-07 12:15:58 6029 1

原创 usb键鼠驱动分析

一、鼠标linux下的usb鼠标驱动在/drivers/hid/usbhid/usbmouse.c中实现1.加载初始化过程1.1模块入口module_init(usb_mouse_init);1.2初始化函数static int __init usb_mouse_init(void) //初始化{ int retval = usb_register(&usb_mou

2013-06-29 11:27:40 5053

原创 让qt应用程序支持触摸

一.设备驱动我的触摸屏是usb接口的可以参考下这2篇文件http://blog.csdn.net/paomadi/article/details/8754783 usb触摸屏http://blog.csdn.net/paomadi/article/details/8309861 输入子系统不是usb接口的或者自己想写多一个也可以(需要我的源码的请留邮箱说下,我贴一部分)us

2013-06-20 14:03:47 19104 26

原创 alsa音频架构4-声卡控制

第十五部分 声卡控制接口前面第一篇中讲到了每注册一个声卡都会创建注册一个对应的声卡控制设备,并给出了其操作函数集snd_ctl_f_ops,在"amixer,aplay,arecord的使用"一文中提及了amixer如何设置获取声卡的控制选项 接着在第二篇中讲到Asoc声卡驱动编写的步骤,步骤中没牵扯到控制设备的控制选项,这里要补充第5个步骤第5个步骤就是在设备驱动中要调用snd_

2013-05-31 12:57:31 4003 3

原创 alsa音频架构3-pcm

第十四部分 snd_pcm1.pcm结构体struct snd_pcm { struct snd_card *card; //声卡 struct list_head list; int device; //设备号 unsigned int info_flags; unsigned short dev_class; unsigned short dev_subclass; ch

2013-05-30 23:52:57 7416 2

原创 amixer,aplay,arecord交叉编译及使用

一.amixer用于控制设置 amixer的帮助提示信息Usage: amixer [command]Available options: -h,--help this help -c,--card N select the card -D,--device N select the device, default 'default' -d,-

2013-05-30 04:26:26 11567

原创 alsa音频架构2-ASoc

设计ASoc的目的是为嵌入式系统片上处理器音频单元或外部的音频解码芯片提供更好的ALSA支持ASoC有多个组件组成snd_soc_platform/snd_soc_codec/snd_soc_dai/snd_soc_card以及ALSA的snd_pcmsnd_soc_platform和snd_soc_codec就行平台与设备的关系缺一不可,snd_soc_card是它们实例化的一个对象

2013-05-28 11:58:21 5792 2

原创 linux中的轮询机制select/poll/epoll

参考:StephenChan's Tech Spacehttp://www.cnblogs.com/xuxm2007/archive/2011/08/15/2139809.htmlhttp://xingyunbaijunwei.blog.163.com/blog/static/76538067201241685556302/比较 select sel

2013-05-23 12:46:51 12667

转载 成大事必备9种能力、9种手段、9种心态

出处:http://blog.csdn.net/tigerdsh/article/details/8890086成大事的九种手段:1、敢于决断--克服犹豫不定的习性 很多人之所以一事无成,最大的毛病就是缺乏敢于决断的手段,总是左顾右盼、思前想后,从而错失成功的最佳时机。成大事者在看到事情的成功可能性到来时,敢于做出重大决断,因此取得先机。2、挑战弱点--彻底改变自己的缺

2013-05-06 16:10:27 1397

原创 alsa音频架构1

第一部分 alsa子系统关键结构体对象等1.声卡设备类型定义#define SNDRV_DEV_TOPLEVEL ((__force snd_device_type_t) 0)#define SNDRV_DEV_CONTROL ((__force snd_device_type_t) 1) #define SNDRV_DEV_LOWLEVEL_PRE ((__force snd_dev

2013-05-06 09:16:41 5156

原创 【android】根据init.rc启动action和service

一、init.rc语法规则1.init.rc文件的内容主要分类动作(Action)命令(Commands)服务(Services)选项(Options)触发(trigger)2.动作和命令一起使用on 2.1.trigger是触发条件,为真执行命令trigger有以下几种类型boot /init.conf加载完毕时触发=

2013-04-08 14:13:15 11250 1

原创 usb触摸屏驱动

源码在/drivers/input/touchscreen/usbtouchscreen.c中static int __init usbtouch_init(void) //入口函数{ return usb_register(&usbtouch_driver); //注册usb触摸屏驱动}module_init(usbtouch_init);看usbtouch_driver的定义s

2013-04-03 13:09:43 7643 1

原创 linux 中断机制浅析

一、中断相关结构体1.irq_desc中断描述符struct irq_desc {#ifdef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED struct irq_data irq_data;#else union { struct irq_data irq_data; //中断数据 struct { unsigned int irq;

2013-03-27 09:26:43 4425 1

原创 网卡从24c02获取设置mac地址

#include #include #include unsigned char mac_read(unsigned char command){ int ret; unsigned char buf; struct i2c_adapter *a = i2c_get_adapter(1); struct i2c_msg msg[2] = { { .addr = 0

2013-03-22 14:02:19 2770

原创 linux gpio接口

一.相关结构体1.gpio_chip代表一个芯片的一个gpio bankstruct gpio_chip { //gpio bank const char *label; //bank名 struct device *dev; //设备文件 struct module *owner; //模块所有者 int (*request)(struct gpio_chip *chip,u

2013-03-01 11:50:17 7098

原创 二 spi 子系统(spidev.c)

一.spidev.c文件看一个设备驱动的方法:概览下重要的结构体spidev_data及全局变量device_list,bufsiz,SPIDEV_MAJOR...module_init标识的入口初始化函数spidev_init,(module_exit标识的出口函数)设备与设备驱动匹配时候调用的probe方法spidev_probe设备驱动的操作函数集file_operati

2013-02-27 14:50:03 10458 2

linux 2+1+2

Understanding the Linux Virtual Memory Manager Understanding Linux Network Internals Understanding The Linux Kernel 3 Linux Kernel Development 3 Linux Device driver 3 全部都是英文版

2012-08-20

Windows 7 USB_DVD tool

windows7 u盘安装工具 windows7 u盘安装工具 windows7 u盘安装工具

2010-12-23

Universal-USB-Installer-1.8.1.5.exe

Universal-USB-Installer-1.8.1.5.exeUniversal-USB-Installer-1.8.1.5.exeUniversal-USB-Installer-1.8.1.5.exeUniversal-USB-Installer-1.8.1.5.exe

2010-12-02

Advanced_Programming_In_The_UNIX_Environment(2005)2Ed

Advanced_Programming_In_The_UNIX_Environment(2005)2Ed.pdfAdvanced_Programming_In_The_UNIX_Environment(2005)2Ed.pdfAdvanced_Programming_In_The_UNIX_Environment(2005)2Ed.pdfAdvanced_Programming_In_The_UNIX_Environment(2005)2Ed.pdfAdvanced_Programming_In_The_UNIX_Environment(2005)2Ed.pdfAdvanced_Programming_In_The_UNIX_Environment(2005)2Ed.pdfAdvanced_Programming_In_The_UNIX_Environment(2005)2Ed.pdf

2010-12-02

SoftICE for XP

  SoftICE是Compuware NuMega公司[1]的产品,是目前公认最好的系统级调试工具!兼容性和稳定性极好,可在源代码级调试各种应用程序和设备驱动程序,也可使用TCP/IP连接进行远程调试。ICE的含义   ICE(In Circuit Emulator)即实体电路模拟器,是用来跟踪软件执行动作细节的一个模拟CPU的电子设备。当然这种设备价格昂贵,不是常人所能拥有的。NuMega公司推出的Soft "ICE",意思是靠软件实现ICE的功能。   SoftICE单独发行的最高版本是SoftICE v4.3.2.2485,针对不同平台推出的相应的版本:DOS,Windows3.x,Windows 9x,Windows NT和Windows 2000。

2010-11-06

coreutils linux终端源码

coreutils-8.5.tar.gz 贴段CAT的大伙瞅瞅 /* cat -- concatenate files and print on the standard output. Copyright (C) 1988, 1990-1991, 1995-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Differences from the Unix cat: * Always unbuffered, -u is ignored. * Usually much faster than other versions of cat, the difference is especially apparent when using the -v option. By [email protected], Torbjorn Granlund, advised by rms, Richard Stallman. */ #include <config.h> #include <stdio.h> #include <getopt.h> #include <sys/types.h> #if HAVE_STROPTS_H # include <stropts.h> #endif #if HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif #include "system.h" #include "error.h" #include "full-write.h" #include "quote.h" #include "safe-read.h" #include "xfreopen.h" /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "cat" #define AUTHORS \ proper_name_utf8 ("Torbjorn Granlund", "Torbj\303\266rn Granlund"), \ proper_name ("Richard M. Stallman") /* Name of input file. May be "-". */ static char const *infile; /* Descriptor on which input file is open. */ static int input_desc; /* Buffer for line numbers. An 11 digit counter may overflow within an hour on a P2/466, an 18 digit counter needs about 1000y */ #define LINE_COUNTER_BUF_LEN 20 static char line_buf[LINE_COUNTER_BUF_LEN] = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0', '\t', '\0' }; /* Position in `line_buf' where printing starts. This will not change unless the number of lines is larger than 999999. */ static char *line_num_print = line_buf + LINE_COUNTER_BUF_LEN - 8; /* Position of the first digit in `line_buf'. */ static char *line_num_start = line_buf + LINE_COUNTER_BUF_LEN - 3; /* Position of the last digit in `line_buf'. */ static char *line_num_end = line_buf + LINE_COUNTER_BUF_LEN - 3; /* Preserves the `cat' function's local `newlines' between invocations. */ static int newlines2 = 0; void usage (int status) { if (status != EXIT_SUCCESS) fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ "), program_name); fputs (_("\ Concatenate FILE(s), or standard input, to standard output.\n\ \n\ -A, --show-all equivalent to -vET\n\ -b, --number-nonblank number nonempty output lines\n\ -e equivalent to -vE\n\ -E, --show-ends display $ at end of each line\n\ -n, --number number all output lines\n\ -s, --squeeze-blank suppress repeated empty output lines\n\ "), stdout); fputs (_("\ -t equivalent to -vT\n\ -T, --show-tabs display TAB characters as ^I\n\ -u (ignored)\n\ -v, --show-nonprinting use ^ and M- notation, except for LFD and TAB\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (_("\ \n\ With no FILE, or when FILE is -, read standard input.\n\ "), stdout); printf (_("\ \n\ Examples:\n\ %s f - g Output f's contents, then standard input, then g's contents.\n\ %s Copy standard input to standard output.\n\ "), program_name, program_name); emit_ancillary_info (); } exit (status); } /* Compute the next line number. */ static void next_line_num (void) { char *endp = line_num_end; do { if ((*endp)++ < '9') return; *endp-- = '0'; } while (endp >= line_num_start); if (line_num_start > line_buf) *--line_num_start = '1'; else *line_buf = '>'; if (line_num_start < line_num_print) line_num_print--; } /* Plain cat. Copies the file behind `input_desc' to STDOUT_FILENO. Return true if successful. */ static bool simple_cat ( /* Pointer to the buffer, used by reads and writes. */ char *buf, /* Number of characters preferably read or written by each read and write call. */ size_t bufsize) { /* Actual number of characters read, and therefore written. */ size_t n_read; /* Loop until the end of the file. */ for (;;) { /* Read a block of input. */ n_read = safe_read (input_desc, buf, bufsize); if (n_read == SAFE_READ_ERROR) { error (0, errno, "%s", infile); return false; } /* End of this file? */ if (n_read == 0) return true; /* Write this block out. */ { /* The following is ok, since we know that 0 < n_read. */ size_t n = n_read; if (full_write (STDOUT_FILENO, buf, n) != n) error (EXIT_FAILURE, errno, _("write error")); } } } /* Write any pending output to STDOUT_FILENO. Pending is defined to be the *BPOUT - OUTBUF bytes starting at OUTBUF. Then set *BPOUT to OUTPUT if it's not already that value. */ static inline void write_pending (char *outbuf, char **bpout) { size_t n_write = *bpout - outbuf; if (0 < n_write) { if (full_write (STDOUT_FILENO, outbuf, n_write) != n_write) error (EXIT_FAILURE, errno, _("write error")); *bpout = outbuf; } } /* Cat the file behind INPUT_DESC to the file behind OUTPUT_DESC. Return true if successful. Called if any option more than -u was specified. A newline character is always put at the end of the buffer, to make an explicit test for buffer end unnecessary. */ static bool cat ( /* Pointer to the beginning of the input buffer. */ char *inbuf, /* Number of characters read in each read call. */ size_t insize, /* Pointer to the beginning of the output buffer. */ char *outbuf, /* Number of characters written by each write call. */ size_t outsize, /* Variables that have values according to the specified options. */ bool show_nonprinting, bool show_tabs, bool number, bool number_nonblank, bool show_ends, bool squeeze_blank) { /* Last character read from the input buffer. */ unsigned char ch; /* Pointer to the next character in the input buffer. */ char *bpin; /* Pointer to the first non-valid byte in the input buffer, i.e. the current end of the buffer. */ char *eob; /* Pointer to the position where the next character shall be written. */ char *bpout; /* Number of characters read by the last read call. */ size_t n_read; /* Determines how many consecutive newlines there have been in the input. 0 newlines makes NEWLINES -1, 1 newline makes NEWLINES 1, etc. Initially 0 to indicate that we are at the beginning of a new line. The "state" of the procedure is determined by NEWLINES. */ int newlines = newlines2; #ifdef FIONREAD /* If nonzero, use the FIONREAD ioctl, as an optimization. (On Ultrix, it is not supported on NFS file systems.) */ bool use_fionread = true; #endif /* The inbuf pointers are initialized so that BPIN > EOB, and thereby input is read immediately. */ eob = inbuf; bpin = eob + 1; bpout = outbuf; for (;;) { do { /* Write if there are at least OUTSIZE bytes in OUTBUF. */ if (outbuf + outsize <= bpout) { char *wp = outbuf; size_t remaining_bytes; do { if (full_write (STDOUT_FILENO, wp, outsize) != outsize) error (EXIT_FAILURE, errno, _("write error")); wp += outsize; remaining_bytes = bpout - wp; } while (outsize <= remaining_bytes); /* Move the remaining bytes to the beginning of the buffer. */ memmove (outbuf, wp, remaining_bytes); bpout = outbuf + remaining_bytes; } /* Is INBUF empty? */ if (bpin > eob) { bool input_pending = false; #ifdef FIONREAD int n_to_read = 0; /* Is there any input to read immediately? If not, we are about to wait, so write all buffered output before waiting. */ if (use_fionread && ioctl (input_desc, FIONREAD, &n_to_read) < 0) { /* Ultrix returns EOPNOTSUPP on NFS; HP-UX returns ENOTTY on pipes. SunOS returns EINVAL and More/BSD returns ENODEV on special files like /dev/null. Irix-5 returns ENOSYS on pipes. */ if (errno == EOPNOTSUPP || errno == ENOTTY || errno == EINVAL || errno == ENODEV || errno == ENOSYS) use_fionread = false; else { error (0, errno, _("cannot do ioctl on %s"), quote (infile)); newlines2 = newlines; return false; } } if (n_to_read != 0) input_pending = true; #endif if (!input_pending) write_pending (outbuf, &bpout); /* Read more input into INBUF. */ n_read = safe_read (input_desc, inbuf, insize); if (n_read == SAFE_READ_ERROR) { error (0, errno, "%s", infile); write_pending (outbuf, &bpout); newlines2 = newlines; return false; } if (n_read == 0) { write_pending (outbuf, &bpout); newlines2 = newlines; return true; } /* Update the pointers and insert a sentinel at the buffer end. */ bpin = inbuf; eob = bpin + n_read; *eob = '\n'; } else { /* It was a real (not a sentinel) newline. */ /* Was the last line empty? (i.e. have two or more consecutive newlines been read?) */ if (++newlines > 0) { if (newlines >= 2) { /* Limit this to 2 here. Otherwise, with lots of consecutive newlines, the counter could wrap around at INT_MAX. */ newlines = 2; /* Are multiple adjacent empty lines to be substituted by single ditto (-s), and this was the second empty line? */ if (squeeze_blank) { ch = *bpin++; continue; } } /* Are line numbers to be written at empty lines (-n)? */ if (number && !number_nonblank) { next_line_num (); bpout = stpcpy (bpout, line_num_print); } } /* Output a currency symbol if requested (-e). */ if (show_ends) *bpout++ = '$'; /* Output the newline. */ *bpout++ = '\n'; } ch = *bpin++; } while (ch == '\n'); /* Are we at the beginning of a line, and line numbers are requested? */ if (newlines >= 0 && number) { next_line_num (); bpout = stpcpy (bpout, line_num_print); } /* Here CH cannot contain a newline character. */ /* The loops below continue until a newline character is found, which means that the buffer is empty or that a proper newline has been found. */ /* If quoting, i.e. at least one of -v, -e, or -t specified, scan for chars that need conversion. */ if (show_nonprinting) { for (;;) { if (ch >= 32) { if (ch < 127) *bpout++ = ch; else if (ch == 127) { *bpout++ = '^'; *bpout++ = '?'; } else { *bpout++ = 'M'; *bpout++ = '-'; if (ch >= 128 + 32) { if (ch < 128 + 127) *bpout++ = ch - 128; else { *bpout++ = '^'; *bpout++ = '?'; } } else { *bpout++ = '^'; *bpout++ = ch - 128 + 64; } } } else if (ch == '\t' && !show_tabs) *bpout++ = '\t'; else if (ch == '\n') { newlines = -1; break; } else { *bpout++ = '^'; *bpout++ = ch + 64; } ch = *bpin++; } } else { /* Not quoting, neither of -v, -e, or -t specified. */ for (;;) { if (ch == '\t' && show_tabs) { *bpout++ = '^'; *bpout++ = ch + 64; } else if (ch != '\n') *bpout++ = ch; else { newlines = -1; break; } ch = *bpin++; } } } } int main (int argc, char **argv) { /* Optimal size of i/o operations of output. */ size_t outsize; /* Optimal size of i/o operations of input. */ size_t insize; size_t page_size = getpagesize (); /* Pointer to the input buffer. */ char *inbuf; /* Pointer to the output buffer. */ char *outbuf; bool ok = true; int c; /* Index in argv to processed argument. */ int argind; /* Device number of the output (file or whatever). */ dev_t out_dev; /* I-node number of the output. */ ino_t out_ino; /* True if the output file should not be the same as any input file. */ bool check_redirection = true; /* Nonzero if we have ever read standard input. */ bool have_read_stdin = false; struct stat stat_buf; /* Variables that are set according to the specified options. */ bool number = false; bool number_nonblank = false; bool squeeze_blank = false; bool show_ends = false; bool show_nonprinting = false; bool show_tabs = false; int file_open_mode = O_RDONLY; static struct option const long_options[] = { {"number-nonblank", no_argument, NULL, 'b'}, {"number", no_argument, NULL, 'n'}, {"squeeze-blank", no_argument, NULL, 's'}, {"show-nonprinting", no_argument, NULL, 'v'}, {"show-ends", no_argument, NULL, 'E'}, {"show-tabs", no_argument, NULL, 'T'}, {"show-all", no_argument, NULL, 'A'}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} }; initialize_main (&argc, &argv); set_program_name (argv[0]); setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); /* Arrange to close stdout if we exit via the case_GETOPT_HELP_CHAR or case_GETOPT_VERSION_CHAR code. Normally STDOUT_FILENO is used rather than stdout, so close_stdout does nothing. */ atexit (close_stdout); /* Parse command line options. */ while ((c = getopt_long (argc, argv, "benstuvAET", long_options, NULL)) != -1) { switch (c) { case 'b': number = true; number_nonblank = true; break; case 'e': show_ends = true; show_nonprinting = true; break; case 'n': number = true; break; case 's': squeeze_blank = true; break; case 't': show_tabs = true; show_nonprinting = true; break; case 'u': /* We provide the -u feature unconditionally. */ break; case 'v': show_nonprinting = true; break; case 'A': show_nonprinting = true; show_ends = true; show_tabs = true; break; case 'E': show_ends = true; break; case 'T': show_tabs = true; break; case_GETOPT_HELP_CHAR; case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); default: usage (EXIT_FAILURE); } } /* Get device, i-node number, and optimal blocksize of output. */ if (fstat (STDOUT_FILENO, &stat_buf) < 0) error (EXIT_FAILURE, errno, _("standard output")); outsize = io_blksize (stat_buf); /* Input file can be output file for non-regular files. fstat on pipes returns S_IFSOCK on some systems, S_IFIFO on others, so the checking should not be done for those types, and to allow things like cat < /dev/tty > /dev/tty, checking is not done for device files either. */ if (S_ISREG (stat_buf.st_mode)) { out_dev = stat_buf.st_dev; out_ino = stat_buf.st_ino; } else { check_redirection = false; #ifdef lint /* Suppress `used before initialized' warning. */ out_dev = 0; out_ino = 0; #endif } if (! (number || show_ends || squeeze_blank)) { file_open_mode |= O_BINARY; if (O_BINARY && ! isatty (STDOUT_FILENO)) xfreopen (NULL, "wb", stdout); } /* Check if any of the input files are the same as the output file. */ /* Main loop. */ infile = "-"; argind = optind; do { if (argind < argc) infile = argv[argind]; if (STREQ (infile, "-")) { have_read_stdin = true; input_desc = STDIN_FILENO; if ((file_open_mode & O_BINARY) && ! isatty (STDIN_FILENO)) xfreopen (NULL, "rb", stdin); } else { input_desc = open (infile, file_open_mode); if (input_desc < 0) { error (0, errno, "%s", infile); ok = false; continue; } } if (fstat (input_desc, &stat_buf) < 0) { error (0, errno, "%s", infile); ok = false; goto contin; } insize = io_blksize (stat_buf); /* Compare the device and i-node numbers of this input file with the corresponding values of the (output file associated with) stdout, and skip this input file if they coincide. Input files cannot be redirected to themselves. */ if (check_redirection && stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino && (input_desc != STDIN_FILENO)) { error (0, 0, _("%s: input file is output file"), infile); ok = false; goto contin; } /* Select which version of `cat' to use. If any format-oriented options were given use `cat'; otherwise use `simple_cat'. */ if (! (number || show_ends || show_nonprinting || show_tabs || squeeze_blank)) { insize = MAX (insize, outsize); inbuf = xmalloc (insize + page_size - 1); ok &= simple_cat (ptr_align (inbuf, page_size), insize); } else { inbuf = xmalloc (insize + 1 + page_size - 1); /* Why are (OUTSIZE - 1 + INSIZE * 4 + LINE_COUNTER_BUF_LEN + PAGE_SIZE - 1) bytes allocated for the output buffer? A test whether output needs to be written is done when the input buffer empties or when a newline appears in the input. After output is written, at most (OUTSIZE - 1) bytes will remain in the buffer. Now INSIZE bytes of input is read. Each input character may grow by a factor of 4 (by the prepending of M-^). If all characters do, and no newlines appear in this block of input, we will have at most (OUTSIZE - 1 + INSIZE * 4) bytes in the buffer. If the last character in the preceding block of input was a newline, a line number may be written (according to the given options) as the first thing in the output buffer. (Done after the new input is read, but before processing of the input begins.) A line number requires seldom more than LINE_COUNTER_BUF_LEN positions. Align the output buffer to a page size boundary, for efficency on some paging implementations, so add PAGE_SIZE - 1 bytes to the request to make room for the alignment. */ outbuf = xmalloc (outsize - 1 + insize * 4 + LINE_COUNTER_BUF_LEN + page_size - 1); ok &= cat (ptr_align (inbuf, page_size), insize, ptr_align (outbuf, page_size), outsize, show_nonprinting, show_tabs, number, number_nonblank, show_ends, squeeze_blank); free (outbuf); } free (inbuf); contin: if (!STREQ (infile, "-") && close (input_desc) < 0) { error (0, errno, "%s", infile); ok = false; } } while (++argind < argc); if (have_read_stdin && close (STDIN_FILENO) < 0) error (EXIT_FAILURE, errno, _("closing standard input")); exit (ok ? EXIT_SUCCESS : EXIT_FAILURE); }

2010-09-02

protues最好的教程

Isis ares vsm 仿真器件的使用 画板 原理图 封装图 元件库 虚拟串口

2010-08-13

ANSI C c99规范

ANSI C c99规范

2010-08-13

网络调试助手+串口调试助手

网络调试助手+串口调试助手网络调试助手+串口调试助手网络调试助手+串口调试助手网络调试助手+串口调试助手网络调试助手+串口调试助手网络调试助手+串口调试助手

2010-08-11

----串口调试器----

串口调试手串口调试手串口调试手串口调试手串口调试手

2010-08-11

SD卡 物理层协议

1. General Description............................................................................................................1 2. System Features .................................................................................................................3 3. SD Memory Card System Concept ....................................................................................5 3.1 Read-Write Property......................................................................................................................5 3.2 Supply Voltage...............................................................................................................................5 3.3 Card Capacity................................................................................................................................5 3.4 Speed Class ..................................................................................................................................6 3.5 Bus Topology .................................................................................................................................7 3.6 Bus Protocol ..................................................................................................................................7 3.6.1 SD Bus....................................................................................................................................7 3.6.2 SPI Bus .................................................................................................................................10 3.7 SD Memory Card–Pins and Registers......................................................................................... 11 4. SD Memory Card Functional Description .......................................................................12 4.1 General ........................................................................................................................................12 4.2 Card Identification Mode..............................................................................................................13 4.2.1 Card Reset ............................................................................................................................13 4.2.2 Operating Condition Validation..............................................................................................13 4.2.3 Card Initialization and Identification Process ........................................................................15 4.3 Data Transfer Mode.....................................................................................................................17 4.3.1 Wide Bus Selection/Deselection ...........................................................................................19 4.3.2 2 GByte Card ........................................................................................................................19 4.3.3 Data Read.............................................................................................................................19 4.3.4 Data Write .............................................................................................................................20 4.3.5 Erase.....................................................................................................................................22 4.3.6 Write Protect Management ...................................................................................................22 4.3.7 Card Lock/Unlock Operation.................................................................................................23 4.3.7.1 General ................................................................................................................................. 23 4.3.7.2 Parameter and the Result of CMD42.................................................................................... 25 4.3.7.3 Forcing Erase ....................................................................................................................... 27 4.3.7.3.1 Force Erase Function to the Locked Card...................................................................... 27 4.3.7.4 Relation Between ACMD6 and Lock/Unlock State................................................................ 28 4.3.7.5 Commands Accepted for Locked Card ................................................................................. 28 4.3.7.6 Two Types of Lock/Unlock Card............................................................................................ 29 4.3.8 Content Protection ................................................................................................................29 4.3.9 Application-Specific Commands............................................................................................29 4.3.9.1 Application-Specific Command – APP_CMD (CMD55)......................................................... 29 4.3.9.2 General Command - GEN_CMD (CMD56) ........................................................................... 30 4.3.10 Switch Function Command .................................................................................................31 4.3.10.1 General ............................................................................................................................... 31 4.3.10.2 Mode 0 Operation - Check Function ................................................................................... 32 4.3.10.3 Mode 1 Operation - Set Function........................................................................................33 4.3.10.4 Switch Function Status........................................................................................................ 35 4.3.10.4.1 Busy Status Indication for Functions ............................................................................ 36 4.3.10.4.2 Data Structure Version ................................................................................................. 37 4.3.10.4.3 Function Table of Switch Command............................................................................. 37 4.3.10.5 Relationship between CMD6 data & other commands ....................................................... 38 4.3.10.6 Switch Function Flow Example...........................................................................................38 4.3.10.7 Example of Checking.......................................................................................................... 38 4.3.11 High-Speed Mode (25 MB/sec interface speed)..................................................................39 4.3.12 Command System...............................................................................................................39 4.3.13 Send Interface Condition Command (CMD8) .....................................................................40 4.3.14 Command Functional Difference in High Capacity SD Memory Card.................................41 4.4 Clock Control ...............................................................................................................................42 4.5 Cyclic Redundancy Code (CRC) .................................................................................................43 4.6 Error Conditions...........................................................................................................................45 4.6.1 CRC and Illegal Command ...................................................................................................45 4.6.2 Read, Write and Erase Timeout Conditions ..........................................................................45 4.6.2.1 Read ..................................................................................................................................... 45 4.6.2.2 Write ..................................................................................................................................... 45 4.6.2.3 Erase .................................................................................................................................... 45 4.7 Commands ..................................................................................................................................46 4.7.1 Command Types ...................................................................................................................46 4.7.2 Command Format .................................................................................................................46 4.7.3 Command Classes................................................................................................................46 4.7.4 Detailed Command Description ............................................................................................49 4.8 Card State Transition Table .........................................................................................................56 4.8 Card State Transition Table .........................................................................................................56 4.9 Responses...................................................................................................................................58 4.9.1 R1 (normal response command):..........................................................................................58 4.9.2 R1b........................................................................................................................................58 4.9.3 R2 (CID, CSD register) .........................................................................................................58 4.9.4 R3 (OCR register) .................................................................................................................59 4.9.5 R6 (Published RCA response) ..............................................................................................59 4.9.6 R7 (Card interface condition) ................................................................................................59 4.10 Two Status Information of SD Memory Card .............................................................................61 4.10.1 Card Status .........................................................................................................................61 4.10.2 SD Status ............................................................................................................................65 4.11 Memory Array Partitioning .........................................................................................................68 4.12 Timings ......................................................................................................................................68 4.13 Speed Class Specification .........................................................................................................69 4.13.1 Allocation Unit (AU) .............................................................................................................69 4.13.2 Recording Unit (RU)............................................................................................................69 4.13.3 Write Performance ..............................................................................................................69 4.13.4 Read Performance..............................................................................................................69 4.13.5 Performance Curve Definition.............................................................................................69 4.13.6 Speed Class Definition........................................................................................................69 4.13.7 Consideration for Inserting FAT Update during Recording..................................................70 4.13.8 Measurement Conditions and Requirements of the Speed Class.......................................70 4.14 Erase Timeout Calculation.........................................................................................................71 4.14.1 Erase Unit ...........................................................................................................................71 4.14.2 Case Analysis of Erase Time Characteristics......................................................................71 4.14.3 Method for Erase Large Areas ............................................................................................72 4.14.4 Calculation of Erase Timeout Value Using the Parameter Registers ..................................72 5. Card Registers ..................................................................................................................73 5.1 OCR register................................................................................................................................74 5.2 CID register .................................................................................................................................75 5.3 CSD Register...............................................................................................................................77 5.3.1 CSD_STRUCTURE ..............................................................................................................77 5.3.2 CSD Register (CSD Version 1.0) ..........................................................................................78 5.3.3 CSD Register (CSD Version 2.0) ..........................................................................................86 5.4 RCA register ................................................................................................................................89 5.5 DSR register (Optional) ...............................................................................................................89 5.6 SCR register ................................................................................................................................89 6. SD Memory Card Hardware Interface..............................................................................91 6.1 Hot Insertion and Removal ..........................................................................................................91 6.2 Card Detection (Insertion/Removal) ............................................................................................91 6.3 Power Protection (Insertion/Removal) .........................................................................................91 6.4 Power Scheme ............................................................................................................................91 6.4.1 Power Up ..............................................................................................................................91 6.4.2 Power Down and Power Cycle..............................................................................................92 6.5 Programmable Card Output Driver (Optional) .............................................................................92 6.6 Bus Operating Conditions............................................................................................................92 6.7 Bus Timing (Default) ....................................................................................................................92 6.8 Bus Timing (High-Speed Mode)...................................................................................................92 7. SPI Mode............................................................................................................................93 7.1 Introduction..................................................................................................................................93 7.2 SPI Bus Protocol .........................................................................................................................93 7.2.1 Mode Selection and Initialization...........................................................................................94 7.2.2 Bus Transfer Protection.........................................................................................................96 7.2.3 Data Read.............................................................................................................................96 7.2.4 Data Write .............................................................................................................................97 7.2.5 Erase & Write Protect Management......................................................................................98 7.2.6 Read CID/CSD Registers......................................................................................................99 7.2.7 Reset Sequence....................................................................................................................99 7.2.8 Error Conditions ....................................................................................................................99 7.2.9 Memory Array Partitioning.....................................................................................................99 7.2.10 Card Lock/Unlock................................................................................................................99 7.2.11 Application Specific Commands ..........................................................................................99 7.2.12 Content Protection Command.............................................................................................99 7.2.13 Switch Function Command ...............................................................................................100 7.2.14 High-Speed Mode .............................................................................................................100 7.2.15 Speed Class Specification.................................................................................................100 7.3 SPI Mode Transaction Packets .................................................................................................101 7.3.1 Command Tokens ...............................................................................................................101 7.3.1.1 Command Format ............................................................................................................... 101 7.3.1.2 Command Classes ............................................................................................................. 101 7.3.1.3 Detailed Command Description .......................................................................................... 102 7.3.1.4 Card Operation for CMD8 in SPI mode .............................................................................. 108 7.3.2 Responses ..........................................................................................................................109 7.3.2.1 Format R1........................................................................................................................... 109 7.3.2.2 Format R1b......................................................................................................................... 109 7.3.2.3 Format R2............................................................................................................................110 7.3.2.4 Format R3............................................................................................................................110 7.3.2.5 Formats R4 & R5 .................................................................................................................111 7.3.2.6 Format R7............................................................................................................................111 7.3.3 Control Tokens .................................................................................................................... 111 7.3.3.1 Data Response Token..........................................................................................................111 7.3.3.2 Start Block Tokens and Stop Tran Token..............................................................................111 7.3.3.3 Data Error Token..................................................................................................................112 7.3.4 Clearing Status Bits............................................................................................................. 113 7.4 Card Registers........................................................................................................................... 114 7.5 SPI Bus Timing Diagrams.......................................................................................................... 114 7.6 SPI Electrical Interface .............................................................................................................. 114 7.7 SPI Bus Operating Conditions................................................................................................... 114 7.8 Bus Timing................................................................................................................................. 114 8. SD Memory Card Mechanical Specification .................................................................115 Appendix A..........................................................................................................................116 A.1 Connector.................................................................................................................................. 116 A.2 Related Documentation............................................................................................................. 116 Appendix B..........................................................................................................................117 B.1 Abbreviations and terms............................................................................................................ 117

2010-08-03

C # 记事本源代码

打印功能没实现,其他都差不多了的,发现bug跟我说下 C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码C # 记事本源代码

2010-07-23

ARM7芯片 LPC2103

数据手册 datasheet 用户手册 User manual 头文件 lpc2103.H 都是标准的资料

2010-07-23

PS/2键盘驱动设计指南

针脚分布图 引脚定义 第二套扫描码 小键盘的也有 读写时序图 数据位的定义解释 硬件电路图 源码 wps文件 用word可以打开

2010-07-23

Linux DeviceDrivers 3rd Edition

(英文版 第三版 中文书签我自己做的 大家要是不喜欢就用福听PDF删除掉我加上去的东西 我还有很多好资源 大家都去逛逛 还有这个是单本的 网上还有个分很多章的) 前言 1 第一章 设备驱动程序简介 9 设备驱动程序的作用 10 内核功能划分 12 设备和模块的分类 14 安全问题 15 版本编号 17 许可证条款 18 加入内核开发社团 19 本书概要 19 第二章 构造和运行模块 21 设置测试系统 21 Hello World模块 22 核心模块与应用程序的对比 24 编译和装载 28 内核符号表 33 预备知识 35 初始化和关闭 36 模块参数 40 在用户空间编写驱动程序 42 .快速参考 44 第三章 字符设备驱动程序 46 scull的设计 46 主设备号和次设备号 47 一些重要的数据结构 53 字符设备的注册 59 open和release 62 scull的内存使用 64 read和write 67 试试新设备 74 快速参考 74 第四章 调试技术 76 内核中的调试支持 76 通过打印调试 78 通过查询调试 85 通过监视调试 94 调试系统故障 96 调试器和相关工具 102 第五章 并发和竞态 109 scull的缺陷 109 并发及其管理 110 信号量和互斥体 111 completion 116 自旋锁 118 锁陷阱 123 除了锁之外的办法 125 快速参考 132 第六章 高级字符驱动程序操作 137 ioctl 137 阻塞型I/O 149 poll和select 163 异步通知 168 定位设备 172 设备文件的访问控制 173 快速参考 179 第七章 时间、延迟及延缓操作 183 度量时间差 183 获取当前时间 188 延迟执行 190 内核定时器 196 tasklet 202 工作队列 204 快速参考 208 第八章 分配内存 213 kmalloc函数的内幕 213 后备高速缓存 217 get_free_page和相关函数 221 vmalloc及其辅助函数 225 per-CPU变量 228 获取大的缓冲区 230 快速参考 231 第九章 与硬件通信 235 I/O端口和I/O内存 235 使用I/O端口 239 I/O端口示例 245 使用I/O内存 248 快速参考 254 第十章 中断处理 258 准备并口 259 安装中断处理例程 259 实现中断处理例程 269 顶半部和底半部 274 中断共享 278 中断驱动的I/O 281 快速参考 285 第十一章 内核的数据类型 287 使用标准C语言类型 287 为数据项分配确定的空间大小 289 接口特定的类型 289 其他有关移植性的问题 291 链表 294 快速参考 298 第十二章 PCI驱动程序 300 PCI接口 300 ISA回顾 317 PC/104和PC/104+ 319 其他的PC总线 319 SBus 320 NuBus 321 外部总线 321 快速参考 322 第十三章 USB驱动程序 324 USB设备基础 326 USB和Sysfs 329 USB urb 331 编写USB驱动程序 342 不使用urb的USB传输 352 快速参考 356 第十四章 Linux设备模型 359 kobject、kset和子系统 361 低层sysfs操作 368 热插拔事件的产生 372 总线、设备和驱动程序 374 类 384 各环节的整合 388 热插拔 394 处理固件 401 快速索引 403 第十五章 内存映射和DMA 408 Linux的内存管理 408 mmap设备操作 418 执行直接I/O访问 429 直接内存访问 435 快速参考 453 第十六章 块设备驱动程序 458 注册 459 块设备操作 464 请求处理 468 其他一些细节 484 快速参考 487 第十七章 网络驱动程序 491 snull设计 492 连接到内核 495 net_device结构细节 499 打开和关闭 508 数据包传输 510 数据包的接收 514 中断处理例程 516 不使用接收中断 518 链路状态的改变 521 套接字缓冲区 521 MAC 地址解析 525 定制 ioctl 命令 527 统计信息 528 组播 529 其他知识点详解 533 快速参考 534 第十八章 TTY驱动

2010-07-23

华为PCB布线规范 华为PCB布线规范

华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范华为PCB布线规范

2010-07-14

云计算 Cloud Computing--michael miller

Cloud Computing--michael miller PDF格式 云计算经典权威原版书籍 About the Author Michael Miller is a successful and prolific author. He is known for his casual, easy-to-read writing style and his ability to explain a wide variety of complex topics to an everyday audience. Mr. Miller has written more than 80 nonfiction books over the past two decades, with more than a million copies in print. His books for Que include Absolute Beginner’s Guide to Computer Basics, How Microsoft Windows Vista Works, Making a Living from Your eBay Business, Googlepedia: The Ultimate Google Resource, and Is It Safe? Protecting Your Computer, Your Business, and Yourself Online. You can email Mr. Miller directly at [email protected]. His website is located at www.molehillgroup.com. Dedication To Sherry. Life is a cloud. Acknowledgments Thanks to the usual suspects at Que, including but not limited to Greg Wiegand, Rick Kughen, Seth Kerney, Keith Cline, and technical editor Aaron Ricadela.

2010-06-24

CodeVisionAVR Evaluation V2.04.4a

CodeVisionAVR Evaluation V2.04.4a.exe

2009-10-31

linux内核 0.11版本源码 带中文注释

目录树 下面再给个样例 ├─Makefile │ ├─boot │ bootsect.s │ head.s │ setup.s │ ├─fs │ bitmap.c │ block_dev.c │ buffer.c │ char_dev.c │ exec.c │ fcntl.c │ file_dev.c │ file_table.c │ inode.c │ ioctl.c │ Makefile │ namei.c │ open.c │ pipe.c │ read_write.c │ stat.c │ super.c │ truncate.c │ ├─include │ │ a.out.h │ │ const.h │ │ ctype.h │ │ errno.h │ │ fcntl.h │ │ signal.h │ │ stdarg.h │ │ stddef.h │ │ string.h │ │ termios.h │ │ time.h │ │ unistd.h │ │ utime.h │ │ │ ├─asm │ │ io.h │ │ memory.h │ │ segment.h │ │ system.h │ │ │ ├─linux │ │ config.h │ │ fs.h │ │ hdreg.h │ │ head.h │ │ kernel.h │ │ mm.h │ │ sched.h │ │ sys.h │ │ tty.h │ │ │ └─sys │ stat.h │ times.h │ types.h │ utsname.h │ wait.h │ ├─init │ main.c │ ├─kernel │ │ asm.s │ │ exit.c │ │ fork.c │ │ mktime.c │ │ panic.c │ │ printk.c │ │ sched.c │ │ signal.c │ │ sys.c │ │ system_call.s │ │ vsprintf.c │ │ │ ├─blk_drv │ │ blk.h │ │ floppy.c │ │ hd.c │ │ ll_rw_blk.c │ │ Makefile │ │ ramdisk.c │ │ │ ├─chr_drv │ │ console.c │ │ keyboard.S │ │ Makefile │ │ rs_io.s │ │ serial.c │ │ tty_io.c │ │ tty_ioctl.c │ │ │ └─math │ Makefile │ math_emulate. │ ├─lib │ close.c │ ctype.c │ dup.c │ errno.c │ execve.c │ Makefile │ malloc.c │ open.c │ setsid.c │ string.c │ wait.c │ write.c │ _exit.c │ ├─mm │ Makefile │ memory.c │ page.s │ └─tools build.c 样例 main。c 用sourceinsight软件阅读 很方便 /* * linux/init/main.c * * (C) 1991 Linus Torvalds */ #define __LIBRARY__ // 定义该变量是为了包括定义在unistd.h 中的内嵌汇编代码等信息。 #include // *.h 头文件所在的默认目录是include/,则在代码中就不用明确指明位置。 // 如果不是UNIX 的标准头文件,则需要指明所在的目录,并用双引号括住。 // 标准符号常数与类型文件。定义了各种符号常数和类型,并申明了各种函数。 // 如果定义了__LIBRARY__,则还包括系统调用号和内嵌汇编代码_syscall0()等。 #include // 时间类型头文件。其中最主要定义了tm 结构和一些有关时间的函数原形。 /* * we need this inline - forking from kernel space will result * in NO COPY ON WRITE (!!!), until an execve is executed. This * is no problem, but for the stack. This is handled by not letting * main() use the stack at all after fork(). Thus, no function * calls - which means inline code for fork too, as otherwise we * would use the stack upon exit from 'fork()'. * * Actually only pause and fork are needed inline, so that there * won't be any messing with the stack from main(), but we define * some others too. */ /* * 我们需要下面这些内嵌语句 - 从内核空间创建进程(forking)将导致没有写时复制(COPY ON WRITE)!!! * 直到一个执行execve 调用。这对堆栈可能带来问题。处理的方法是在fork()调用之后不让main()使用 * 任何堆栈。因此就不能有函数调用 - 这意味着fork 也要使用内嵌的代码,否则我们在从fork()退出 * 时就要使用堆栈了。 * 实际上只有pause 和fork 需要使用内嵌方式,以保证从main()中不会弄乱堆栈,但是我们同时还 * 定义了其它一些函数。 */ static inline _syscall0 (int, fork) // 是unistd.h 中的内嵌宏代码。以嵌入汇编的形式调用 // Linux 的系统调用中断0x80。该中断是所有系统调用的 // 入口。该条语句实际上是int fork()创建进程系统调用。 // syscall0 名称中最后的0 表示无参数,1 表示1 个参数。 static inline _syscall0 (int, pause) // int pause()系统调用:暂停进程的执行,直到 // 收到一个信号。 static inline _syscall1 (int, setup, void *, BIOS) // int setup(void * BIOS)系统调用,仅用于 // linux 初始化(仅在这个程序中被调用)。 static inline _syscall0 (int, sync) // int sync()系统调用:更新文件系统。 #include // tty 头文件,定义了有关tty_io,串行通信方面的参数、常数。 #include // 调度程序头文件,定义了任务结构task_struct、第1 个初始任务 // 的数据。还有一些以宏的形式定义的有关描述符参数设置和获取的 // 嵌入式汇编函数程序。 #include // head 头文件,定义了段描述符的简单结构,和几个选择符常量。 #include // 系统头文件。以宏的形式定义了许多有关设置或修改 // 描述符/中断门等的嵌入式汇编子程序。 #include // io 头文件。以宏的嵌入汇编程序形式定义对io 端口操作的函数。 #include // 标准定义头文件。定义了NULL, offsetof(TYPE, MEMBER)。 #include // 标准参数头文件。以宏的形式定义变量参数列表。主要说明了-个 // 类型(va_list)和三个宏(va_start, va_arg 和va_end),vsprintf、 // vprintf、vfprintf。 #include #include // 文件控制头文件。用于文件及其描述符的操作控制常数符号的定义。 #include // 类型头文件。定义了基本的系统数据类型。 #include // 文件系统头文件。定义文件表结构(file,buffer_head,m_inode 等)。 static char printbuf[1024]; // 静态字符串数组。 extern int vsprintf (); // 送格式化输出到一字符串中(在kernel/vsprintf.c,92 行)。 extern void init (void); // 函数原形,初始化(在168 行)。 extern void blk_dev_init (void); // 块设备初始化子程序(kernel/blk_drv/ll_rw_blk.c,157 行) extern void chr_dev_init (void); // 字符设备初始化(kernel/chr_drv/tty_io.c, 347 行) extern void hd_init (void); // 硬盘初始化程序(kernel/blk_drv/hd.c, 343 行) extern void floppy_init (void); // 软驱初始化程序(kernel/blk_drv/floppy.c, 457 行) extern void mem_init (long start, long end); // 内存管理初始化(mm/memory.c, 399 行) extern long rd_init (long mem_start, int length); //虚拟盘初始化(kernel/blk_drv/ramdisk.c,52) extern long kernel_mktime (struct tm *tm); // 建立内核时间(秒)。 extern long startup_time; // 内核启动时间(开机时间)(秒)。 /* * This is set up by the setup-routine at boot-time */ /* * 以下这些数据是由setup.s 程序在引导时间设置的(参见第2 章2.3.1 节中的表2.1)。 */ #define EXT_MEM_K (*(unsigned short *)0x90002) // 1M 以后的扩展内存大小(KB)。 #define DRIVE_INFO (*(struct drive_info *)0x90080) // 硬盘参数表基址。 #define ORIG_ROOT_DEV (*(unsigned short *)0x901FC) // 根文件系统所在设备号。 /* * Yeah, yeah, it's ugly, but I cannot find how to do this correctly * and this seems to work. I anybody has more info on the real-time * clock I'd be interested. Most of this was trial and error, and some * bios-listing reading. Urghh. */ /* * 是啊,是啊,下面这段程序很差劲,但我不知道如何正确地实现,而且好象它还能运行。如果有 * 关于实时时钟更多的资料,那我很感兴趣。这些都是试探出来的,以及看了一些bios 程序,呵! */ #define CMOS_READ(addr) ({ \ // 这段宏读取CMOS 实时时钟信息。 outb_p (0x80 | addr, 0x70); \ // 0x70 是写端口号,0x80|addr 是要读取的CMOS 内存地址。 inb_p (0x71); \ // 0x71 是读端口号。 } ) #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) // 将BCD 码转换成数字。 static void time_init (void) // 该子程序取CMOS 时钟,并设置开机时间??startup_time(秒)。 { struct tm time; do { time.tm_sec = CMOS_READ (0); // 参见后面CMOS 内存列表。 time.tm_min = CMOS_READ (2); time.tm_hour = CMOS_READ (4); time.tm_mday = CMOS_READ (7); time.tm_mon = CMOS_READ (8); time.tm_year = CMOS_READ (9); } while (time.tm_sec != CMOS_READ (0)); BCD_TO_BIN (time.tm_sec); BCD_TO_BIN (time.tm_min); BCD_TO_BIN (time.tm_hour); BCD_TO_BIN (time.tm_mday); BCD_TO_BIN (time.tm_mon); BCD_TO_BIN (time.tm_year); time.tm_mon--; startup_time = kernel_mktime (&time); } static long memory_end = 0; // 机器具有的内存(字节数)。 static long buffer_memory_end = 0; // 高速缓冲区末端地址。 static long main_memory_start = 0; // 主内存(将用于分页)开始的位置。 struct drive_info { char dummy[32]; } drive_info; // 用于存放硬盘参数表信息。 void main (void) /* This really IS void, no error here. */ { /* The startup routine assumes (well, ...) this */ /* 这里确实是void,并没错。在startup 程序(head.s)中就是这样假设的。 */ // 参见head.s 程序第136 行开始的几行代码。 /* * Interrupts are still disabled. Do necessary setups, then * enable them */ /* * 此时中断仍被禁止着,做完必要的设置后就将其开启。 */ // 下面这段代码用于保存: // 根设备号 ??ROOT_DEV; 高速缓存末端地址??buffer_memory_end; // 机器内存数??memory_end;主内存开始地址 ??main_memory_start; ROOT_DEV = ORIG_ROOT_DEV; drive_info = DRIVE_INFO; memory_end = (1 << 20) + (EXT_MEM_K < 16 * 1024 * 1024) // 如果内存超过16Mb,则按16Mb 计。 memory_end = 16 * 1024 * 1024; if (memory_end > 12 * 1024 * 1024) // 如果内存>12Mb,则设置缓冲区末端=4Mb buffer_memory_end = 4 * 1024 * 1024; else if (memory_end > 6 * 1024 * 1024) // 否则如果内存>6Mb,则设置缓冲区末端=2Mb buffer_memory_end = 2 * 1024 * 1024; else buffer_memory_end = 1 * 1024 * 1024; // 否则则设置缓冲区末端=1Mb main_memory_start = buffer_memory_end; // 主内存起始位置=缓冲区末端; #ifdef RAMDISK // 如果定义了虚拟盘,则主内存将减少。 main_memory_start += rd_init (main_memory_start, RAMDISK * 1024); #endif // 以下是内核进行所有方面的初始化工作。阅读时最好跟着调用的程序深入进去看,实在看 // 不下去了,就先放一放,看下一个初始化调用 -- 这是经验之谈?。 mem_init (main_memory_start, memory_end); trap_init (); // 陷阱门(硬件中断向量)初始化。(kernel/traps.c,181 行) blk_dev_init (); // 块设备初始化。 (kernel/blk_dev/ll_rw_blk.c,157 行) chr_dev_init (); // 字符设备初始化。 (kernel/chr_dev/tty_io.c,347 行) tty_init (); // tty 初始化。 (kernel/chr_dev/tty_io.c,105 行) time_init (); // 设置开机启动时间??startup_time(见76 行)。 sched_init (); // 调度程序初始化(加载了任务0 的tr, ldtr) (kernel/sched.c,385) buffer_init (buffer_memory_end); // 缓冲管理初始化,建内存链表等。(fs/buffer.c,348) hd_init (); // 硬盘初始化。 (kernel/blk_dev/hd.c,343 行) floppy_init (); // 软驱初始化。 (kernel/blk_dev/floppy.c,457 行) sti (); // 所有初始化工作都做完了,开启中断。 // 下面过程通过在堆栈中设置的参数,利用中断返回指令切换到任务0。 move_to_user_mode (); // 移到用户模式。 (include/asm/system.h,第1 行) if (!fork ()) { /* we count on this going ok */ init (); } /* * NOTE!! For any other task 'pause()' would mean we have to get a * signal to awaken, but task0 is the sole exception (see 'schedule()') * as task 0 gets activated at every idle moment (when no other tasks * can run). For task0 'pause()' just means we go check if some other * task can run, and if not we return here. */ /* 注意!! 对于任何其它的任务,'pause()'将意味着我们必须等待收到一个信号才会返 * 回就绪运行态,但任务0(task0)是唯一的意外情况(参见'schedule()'),因为任务0 在 * 任何空闲时间里都会被激活(当没有其它任务在运行时),因此对于任务0'pause()'仅意味着 * 我们返回来查看是否有其它任务可以运行,如果没有的话我们就回到这里,一直循环执行'pause()'。 */ for (;;) pause (); } static int printf (const char *fmt, ...) // 产生格式化信息并输出到标准输出设备stdout(1),这里是指屏幕上显示。参数'*fmt'指定输出将 // 采用的格式,参见各种标准C 语言书籍。该子程序正好是vsprintf 如何使用的一个例子。 // 该程序使用vsprintf()将格式化的字符串放入printbuf 缓冲区,然后用write()将缓冲区的内容 // 输出到标准设备(1--stdout)。 { va_list args; int i; va_start (args, fmt); write (1, printbuf, i = vsprintf (printbuf, fmt, args)); va_end (args); return i; } static char *argv_rc[] = { "/bin/sh", NULL}; // 调用执行程序时参数的字符串数组。 static char *envp_rc[] = { "HOME=/", NULL}; // 调用执行程序时的环境字符串数组。 static char *argv[] = { "-/bin/sh", NULL}; // 同上。 static char *envp[] = { "HOME=/usr/root", NULL}; void init (void) { int pid, i; // 读取硬盘参数包括分区表信息并建立虚拟盘和安装根文件系统设备。 // 该函数是在25 行上的宏定义的,对应函数是sys_setup(),在kernel/blk_drv/hd.c,71 行。 setup ((void *) &drive_info); (void) open ("/dev/tty0", O_RDWR, 0); // 用读写访问方式打开设备“/dev/tty0”, // 这里对应终端控制台。 // 返回的句柄号0 -- stdin 标准输入设备。 (void) dup (0); // 复制句柄,产生句柄1 号 -- stdout 标准输出设备。 (void) dup (0); // 复制句柄,产生句柄2 号 -- stderr 标准出错输出设备。 printf ("%d buffers = %d bytes buffer space\n\r", NR_BUFFERS, NR_BUFFERS * BLOCK_SIZE); // 打印缓冲区块数和总字节数,每块1024 字节。 printf ("Free mem: %d bytes\n\r", memory_end - main_memory_start); //空闲内存字节数。 // 下面fork()用于创建一个子进程(子任务)。对于被创建的子进程,fork()将返回0 值, // 对于原(父进程)将返回子进程的进程号。所以180-184 句是子进程执行的内容。该子进程 // 关闭了句柄0(stdin),以只读方式打开/etc/rc 文件,并执行/bin/sh 程序,所带参数和 // 环境变量分别由argv_rc 和envp_rc 数组给出。参见后面的描述。 if (!(pid = fork ())) { close (0); if (open ("/etc/rc", O_RDONLY, 0)) _exit (1); // 如果打开文件失败,则退出(/lib/_exit.c,10)。 execve ("/bin/sh", argv_rc, envp_rc); // 装入/bin/sh 程序并执行。 _exit (2); // 若execve()执行失败则退出(出错码2,“文件或目录不存在”)。 } // 下面是父进程执行的语句。wait()是等待子进程停止或终止,其返回值应是子进程的进程号(pid)。 // 这三句的作用是父进程等待子进程的结束。&i 是存放返回状态信息的位置。如果wait()返回值不 // 等于子进程号,则继续等待。 if (pid > 0) while (pid != wait (&i)) /* nothing */ ; // 如果执行到这里,说明刚创建的子进程的执行已停止或终止了。下面循环中首先再创建一个子进程, // 如果出错,则显示“初始化程序创建子进程失败”的信息并继续执行。对于所创建的子进程关闭所有 // 以前还遗留的句柄(stdin, stdout, stderr),新创建一个会话并设置进程组号,然后重新打开 // /dev/tty0 作为stdin,并复制成stdout 和stderr。再次执行系统解释程序/bin/sh。但这次执行所 // 选用的参数和环境数组另选了一套(见上面165-167 行)。然后父进程再次运行wait()等待。如果 // 子进程又停止了执行,则在标准输出上显示出错信息“子进程pid 停止了运行,返回码是i”,然后 // 继续重试下去…,形成“大”死循环。 while (1) { if ((pid = fork ()) < 0) { printf ("Fork failed in init\r\n"); continue; } if (!pid) { close (0); close (1); close (2); setsid (); (void) open ("/dev/tty0", O_RDWR, 0); (void) dup (0); (void) dup (0); _exit (execve ("/bin/sh", argv, envp)); } while (1) if (pid == wait (&i)) break; printf ("\n\rchild %d died with code %04x\n\r", pid, i); sync (); } _exit (0); /* NOTE! _exit, not exit() */ }

2009-08-31

The Linux Kernel Module Programming Guide2.6.pdf

The Linux Kernel Module Programming Guide2.6.pdf 纯英文

2009-07-29

Building.Embedded.Linux.Systems.Aug.2008.pdf

Building.Embedded.Linux.Systems.Aug.2008.pdf 纯英文版

2009-07-29

PDF破解密码(免注册)

pdf文件密码 使到文件可以被复制修改 非常好用的 破解时间很快

2009-07-27

S3C44B0X中文数据手册1~17

缺省15 似乎互联网上都没有出现过15的 S3C44B0X中文数据手册1-S3C44B0X概述.pdf S3C44B0X中文数据手册2-ARM处理器工作模式.pdf S3C44B0X中文数据手册3-ARM微处理器的指令系统.pdf S3C44B0X中文数据手册4-存储器控制器.pdf S3C44B0X中文数据手册5-DMA.pdf S3C44B0X中文数据手册6-处理器Wrapper和总线优.pdf S3C44B0X中文数据手册7-DMA.pdf S3C44B0X中文数据手册8-IO端口.pdf S3C44B0X中文数据手册9-PWM定时器.pdf S3C44B0X中文数据手册10-UART串行口.pdf S3C44B0X中文数据手册11-中断控制器.pdf S3C44B0X中文数据手册12-LCD控制器.pdf S3C44B0X中文数据手册13-AD转换器.pdf S3C44B0X中文数据手册14-RTC.pdf S3C44B0X中文数据手册16-IIC总线接口.pdf S3C44B0X中文数据手册17-IIS总线接口.pdf

2009-07-15

RT1602C详细资料

自己整合网络上的资源制作的,内容包过:1产品规格 2引脚说明 3内置字符表 4基本控制指令 5内部显示地址 6和单片机AT89C51交互 7样本程序1例

2009-05-31

DM642芯片手册,外设,ccs教程等

DM642的芯片资料 各种外设资料 和ccs软件的教程

2009-05-27

魔方虚拟软件(1~20)

支持2阶到20阶的魔方 操作极容易上手 可以保存数据关电脑明天再转也可以

2009-05-27

现代电子技术实践基础教程

第一章 电子实践常识.doc 第七章 可靠性技术.doc 第三章 印制电路板设计.doc 第九章 PROTEL 99 SE.doc 第二章 元器件筛选技术.doc 第五章 系统组装技术.doc 第八章 电子产品认证.doc 第六章 测量与调试技术.doc 第四章 板上组装技术.doc

2009-04-17

谭浩强C语言全书word版

谭浩强C语言全书word版 总共十本内容详细 精心排版

2009-04-11

考研英语大纲词汇中英文.doc

根据新大纲制作,共5495单词 精心表格排版 电脑前照样背单词

2009-04-11

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除