5.5.8 · D1 · HinglishEmbedded Systems & Real-Time Software

FoundationsDMA — memory-to-memory, peripheral-to-memory without CPU

2,131 words10 min read↑ Read in English

5.5.8 · D1 · Coding › Embedded Systems & Real-Time Software › DMA — memory-to-memory, peripheral-to-memory without CPU

Is page par kuch bhi assume nahi kiya gaya. Parent note DMA ko samajhne se pehle, tumhare dimaag mein kuch words bilkul crisp hone chahiye. Hum har ek ko ek picture se banate hain, ek aisi order mein jahan har word sirf pehle se define kiye words use karta hai.


0. Woh stage jis par sab kuch rehta hai: memory ek row of boxes ke roop mein

"Source", "destination", ya "address" ka koi matlab banne se pehle, tumhe memory dekhni hogi.

Figure — DMA — memory-to-memory, peripheral-to-memory without CPU

Figure dekho: chote ghar memory boxes hain. Har ghar ke upar wala number (0, 1, 2, 3 …) uska address hai — isi se tum keh sakte ho ki kaunsa box tumhara matlab hai. Andar ka number data hai — woh actual value jo store hai.

Related vault idea: peripherals bhi box numbers par rehte hain — dekho Memory-Mapped IO.


1. Byte, word, aur item width

Figure — DMA — memory-to-memory, peripheral-to-memory without CPU

Figure mein, width ka ek lavender item ek saath chaar boxes cover karta hai. DMA engine ek poora item ek hi grab mein le sakta hai agar boxes align hain ("aligned").


2. Count aur total bytes


3. Source aur Destination from aur to boxes

Figure — DMA — memory-to-memory, peripheral-to-memory without CPU

Figure mein coral arrow se ki taraf point karta hai — woh arrow hi copy hai. DMA jo kuch bhi karta hai woh wahi ek arrow baar repeat karna hai, har baar aur ko aage nudge karte hue.


4. Address increments aur — arrow kaise chalta hai

Yeh woh subtle part hai jis par parent note bahut zyada lean karta hai, toh hum isse dheere dheere build karte hain.

Item move karne ke baad, addresses update hote hain:

Isse zor se padho: "agla source box current source box plus step hai."

Figure — DMA — memory-to-memory, peripheral-to-memory without CPU

Figure mein do behaviours side by side dikhaye gaye hain:

  • Dono increment karte hain (): arrow dono taraf aage barhta hai — yeh ek memory-to-memory copy hai, jaise kisi list ko duplicate karna.
  • Source fixed (, ): read-box wahi rehta hai jabki write-boxes ek ke baad ek fill hote hain — yeh peripheral-to-memory hai.
Recall

se hi teen directions Mem→Mem increments? ::: Dono: Periph→Mem increments? ::: Source fixed , destination Mem→Periph increments? ::: Source , destination fixed


5. Bus — ek shared hallway

Figure — DMA — memory-to-memory, peripheral-to-memory without CPU

CPU ki desk aur memory shelves ke beech ek one-lane hallway socho. Jab DMA hallway mein koi box carry kar raha hota hai, CPU ko apna data fetch karne ke liye wait karna padta hai. Isliye parent note insist karta hai ki DMA free nahi hai — CPU ki sochne ke liye free hai, lekin hallway ab bhi occupy karta hai.


6. Clock , cycle, beat, aur time

Ab hum speed ki baat kar sakte hain — symbols ka aakhri group.


7. Interrupt — "Main done ho gaya!" wali shoulder tap


Foundations topic ko kaise feed karte hain

Memory as boxes with addresses

Source S and Destination D

Byte word and item width w

Count N and total bytes B

Increments delta S and delta D

Time equals N times c over f

Clock f and beats

The shared bus

Bus arbitration and stalls

Interrupt done signal

Safe to read buffer

DMA transfer

Left side par sab kuch words hain; sab kuch single box "DMA transfer" mein flow karta hai right side par. Agar koi bhi left-hand box fuzzy hai, toh parent note mechanism ki jagah magic lagega.


Equipment checklist

Right side cover karo aur zor se jawab do. Agar koi atka, toh uska section upar dobara padho.

Address kya hota hai?
Woh number jo ek memory box ko naam deta hai, taaki tum keh sako kaunsa box tumhara matlab hai.
Item width kya hai?
Ek item mein kitne bytes hain jo tum ek grab mein move karte ho (1, 2, ya 4).
Count kya hai, aur total bytes kaise milta hai?
= items ki sankhya; .
aur kiske liye stand karte hain?
Source (woh address jahan se read karte ho) aur Destination (woh address jahan write karte ho).
ka kya matlab hai, aur ek peripheral source ke liye kya hoga?
"Change in"; kyunki peripheral data register ek fixed box hai.
Bus ek bottleneck kyun hai?
Yeh ek single shared road hai — ek waqt mein sirf CPU ya DMA mein se ek hi use kar sakta hai.
kya hai, aur ek clock tick kitni lambi hoti hai?
Clock frequency Hz mein; ek tick seconds leti hai.
DMA transfer-time formula likho.
.
Buffer read karne se pehle interrupt ka wait kyun karna chahiye?
DMA background mein run karta hai; data tab tak complete nahi hota jab tak transfer-complete interrupt fire na ho.