I am new to linux kernel modules and want to create a kernel module that interacts with the proc file system.
My Idea is to create a file in /proc that has a read that returns the real-time clocks hours, minutes and seconds.
However I am not sure how to use the linux/rtc.h interface to get whats required or if thats even the place I should be looking to try and access the real time clock hardware.
Any ideas on where to start looking to complete this would be greatly appreciated cause I am completely stuck right now.
Related
I have to do a code in C to detect the inter-characters time within a rs232 line on linux. Inter-characters time to detect could be 1ms. So I need something to timestamp very quickly an incomming characters. When I say very quickly is less than 1ms.
I don't ask for a coding solution, I just want a initial help to know what path I have to take : is it possible to do this on linux ? I have to modify a driver to reach this kind of time ? Or Something on user space can do it (I don't think so).
No chance to achieve this in user space, as far as I know there is no serial port configuration that allows you to specify precise inter-character timeout. Maybe coding custom driver could bring you closer to UART interrupts since that's what you need.
However every time I had to solve similar task, I ended up creating a tiny hardware module that performs my time-critical task very precisely and only reports results to the linux machine. It totally depends on what you need and how precise your communication gaps detection should be.
I am working on a personal project and want to try to come up with an implementation of the character device in the userspace instead of the kernelspace. I am using this github project https://github.com/ningfei/ethercat. I know it is something which is really exhaustive as I would need to replace all the linux kernel system calls by a mock representation. Can someone give me an idea on how to do so?
The image below shows the ethercat architecture.Ethercat architecture
So with other words you want all parts of EtherLAB master run in userspace,
then try http://fh-soft.de/src/ethercat-userspace.html .
Bear in mind that a pure userspace version of EtherLAB master means higher latency and lower cycle frequency.
I am currently working with the BeagleBone Black using Ubuntu and I am trying to find some direction. I have created a c program that listens for SIGIO and runs a read() to get the data on that line. From my research on the internet and looking through some books, it appears that this method is not very efficient in that using a loop listening for a Signal interrupt is bad because of the large amount of context switching (it should be noted that this I/O line will be busy so the SIGIO will trigger at least 4 times a second and this is an asynchronous). It was suggested to use hardware interrupts and have that trigger a response to take the data from the line and place it into a register and will be accessable from the User using Direct Memory Access preferably. So the question remains to be where can I look to get more info on how to do this, I find a lot of info on this topic but most of which just talk about how to OS does interrupts or using Signals, which with a busy line is pretty taxing.
If you are that much concerned about the timings and latency, you should probably use some real time system.
Fortunately, Beaglebone black has real-time processing cores on its SOC, called the PRU (Programmable real-time units).
If you are new to the concept of PRUs, you probably would like to start here and then, once you have understood the need and purpose of the PRUs, that same website has some tutorial to get started.
With the latest software support like remoteproc, rpmsg and Beaglescope project, PRUs can be used quite easily, once you have understood its working.
I have written an application for defragmenation which starts at boot time.We know every system boots up faster or slower depending on its configuration.I have given hard coded value of 3 seconds during boot time so that,windows registers all ports during that time.I just want to know,are there any APIs existing which gives exact time when windows system is completely ready at boot time.That is whether all USB ports and others got recognized or not.?
I would like to use C in order to get the last time the soundboard was playing a file. Is there a way I could do that?
None of the components you are using (tools, libraries, sound servers, drivers, kernel) logs the time when a sound is played.
If you are using one specific tool to play sounds, you could modify it to log the time.
Otherwise, you have to actively monitor the current status of the sound device.
(With ALSA, you could poll /proc/asound/card*/pcm*/sub*/status.)
I think it's not possible because of ALSA(Advanced Linux Sound Architecture) is just kernel component that provide device drivers for sound card.But i don't know if some user-space API's and library's like (alsa-ustils) can do that!,I advice may is better to check Sound-Player applications(VLC etc..) log ?!