- 论坛徽章:
- 0
|
在学习点灯驱动程序中遇到一下一问题,请各位大虾给予解惑:
驱动程序中的入口点:
....
static struct file_operations matrix4_leds_fops = {
owner: THIS_MODULE,
ioctl: leds_ioctl,
};
static int leds_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{...... //实现
}
....
而在上层控制程序中有:
int main(int argc, char **argv)
{
int on;
int led_no;
int fd;
.....
fd = open("/dev/leds", 0);
...
ioctl(fd, on, led_no); //疑惑????
....
}
请问上层测试程序ioctl(fd, on, led_no)和驱动中的ioctl函数是怎样调用的啊?他们的参数的个数以及参数的类型好像不一致?那么是怎样匹配的呢?
请各位大虾给以解答!提前谢了. |
|