linux-device-driver

How many instructions does Linux kernel need in order to handle an interrupt on an arm cortex A9?

送分小仙女□ 提交于 2019-12-01 05:40:10
问题 I would like to estimate the amount of opcodes it takes a ARM cortex A9 single core to handle an IRQ. Assuming I work with Linux kernel 3.4 , how many opcodes it takes to call the irq and execute the irq_handler ? 回答1: You question is related how to calculate the interrupt latency of Linux. At least you might be interested in how long it takes before your interrupt even starts. We will ignore this aspect of irqs here. A simple way is to toggle a GPIO and use a scope to measure the interrupt.

what is difference between cdev_alloc and cdev_init

帅比萌擦擦* 提交于 2019-12-01 05:31:00
问题 I'm creating a character device. I found two way to initialize char device cdev_alloc and cdev_init According to book, if i'm embedding struct cdev in my device struct then i should use cdev_init Can any one tell me that what are difference between them? 回答1: you can use either: struct cdev my_cdev; in this case you don't need to call cdev_alloc because memory is already allocated. Instead you must call cdev_init(&my_cdev, &fops) . and then my_cdev.owner = THIS_MODULE; OR you can use: struct

How is the init process started in the Linux kernel?

偶尔善良 提交于 2019-12-01 04:02:29
I am trying to understand the init process in the linux kernel which is the first process and is statically initialized with the INIT_TASK macro. 161 #define INIT_TASK(tsk) \ 162 { \ 163 .state = 0, \ 164 .stack = &init_thread_info, \ 165 .usage = ATOMIC_INIT(2), \ 166 .flags = PF_KTHREAD, \ 167 .prio = MAX_PRIO-20, \ 168 .static_prio = MAX_PRIO-20, \ 169 .normal_prio = MAX_PRIO-20, \ 170 .policy = SCHED_NORMAL, \ 171 .cpus_allowed = CPU_MASK_ALL, \ 172 .nr_cpus_allowed= NR_CPUS, \ 173 .mm = NULL, \ 174 .active_mm = &init_mm, \ 175 .se = { \ 176 .group_node = LIST_HEAD_INIT(tsk.se.group_node),

How is the init process started in the Linux kernel?

只谈情不闲聊 提交于 2019-12-01 02:20:53
问题 I am trying to understand the init process in the linux kernel which is the first process and is statically initialized with the INIT_TASK macro. 161 #define INIT_TASK(tsk) \ 162 { \ 163 .state = 0, \ 164 .stack = &init_thread_info, \ 165 .usage = ATOMIC_INIT(2), \ 166 .flags = PF_KTHREAD, \ 167 .prio = MAX_PRIO-20, \ 168 .static_prio = MAX_PRIO-20, \ 169 .normal_prio = MAX_PRIO-20, \ 170 .policy = SCHED_NORMAL, \ 171 .cpus_allowed = CPU_MASK_ALL, \ 172 .nr_cpus_allowed= NR_CPUS, \ 173 .mm =

Is the naming convention for java native interface method and module name?

做~自己de王妃 提交于 2019-12-01 00:19:56
I am able to follow a jni tutorial just fine. But when I change the method name, I run into trouble. Is there a naming convention I need to follow? The tutorial used HelloJNI as the module name, and library name. I used "useaaacom". I got great feedback on this and i am making progress. I have a related question; let me know if I should create another post for it. I like to build on this app, which runs at this point. How do I call functions from a device driver? I have the header file, and the driver is loaded into my image. By "how" I mean, do I need to have a copy of the header file in my

Direct Control of HCI Device (Bypass Bluetooth Drivers) on Linux

℡╲_俬逩灬. 提交于 2019-11-30 23:53:05
I need to control an HCI device directly without the Linux drivers/kernel interfering. For example, when creating an LE connection to a peripheral, the driver is independently sending an "LE Connection Update" command which I would like to avoid. I though of two approaches to resolve this: Configure the bluetooth drivers to somehow disable interference with the HCI device (similar to the -r flag on hciattach), then control the HCI device using a regular AF_BLUEOOTH socket. Disable this particular HCI device, but keep the parent char device and connect to it directly. So far I did not succeed

Regarding NAPI implementation in Linux Kernel

江枫思渺然 提交于 2019-11-30 23:17:10
I am trying to understand the NAPI enabled Network driver and have some doubts regarding the same. If I talk about in layman's term whenever a network packets comes at the interface, it is notified to CPU and appropriate Ethernet driver(interrupt handler) code is executed.Ethernet driver code then copy the packet from Ethernet's Device memory to DMA buffers and finally packets are pushed to upper layer. Is above true for NAPI disabled Ethernet driver? Now for NAPI enabled Ethernet driver initially whenever packets comes at interface ,it is notified to CPU and appropriate Ethernet driver code

How linux drive many network cards with the same driver?

十年热恋 提交于 2019-11-30 21:06:21
I am learning linux network driver recently, and I wonder that if I have many network cards in same type on my board, how does the kernel drive them? Does the kernel need to load the same driver many times? I think it's not possible, insmod won't do that, so how can I make all same kind cards work at same time? regards The state of every card (I/O addresses, IRQs, ...) is stored into a driver-specific structure that is passed (directly or indirectly) to every entry point of the driver which can this way differenciate the cards. That way the very same code can control different cards (which

Is the naming convention for java native interface method and module name?

只谈情不闲聊 提交于 2019-11-30 19:23:55
问题 I am able to follow a jni tutorial just fine. But when I change the method name, I run into trouble. Is there a naming convention I need to follow? The tutorial used HelloJNI as the module name, and library name. I used "useaaacom". I got great feedback on this and i am making progress. I have a related question; let me know if I should create another post for it. I like to build on this app, which runs at this point. How do I call functions from a device driver? I have the header file, and

Questions about register_chrdev_region() in linux device driver

半世苍凉 提交于 2019-11-30 18:53:32
I'm learning about the registration of a kernel module using register_chrdev_region(dev_t from, unsigned count, const char * name); . I notice that with or without this function, my kernel module worked as expected. The code I used for testing: first = MKDEV(MAJOR_NUM, MINOR_NUM); register_chrdev_region(first, count, DEVICE_NAME);//<---with and without mycdev=cdev_alloc(); mycdev->ops= &fops; mycdev->owner = THIS_MODULE; if (cdev_add(mycdev,first, count) == 0) {printk(KERN_ALERT "driver loaded\n");} I commented out the line register_chrdev_region(first, count, DEVICE_NAME); , and the printk