aPCI-P54 Windows 95/98/Me/NT4.0/2000/XP API dl

ADTEK SYSTEM SCIENCE Co., Ltd.
========================================================================

ڎ

1.  Tv
2.  
3.  vO\
4.  API t@X
4.1.   API
4.1.1.  Apci54GetVersion
4.1.2.  Apci54Create
4.1.3.  Apci54Close
4.1.4.  Apci54GetResource
4.1.5.  Apci54GetSwitchValue
4.2.  I/O API
4.2.1.  Apci54GetDirections
4.2.2.  Apci54SetDirections
4.2.3.  Apci54InPort
4.2.4.  Apci54OutPort
4.3.  ̑ API
4.3.1.  Apci54GetLastError
5.  bZ[W
6.  萔
6.1.  G[R[h
6.2.  o͕wrbg}bv萔
6.3.  _|[gԍ萔
6.4.  ̑̒萔

========================================================================

1.  Tv

    { aPCI-P54 p[UJ API _Ci~bNNCu
     (ȉuDLLv) xŒ`܂B
    foCXhCȍڍׂɂĂ͐GĂ܂B
    ȂAP DLL  aPCI-P54 𐧌䂵܂B

========================================================================

2.  

    {Œ` API  Windows(R) 95/Windows(R) 98/Windows(R) Me/
    Windows NT(R) 4.0/Windows(R) 2000  Windows(R) XP ōő
    16 ܂ł aPCI-P54 (ȉufoCXv) 𐧌䂵܂B

========================================================================

3.  vO\

    {Œ` API ̓foCXhCo
    Eapci54.vxd (Windows 95/98/Me)
    Eapci54.sys (Windows NT4.0)
    Eapci54.sys (Windows 2000/XP)
    сAL 3 ɑΉ_Ci~bNNCu
    Eapci54.dll (Windows 95/98/Me)
    Eapci54.dll (Windows NT4.0)
    Eapci54.dll (Windows 2000/XP)
    ɂ܂B

========================================================================

4.  API t@X

    API ͈ȉ̂悤ɑʂ܂B

        1.   API
        2.  I/O API
        3.  ̑ API

------------------------------------------------------------------------

4.1.   API

------------------------------------------------------------------------

4.1.1.  Apci54GetVersion

@\
    o[Wԍ擾

`
EVisual C++
BOOL Apci54GetVersion(PDWORD pdwDllVersion, PDWORD pdwDriverVersion);

EVisual Basic
Function Apci54GetVersion(pdwDllVersion As Long, pdwDriverVersion As Long) As Long

EDelphi
function Apci54GetVersion(var pdwDllVersion: DWORD; var pdwDriverVersion: DWORD): BOOL;


    pdwDllVersion
        DLL ̃o[Wԍi[̈ւ̃|C^B
        NULL B

    pdwDriverVersion
        foCXhCõo[Wԍi[̈ւ̃|C^B
        NULL B

o
    *pdwDllVersion
        DLL ̃o[WԍB

    *pdwDriverVersion
        foCXhCõo[WԍB

߂l
    API IAsԂ܂B
    FALSE
        sB
    TRUE
        IB


    DLL  foCXhCõo[Wԍ擾܂B
        16Bit@W[o[W
        16Bit@}Ci[o[W

G[
    APCI54_ERR_SYSTEM
        Windows  GetLastError() R[ĂB̃tH_
        ɃhCo̗RŃfoCXhCogݍ܂ĂȂ
        \܂B

------------------------------------------------------------------------

4.1.2.  Apci54Create

@\
    foCX̎gp錾

`
EVisual C++
#define APCI54_SLOT_AUTO    ((WORD) ~0U)
BOOL Apci54Create(PWORD pwLogSlot);

EVisual Basic
Global Const APCI54_SLOT_AUTO = &HFFFF
Function Apci54Create(pwLogSlot As Integer) As Long

EDelphi
const
    APCI54_SLOT_AUTO    = $ffff;
function Apci54Create(var pwLogSlot: WORD): BOOL;


    *pwLogSlot
        gpfoCX̘_Xbgԍw肵܂B
        Ŏw肷ԍ aPCI-P54 {[h̘_Xbgԍݒ肵܂B
        ܂ APCI54_SLOT_AUTO w肵ꍇAfoCX݂Ă
        _XbgT܂BłɃAvP[Vɂgp
        ĂfoCX̓XLbv܂B

        ȌAAvP[V͂̒lŃfoCXʂ܂B
        NULL ͕sB

o
    *pwLogSlot
        gp\ȃfoCXꍇ́A̘_Xbgԍ
        i[܂BȂꍇA̒l͖`łB

߂l
    API IAsԂ܂B
    FALSE
        sB
    TRUE
        IB


    Xbgɑ݂Ăł낤foCXAAvP[Vgp
    邱ƂfoCXhCoɒʒm܂B
    XbgɃfoCX݂ĂȂꍇ́AG[ƂȂ܂B
    Xbg̃foCXłɑ̃AvP[VŎgpĂ
    ꍇG[ƂȂ܂BɂA1 ̃foCX͒P̃Av
    P[VrIɎgp܂B

    Apci54GetVersion ȊO API ĂяoOɕK API Ăяo
    ĂB

G[
    APCI54_ERR_SYSTEM
        Windows  GetLastError() R[ĂB
    APCI54_ERR_NO_DEVICE
        gp\ȃfoCX܂ (APCI54_SLOT_AUTO w肵ꍇ)B
    APCI54_ERR_IN_USE
        w̃foCX͎gpłB
    APCI54_ERR_INVALID_ARGUMENT
        pwLogSlot  NULL łB

     API sꍇAApci54GetLastError()  wLogSlot ɂ
    APCI54_SLOT_AUTO w肵ĂB

------------------------------------------------------------------------

4.1.3.  Apci54Close

@\
    foCXJ

`
EVisual C++
BOOL Apci54Close(WORD wLogSlot);

EVisual Basic
Function Apci54Close(ByVal wLogSlot As Integer) As Long

EDelphi
function Apci54Close(wLogSlot: WORD): BOOL;


    wLogSlot
        foCX̘_Xbgԍw肵܂B

߂l
    API IAsԂ܂B
    FALSE
        sB
    TRUE
        IB


    AvP[VfoCX̎gpIAfoCX𑼂̃AvP[
    VɊJ邱ƂfoCXhCoɒʒm܂B

    AvP[VIOɕK API ĂяoĂB

G[
    APCI54_ERR_SYSTEM
        Windows  GetLastError() R[ĂB
    APCI54_ERR_INVALID_SLOT
        Ș_XbgԍłB
    APCI54_ERR_NO_CREATE
        foCXNGCgĂ܂B

------------------------------------------------------------------------

4.1.4.  Apci54GetResource

@\
    \[X擾

`
EVisual C++
#define APCI54_MAX_MEM      9
#define APCI54_MAX_IO       20
#define APCI54_MAX_IRQ      7
#define APCI54_MAX_DMA      7

//ؿ\
typedef struct _APCI54RESOURCE {
    DWORD  dwNumMemWindows;                    /* س޳        gp */
    DWORD  dwMemBase        [APCI54_MAX_MEM];  /* س޳ްڽ gp */
    DWORD  dwMemLength      [APCI54_MAX_MEM];  /* س޳        gp */
    DWORD  dwMemAttrib      [APCI54_MAX_MEM];  /* س޳      gp */
    DWORD  dwNumIOPorts;                       /* I/O߰Đ */
    DWORD  dwIOPortBase     [APCI54_MAX_IO];   /* I/O߰ްڽ */
    DWORD  dwIOPortLength   [APCI54_MAX_IO];   /* I/O߰Ē */
    DWORD  dwNumIRQs;                          /* IRQ              gp */
    DWORD  dwIRQRegisters   [APCI54_MAX_IRQ];  /* IRQؽ             gp */
    DWORD  dwIRQAttrib      [APCI54_MAX_IRQ];  /* IRQؽ         gp */
    DWORD  dwNumDMAs;                          /* DMAِ          gp */
    DWORD  dwDMALst         [APCI54_MAX_DMA];  /* DMAؽ         gp */
    DWORD  dwDMAAttrib      [APCI54_MAX_DMA];  /* DMAّؽ     gp */
    DWORD  dwReserved1      [3];               /* \               gp */
} APCI54RESOURCE, *PAPCI54R;

BOOL Apci54GetResource(WORD wLogSlot, PAPCI54R pres);

EVisual Basic
Global Const APCI54_MAX_MEM = 9
Global Const APCI54_MAX_IO = 20
Global Const APCI54_MAX_IRQ = 7
Global Const APCI54_MAX_DMA = 7

Type APCI54RESOURCE
    dwNumMemWindows As Long                     ' س޳       gp
    dwMemBase(1 To APCI54_MAX_MEM) As Long      ' س޳ްڽgp
    dwMemLength(1 To APCI54_MAX_MEM) As Long    ' س޳       gp
    dwMemAttrib(1 To APCI54_MAX_MEM) As Long    ' س޳     gp
    dwNumIOPorts As Long                        ' I/O߰Đ
    dwIOPortBase(1 To APCI54_MAX_IO) As Long    ' I/O߰ްڽ
    dwIOPortLength(1 To APCI54_MAX_IO) As Long  ' I/O߰Ē
    dwNumIRQs As Long                           ' IRQ             gp
    dwIRQRegisters(1 To APCI54_MAX_IRQ) As Long ' IRQؽ            gp
    dwIRQAttrib(1 To APCI54_MAX_IRQ) As Long    ' IRQؽ        gp
    dwNumDMAs As Long                           ' DMAِ         gp
    dwDMALst(1 To APCI54_MAX_DMA) As Long       ' DMAؽ        gp
    dwDMAAttrib(1 To APCI54_MAX_DMA) As Long    ' DMAّؽ    gp
    dwReserved1(1 To 3) As Long                 ' \              gp
End Type

Function Apci54GetResource(ByVal wLogSlot As Integer, pres As APCI54RESOURCE) As Long

EDelphi
const
  APCI54_MAX_MEM      =  9;
  APCI54_MAX_IO       = 20;
  APCI54_MAX_IRQ      =  7;
  APCI54_MAX_DMA      =  7;

type
  TAPCI54RESOURCE = record
    dwNumMemWindows:                                DWORD;  // س޳(gp)
    dwMemBase:      array [1 .. APCI54_MAX_MEM] of  DWORD;  // س޳ްڽ(gp)
    dwMemLength:    array [1 .. APCI54_MAX_MEM] of  DWORD;  // س޳(gp)
    dwMemAttrib:    array [1 .. APCI54_MAX_MEM] of  DWORD;  // س޳(gp)
    dwNumIOPorts:                                   DWORD;  // I/O߰Đ
    dwIOPortBase:   array [1 .. APCI54_MAX_IO] of   DWORD;  // I/O߰ްڽ
    dwIOPortLength: array [1 .. APCI54_MAX_IO] of   DWORD;  // I/O߰Ē
    dwNumIRQs:                                      DWORD;  // IRQ(gp)
    dwIRQRegisters: array [1 .. APCI54_MAX_IRQ] of  DWORD;  // IRQؽ(gp)
    dwIRQAttrib:    array [1 .. APCI54_MAX_IRQ] of  DWORD;  // IRQؽ(gp)
    dwNumDMAs:                                      DWORD;  // DMAِ(gp)
    dwDMALst:       array [1 .. APCI54_MAX_DMA] of  DWORD;  // DMAؽ(gp)
    dwDMAAttrib:    array [1 .. APCI54_MAX_DMA] of  DWORD;  // DMAّؽ(gp)
    dwReserved1:    array [1 .. 3] of               DWORD;  // \(gp)
  end;

function Apci54GetResource(wLogSlot: WORD; var pres: TAPCI54RESOURCE): BOOL;


    wLogSlot
        foCX̘_XbgԍwB

    pres
        \[Xi[̈ւ̃|C^B
        NULL ͕sB

o
    *pres
        蓖ĂĂ郊\[X̏B

߂l
    API IAsԂ܂B
    FALSE
        sB
    TRUE
        IB


    wLogSlot Ŏw肳ꂽfoCXɊ蓖ĂĂ郊\[X\p
    擾܂B
    ʏ킱 API ͎gpKv͂܂B

G[
    APCI54_ERR_INVALID_SLOT
        Ș_XbgԍłB
    APCI54_ERR_NO_CREATE
        foCXNGCgĂ܂B
    APCI54_ERR_INVALID_ARGUMENT
        pres  NULL łB
    APCI54_ERR_SYSTEM
        Windows  GetLastError() R[ĂB

------------------------------------------------------------------------

4.1.5.  Apci54GetSwitchValue

@\
    [^XCb`̒l擾

`
EVisual C++
BOOL Apci54GetSwitchValue(WORD wLogSlot, PDWORD pdwSwitchValue);

EVisual Basic
Function Apci54GetSwitchValue(ByVal wLogSlot As Integer, pdwSwitchValue As Long) As Long

EDelphi
function Apci54GetSwitchValue(wLogSlot: WORD; var pdwSwitchValue: DWORD): BOOL;


    wLogSlot
        foCX̘_XbgԍwB

    pdwSwitchValue
        [^XCb`̒li[̈ւ̃|C^B
        NULL ͕sB

o
    *pdwSwitchValue
        [^XCb`̒lB

߂l
    API IAsԂ܂B
    FALSE
        sB
    TRUE
        IB


    wLogSlot Ŏw肳ꂽfoCXɊ蓖ĂĂ郍[^XCb`
    l擾܂B

G[
    APCI54_ERR_INVALID_SLOT
        Ș_XbgԍłB
    APCI54_ERR_NO_CREATE
        foCXNGCgĂ܂B
    APCI54_ERR_INVALID_ARGUMENT
        pdwSwitchValue  NULL łB
    APCI54_ERR_SYSTEM
        Windows  GetLastError() R[ĂB

------------------------------------------------------------------------

4.2.  I/O API

------------------------------------------------------------------------

4.2.1.  Apci54GetDirections

@\
    fBNV擾

`
EVisual C++
BOOL    Apci54GetDirections(WORD wLogSlot, PDWORD pdwDirections);

EVisual Basic
Function Apci54GetDirections(ByVal wLogSlot As Integer, pdwDirections As Long) As Long

EDelphi
function Apci54GetDirections(wLogSlot: WORD; var pdwDirections: DWORD): BOOL;


    wLogSlot
        foCXwB

    pdwDirections
        fBNVi[̈ւ̃|C^B
        NULL ͕sB

o
    *pdwDirections
        擾fBNVB̒l͊e|[gɑΉrbg}bv
        ȂĂ܂B

            rbg  |[g
            --------------
               0       A
               1       B
               2       C
               3       D
               4       E
               5       F

        erbg 0 ŏóA1 œ͕ɐݒ肳Ă܂B

߂l
    API IAsԂ܂B
    FALSE
        sB
    TRUE
        IB


    wLogSlot Ŏw肳ꂽfoCX̃fBNV擾܂B

G[
    APCI54_ERR_INVALID_SLOT
        Ș_XbgłB
    APCI54_ERR_INVALID_ARGUMENT
        pdwDirections  NULL łB
    APCI54_ERR_NO_CREATE
        foCXNGCgĂ܂B

------------------------------------------------------------------------

4.2.2.  Apci54SetDirections

@\
    fBNVݒ

`
EVisual C++
BOOL    Apci54SetDirections(WORD wLogSlot, DWORD dwDirections);

EVisual Basic
Function Apci54SetDirections(ByVal wLogSlot As Integer, ByVal dwDirections As Long) As Long

EDelphi
function Apci54SetDirections(wLogSlot: WORD; dwDirections: DWORD): BOOL;


    wLogSlot
        foCXwB

    dwDirections
        fBNVe|[gɑΉrbg}bvŎw肵܂B

            rbg  |[g
            --------------
               0       A
               1       B
               2       C
               3       D
               4       E
               5       F

        erbg 0 ŏóA1 œ͕ɐݒ肳܂B

߂l
    API IAsԂ܂B
    FALSE
        sB
    TRUE
        IB


    wLogSlot Ŏw肳ꂽfoCX̃fBNVݒ肵܂B


    Lȃ|[gȏ̃rbg͖܂B

G[
    APCI54_ERR_INVALID_SLOT
        Ș_XbgłB
    APCI54_ERR_NO_CREATE
        foCXNGCgĂ܂B

------------------------------------------------------------------------

4.2.3.  Apci54InPort

@\
    ͎s

`
EVisual C++
BOOL Apci54InPort(WORD wLogSlot, DWORD dwLogPort, PBYTE pbInValue);

EVisual Basic
Function Apci54InPort(ByVal wLogSlot As Integer,ByVal dwLogPort As Long, pbInValue As Byte) As Long

EDelphi
function Apci54InPort( wLogSlot: WORD; dwLogPort: DWORD; var pbInValue: BYTE): BOOL;


    wLogSlot
        foCX̘_XbgԍwB

    dwLogPort
        ̘_|[gԍ̓͂s܂B

    pbInValue
        ̓f[^i[̈ւ̃|C^B
        NULL ͕sB

o
    *pbInValue
        ̓f[^B

߂l
    API IAsԂ܂B
    FALSE
        sB
    TRUE
        IB


    wLogSlot Ŏw肳ꂽfoCX̘_|[gԍ dwLogPort 
    ܂B

G[
    APCI54_ERR_INVALID_SLOT
        Ș_XbgԍłB
    APCI54_ERR_NO_CREATE
        foCXNGCgĂ܂B
    APCI54_ERR_INVALID_PORT
        Ș_|[gԍłB
    APCI54_ERR_INVALID_ARGUMENT
        pbInValue  NULL łB

------------------------------------------------------------------------

4.2.4.  Apci54OutPort

@\
    o͎s

`
EVisual C++
BOOL Apci54OutPort(WORD wLogSlot, DWORD dwLogPort, BYTE bOutValue);

EVisual Basic
Function Apci54OutPort(ByVal wLogSlot As Integer,ByVal dwLogPort As Long,ByVal bOutValue As Byte) As Long

EDelphi
function Apci54OutPort(wLogSlot: WORD; dwLogPort: DWORD; bOutValue: BYTE): BOOL;


    wLogSlot
        foCX̘_XbgԍwB

    dwLogPort
        ̘_|[gԍւ̏o͂s܂B

    bOutValue
        o̓f[^B

߂l
    API IAsԂ܂B
    FALSE
        sB
    TRUE
        IB


    wLogSlot Ŏw肳ꂽfoCX̘_|[gԍ dwLogPort ɏo͂
    ܂B

G[
    APCI54_ERR_INVALID_SLOT
        Ș_XbgԍłB
    APCI54_ERR_NO_CREATE
        foCXNGCgĂ܂B
    APCI54_ERR_INVALID_PORT
        Ș_|[gԍłB

------------------------------------------------------------------------

4.3.  ̑ API

------------------------------------------------------------------------

4.3.1.  Apci54GetLastError

@\
    G[R[h擾

`
EVisual C++
DWORD Apci54GetLastError(WORD wLogSlot);

EVisual Basic
Function Apci54GetLastError(ByVal wLogSlot As Integer) As Long

EDelphi
function Apci54GetLastError(wLogSlot: WORD): DWORD;


    wLogSlot
        foCX̘_XbgԍwB

߂l
    G[R[hB


    ƂŋߋNG[̃R[h擾܂B

========================================================================

5.  bZ[W

    bZ[W͂܂B

========================================================================

6.  萔

------------------------------------------------------------------------

6.1.  G[R[h

#define APCI54_SUCCESS              0   // I
#define APCI54_ERR_SYSTEM           1   // GetLastError sĂ
#define APCI54_ERR_NO_DEVICE        2   // gp\޲Ȃ
#define APCI54_ERR_IN_USE           3   // w肳ꂽ޲͎gp
#define APCI54_ERR_INVALID_SLOT     4   // Ș_ۯĔԍw肵
#define APCI54_ERR_RESOURCE         5   // ؿװ
#define APCI54_ERR_INVALID_PORT     6   // ߰Ăv
#define APCI54_ERR_INVALID_ARGUMENT 7   // Ȉv
#define APCI54_ERR_NO_CREATE        8   // ޲شĂĂ܂

------------------------------------------------------------------------

6.2.  o͕wrbg}bv萔

#define APCI54_DIR_A_OUTPUT (0 << 0)
#define APCI54_DIR_A_INPUT  (1 << 0)
#define APCI54_DIR_B_OUTPUT (0 << 1)
#define APCI54_DIR_B_INPUT  (1 << 1)
#define APCI54_DIR_C_OUTPUT (0 << 2)
#define APCI54_DIR_C_INPUT  (1 << 2)
#define APCI54_DIR_D_OUTPUT (0 << 3)
#define APCI54_DIR_D_INPUT  (1 << 3)
#define APCI54_DIR_E_OUTPUT (0 << 4)
#define APCI54_DIR_E_INPUT  (1 << 4)
#define APCI54_DIR_F_OUTPUT (0 << 5)
#define APCI54_DIR_F_INPUT  (1 << 5)

------------------------------------------------------------------------

6.3.  _|[gԍ萔

#define APCI54_PORT_A   0
#define APCI54_PORT_B   1
#define APCI54_PORT_C   2
#define APCI54_PORT_D   3
#define APCI54_PORT_E   4
#define APCI54_PORT_F   5

------------------------------------------------------------------------

6.4.  ̑̒萔

#define APCI54_MAX_SLOTS    16              /* T|[gXbg */
#define APCI54_MAX_PORTS    6               /* foCX̃|[g */
#define APCI54_SLOT_AUTO    ((WORD)~0U)     /* ftHg  T[` */

