【Linux】驱动的基本架构和编译

驱动源码

/*
 *  Silicon Integrated Co., Ltd haptic sih688x haptic driver file
 *
 *  Copyright (c) 2021 kugua 
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation
 */

#include   //包含宏定义的头文件
#include    //包含初始化加载模块的头文件

static int __init haptics_init(void)
{
   
	//内核层只能使用printk,不能使用printf
    	printk(KERN_EMERG "[ KERN_EMERG ]  Haptics Init\n"); //输出等级为0
    	printk("[ default ]  Haptics Init\n");
    	return 0;
}

static void __exit haptics_exit

你可能感兴趣的:(Linux,linux,driver)