⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 da.c

📁 fft 2410 linux 部分驱动 报扩 ad da 数码管 led
💻 C
字号:
/****************************************Copyright (c)**************************************************
**                                  西安傅立叶电子有限公司
**                                     研    发    部
**                              http://www.FFTChina.com
**-----------------------------------------文件信息-----------------------------------------------------
**文   件   名: cantest.c
**创   建   人: 
**最后修改日期: 2005年6月30日
**描        述: CAN模块测试驱动程序(查询模式)
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
#ifndef __KERNEL__
#define __KERNEL__
#endif
#ifndef MODULE
#define MODULE
#endif
#include  <linux/capability.h>
#include  <linux/smp_lock.h>
#include  <linux/module.h>
#include <linux/spinlock.h>
#include <linux/poll.h>

#include  <asm/hardware.h>
#include  <asm/io.h>
#include  <linux/irq.h>
#include  <linux/devfs_fs_kernel.h>
#include  <linux/init.h>
#if LINUX_KERNEL_VERSION >= KERNEL_VERSION(2,4,0)
#include  "linux/smp_lock.h"
#endif
char   kernel_version[]=UTS_RELEASE;
devfs_handle_t  dev_handle3; 
 #define FFTspi_MAJOR 30
#define DEBUG         1
//void *DAAdr,*DAAdr1;
short int *DAAdr,*DAAdr1;



void da_Port_Init(void)
{
         
     
    
}
/*******************************************************
*函数原形:read_fftspi(struct file *file, char *buf, size_t count,loff_t *f_pos)
*参数:        buf  : 传入该函数的数据缓冲区指针
*	           count:CAN的通道号
*返回值 : 0
*函数说明:读出接收到的CAN数据
*******************************************************/
static int  read_fftspi(struct file *file, char *buffer, size_t count,loff_t *f_pos)
{	
	    return 0;
}

/*******************************************************
*函数原形:write_fftspi(struct file *file,const char *buf,size_t count,loff_t *f_pos)
*参数:    buf  : 传入该函数的数据缓冲区指针
*	       count:CAN的通道号
*返回值 : 0 说明成功写入
*函数说明:向CAN总线发送数据
*******************************************************/

static int  write_fftspi(struct file *file,const char *buf,size_t count,loff_t *f_pos)
{    
    	return 0;
}
/*******************************************************
*函数原形:open_fftspi(struct inode *inode,struct file *file)
*参数:               
*返回值 : 
*函数说明:
*******************************************************/
static int open_fftspi(struct inode *inode,struct file *file)
{   
    MOD_INC_USE_COUNT;
    return 0;
}
/*******************************************************
*函数原形:open_fftspi(struct inode *inode,struct file *file)
*参数:               
*返回值 : 
*函数说明:
*******************************************************/
static int release_fftspi(struct inode *inode,struct file *file)
{
    MOD_DEC_USE_COUNT;
    return 0;
}
/***************************************************************************************************
** function descrp:
** arg:     cmd:    0: slave mode 1: master mode
            arg:    Baud rate = 50M / 2 / (arg + 1)
** detail:     
**************************************************************************************************/
static int ioctl_fftspi(struct inode *inode,struct file *file,unsigned int cmd,unsigned long arg)
{
   *DAAdr=cmd;
   *DAAdr1=arg;
 
   return 0;
}
/***************************************
** 函数指针结构: file_operations
** 说明        :
***************************************/
struct file_operations fftspi_fops={

  	read :      read_fftspi,
    write:      write_fftspi,
	ioctl:	    ioctl_fftspi,
	open :	    open_fftspi,
    release:    release_fftspi,
};
/******************************************************
**  初始化模块:在加载模块时候调用
**  函数原形  : init_module(void)
**  说    明  :不用修改
******************************************************/
 static int __init  fftspi0_init_module(void)
{
   int result;
   da_Port_Init();
   dev_handle3 = devfs_register( NULL, "fftda", DEVFS_FL_DEFAULT, FFTspi_MAJOR, 0, S_IFCHR, &fftspi_fops, NULL);
  DAAdr= ioremap(0x28800000,0xf0);
  DAAdr1= ioremap(0x28800400,0xf0);
   printk("congraulation,fftioport are successful registed\n");
   return 0;
}
/*******************************************************
**  函数原形 : cleanup_module(void)
**  说明     : 在卸载模块时调用
******************************************************/
static void __exit fftclrspi0_module(void)
{
  iounmap(DAAdr);
  iounmap(DAAdr1);
   devfs_unregister (dev_handle3);
  printk("exit fftioport\n");

}
MODULE_LICENSE("GPL");

module_init(fftspi0_init_module);
module_exit(fftclrspi0_module);



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -