ÀÌ ¸Å´º¾óÀº JKÀüÀÚ(JK Electronics) ¿¡ ÀÇÇؼ ¹ø¿ª, ¼öÁ¤, ÀÛ¼º µÇ¾ú°í ¼ÒÀ¯±Ç ¶ÇÇÑ JKÀüÀÚ(JK Electronics)ÀÇ °ÍÀÔ´Ï´Ù. ¼ÒÀ¯±ÇÀÚÀÇ Çã°¡¸¦ ¹ÞÁö ¾Ê°í ¹«´ÜÀ¸·Î ¼öÁ¤, »èÁ¦Çϰųª ¹èÆ÷ ÇÒ ¼ö ¾ø½À´Ï´Ù. |
||||||||||||||||||||||||||||||||||||||||||||
S3C6410 Start Kit Linux µð¹ÙÀ̽º µå¶óÀ̹ö Developer Guide |
||||||||||||||||||||||||||||||||||||||||||||
* Update history - 2011.1.13 : Ãʱâ Release |
||||||||||||||||||||||||||||||||||||||||||||
1. Environment Setup
S3C6410 Startkit ÀÇ ¸ðµç ¿¹Á¦¿Í ÄÄÆÄÀÏ °úÁ¤Àº VMWare¿¡ ¼³Ä¡µÈ Fedora9 ¸Ó½Å¿¡¼ ½ÇÇà ÇÏ¿´½À´Ï´Ù. ´Ù¸¥
¸®´ª½º ȯ°æ¿¡¼´Â Å×½ºÆ® µÇÁö ¾Ê¾Ò½À´Ï´Ù. Æóµµ¶ó ¸®´ª½ºÀÇ Àüü ¼³Ä¡ °úÁ¤Àº ¿©±â Installation
Fedora9 À» ÂüÁ¶ÇϽñ⠹ٶø´Ï´Ù.
|
µå¶óÀ̹ö ¼Ò½º µð·ºÅ丮 | /opt/FriendlyARM/mini6410/linux/linux-2.6.36/drivers/char |
µå¶óÀ̹ö ¼Ò½º ÆÄÀÏ À̸§ | Mini6410_hello_module.c |
The driver will not load any device in the dev node | |
#include <linux/kernel.h> #include <linux/module.h> static int __init mini6410_hello_module_init(void) { printk("Hello, Mini6410 module is installed !\n"); return 0; } static void __exit mini6410_hello_module_cleanup(void) { printk("Good-bye, Mini6410 module was removed!\n"); } module_init(mini6410_hello_module_init); module_exit(mini6410_hello_module_cleanup); MODULE_LICENSE("GPL"); |
(1) "Hello, Module" À» Ä¿³Î ¼Ò½º Æ®¸®¿¡ ³Ö¾î¼ ÄÄÆÄÀÏ ÇÏ´Â ¹æ¹ý(added to
the kernel source tree, and compile)
General compile the driver module version 2.6 driver code need to be
added to the kernel source tree, and make the appropriate
configuration. make menuconfig ¸í·É¿¡ ÀÇÇؼ ¼±Åà ÇÒ ¼ö ÀÖµµ·Ï ÇÕ´Ï´Ù.
Step1 : Kconfig ÆÄÀÏÀ» ¿¾î ´ÙÀ½°ú °°ÀÌ ¼öÁ¤ ÇÕ´Ï´Ù. Open
"linux-2.6.36/drivers/char/Kconfig" file
linux-2.6.36 Ä¿³ÎÀÌ ÀÖ´Â µð·ºÅ丮¿¡¼ "make menuconfig" ¸í·ÉÀ» ½ÇÇà ÇÕ´Ï´Ù.
Device
Drivers -> Character devices -> "Mini6410 module sample"
¿¡¼
<M> À» ¼±ÅÃÇÏ¸é ¸ðµâ·Î ÄÄÆÄÀÏ µÈ´Ù´Â ÀǹÌÀÌ°í "*" ¸¦ ¼±ÅÃÇϸé Ä¿³Î¿¡ Æ÷ÇÔÇؼ ÄÄÆÄÀÏ ÇÑ´Ù´Â
ÀÇ¹Ì ÀÔ´Ï´Ù.
¿©±â¿¡¼´Â <M> À¸·Î ¼±ÅÃÇÕ´Ï´Ù.
Step2: Step1¿¡¼ÀÇ ¼³Á¤Àº Ä¿³Î ÄÁÇDZԷ¹À̼ǻóÀÇ ¼³Á¤ÀÌ°í ½ÇÁ¦·Î´Â À̹ø ´Ü°è¿¡¼ MakefileÀ» ¼öÁ¤ ÇÑ°ÍÀÌ ÄÄÆÄÀϽÃ
¹Ý¿µÀÌ µË´Ï´Ù. "linux-2.6.36/drivers/char/Makefile" ÆÄÀÏÀ» Open ÇÕ´Ï´Ù.
Step3: À̹ø ´Ü°è¿¡¼´Â ½ÇÁ¦·Î ¸ðµâ·Î ¼Ò½º ÆÄÀÏÀ» ÄÄÆÄÀÏ ÇÏ´Â ´Ü°è ÀÔ´Ï´Ù.
(2) "Hello, Module download and install it using the development board
FTP¸¦ ÀÌ¿ëÇؼ Ÿ°Ù °³¹ßº¸µåÀÇ "/lib/modules/2.6.36-FriendlyARM" À§Ä¡¿¡
"mini6410_hello_module.ko" ÆÄÀÏÀ» ´Ù¿î·Îµå ÇÕ´Ï´Ù. ±×¸®°í ³ª¼ "modprobe" ¸í·ÉÀ» À§Çؼ ¸ðµâÀ»
Ä¿³Î¿¡ Load ÇÕ´Ï´Ù modprobe ¸í·É½Ã "ko" È®ÀåÀÚ´Â ºÙÀÌÁö ¾Ê½À´Ï´Ù.
# modprobe mini6410_hello_module
´ÙÀ½ ¸í·ÉÀº ¸ðµâÀº Unload ÇÏ´Â ¸í·É ÀÔ´Ï´Ù.
# rmmod mini6410_hello_module
LED1 ~ LED4±îÁö¸¦ ÄÁÆ®·Ñ ÇÏ´Â µð¹ÙÀ̽º µå¶óÀ̹ö ¿¹Á¦ ÀÔ´Ï´Ù. °¢ LEDµéÀÇ 6410
CPU¿¡ ÇÒ´çµÈ ¸®¼Ò½º ÀÔ´Ï´Ù.
LED | IO Æ÷Æ® À̸§ | CPU Pin name |
LED1 | GPK4 | R23 |
LED2 | GPK5 | R22 |
LED3 | GPK6 | R24 |
LED4 | GPK7 | R25 |
µå¶óÀ̹ö ¼Ò½º µð·ºÅ丮 | /opt/FriendlyARM/mini6410/linux/linux-2.6.36/drivers/char |
µå¶óÀ̹ö ¼Ò½º ÆÄÀÏ À̸§ | Mini6410_leds.c |
Device Type | misc |
Device Name | /dev/leds |
¿¹Á¦ ¼Ò½º µð·ºÅ丮 À§Ä¡ | /opt/FriendlyARM/mini6410/linux/examples/leds |
µå¶óÀ̹ö ¼Ò½º ÆÄÀÏ À̸§ | led.c |
µå¶óÀ̹ö ÆÄÀÏ À̸§ | led |
The driver will not load any device in the dev node | |
#include <linux/miscdevice.h> #include <linux/delay.h> #include <asm/irq.h> //#include <mach/regs-gpio.h> #include <mach/hardware.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h> #include <linux/mm.h> #include <linux/fs.h> #include <linux/types.h> #include <linux/delay.h> #include <linux/moduleparam.h> #include <linux/slab.h> #include <linux/errno.h> #include <linux/ioctl.h> #include <linux/cdev.h> #include <linux/string.h> #include <linux/list.h> #include <linux/pci.h> #include <asm/uaccess.h> #include <asm/atomic.h> #include <asm/unistd.h> #include <mach/map.h> #include <mach/regs-clock.h> #include <mach/regs-gpio.h> #include <plat/gpio-cfg.h> #include <mach/gpio-bank-e.h> #include <mach/gpio-bank-k.h> #define DEVICE_NAME "leds" static long sbc2440_leds_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { switch(cmd) { unsigned tmp; case 0: case 1: if (arg > 4) { return -EINVAL; } tmp = readl(S3C64XX_GPKDAT); tmp &= ~(1 << (4 + arg)); tmp |= ( (!cmd) << (4 + arg) ); writel(tmp, S3C64XX_GPKDAT); //printk (DEVICE_NAME": %d %d\n", arg, cmd); return 0; default: return -EINVAL; } } static struct file_operations dev_fops = { .owner = THIS_MODULE, .unlocked_ioctl = sbc2440_leds_ioctl, }; static struct miscdevice misc = { .minor = MISC_DYNAMIC_MINOR, .name = DEVICE_NAME, .fops = &dev_fops, }; static int __init dev_init(void) { int ret; { unsigned tmp; (tmp & ~(0xffffU<<16))|(0x1111U<<16); writel(tmp, S3C64XX_GPKCON); tmp = readl(S3C64XX_GPKDAT); tmp |= (0xF << 4); writel(tmp, S3C64XX_GPKDAT); } ret = misc_register(&misc); printk (DEVICE_NAME"\tinitialized\n"); return ret; } static void __exit dev_exit(void) { misc_deregister(&misc); } module_init(dev_init); module_exit(dev_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("FriendlyARM Inc."); |