-}
-
-/* XXX temporary */
-kernel_space(x)
-unsigned long x;
-{
- if ((x >= sbase) & (x < sbase + 0x800000)) return 1;
- else return 0;
-}
-
-
-/****************************************************************************/
-/* fd_dma */
-/* set up DMA read/write operation and virtual address addr for nbytes */
-/****************************************************************************/
-fd_dma(read,addr,nbytes)
-int read;
-unsigned long addr;
-int nbytes;
-{
- unsigned long phys;
- int s,raw;
-
- if (kernel_space(addr)) raw = 0;
- else raw = 1;
-
- /* copy bounce buffer on write */
- if (raw && !read) bcopy(addr,fdrawbuf,FDBLK);
-
- /* Set read/write bytes */
- if (read) {
- outb(0xC,0x46); outb(0xB,0x46);
- } else {
- outb(0xC,0x4A); outb(0xB,0x4A);
- }
- /* Send start address */
- if (raw) phys = (unsigned long) &fdrawbuf[0];
- else phys = addr;
- /* translate to physical */
- phys = phys - sbase;
- outb(0x4,phys & 0xFF);
- outb(0x4,(phys>>8) & 0xFF);
- outb(0x81,(phys>>16) & 0xFF);
- /* Send count */
- nbytes--;
- outb(0x5,nbytes & 0xFF);
- outb(0x5,(nbytes>>8) & 0xFF);
- /* set channel 2 */
- outb(0x0A,2);