
Applied Micro Circuits Corporation
6195 Lusk Blvd., San Diego, CA 92121 (619) 450-9333
15-23
BUS MASTERING WITH THE S5933 PCI MATCHMAKER
/***************************************************************************/
/*
Function:
setup_pci_dma
*/
/*
Purpose:
Configure the S5933 for PCI initiated DMA
*/
/*
Inputs:
None
*/
/*
Outputs:
None
*/
/*
*/
/* The following function assumes the S5933 is configured
*/
/* for PCI initiated DMA transfers and sets up the DMA channels
*/
/***************************************************************************/
void setup_pci_dma(void)
{
char src[20], dest[20], rtc[20], wtc[20];
dword
source, destination, temp = 0;
dword readtc, writetc;
/* Read in source,destination and transfer counts */
printf(“Input address values in hex format: 0x...\n\n”);
printf(“Input transfer count values in decimal\n\n”);
printf(“Read from address: “);
gets(src);
source=strtoul(src,NULL,16);
printf(“%lX\n”,source);
printf(“Write to address: “);
gets(dest);
destination=strtoul(dest,NULL,16);
printf(“%lX\n”,destination);
printf(“Read byte count: “);
gets(rtc);
readtc=strtoul(rtc,NULL,10);
printf(“%d\n”,readtc);
printf(“Write byte count: “);
gets(wtc);
writetc=strtoul(wtc,NULL,10);
printf(“%d\n”,writetc);
outpd(op_reg_base_address+AMCC_OP_REG_MWAR, destination);
outpd(op_reg_base_address+AMCC_OP_REG_MRAR, source);
outpd(op_reg_base_address+AMCC_OP_REG_MWTC, writetc);
outpd(op_reg_base_address+AMCC_OP_REG_MRTC, readtc);
/* Enable Transfer Count interrupts */
temp = inpd(op_reg_base_address+AMCC_OP_REG_INTCSR);
outpd(op_reg_base_address+AMCC_OP_REG_INTCSR,temp|
EN_READ_TC_INT|
EN_WRITE_TC_INT);
/* Enable Bus Mastering */
temp = inpd(op_reg_base_address+AMCC_OP_REG_MCSR);
outpd(op_reg_base_address+AMCC_OP_REG_MCSR, temp|RESET_A2P_FLAGS|
RESET_P2A_FLAGS|
A2P_HI_PRIORITY|
P2A_HI_PRIORITY|
EN_A2P_TRANSFERS|
EN_P2A_TRANSFERS);
}