plat_device.c
#include
#include
#include
#include
#include
#include
#include
#include
#include
static struct resource s3c_buttons_resource = {
[0]={
.start = s3c24xx_pa_gpio,
.end = s3c24xx_pa_gpio + s3c24xx_sz_gpio - 1,
.flags = ioresource_mem,
[1]={
.start = irq_eint8,
.end = irq_eint8,
.flags = ioresource_irq,
[2]={
.start = irq_eint11,
.end = irq_eint11,
.flags = ioresource_irq,
[3]={
.start = irq_eint13,
.end = irq_eint13,
.flags = ioresource_irq,
[4]={
.start = irq_eint14,
.end = irq_eint14,
.flags = ioresource_irq,
[5]={
.start = irq_eint15,
.end = irq_eint15,
.flags = ioresource_irq,
[6]={
.start = irq_eint19,
.end = irq_eint19,
.flags = ioresource_irq,
static struct platform_device *s3c_buttons;
static int __init platform_init(void)
s3c_buttons = platform_device_alloc("mini2440buttons",-1);
/*定義平台名為mini2440buttons,與驅動名相匹配*/
platform_device_add_resources(s3c_buttons,&s3c_buttons_resource,7); /*為裝置新增資源*/
platform_device_add(s3c_buttons); /*註冊平台裝置s3c_buttons */
static void __exit platform_exit(void)
platform_device_unregister(s3c_buttons);
module_init(platform_init);
module_exit(platform_exit);
module_license("gpl");
按鍵驅動 platform裝置的例子
下面將之前的按鍵驅動改寫為platform裝置。1 建立資料夾key platform 2 在資料夾key platform下建立裝置檔案keydevice.c。include include include include include include module author wjb mod...
按鍵驅動 platform裝置的例子
下面將之前的按鍵驅動改寫為platform裝置。1 建立資料夾key platform 2 在資料夾key platform下建立裝置檔案keydevice.c。include include include include include include module author wjb mod...
platform裝置驅動之按鍵掃瞄(cdev裝置)
一 開發環境 1 硬體平台 fs2410 2 主機 ubuntu 10.10 3 核心版本 linux 2.6.35 4 交叉編譯工具鏈 arm none linux gnueabi 二 詳細 1 button device.c platform device include include inc...