Windows7 + vmware workstation 6.5 + Ubuntu9.10
Linux Source Code: FORLINX_linux-3.0.1.tar.gz
ARM CROSS GCC: arm-linux-gcc v4.3.2
源码:
//s3c6410_led.c – driver file
#include
#include
#include
#include
#include
#define DEV_MAJOR 176
#define DEV_NAME "s3c6410_leds"
#define GPMCON 0x7F008820
#define GPMDAT 0x7F008824
#define GPMPUD 0x7F008828
volatile unsigned long *gpmcon = NULL;
volatile unsigned long *gpmdat = NULL;
volatile unsigned long *gpmpud = NULL;
static int s3c6410_led_open(struct inode *inode, struct file *filp)
{
}
static ssize_t s3c6410_led_write(struct file *filp,const char __user *buf,size_t count,loff_t *ppos)
{
}
struct file_operations s3c6410_led_flops = {
};
static int __init s3c6410_led_init(void)
{
}
static void __exit s3c6410_led_exit(void)
{
}
module_init(s3c6410_led_init);
module_exit(s3c6410_led_exit);
MODULE_DESCRIPTION("This is led driver sample for OK6410A board.");
MODULE_VERSION("1.0");
MODULE_AUTHOR("");
MODULE_LICENSE("Dual BSD/GPL");
//s3c6410_led_test.c – test file
#include
#include
int main(int argc,char* argv[])
{
}
解析:
1.
2.
3.
4.
驱动程序Makefile如下:
obj-m:=s3c6410_led.o
KERNELDIR?=/usr/src/linux-3.0.1
default:
$(MAKE) -C $(KERNELDIR) M=$(shell pwd) modules
clean:
rm -rf *.o *~ *.ko *.mod.c *.order *.symvers
在终端下执行如下命令:
#make //编译驱动程序,得到s3c6410_led.ko文件
#arm-linux-gcc s3c6410_led_test.c –o s3c6410_led_test //编译测试源码
5.
上一篇:OK6410A学习笔记四:嵌入式Linux驱动之LED驱动进阶
下一篇:OK6410A学习笔记二:嵌入式Linux驱动开发环境的配置和测试
推荐阅读最新更新时间:2024-03-16 14:50