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
Ïà¹ØÎĵµ£º
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
ÏÖÔÚʹÓÃlinuxµÄÅóÓÑÔ½À´Ô½¶àÁË£¬ÔÚlinuxÏÂ×ö¿ª·¢Ê×ÏȾÍÊÇÐèÒªÅäÖû·¾³±äÁ¿£¬ÏÂÃæÒÔÅäÖÃjava»·¾³±äÁ¿ÎªÀý½éÉÜÈýÖÖÅäÖû·¾³±äÁ¿µÄ·½·¨¡£
1.ÐÞ¸Ä/etc/profileÎļþ
Èç¹ûÄãµÄ¼ÆËã»ú½ö½ö×÷Ϊ¿ª·¢Ê¹ÓÃʱÍƼöʹÓÃÕâÖÖ·½·¨£¬ÒòΪËùÓÐÓû§µÄshell¶¼ÓÐȨʹÓÃÕâЩ»·¾³±äÁ¿£¬¿ÉÄÜ»á¸øϵͳ´øÀ´°²È«ÐÔÎÊÌâ¡£
......
ÂòÁËÒ»±¾linuxÃüÁî¡¢±à¼Æ÷Óëshell±à³Ì£¬ÒÔǰѧϰ¹ýÒ»Õó×Ó£¬ºóÀ´¹¤×÷ʵÔÚ̫棬ûʱ¼ä¿´ÁË£¬½ñÌìÄÃÆðÊéÒ»¿´£¬ÒÔÇ°¿´µÄÒ²ÍüÁË£¬ËùÒÔ´Ó½ñÌ쿪ʼ£¬Ð´²©¿Í£¬Ã¿Ì춼¿´£¬ÏàÐżá³ÖºÍ»ýÀÛµÄÁ¦Á¿¡£Ïȸø×Ô¼º´ò´òÆø°É¡£
Öض¨Ïò£º
Êä³öÖض¨Ïò£ºµ±Ïòlinuxϵͳ·¢³öÃüÁîʱ£¬¿Éָʾ²Ù×÷ϵͳ½«Êä³ö·¢Ë͵½ÈκÎÒ»¸öÖ¸¶¨µÄÉ豸»ò ......
QTÊÇÄ¿Ç°ÔÚLinux²Ù×÷ϵͳƽ̨ÏÂÓ¦ÓÃ×î¶àµÄͼÐÎÓû§½çÃæµÄµ×²ã¿â£¬ÓÉÆäÅÉÉú³öµÄQT/Embedded´óÁ¿ÓÃÓÚǶÈëʽϵͳ¿ª·¢ºÍÑÐÖÆÖС£Êµ¼ÊÉÏ£¬QT/EmbeddedÌṩ¸øÓû§µÄ·ÇASCIIÂëµÄ×Ö¿âÒ»°ã±È½ÏÉÙ£¬ÔÚÎÒÃÇ¿ª·¢¹ý³ÌÖÐÓõÄǶÈëʽLinuxϵͳÖÐÖÐÎĺÍÈÕÎĵÄ×ֿⶼֻÓÐÒ»¸ö(²»Ë㲻ͬµÄÐýת½Ç)£¬ÆäÖл¹´æÔÚ×ÖÌå´óС²»Ò»ÑùµÄÎÊÌ⣬Òò´ËÔÚʵ¼Ê¿ ......