embedded-linux

how to detect a pin change of a GPIO on Linux board

家住魔仙堡 提交于 2019-12-09 15:28:57
问题 I am using 3.12 kernel on an ARM based linux board (imx233 CPU). My purpose is to detect pin change of a GPIO (1 to 0). I can read the pin value constantly calling the below function (in a while(1) loop) int GPIO_read_value(int pin){ int gpio_value = 0; char path[35] = {'\0'}; FILE *fp; sprintf(path, "/sys/class/gpio/gpio%d/value", pin); if ((fp = fopen(path,"rb+")) == NULL){ //echo in > direction //error } fscanf(fp, "%d", &gpio_value); fclose(fp); return gpio_value; } But it causes too much

Mapping a physical device to a pointer in User space

淺唱寂寞╮ 提交于 2019-12-09 12:13:40
问题 We have an embedded system where a memory mapped device is connected, and an ARM CPU runs Linux. The device is located at address 0x40400000 and occupies a megabyte (most of it is not backed by an actual memory, but the address space is mapped to the device anyway). We currently don't have a device driver for this device. In the device there is a special read-only register (called CID) at address 0x404f0704 . This register contains the value CID = 0x404 . I am trying to read this register

Using RNDADDENTROPY to add entropy to /dev/random

柔情痞子 提交于 2019-12-09 10:44:01
问题 I have a device which generates some noise that I want to add to the entropy pool for the /dev/random device in an embedded Linux system. I'm reading the man page on /dev/random and I don't really understand the structure that you pass into the RNDADDENTROPY ioctl call. RNDADDENTROPY Add some additional entropy to the input pool, incrementing the entropy count. This differs from writing to /dev/random or /dev/urandom, which only adds some data but does not increment the entropy count. The

How to fix “iptables: No chain/target/match by that name”?

狂风中的少年 提交于 2019-12-08 19:42:01
问题 I built and installed iptables on my linux embedded system. If I list all rules, everything works fine: #iptables --list Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination But, if I add a new rule to block icmp ping, I'll get the follwing error: iptables -A INPUT -i eth0 -p icmp --icmp-type any -s 0/0 -d 10.20.3.179 -m state --state NEW,ESTABLISHED

Which processor would execute hardware interrupt in a muticore system

帅比萌擦擦* 提交于 2019-12-08 19:38:31
In general hardware interrupts need to be processed immediately, at least so as to acknowledge it and do some first level of processing. As I understand this is not scheduled activity. Please correct me. So the question is how to choose a processor that would actually execute this hardware interrupt handler? One can answer this for Linux and/or BSD systems In general, this depends on the functionality offered by multi-core processor and OS. While using multi-core processors, you might need to configure the affinity of the interrupt as per your requirement. In the case of linux , the /proc file

Good emulators for embedded Linux

一个人想着一个人 提交于 2019-12-08 19:21:11
问题 Are there any good emulators for learning embedded Linux ? 回答1: If you want to play with Linux on the Arm, you can play with qemu. That way, you can emulate, for instance, an N8x0 tablet 回答2: Embedded Linux is like Linux, but sometimes with the capabilities of a microcontroller. Learn Linux on a normal PC, then find yourself a PIC toolkit that uses a C compiler and learn the MCU stuff on that. 回答3: The Beagle Board is a good DIY development board/environment for learning embedded Linux. The

Adding entry to task_struct and initializing to default value

ε祈祈猫儿з 提交于 2019-12-08 16:45:40
问题 I want to add an entry to process control block structure ( task_struct ). Let say a way to tag some process. I want to initialize this field to 0 for all the process except "some special processes", later by calling sched_setscheduler() I will set this flag for the "special processes". Does anybody have an idea how to assign a default value to a member variable in task_struct ? 回答1: I'm assuming you are talking about a recent Linux kernel, because implementation detail changes over time.

How to communicate with the USB Host from a Linux USB Client

时光总嘲笑我的痴心妄想 提交于 2019-12-08 14:47:28
The host part will be a PC program made from c# in which I will use LibUSBdotnet to do the communication. My problem is how do I make the Linux side pickup and respond. I don't really know where to start. Whenever I try to search for it, all result show are "how linux communicates with a device attached to it". Or it does not matter if a device is host or client, because they utilize the same pipes/bus? Can I use something in "/dev/usb***"? I have seen "libusb" which I believe is the linux cousin of libusbdotnet. Can I somehow use this library? If anyone can show me the right direction, I

Unable to run Snappy player on Beaglebone Black using Yocto Project

隐身守侯 提交于 2019-12-08 12:47:38
My main objective is to run snappy player ( https://wiki.gnome.org/Snappy ) on target machine ( BeagleBone Black ) so, I wrote a recipe for Snappy player( snappy_1.0.bb ) as below LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://COPYING;md5=686e6cb566fd6382c9fcc7a557bf4544" SRCREV = "e73fabce4c397b40d490c74f6a6a0de000804f42" SRC_URI = "git://git.gnome.org/snappy" S = "${WORKDIR}/git" RDEPENDS_${PN} = "gtk+3 gstreamer1.0 glib-2.0 clutter-1.0 gstreamer1.0-plugins-base libxtst clutter-gst-3.0 clutter-gtk-1.0 libx11 cairo gdk-pixbuf" # inherit line inherit pkgconfig autotools FILES_${PN} += "${datadir

spidev Linux driver on Intel Atom board

烈酒焚心 提交于 2019-12-08 12:30:24
问题 I am working on bringing up SPI on Kontron's Atom-based SMARC-sXBTi board under Linux. Kontron provided Yocto BSP but it does not include SPI driver. I rebuilt Linux with SPI support. I can see the SPI controller in lspci and in sysfs the SPI PCI device is bound to pca2xx_spi_pci driver. As I understand this is a platform driver which does not expose user mode API and I need spidev to be able to work via /dev/spidev but when I modeprobe spidev I don't see anything happening: no file added to