移植树莓派中的fbtft显示驱动到Linux开发板下(三)-参数传递

来源:互联网 发布:删除数组中重复元素 编辑:程序博客网 时间:2024/06/07 07:44

在fbtft显示驱动fbtft_device.c下有很多待传入的参数,如name设备名称,用它来匹配寻找你的对应的显示屏驱动

了解一下传参的函数:

module_param(name,type,perm);

module_param 使用了 3 个参数: 变量名, 变量名的类型, 以及一个权限掩码用来做一个辅助的 sysfs 入口

static char *name;
module_param(name, charp, 0);
MODULE_PARM_DESC(name, "Devicename (required). name=list => list all supported devices.");
name:传入的设备名称,用来匹配对应的显示屏驱动程序

static unsigned int rotate;
module_param(rotate, uint, 0);
MODULE_PARM_DESC(rotate,"Angle to rotate display counter clockwise: 0, 90, 180, 270");
rotate:顺时针方向旋转显示计数器

static unsigned int busnum;
module_param(busnum, uint, 0);
MODULE_PARM_DESC(busnum, "SPI bus number (default=0)");
busnum:spi的总线号

static unsigned int cs;
module_param(cs, uint, 0);
MODULE_PARM_DESC(cs, "SPI chip select (default=0)");
cs:spi总线的片选信号

static unsigned int speed;
module_param(speed, uint, 0);
MODULE_PARM_DESC(speed, "SPI speed (override device default)");
speed:spi总线的通信速率

static int mode = -1;
module_param(mode, int, 0);
MODULE_PARM_DESC(mode, "SPI mode (override device default)");
mode:spi总线的通信模式

static char *gpios;
module_param(gpios, charp, 0);
MODULE_PARM_DESC(gpios,
"List of gpios. Comma separated with the form: reset:23,dc:24 (when overriding the default, all gpios must be specified)");
gpios:gpio端口

static unsigned int fps;
module_param(fps, uint, 0);
MODULE_PARM_DESC(fps, "Frames per second (override driver default)");
fps:图像帧每秒

static char *gamma;
module_param(gamma, charp, 0);
MODULE_PARM_DESC(gamma,
"String representation of Gamma Curve(s). Driver specific.");
gamma:未知

static int txbuflen;
module_param(txbuflen, int, 0);
MODULE_PARM_DESC(txbuflen, "txbuflen (override driver default)");
tcbuflen:发送缓冲区的的长度

static int bgr = -1;
module_param(bgr, int, 0);
MODULE_PARM_DESC(bgr,
"BGR bit (supported by some drivers).");
bgr:BGR bit

static unsigned int startbyte;
module_param(startbyte, uint, 0);
MODULE_PARM_DESC(startbyte, "Sets the Start byte used by some SPI displays.");
startbyte:设置一些SPI显示使用的开始字节

static bool custom;
module_param(custom, bool, 0);
MODULE_PARM_DESC(custom, "Add a custom display device. Use speed= argument to make it a SPI device,else platform_device");
custom:添加一个自定义显示设备

static unsigned int width;
module_param(width, uint, 0);
MODULE_PARM_DESC(width, "Display width, used with the custom argument");
width:显示宽度

static unsigned int height;
module_param(height, uint, 0);
MODULE_PARM_DESC(height, "Display height, used with the custom argument");
height:显示高度

static unsigned int buswidth = 8;
module_param(buswidth, uint, 0);
MODULE_PARM_DESC(buswidth, "Display bus width, used with the custom argument");
buswidth:总线的宽度

static int init[FBTFT_MAX_INIT_SEQUENCE];
static int init_num;
module_param_array(init, int, &init_num, 0);
MODULE_PARM_DESC(init, "Init sequence, used with the custom argument");


static unsigned long debug;
module_param(debug, ulong, 0);
MODULE_PARM_DESC(debug,"level: 0-7 (the remaining 29 bits is for advanced usage)");


static unsigned int verbose = 3;
module_param(verbose, uint, 0);
MODULE_PARM_DESC(verbose,"0 silent, >0 show gpios, >1 show devices, >2 show devices before (default=3)");


阅读全文
1 0
原创粉丝点击