47.6.4.2 Channel Servicing
After initialization, each channel will require periodic servicing.
The following software flows can be performed concurrently and in any order:
- Servicing the AHB Block (DMA) Interrupts
- Servicing the MediaLB Interrupts
- Polling for MediaLB System Commands
Servicing the AHB Block (DMA) Interrupts
The MLB_ACMR0, MLB_ACMR1, MLB_ACTL, MLB_ACSR0, and MLB_ACSR1 registers are accessible directly via APB reads and writes.
- Program the MLB_ACMRn registers to enable interrupts from all active DMA channels.
- Select the status clear method: MLB_ACTL.SCE = 0 (hardware clears on read), MLB_ACTL.SCE = 1 (software writes a ‘1’ to clear).
- Select 1 or 2 interrupt signals: MLB_ACTL.SMX = 0 (one interrupt for channels 0–31 on MediaLB IRQ0 and another interrupt for channels 32–63 on MediaLB IRQ1), MLB_ACTL.SMX = 1 (single interrupt for all channels on MediaLB IRQ0).
- Wait for an interrupt from MediaLB IRQ[1:0].
- Read the MLB_ACSRn registers to determine which channel or channels are causing the interrupt.
- If MLB_ACTL.SCE = 1, write the results of step 5 back to MLB_ACSR0 and MLB_ACSR1 to clear the interrupt.
- Select a logical channel (N = 0–63) with an interrupt to service.
- Read the ADT entry for channel N
- Determine the active page (ping or pong) via the PG bit.
- Determine which page(s) are done via the DNEn bits.
- Determine which channels encountered an AHB error via the ERRn bit.
- Determine which asynchronous and control Rx channel pages contain a packet start via the PSn bit (extract the PML).
- Reprogram the expired or broken AHB page(s) via steps 3 and 4 in Section “Program the AHB Block DMAs”.
- Repeat steps 6–9 for all channels with pending interrupts.
- Repeat steps 4–10 while there are active channels.
Servicing the MediaLB Interrupts
- Select the MediaLB Channel Status Register (MSn) to be cleared by software, writing a ‘0’ to the appropriate bits.
- Program MLB_MIEN to enable protocol error interrupts for all active MediaLB channels (MLB_MIEN.CTX_PE = 1, MLB_MIEN.CRX_PE = 1, MLB_MIEN.ATX_PE = 1, MLB_MIEN.ARX_PE = 1, MLB_MIEN.SYNC_PE = 1, and MLB_MIEN.ISOC_PE = 1)
- Wait for an interrupt on the mlb_int signal.
- Read the MSn registers to determine which channel(s) are causing the interrupt.
- Read RSTS/WSTS of the appropriate CDT(s) to determine the interrupt type.
- Clear RSTS/WSTS errors to resume channel
operation.
- For synchronous channels: WSTS[3] = 0
- For isochronous channels: WSTS[2:1] = 00
- For asynchronous and control channels: RSTS[4]/WSTS[4] = 0 and RSTS[2]/ WSTS[2] = 0
Polling for MediaLB System Commands
The MLB supports the MediaLB System Commands (e.g. MlbScan, MlbReset, MOST_Unlock). The MediaLB System Status (MLB_MSS) Register is used to detect a System Command received from the MediaLB Controller. The MLB automatically sends the appropriate system response to the MediaLB Controller.
The procedure for the application is:
- The application periodically polls the MLB_MSS register.
- Clear by writing a ‘0’ to the appropriate bit in MLB_MSS register after the application finishes the service.
- If MLB_MSS.SWSYSCMD = 1, read the MLB_MSD register to receive the system data sent from MediaLB Controller.