EmbLogic's Blog

Author Archives: gaurav

Interrupt handler

The role of an interrupt handler is to give feedback to its device about interrupt reception and to read or write data according to the meaning of the interrupt being serviced. The first step usually consists of clearing a bit … Continue reading →

Posted in Uncategorized | Leave a comment

Blocking I/O

A call to read may come when no data is available, but more is expected in the future. Or a process could attempt to write, but your device is not ready to accept the data, because your output buffer is … Continue reading →

Posted in Uncategorized | Leave a comment

Interrupt Disabling

However, interrupt disabling alone does not always prevent kernel control path interleaving. Indeed, a kernel control path could raise a “Page fault” exception, which in turn could suspend the current process (and thus the corresponding kernel control path). Or again, … Continue reading →

Posted in Uncategorized | Leave a comment

Interrupt Disabling

For any section of code too large to be defined as an atomic operation, more complicated means of providing critical sections are needed. To ensure that no window is left open for a race condition to slip in, even a … Continue reading →

Posted in Uncategorized | Leave a comment

Atomic Operations

The easiest way to prevent race conditions is by ensuring that an operation is atomic at the chip level: the operation must be executed in a single instruction. These very small atomic operations can be found at the base of … Continue reading →

Posted in Uncategorized | Leave a comment

A race condition can occur when the outcome of some computation depends on how two or more interleaved kernel control paths are nested. A critical region is any section of code that should be completely executed by each kernel control … Continue reading →

Posted in Uncategorized | Leave a comment

Nonpreemptability of Processes in Kernel Mode

Linux kernel is not preemptive, that is, a running process cannot be preempted (replaced by a higher-priority process) while it remains in Kernel Mode. In particular, the following assertions always hold in Linux: No process running in Kernel Mode may … Continue reading →

Posted in Uncategorized | Leave a comment

PCI

The CPU and the PCI devices need to access memory that is shared between them. This memory is used by device drivers to control the PCI devices and to pass information between them. Typically the shared memory contains control and … Continue reading →

Posted in Uncategorized | Leave a comment

SPI

The Serial Peripheral Interface (SPI) bus is a serial master-slave interface similar to I 2C and comes built in on many microcontrollers. It uses four wires (compared to two on I2C): Serial CLocK (SCLK), Chip Select (CS),Master Out Slave In … Continue reading →

Posted in Uncategorized | Leave a comment

sysfs

Kobjects are the mechanism behind the sysfs virtual filesystem. For every directory found in sysfs, there is a kobject lurking somewhere within the kernel. Every kobject of interest also exports one or more attributes, which appear in that kobject’s sysfs … Continue reading →

Posted in Uncategorized | 1 Comment

kobject

Adding a kobject to a kset is usually done when the object is created; it is a two-step process. The kobject’s kset field must be pointed at the kset of interest; then the kobject should be passed to: int kobject_add(struct … Continue reading →

Posted in Uncategorized | Leave a comment

i2c probe and attach functions.

When the i2c core calls the driver’s probe() method signifying the presence of a host adapter, it, in turn,invokes i2c_probe() with arguments specifying the addresses of the slave devices that the driver is responsible for and an associated attach() routine,which … Continue reading →

Posted in Uncategorized | Leave a comment

class object

Each class object includes a list of class_device descriptors, each of which represents a single logical device belonging to the class. The class_device structure includes a dev field that points to a device descriptor, thus a logical device always refers … Continue reading →

Posted in Uncategorized | Leave a comment

i2c

I2C is the name for a two-wire serial bus protocol originally developed by Phillips. It commonly is used in embedded systems so different components can communicate; PC motherboards use I2C to talk to different sensor chips. Those sensors typically report … Continue reading →

Posted in Uncategorized | Leave a comment

Dentry Object

VFS considers each directory a file that contains a list of files and other directories.Once a directory entry is read into memory, however, it is transformed by the VFS into a dentry object based on the dentry structure.The kernel creates … Continue reading →

Posted in Uncategorized | Leave a comment