91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 45KB
    文件類型: .xz
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-16
  • 語言: 其他
  • 標簽:

資源簡介

該代碼基于exynos4412編寫,基于kerenl3.14的驅動模塊,加載后執行音樂程序開始播放

資源截圖

代碼片段和文件信息


/*************************************************************************
>?File?Name:?pmw.c
>?Author:?BlueMoon
>?Mail:?Leeruile@outlook.com
>?Created?Time:?2018年08月28日?星期二?14時17分26秒
?************************************************************************/

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include“pmw.h“


#define?TCFG0????????0x00
#define?TCFG1????????0x04
#define?TCON?????????0x08
#define?TCNTB1???????0x0c
#define?TCMPB1???????0x10


//主次設備號定義
#define???????????????PMW_MAJOR?????410
#define???????????????PMW_MIJOR?????0
#define???????????????PMW_NUM???????1


dev_t?dev_ID;
void?auto_create_node(dev_t?dev_ID);
struct?_pmw
{
????unsigned?int?*gpdcon;
????void?__iomem?*timer_base;
????struct?cdev?cdev;
}*pmw;

//定義字符設備
//定義寄存器變量
struct?resource*?????????pmw_con;
struct?resource*?????????pmw_timer_base;

unsigned?int*????????????gpdcon;
unsigned?int*????????????gpddat;

struct?class*????????????pmw_class;
int?ret;
#define????dev_node_name??“PMW“


static?int?pmw_open(struct?inode?*inodestruct?file?*file)
{
????writel((readl(pmw->gpdcon)?&?~0xf)?|?0x2pmw->gpdcon);
????writel(readl(pmw->timer_base?+?TCFG0)?|?0xffpmw->timer_base?+?TCFG0);
????writel((readl(pmw->timer_base?+?TCFG1)?&?~0xf)?|?0x2?pmw->timer_base?+?TCFG1);
writel(300?pmw->timer_base?+?TCNTB1);
writel(150?pmw->timer_base?+?TCMPB1);
writel((readl(pmw->timer_base?+?TCON)?&?~0x1f)?|?0x2?pmw->timer_base?+?TCON);
//writel((readl(pwm->timer_base?+?TCON)?&?~(0xf?<timer_base?+?TCON);
return?0;
}

static?int?pmw_release(struct?inode?*inode?struct?file?*file)
{
writel(readl(pmw->timer_base?+?TCON)?&?~0xf?pmw->timer_base?+?TCON);
return?0;
}

static?long?pmw_ioctl(struct?file?*file?unsigned?int?cmd?unsigned?long?arg)
{
int?data?=?0;

if?(_IOC_TYPE(cmd)?!=?‘K‘)
return?-ENOTTY;

if?(_IOC_NR(cmd)?>?3)
return?-ENOTTY;

if?(_IOC_DIR(cmd)?==?_IOC_WRITE)
if?(copy_from_user(&data?(void?*)arg?sizeof(data)))
return?-EFAULT;

switch(cmd)
{
????case?PWM_ON:
????writel((readl(pmw->timer_base?+?TCON)?&?~0x1f)?|?0x9?pmw->timer_base?+?TCON);
????break;
????case?PWM_OFF:
????writel(readl(pmw->timer_base?+?TCON)?&?~0x1f?pmw->timer_base?+?TCON);
????break;
????case?SET_PRE:
????writel(readl(pmw->timer_base?+?TCON)?&?~0x1f?pmw->timer_base?+?TCON);
????writel((readl(pmw->timer_base?+?TCFG0)?&?~0xff)?|?(data?&?0xff)?pmw->timer_base?+?TCFG0);
???? writel((readl(pmw->timer_base?+?TCON)?&?~0x1f)?|?0x9?pmw->timer_base?+?TCON);
????break;
????case?SET_CNT:
????writel(data?pmw->timer_base?+?TCNTB1);
????writel(data?>>?1?pmw->timer_base?+?TCMPB1);
????break;
}

return?0;
}

//定義操作函數
static?struct?file_operations?pmw_fops?=?{
????.owner????=?THIS_MODULE
????.open?????=?pmw_open
????.release??=?pmw_release
????.unlocked_ioctl

評論

共有 條評論

相關資源