
Applied Micro Circuits Corporation
6195 Lusk Blvd., San Diego, CA 92121 (619) 450-9333
15-21
BUS MASTERING WITH THE S5933 PCI MATCHMAKER
6.0 SAMPLE S5933 DMA SUPPORT CODE
The following section is a sample program written in C-language to setup the S5933 for DMA operations. The
code is written for PCI initiated bus mastering using transfer count interrupts. The code is written for an x86
compatible PCI platform, but could be modified to support other host processors.
The code has been compiled using Borland C/C++ Version 4.5. Because 32-bit registers are used within the
code, code must be compiled to generate 386 code (otherwise, 32-bit register mneumonics such as _EAX are
not recognized).
#include <dos.h>
#include <stddef.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include “amcc.h”
/****************************************************************/
/*
A2P = Add-on to PCI FIFO
*/
/*
P2A = PCI to Add-on FIFO
*/
/****************************************************************/
/* Transfer Count Interrupt Enables */
#define EN_READ_TC_INT
0x00008000L
#define EN_WRITE_TC_INT
0x00004000L
/* FIFO Flag Reset */
#define RESET_A2P_FLAGS
0x04000000L
#define RESET_P2A_FLAGS
0x02000000L
/* FIFO Management Scheme */
#define A2P_REQ_AT_4FULL
0x00000200L
#define P2A_REQ_AT_4EMPTY
0x00002000L
/* FIFO Relative Priority */
#define A2P_HI_PRIORITY
0x00000100L
#define P2A_HI_PRIORITY
0x00001000L
/* Enable Transfer Count */
#define EN_TCOUNT
0x10000000L
/* Enable Bus Mastering */
#define EN_A2P_TRANSFERS
0x00000400L
#define EN_P2A_TRANSFERS
0x00004000L
/* Identify S5933 Interrupt Sources */
#define ANY_S5933_INT
0x80
#define READ_TC_INT
0x08
#define WRITE_TC_INT
0x04
#define MASTER_ABORT_INT
0x10
#define TARGET_ABORT_INT
0x20
#define BUS_MASTER_INT
0x20
/* Global Variable Definition */
byte
interrupt_line;
word
op_reg_base_address;
void(interrupt *oldhandler)(void);