s3c2440»ùÓÚlinuxµÄgpio led×Ö·ûÉ豸Çý¶¯Êµ¼ù
½ñÌìÍê³ÉÁËǶÈëʽlinuxµÄµÚÒ»¸öÇý¶¯µÄ±àдºÍ²âÊÔ£¬ËäÈ»ÊǸö¼òµ¥µÄ³ÌÐò£¬µ«ÊÇÂéȸËäС£¬ÎåÔà¾ãÈ«£¬Ï£Íû¿ÉÒÔ¸ø¸Õ¿ªÊ¼½Ó´¥Çý¶¯±àдµÄÈËһЩÌáʾ£¬¹²Í¬½ø²½¡£
Ô´´úÂ룺
·ÖÎöÈçÏ£º
ÏÂÃæÊÇÎÒµÄÇý¶¯³ÌÐò£º
#include <linux/config.h>//ÅäÖÃÍ·Îļþ
#include <linux/kernel.h>//ÄÚºËÍ·Îļþ
#include <linux/sched.h>
#include <linux/timer.h>//ʱÖÓÍ·Îļþ
#include <linux/init.h>//Óû§¶¨ÒåÄ£¿é³õʼº¯ÊýÃûÐèÒýÓõÄÍ·Îļþ
#include <linux/module.h>//Ä£¿é¼ÓÔصÄÍ·Îļþ
#include <asm/hardware.h>
#include <asm/arch/S3C2440.h> //Õâ¸öÊÇ2440µÄ¼Ä´æÆ÷Í·Îļþ£¬asm/srchÖ»ÊǸöÁ´½Ó
//ʵ¼Ê¸ù¾Ý×Ô¼ºµÄÇé¿ö²éÕÒ,Ò»°ãÊÇ../../linux2.*.*/include/asm/arch-s3c2440Àï ±àÒëÆ÷
//×Ô¼º»á²éѯÁ´½Ó,ÒÔÇ°²»ÖªµÀ£¬ÕÒÁË°ëÌì
// GPIO_LED DEVICE MAJOR
#define GPIO_LED_MAJOR 97 //¶¨ÒåÖ÷É豸ºÅ
//define LED STATUS Îҵİå×Ó LEDÔÚGPB0 ÓëGPB1 ´¦ ´ó¼Ò¸ù¾Ý×Ô¼ºÇé¿ö¸Ä
#define LED_ON 0 //¶¨ÒåLEDµÆµÄ״̬ ¿ª
#define LED_OFF 1 //
// ------------------- READ ------------------------ Õâ¸öÇ°ÃæÒª¼Óstatic ·ñÔò¾¯¸æ
static ssize_t GPIO_LED_read (struct file * file ,char * buf, size_t count, loff_t * f_ops)
{
return count;
}
// ------------------- WRITE -----------------------
static ssize_t GPIO_LED_write (struct file * file ,const char * buf, size_t count, loff_t * f_ops)
{
return count;
}
// ------------------- IOCTL -----------------------
static ssize_t GPIO_LED_ioctl (struct inode * inode ,struct file * file, unsigned int cmd, long data) //Õâ¸öº¯ÊýʵÏÖÁËledµÆÁÁÃðµÄ½Ó¿Ú
{
switch (cmd)
{
case LED_ON : { GPBDAT =0x01; break;} //¸ù¾Ý×Ô¼ºÇé¿öÐÞ¸Ä Ò»¸öÁÁ Ò»¸öÃð
case LED_OFF: { GPBDAT =0x02; break;} //½»ÌæÉÁ˸
default :
&n
Ïà¹ØÎĵµ£º
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......
ÔÚLinuxϵͳÉÏÃüÃûĿ¼µÄ·½Ê½ÊÇÏ൱ÒþÃصģ¬ÕâҪ׷Ëݵ½µçÄÔÓ²¼þ´¦ÀíÄÜÁ¦±È½ÏÈõ¶ø¼Û¸ñÓֱȽϹóµÄʱÆÚ¡£ÔÚLinuxϵͳÉÏÃüÃûĿ¼µÄ·½Ê½ËƺõÓе㱿׾£¬µ«ÓëÆäËûµÄÿ¼þÊÂÇéÒ»Ñù£¬ÕâÖ»Ð軨һЩʱ¼ä¼ÓÒÔÏ°¹ß¡£Í¨¹ýÃèÊöLinuxÎļþϵͳµÄÈ«¾°£¬Ê¹¶ÁÕß¿ÉÒÔ¶ÔLinuxµÄÎļþϵͳÓнÏÇå³þµÄÈÏʶ¡£
¸ùĿ¼(/)
¡¡¡¡Ä¿Â¼½á¹¹ÉϵÄ×î¸ßµã± ......
Linux¶ÑÕ»Òç³öµÄ¾µäÎÊÌâ
ÉùÃ÷£º±¾ÎÄÕÂÖ»ÊÇÎÒѧϰµÄÒ»¸ö¼Ç¼£¬ÓйØÒýÓõĵط½£¬ÎÒ¶¼»á¸ø³öÁ´½ÓµÄ¡£Èç¹ûÇÖ·¸×÷ÕßȨÒ棬Çë֪ͨÎÒ¼°Ê±É¾³ý¡£
¿´ÁËһϣ¬LinuxһվʽѧϰµÄº¯Êýµ÷ÓÃ
£¬¸ãµÄÎÒÈÈѪ·ÐÌÚ£¬Á¢ÂíÕÒÄãÒ»ÏÂÕâ·½ÃæµÄ×ÊÁÏ¿´¿´¡£ÖÕÓÚ¿´µ½ÁËÒ»¸öÓйØLinux¶ÑÕ»Òç³öµÄÎÄÕ£¬¾ÍÄÃÀ´ÊÔÊÔÊÖÁË¡£²Î¿¼
ÎÒµÄѧϰlinux±Ê¼Ç ......
1¡¢ µ±°ÑÏîÄ¿ÅäÉÏÓòÃûʱ£¬±ØÐë°ÑtomcatµÄ¶Ë¿Ú¸ÄΪ80£¬×¢Òâµ±Ìæ»»ÅäÖÃÎļþʱ£¬Òª¼ÇµÃ°Ñtomcat¶Ë¿Ú¸Äһϡ£
2¡¢ CÅÌϵÄhostsÎļþ£¬ÊÇÅäÖÃÓòÃûÓõģ¬µ±²»ÔÚhostsÅäÖÃÓòÃûʱ£¬windowsϵͳ»áµ½ÍâÍøÈ¥ÕÒ·ûºÏµÄÓòÃû£¬µ±ÔÚhostsÏÂÅäÖÃÓòÃûʱ£¬¾Í²»»áµ½ÍâÍøÈ¥ÕÒÁË¡£
3¡¢ Îļþ¸üеÄÕû¸öÁ÷³Ì£º
£¨1£©£ºÓÃÔ¶³ ......
£¨Ò»£© ÍøÂçÖб鲼×Å´óÁ¿µÄLinuxÏà¹ØÕ¾µã£»
£¨¶þ£© Óû§ÎÞÐëÏêϸÁ˽âÿһ¸ö´ËÀàÕ¾µã£¬Êµ¼ÊÉÏ£¬Ò»°Ù¸öÕ¾µã×ã¹»ÄãʹÓÃÁË¡£
ÆÀÑ¡³öµÄÕâ100¸öÓÅÐãÕ¾µã£¬½«°´ÕÕÏÂÊö20¸öÀà±ð×÷ÒÔÆÀ½é£º
£¨Ò»£© ÎļþÏÂÔØ
£¨¶þ£© ÓÄĬÓéÀÖ
£¨Èý£© Ïà¹ØÐÂÎÅ
£¨ËÄ£© ͨÓÃÓ²¼þ
£¨Î壩 רÓÃÓ²¼þ
£¨Áù£© ÐÂÊÖÕ¾µã
£¨Æߣ© ͼÐÎ/¶àÃ½Ì ......