linux-device-driver

what are mapbase and membase members of UART 8250 port structure?

ぃ、小莉子 提交于 2019-12-12 02:23:15
问题 I am trying to understand the 8250 serial port on pci express bus of our board by going through the driver code and I am having hard time understanding the below two members of struct uart_8250_port struct uart_8250_port x; memset(&x, 0, sizeof(x)); .... .... x.port.regshift = 0; x.port.iotype = UPIO_MEM; x.port.flags = UPF_SHARE_IRQ | UPF_LOW_LATENCY; x.port.membase = raw_address; x.port.mapbase = ioremap(raw_address); What are the members membase and mapbase ? Also, why does membase take

how to export symbol from kernel module in this case?

爱⌒轻易说出口 提交于 2019-12-12 01:53:33
问题 I've got two kernel modules built, one of which is a net_device. My net_device module A depends on module B which provide some extra control mechanism to export device info. Now, I want to be able to call the xmit function in module A from module B. As a result, module B will become dependent on module A if I simple export symbol from A. This, obviously, creates a 'deadlock' like dependency situation. Does anyone have experience resolving this? How can I properly export the xmit function in A

probe is not getting called in i2c driver

♀尐吖头ヾ 提交于 2019-12-12 00:38:40
问题 I am trying to learn to write a i2c driver on raspberry pi board and i have taken groove LCD back-light.Here driver.probe is not getting called whereas driver's inserted in system as i can see in dmesg. Init code of driver is getting called, and code => static int lcd_probe(struct i2c_client *i2c_client, const struct i2c_device_id *i2c_id) { int ret = 0; //struct lcd_data *lcd_data; // struct device *dev = &i2c_client->dev; // lcd_data->client = i2c_client; pr_debug("lcd_probe : calling the

Need help in enable configuration when compile Kernel module

耗尽温柔 提交于 2019-12-12 00:27:56
问题 I am using 3.10.x kernel tree. My kernel module needs config VIDEOBUF2. That is defined in drivers/media/v4l2-core/Kconfig: # Used by drivers that need Videobuf2 modules config VIDEOBUF2_CORE select DMA_SHARED_BUFFER tristate So I put 'CONFIG_VIDEOBUF2_CORE=y' in my Kernel config file and compile. From the Kconfig it has CONFIG_VIDEOBUF2_CORE has no dependency and I think adding CONFIG_VIDEOBUF2_CORE=y to my kernel config should work. I am modify the right kernel config file since I set other

configuring serial port from kernel space

懵懂的女人 提交于 2019-12-11 20:23:36
问题 How to configure the serial port in kernel module. I am doing this in init module function. same configuration is working in userpsace. I am using the below code to configure the serial port. mm_segment_t oldfs; oldfs = get_fs(); set_fs(KERNEL_DS); fp = filp_open("/dev/ttyS0",O_RDWR | O_NOCTTY | O_NDELAY); tty = (struct tty_struct *)fp->private_data; setting the required configuration(tty->termios) set_fs(oldfs); 回答1: Almost all functions of serial port operations are implemented by drivers

Module Programming in linux

荒凉一梦 提交于 2019-12-11 20:12:31
问题 here is the simple module program code. #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_INFO */ #include <linux/init.h> /* Needed for the macros */ static int hello3_data __initdata = 3; static int __init hello_3_init(void) { printk(KERN_INFO "Hello, world %d\n", hello3_data); return 0; } static void __exit hello_3_exit(void) { printk(KERN_INFO "Goodbye, world %d\n",hello3_data); } module_init(hello_3_init); module_exit(hello_3_exit); I've

How to arrive at irq base for an mfd device?

妖精的绣舞 提交于 2019-12-11 19:34:05
问题 In an MFD device. I wanted to understand, how do we arrive at irq base . Is it a random number.? Please some one explain. 回答1: Basically one first needs to associate a particular IRQ number with an actual physical hardware interrupt before attempting to register an ISR for that IRQ number. This is commonly done in the Linux kernel using irq_domain_add_linear(). In the past, IRQ numbers could be chosen so they matched the hardware IRQ line into the root interrupt controller (i.e. the component

Getting information from the device tree and requesting irq

烈酒焚心 提交于 2019-12-11 19:29:12
问题 Context In the device tree I am using, in one of its node, the filed interrupts is: interrupts = <0x0 0x1d 0x4>; (from a device tree of a Pynq board, equipaged with a ZYnq device with a dual-core ARM A9 ) Now, in the device tree .probe function, I use the Linux kernel API: irq_line = platform_get_irq(pdev, 0); in order to get the irq to use for the function request_irq (described in ldd3 chapter 10). Ones the irq_line = platform_get_irq(pdev, 0); is executed, I get the value 0x2e that DOESN'T

Linux Kernel Threads : How to pass the Linux module write function as the function that the thread has to execute?

為{幸葍}努か 提交于 2019-12-11 18:39:02
问题 I am developing Linux kernel module that communicate with user space program. This module waits for a message which is being sent from user space in order to print it in kernel mode. This is the module : #include <linux/init.h> #include <linux/module.h> #include <linux/fs.h> #include <linux/device.h> #include <linux/kernel.h> #include <linux/uaccess.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("Gaston"); MODULE_DESCRIPTION("A simple Linux char driver"); MODULE_VERSION("0.1"); #define MAX 256

Dynamic allocate/free structure with embedding lock in linux kernel

与世无争的帅哥 提交于 2019-12-11 18:26:54
问题 I want to free a structure with spin_lock is embedded. scenario is as follows: I have two functions f1 () { ***************** spin_lock_irqsave(&my_obj_ptr->my_lock, flags) .... .... ........................................ here f2 is called spin_lock_irqstore(&my_obj_ptr->my_lock, flags) ******************* kfree(my_obj_ptr) } and f2 has similar content with f1. when f2 is called my_lock is being used, f2 must busy waiting. however, when f2 is entering the critical section, my_obj_ptr is