• 検索結果がありません。

General Host Programming Guidelines

ドキュメント内 PCI Master/Target MegaCore Function with DMA Data Sheet (ページ 54-60)

3

Operation PCI Bus Interface 4. In clock four, local logic asserts l_dma_acr_wr while supplying data

value in the l_dma_dat_in[] bus. This signal sequence writes a hexadecimal value of 00400000 into the dma_acr register. The pci_a function starts its PCI write operation at the the hexadecimal address of 00400000.

5. In clock five, the write transaction to the dma_bcr and dma_acr take effect. Figure 20 shows the changes in the values on the

l_dma_bcr_out[16..0] and l_dma_acr_out[31..0] buses.

Figure 20 also shows the changes in values on the

l_dma_isr_out[4..0] and l_dma_csr_out[6..0] buses, which set the ad_loaded and dma_on bits.

6. The pci_a function asserts l_ackn, indicating it is ready to accept data from the local side.

7. On the rising edge of clock nine, local logic begins to provide data on the l_dat_in[31..0] bus into the buffer.

Figure 20. Local Side Initiated DMA Write Transaction

Initializing the pci_a Function

To initialize the pci_a function:

1. Configure the pci_a-supported PCI bus configuration registers.

2. Configure the dma_csr register. See Table 32.

DMA Operation

To begin a DMA operation, perform the steps below:

1. Load the dma_bcr. (This step is optional if the byte count for the next block of data is the same as the current block.)

2. Load the dma_acr. (See “Internal Target Registers Memory Map” on page 43)

3. Configure the local side peripheral device. This step will set up the address generation process necessary on the local side and allow the local side to assert l_req. However, if an intelligent PCI agent (e.g., a microprocessor) is operating on the local side, this step may not be necessary. See Table 33.

Table 32. Initializing the pci_a Function Step Address

(Hexadecimal)

Register Name

Data (Hexadecimal)

Definition

1 04 PCI bus

command/status register

0000.0146 The value in the PCI bus command register enables memory transfers, master operations, the assertion of perrn in the case of data parity errors, and the assertion of serrn in case of address parity errors.

2 BAR0: 0.0000 0000.0011 The value in the dma_csr enables both the interrupts and the DMA engine.

3

Operation PCI Bus Interface 4. At this point, the pci_a function generates a PCI interrupt (intan)

to interrupt the controller due to byte counter expiration.

Interrupt Service Operation

To interrupt a service operation, perform the steps below:

1. Read the dma_isr.

a. If the dma_tc bit is high and err_pend bit is low, indicating that the DMA operation was successful and that the pci_a is ready for a new DMA transfer, go to step 1 of “DMA Operation” on page 55.

b. If the err_pend bit is high, indicating that the DMA operation was stopped due to an error, go to step 2 in “Clearing Error Bits”

on page 57. Clear the error bit prior to continuing. See Table 34.

Table 33. DMA Operation Step Address

(Hexadecimal)

Register Name Data (Hexadecimal)

Definition

1 BAR0: 0.0008 dma_bcr User defined The amount of data (in bytes) for a DMA transfer

2 BAR0: 0.0004 dma_acr User defined The PCI bus address where the transfer should begin. This address is automatically updated after every data transfer.

3 BAR0: 8.0000 External target register

User defined This step may involve several steps, e.g., setting-up the local address generator; or asserting l_req from the local side.

Table 34. Interrupt Service Routine Step Address

(Hexadecimal)

Register Name Data (Hexadecimal)

Definition

1 BAR0: 0.000C dma_isr User defined The value in the dma_isr register indicates the progress of the DMA operation and the reason the operation is terminated.

Clearing Error Bits

To clear the error bits, perform the following steps:

1. Read the dma_isr. If the err_pend bit is active, go to step 2.

2. Configure the dma_csr by asserting the flush bit to clear the ad_loaded bit (bit 4 of the dma_isr).

3. Read the PCI bus configuration status register and determine which error is asserted (i.e., bit 15, 12, or 13).

4. Configure the pci_a-supported PCI status register and write a logic one to the appropriate error bit field. Writing a one to a bit in the status register clears the bit, allowing the designer to read the status register and write the same value to clear the error conditions.

3

Operation PCI Bus Interface

Applications

The pci_a function is ideal for add-in applications. Figure 21 shows a typical connection to an intelligent local-side host. In this example, a target and a DMA control block are needed for access to the local side. The local side data bus is a bidirectional bus controlled by the l_holdn output.

The host asserts l_holdn whenever it is accessing the local bus. Because the PCI bus address is often different than the local side address, the host is responsible for generating the local side address during a DMA access.

Figure 21. Local Side Interface to an Intelligent Local-Side Host with a Shared Memory Bus

Figure 22 shows a typical pci_a connection to a dumb memory FIFO buffer. In this example, a target and a DMA control block are needed for access to the local side.

Because the local side does not have the intelligence to generate control and address signals during a DMA access, designers can set up the DMA control block to accept configuration and control data from the PCI bus via target access. Figure 22 illustrates the process via the bidirectional signals going between the two control blocks.

pci_a Master/Target

Local Side I/O

l_rdn

l_rdn l_wrn l_holdn l_req l_irqn l_reset l_ackn

l_dat_in[31..0 l_dat_out[31..0]

Local Side Interface:

Add-on Logic External Target

Local Side Host:

DMA Control

address[16..

csn oen wen

SRAM

I/O l_clk

l_adr[18..0]

l_csn

l_wrn

Figure 22. Local Side Interface to a Dumb FIFO Buffer

Local Side Interface:

DMA Control Add-on Logic Local Side

Interface:

Add-on Logic External Target Registers pci_a

Master/Target Local Side I/O

l_rdn l_wrn l_req l_holdn l_irqn l_reset l_ackn

wrn

control ren oen

Error Flags FIFO Buffer l_dat_out[31..0]

l_dat_in[31..0]

l_clk

l_adr[18..0]

l_csn

3

Operation PCI Bus Interface

PCI SIG

ドキュメント内 PCI Master/Target MegaCore Function with DMA Data Sheet (ページ 54-60)

関連したドキュメント