资料介绍
基于linux-2.6.38内核的嵌入式驱动常用的函数调用
基于linux-2.6.38内核的嵌入式驱动常用的函数调用:
1.static inline unsigned long copy_from_user(void __user *to,const void
*from, unsigned long n)
{
......
}
作用:用copy_from_user(),用户空间到内核空间传递数据,参数:目的,源,长度/??
小,返回值是n??
举例:copy_from_user(&val,buf,count);
2.static inline int register_chrdev(unsigned int major, const char
*name,const struct file_operations *fops)
{
......
}
作用:注册,即告诉内核将结构体static struct file_operations xxx_fops
举例:major=register_chrdev(0,"first_drv_led",&first_drv_led_fops);
3.static inline void __iomem *ioremap(phys_addr_t offset, unsigned long
size)
{
......
}
举例:gpkcon0 = (volatile unsigned long *)ioremap(0x7F008800, 16);
4.struct class *__class_create(struct module *owner, const char
*name,struct lock_class_key *key)
{