Tuesday 16 May 2017

Embedded

retrieve major and minor number from dev_t type

int major=MAJOR(dev_t dev);

int minor =MINOR(dev_t dev);


diff b/w modprobe and insmod

modprobe                                                  insmod

1) First it will check the dependencies of      1) It can't load the dependencies ..
a module , if the module is
having any dependencies immediately it will
load the dependencies .

ex:  Suppose B modules executions is
depending upon A module .then modprobe
First it will load the module the "A" module
and later it will load the "B" module.


Socket buffer and its relationship to other structures
Socket buffers are designed to be linked together for a given socket and include a multitude of information, including the links to the protocol headers, a timestamp (when the packet was sent or received), and the device associated with the packet.



+----------+------------------+----------------+
| headroom | packet data | tailroom |
+----------+------------------+----------------+
skb->head skb->data skb->tail skb->end

The function skb_headroom(skb) calculates 'skb->data - skb->head', 


Shared Memory is memory that can be used between different Linux applications for communicating together. If two different applications needs to communicate together, they basically cannot use memory, because each application use her own memory segment.
Shared Memory is used then for sharing data between different processes.
Basically, shared memory is used one way, of course, if more than one process has to write in the same memory segment, their would be a problem of data availability.

Linux Thread Scheduling Policy and Priority


 Linux 2.6.x is pre-emptive kernel. It has 100 level priorities: 0 to 99. 0 is the lowest priority and 99 is the highest.
  • SCHED_OTHER: This is default policy. It is a time-slice based policy. All threads of this policy have the same priority 0.
  • SCHED_FIFO: This is a real-time scheduling. The high priority thread always pre-empt the lower priority threads. The threads with the same priority run in a FIFO mode,
  • SCHED_RR:This is the same as SCHED_FIFO with difference about the scheduling of the threads with the same priority. The threads with the same priority are scheduled in a round-robin mode.  
 Device Trees
The Flattened Device Tree (FDT) is a data structure for describing the hardware in a system.
It is derived from the device tree format used by Open Firmware. The format is expressive and able to describe most board design aspects including: 
  • the number and type of CPUs,
  • base addresses and size of RAM,
  • busses and bridges,
  • peripheral device connections, and
  • interrupt controllers and IRQ line connections.

Why a device tree is necessary

The main issue with running Linux on an FPGA is that the Linux kernel needs to know what peripherals it has and where it can find them
The elegant solution for this is the Flattened Device Tree. The idea is to create some binary data structure, which is either linked into the kernel image or given to it during boot. This binary blob contains the information about the processor itself and its peripherals, including the addresses, interrupts and several application-specific parameters.

As part of a full kernel compilation, the .dts is compiled into a .dtb file (the Device Tree binary blob), which can be found in the same directory as the generated kernel image. The Device Tree Compiler (dtc) comes with the kernel sources, and can be found in scripts/dtc.
  
 

No comments:

Post a Comment