Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
November 01, 1993

DMA Controller Programming in C

(Page 3 of 5)

Listing 3 VDS service access functions

/*
vds.c - VDS interface functions
Written by Robert Watson
(C) Copyright Robert Watson 1993
*/

#include <dos.h>

#include "vds.h"

/* IsVDSAvailable - Returns non-zero if VDS services
   are available */

int IsVDSAvailable (void) {
   return (0x20 & *((char *)MK_FP(0x40,0x7B)));
}

/* RequestVDSBuffer - Request the DMA buffer
   maintained by VDS services */

int RequestVDSBuffer (VDS_DDS * DDS) {
   struct REGPACK regs;

   regs.r_ax = 0x8107;
   regs.r_dx = 0;
   regs.r_es = FP_SEG (DDS);
   regs.r_di = FP_OFF (DDS);
   intr (0x4B, &regs);
   if (regs.r_flags & 1) return (regs.r_ax);
   return (0);
}

/* ReleaseVDSBuffer - Release a buffer allocated
   by RequestVDSBuffer */

int ReleaseVDSBuffer (VDS_DDS * DDS) {
   struct REGPACK regs;

   regs.r_ax = 0x8108;
   regs.r_dx = 0;
   regs.r_es = FP_SEG (DDS);
   regs.r_di =FP_OFF (DDS);
   intr (0x48, &regs);
   if (regs.r_flags & 1) return (regs.r_ax);
   return (0);
}

/* DisableVDSTranslation - Disable automatic
   address translation on a DMA channel. */

int DisableVDSTranslation (int Channel) {
   struct REGPACK regs;
   
   regs.r_ax = 0x810B;
   regs.r_bx = Channel;
   regs.r_dx = 0;
   intr (0x4B, &regs);
   if (regs.r_flags & 1) return (regs.r_ax);
   return (0);
}

/* Enable automatic translation that was disabled
   by DisableVDSTranslation. */

int EnableVDSTranslation (int Channel) {
   struct REGPACK regs;

   regs.r_ax = 0x810C;
   regs.r_bx = Channel;
   regs.r_dx = 0;
   intr (0x4B, &regs);
   if (regs.r_flags & 1) return (regs.r_ax);
   return (0);
}

/* CopyFromDMABuffer - Copy data from a DMA buffer
   to a malloc'd buffer */

int CopyFromDMABuffer (VDS_DDS * DDS,
                   long BufferOffset) {
   struct REGPACK regs;

   regs.r_ax = 0x810A;
   regs.r_dx = 0;
   regs.r_es = FP_SEG (DDS);
   regs.r_di = FP_OFF (DDS);
   regs.r_bx = BufferOffset >> 16;
   regs.r_cx = BufferOffset;
   intr (0x4B, &regs);
   if (regs.r_flags & 1) return (regs.r_ax);
   return (0);

}
/* End of File */
Previous Page | 1 | 2 | 3 | 4 | 5 Next Page
RELATED ARTICLES
No Related Articles
TOP 5 ARTICLES
No Top Articles.
SD Best Practices 2008, October 27-30 in Boston, features world-class training on the entire software development lifecycle.
DR. DOBB'S CAREER CENTER
Ready to take that job and shove it? open | close
Search jobs on Dr. Dobb's TechCareers
Function:

Keyword(s):

State:  
  • Post Your Resume
  • Employers Area
  • News & Features
  • Blogs & Forums
  • Career Resources

    Browse By:
    Location | Employer | City
  • Most Recent Posts:
    DC Systems Technician I
    Lowes seeking DC Systems Technician I in Lebanon, OR

    Software Developers
    D. E. Shaw Research seeking Software Developers in New York, NY

    Engineers
    D. E. Shaw Research seeking Engineers in New York, NY

    Sr. Power Electronics Engineers
    Satcon seeking Sr. Power Electronics Engineers in Linthicum, MD

    Systems Administrator
    United Nations Foundation seeking Systems Administrator in Washington, DC




    MICROSITES
    FEATURED TOPIC

    ADDITIONAL TOPICS




    MARKETPLACE (Sponsored Links)
    100% Online programs in Six Sigma, IS Security, CISSP Prep, Business Analysis, Proj. Mgmt. and more!
    Easily create an automated, repeatable process for building and deploying software.
    Automatically capture customer crash data, no debugger required. Support for .NET, C++, OS X, Java.
    Understand C/C++ code in less time. A new team member ? Inherited legacy code ? Get up to speed fast...
    and develop 10 times faster ! ALM, IDE, .Net, PDF, 5GL, Database, 64-bit, etc. Free Express version
    Advertise With Us
     



    Related Sites: DotNetJunkies, SD Expo, SqlJunkies