MF9BF506N DMAC

Started by tha, February 18, 2015, 08:36:17 AM

Previous topic - Next topic

tha

นอกจากนั่งสมาธิ เดินจงกรม แล้วไม่ได้ทำอะไรเป็นชิ้นเป็นอัน ก็เลยหาอะไรทำยามว่างครับ วันนี้เย็นหน่อยเลยได้ 2 ตอน

tha

 Explanation of Control Procedure(คำอธิบายของขบวนการควบคุม)

1. Disable state / Preparation for transfer(สถานะปิดการใช้งาน / เตรียมการสำหรับการ transfer)
   ดู Step 1 ใน the software transfer procedure.

   ข้อจำกัดดังต่อไปนี้นำไปใช้กับ hardware transfer. ตัดสินใจล่วงหน้าว่าด้วย interrupt signal ของ Peripheral ที่ถูกใช้เป็น transfer request signal ไปยัง DMAC โดยใช้ the interrupt controller block (ดู the section on the functional explanation). เซต ST=0 และระบุ transfer request ของ Peripheral ที่ถูกดำเนินการที่ channel ที่จะกระทำการ transfer, โดย IS ในเวลาเดียวกัน. หลายชาแนลไม่สามารถดำเนินการ transfer request ชอง Peripheral เดียวกันได้. ในกรณีของ Demand transfer mode, เซต BC=0. ส่วน(section) นี้อธิบายการทำงานเมื่อ EM=0 ถูกเซต

tha

2. Disable state => Wait-1st-trigger state / Transfer enabled
   คำสั่งเปิดการใช้งาน individual-channel operation ถูกออกมาจาก CPU. เมื่อ DE=1, EB=1, DH=0000 และ PB=0 ถูกเซต, the channel ที่ถูกควบคุมเคลื่อนไปสู่ Wait-1st-trigger state.


tha

3. Wait-1st-trigger state / Start of transfer
  The channel ใน Wait-1st-trigger state กำลังคอยเพื่อให้ the transfer request signal ถูกถือสิทธิ์จาก the Peripheral หรือเพื่อให้มีคำสั่งจาก CPU. เมื่อ the first transfer request signal ถูกถือสิทธิ์, มันเคลื่อนไปสู่ Transfer state

tha

4. Transfer state
    ดู Step 3 ใน the software transfer procedure.

    ในกรณีของ hardware transfer, channel หนึ่งใน Transfer state กระทำการ transfer operation โดย the transfer request signal จาก a Peripheral, ตามที่อธิบายใน Sections 3.3 and 3.4. ในแต่ละ mode, จับคู่จำนวนของ transfer requests จาก the Peripheral ด้วยจำนวนของ transfer requests ที่ต้องการโดย DMAC. ข้างล่างนี้คือคำอธิบายการทำงานเมื่อจำนวนของ transfer requests มีมากกว่าหรือต่ำกว่าความต้องการในแต่ละ operation mode.

   Figure 4-6 แสดงกรณีของ Demand transfer. ในกรณีของ Demand transfer, จำนวนของ transfer requests ที่ต้องการให้เสร็จการ transfer คือ TC+1. แม้ว่าจำนวนของ transfer requests มีไปมากกว่าหรือต่ำกว่าความต้องการ, CPU ก็ไม่มีการไปแทรกแซง (Example 1 in Figure 4-6).

   ถ้าจำนวนของtransfer requests ที่เกิดจาก the Peripheral มีเกินกว่าจำนวนของการ transfer ที่เซตที่ DMAC, DMAC เคลื่อนไปสู่ Disable state หลังจากเสร็จสิ้นตามจำนวนการ transfers ที่ระบุ. ใน Disable state, ไม่มีการกระทำการ transfers อีกต่อไป. ตามที่ transfer request signals ที่เกินนั้นไม่ถูกเคลียร์จาก DMAC, สถานะการถือสทธิ์ยังคงอยู่ต่อไปอีกด้วย (Example 2 in Figure 4-6).

  ถ้าจำนวนของ transfer requests ที่เกิดจาก the Peripheral มีน้อยกว่าจำนวนของการ transfer ที่เซตที่ DMAC, DMAC คอยจำนวนของ transfer requests ที่เหลืออยู่ใน Transfer state (Example 3 in Figure 4-6).

  สมมุตว่า DMAC's transfer processing อาจจะช้าเกินไปในการตรวจจับการหยุดพักเป็นช่วงๆของ transfer requests จาก Peripheral. ในกรณีของ Demand transfer, the transfer request signal ยังคงถือสิทธิ์; ดังนั้น, มากที่สุดเท่าที่ TC+1 ของการ transfers สามารถถูกกระทำ (Example 4 in Figure 4-6)


tha

  Figure 4-7 แสดงกรณีของ Block transfer. ในกรณีของ Block transfer, จำนวนของ transfer requests ที่ต้องการให้เสร็จการ transfer คือ TC+1. แม้ว่าจำนวนของ transfer requests มีไปมากกว่าหรือต่ำกว่าความต้องการ, CPU ก็ไม่มีการไปแทรกแซง (Example 1 in Figure 4-7).



  ถ้าจำนวนของ transfer requests ที่เกิดจาก the Peripheral มีเกินกว่าจำนวนของการ transfer ที่เซตที่ DMAC, DMAC เคลื่อนไปสู่ Disable state หลังจากเสร็จสิ้นตามจำนวนการ transfers ที่ระบุ. ใน Disable state, ไม่มีการกระทำการ transfers อีกต่อไป. ตามที่ transfer request signals ที่เกินนั้นไม่ถูกเคลียร์จาก DMAC, สถานะการถือสทธิ์ยังคงอยู่ต่อไป, ในกรณีนี้, ถอดการถือสิทธิ์ the transfer request signal จาก CPU (Example 2 in Figure 4-7).

   ถ้าจำนวนของ transfer requests ที่เกิดจาก the Peripheral มีน้อยกว่าจำนวนของการ transfer ที่เซตที่ DMAC, DMAC คอยจำนวนของ transfer requests ที่เหลืออยู่ใน Transfer state (Example 3 in Figure 4-7).

  สมมุตว่า DMAC's transfer processing อาจจะช้าเกินไปในการตรวจจับการเกิดการหยุดพักเป็นช่วงๆของ transfer requests จาก Peripheral. ในกรณีของ Block transfer, ถ้า DMAC's transfer processing ถูกทำให้ล่าช้าจาก the transfer request จาก the Peripheral, ขอบขาขึ้นของ transfer request signal ถัดไปในระหว่างการ transfer operation ถูกละเลย.  the transfer request signal ที่ถือสิทธิ์ในระหว่างการ transfer operation จะถูกเคลียร์จาก DMAC อีกด้วย. ดังนั้น, DMAC คอย transfer requests ที่เหลือใน Transfer state (Example 4 in Figure 4-7).

  ในกรณีของ Burst transfer, ทั้งหมดของ (BC+1) X (TC+1) ของการ transfers ถูกกระทำเมื่อมันเข้าถึง the system bus ได้หลังจากได้รับ transfer request แรก. จำนวนของ transfer requests ที่ต้องการจาก the Peripheral คือหนึ่งแรกเท่านั้น. ถ้าจำนวนของ transfer request signals เกิดขึ้นเกินกว่าที่ต้องการ, มันจะถูกละเลยใน Disable state, เหมือนกับ Block transfer.

tha

5. Transfer state => Disable state / Successful completion of transfer
    ดู Step 4 in the software transfer procedure.

6. Transfer state => Disable state / Transfer error stop
   ดู Step 5 in the software transfer procedure.

7. Transfer state => Disable state / End of Peripheral stop request
   The channel ใน Transfer state ระงับ transfer processing ของมัน, ถ้า the transfer stop request signal ถูกถือสิทธิ์จาก the Peripheral. มันจะเคลียร์ EB, PB และ ST และเคลื่อนไปสู่ Disable state. มันจะเซต "010" ไปยัง SS[2:0] และแจ้งให้ทราบถึง the error stop นั้น. ถ้า interrupts ถูกเปิดการใช้งานอยู่แล้วโดย EI, an unsuccessful transfer completion interrupt จะเกิดขึ้น. BC, TC, DMACSA and DMACDA ซึ่งการโหลดซ้ำ( reload )ไม่ได้ถูกระบุไว้ก่อนหน้าจะยึดค่าที่เซตในระหว่างการระงับการ transfer.ต้องเอาใจใส่ต่อค่า SS[2:0], ซึ่งจะเหมือนกันกับ the stop request จาก software.

tha

8. Transfer state, Pause state => Disable state / Forced termination of transfer
   ดู Step 6 in the software transfer procedure.

9. Disable state / Post-transfer processing
   ดู Step 7 in the software transfer procedure.

   ปกติแล้ว, ในกรณีของ stop request จาก Peripherals, บังคับให้สิ้นสุดจาก software และ transfer error stop, the transfer request signal ยังคงถือสิทธิ์, เพราะว่าจำนวนของการ transfers ที่ดำเนินการมีน้อยก่วาจำนวนของ transfer requests จาก the Peripheral. ออกคำสั่งจาก CPU, the Peripheral ถอดการถือสิทธิ์ the transfer request signal. ในกรณีของ stop request จาก Peripherals, the transfer request signal ถูกบังไว้ตราบเท่าที่ the stop request signal ถูกถือสิทธิ์. ยังถอดการถือสิทธิ์ the transfer stop request signal อีกด้วย

   ถึงแม้ว่า DMAC ได้สำเร็จการ transfer ตามจำนวนที่ระบุโดยสมบรูณ์แล้ว, the transfer request signal อาจยังคงถ์อสิทธิ์หรืออาจถูกถือสิทธิ์ซ้ำ, ขึ้นอยู่กับการเซตของ Peripheral. ต้องเอาใจใส่ถึงความเป็นไปได้ที่สิ่งนี้อาจจะมีผลต่อการ transfer ถัดไป.

10. Transfer state, Pause state / Transfer pause
  ดู Step 8 in the software transfer procedure.

11. Pause state
  ดู Step 9 in the software transfer procedure.

  The channel ใน Pause state ไม่กระทำการ transfer, ถึงแม้ว่า the transfer request signal จาก the Peripheral ถูกถือสิทธิ์. มันไม่เคลียร์ the transfer request signal เช่นกัน.