linux-device-driver

How existing kernel driver should be initialized as PCI memory-mapped?

允我心安 提交于 2019-12-23 06:03:32
问题 Existing kernel drivers such as xilinx have specific way to be registered (as tty device), if they are mapped directly to cpu memory map as done here with device tree: https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842249/Uartlite+Driver But in other cases, there is a PCIe device (like FPGA which has the xilinx uart IPs) which is connected to and the cpu. How should we make the uart get registered when using PCIe device ? The device tree I try to register into PCIe is uartlite driver

Deciphering Device Tree

与世无争的帅哥 提交于 2019-12-23 05:28:04
问题 Here is an excerpt I pulled from a device tree on my embedded Linux Kernel. This is how I understand it now: 1) The aemif interface is located at physical address 0x30000000 2) The aemif driver is located in a file called davinci_aemif.c and it uses a clock called aemif 3) The aemif has 2 devices on it, one being cs2 and the other being nand (I don't think this assumption is correct) Now for the Questions: 1) What is the line reg = <0x21000a00 0x100>; doing? How can the aemif which is located

How to use the matrix_keypad.h file for a custom keypad driver?

▼魔方 西西 提交于 2019-12-23 05:10:48
问题 can i emulate a custom keypad with input_dev (from input.h) //an example with just one key. button_dev = input_allocate_device(); if (!button_dev) { printk(KERN_ERR "button.c: Not enough memory\n"); error = -ENOMEM; goto err_free_irq; } button_dev->evbit[0] = BIT_MASK(EV_KEY); button_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0); or i will have to use matrix_keypad header file?If yes then How? 来源: https://stackoverflow.com/questions/45382982/how-to-use-the-matrix-keypad-h-file-for-a-custom

How to use the matrix_keypad.h file for a custom keypad driver?

我只是一个虾纸丫 提交于 2019-12-23 05:10:03
问题 can i emulate a custom keypad with input_dev (from input.h) //an example with just one key. button_dev = input_allocate_device(); if (!button_dev) { printk(KERN_ERR "button.c: Not enough memory\n"); error = -ENOMEM; goto err_free_irq; } button_dev->evbit[0] = BIT_MASK(EV_KEY); button_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0); or i will have to use matrix_keypad header file?If yes then How? 来源: https://stackoverflow.com/questions/45382982/how-to-use-the-matrix-keypad-h-file-for-a-custom

reading the timestamp from kernel using procfs - where is it stored after reading from kernel?

╄→гoц情女王★ 提交于 2019-12-23 04:45:27
问题 when the interrupt occurs in the kernel and If I am reading a timestamp in the kernel. I am reading the timestamp from kernel to the user via procfs. where that interrupt time value will be stored ?? how should the user read that value from the user space ?? ssize_t dev_read(struct file *filp,const char *buf,size_t count,loff_t *offset) { if ( count < sizeof(InterruptTime) ) { // Not enough space provided. return 0; // Or some error code maybe. } if (copy_to_user(buf,&InterruptTime,sizeof

Kernel panic using deferred_io on kmalloced buffer

这一生的挚爱 提交于 2019-12-23 04:04:45
问题 I'm writing a framebuffer for an SPI LCD display on ARM. Before I complete that, I've written a memory only driver and trialled it under Ubuntu (Intel, Virtualbox). The driver works fine - I've allocated a block of memory using kmalloc, page aligned it (it's page aligned anyway actually), and used the framebuffer system to create a /dev/fb1. I have my own mmap function if that's relevant (deferred_io ignores it and uses its own by the look of it). I have set: info->screen_base = (u8 __iomem *

How do cdev and its associated file operation work?

梦想与她 提交于 2019-12-23 02:39:27
问题 Actually working on a PCI driver. I have two PCIe cards with same device ID and vendor ID. So to make a difference, I assign these two cards with two different MINOR numbers. //request for device numbers error = alloc_chrdev_region(&devt, 0, cards_found, DEVICE_NAME); if (error == 0) { major = MAJOR(devt); printk(KERN_INFO "(drv_init): MAJOR number is %d\n", major); printk(KERN_INFO "(drv_init): MINOR number range from 0 to %d\n", cards_found-1); cdevs = cdev_alloc(); cdevs->owner = THIS

Why the operator >> doesn't work with my char device?

时光毁灭记忆、已成空白 提交于 2019-12-22 18:11:50
问题 I'm currently learning linux device drivers. I have begun with an example driver, which is just a memory buffer. My code is available on my github. I test my driver by doing this: # echo "Hello World" > /dev/mad # cat /dev/mad Hello World This is going well but when I use the redirection operator to append something (>>), the behaviour is not the one that I expected. # echo foo > /dev/mad # echo bar >> /dev/mad # cat /dev/mad bar I expected rather to have: foo bar I have implemented the

some flags about workqueue in kernel

倾然丶 夕夏残阳落幕 提交于 2019-12-22 17:51:54
问题 i am dealing with the concurrency managed workqueues in linux kernel 2.6.36.But i am confused about the some flags. WQ_HIGHPRI WQ_UNBOUND WQ_RESCUER WQ_CPU_INTENSIVE I create a workqueue with flag WQ_HIGHPRI and queue some work items(eg w1 w2 w3 w4,by order) to it, none of the 4 work items will sleep. Whether the 4 work items are executed by the same thread and in this situation, is any thread created? In above situation, is there any difference if WQ_UNBOUND is used? Because if you set WQ

current directory of a process in linux-kernel

╄→гoц情女王★ 提交于 2019-12-22 14:00:03
问题 Is it possible to get the process current directory via struct task_struct ? I can see that struct fs_struct has pwd pointer, but I'm not able get the exact variable where this info is stored. Also, can we change current directory value? 回答1: Your working on quite an old kernel so I've had to do some digging. One of the easier ways to deal with this sort of thing is see if the information is in /proc and look at what it does. If we grep for cwd in fs/proc we find: static int proc_cwd_link