linuxµÄplatformÇý¶¯
´ÓLinux 2.6ÆðÒýÈëÁËÒ»Ì×еÄÇý¶¯¹ÜÀíºÍ×¢²á»úÖÆ:Platform_deviceºÍPlatform_driver¡£
LinuxÖд󲿷ֵÄÉ豸Çý¶¯£¬¶¼¿ÉÒÔʹÓÃÕâÌ×»úÖÆ, É豸ÓÃPlatform_device±íʾ£¬Çý¶¯ÓÃPlatform_driver½øÐÐ×¢²á¡£
Linux platform driver»úÖƺʹ«Í³µÄdevice driver »úÖÆ(ͨ¹ýdriver_registerº¯Êý½øÐÐ×¢²á)Ïà±È£¬Ò»¸öÊ®·ÖÃ÷ÏÔµÄÓÅÊÆÔÚÓÚplatform»úÖƽ«É豸±¾ÉíµÄ×ÊÔ´×¢²á½øÄںˣ¬ÓÉÄÚºËͳһ¹ÜÀí£¬ÔÚÇý¶¯³ÌÐòÖÐʹÓÃÕâЩ×ÊԴʱͨ¹ýplatform deviceÌṩµÄ±ê×¼½Ó¿Ú½øÐÐÉêÇ벢ʹÓá£ÕâÑùÌá¸ßÁËÇý¶¯ºÍ×ÊÔ´¹ÜÀíµÄ¶ÀÁ¢ÐÔ£¬²¢ÇÒÓµÓнϺõĿÉÒÆÖ²ÐԺͰ²È«ÐÔ(ÕâЩ±ê×¼½Ó¿ÚÊÇ°²È«µÄ)¡£
Platform»úÖƵı¾ÉíʹÓò¢²»¸´ÔÓ£¬ÓÉÁ½²¿·Ö×é³É£ºplatform_deviceºÍplatfrom_driver¡£
ͨ¹ýPlatform»úÖÆ¿ª·¢·¢µ×²ãÇý¶¯µÄ´óÖÂÁ÷³ÌΪ: ¶¨Òå platform_device à ×¢²á platform_device à ¶¨Òå platform_driver à×¢²á platform_driver¡£
Ê×ÏÈҪȷÈϵľÍÊÇÉ豸µÄ×ÊÔ´ÐÅÏ¢£¬ÀýÈçÉ豸µÄµØÖ·£¬ÖжϺŵȡ£
ÔÚ2.6ÄÚºËÖÐplatformÉ豸ÓýṹÌåplatform_deviceÀ´ÃèÊö£¬¸Ã½á¹¹Ì嶨ÒåÔÚkernel\include\linux\platform_device.hÖУ¬
struct platform_device {
const char * name;
u32 id;
struct device dev;
u32 num_resources;
struct resource * resource;
};
¸Ã½á¹¹Ò»¸öÖØÒªµÄÔªËØÊÇresource£¬¸ÃÔªËØ´æÈëÁË×îΪÖØÒªµÄÉ豸×ÊÔ´ÐÅÏ¢£¬¶¨ÒåÔÚkernel\include\linux\ioport.hÖУ¬
struct resource {
const char *name;
unsigned long start, end;
unsigned long flags;
struct resource *parent, *sibling, *child;
};
ÏÂÃæ¾Ùs3c2410ƽ̨µÄi2cÇý¶¯×÷ΪÀý×ÓÀ´ËµÃ÷£º
/* arch/arm/mach-s3c2410/devs.c */
/* I2C */
static struct resource s3c_i2c_resource[] = {
[0] = {
.start = S3C24XX_PA_IIC,
.end = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
&
Ïà¹ØÎĵµ£º
Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......
Ðí¶àÔÚ shell ÌáʾϼüÈëµÄ Linux ÃüÁÓëÄãÔÚ DOS ϼüÈëµÄÃüÁîÏàËÆ¡£ÊÂʵÉÏ£¬Ä³Ð©ÃüÁîÍêÈ«Ïàͬ¡£
±¾¸½Â¼ÌṩÁË Windows µÄ DOS Ìáʾϵij£ÓÃÃüÁîÒÔ¼°ÔÚ Linux ÖÐÓëËüÃǵÈͬµÄÃüÁî¡£¸½Â¼Öл¹ÌṩÁËÈçºÎÔÚ Linux shell ÌáʾÏÂʹÓÃÕâЩÃüÁîµÄ¼òµ¥ÊµÀý¡£Çë×¢Ò⣬ÕâЩÃüÁîͨ³£ÓÐÐí¶àÑ¡ÏҪ½øÒ»²½Ñ§Ï°Ã¿Ò»¸öÃüÁÇëÔĶÁÏà ......
ÏîÄ¿»ù±¾½áÊø£¬Õâ¸öÊÇÆäÖÐϵͳ²Ã¼õµÄÒ»¸ö×ܽáÎĵµ£¬²»ÖªµÀÓÐûÓÐÈ˸ÐÐËȤ£º)
=============================================
Ç°ÑÔ:
ΪÁËÍê³ÉÓû§µÄÐèÇó£¬ÐèÖÆ×÷Ò»¸öÍêÕûµÄ»·¾³¹©APÔËÐУ¬ÇÒ´æÔÚһЩԼÊøÌõ¼þ¡£
¹Ø¼ü×Ö£º
DOM Kernel Busybox X-Window Window-Manager Interbase nvidia cutdown
Ä¿±ê˵Ã÷£º
ÔÚÒ» ......