aPCI-8304 Windows 9x/Windows NT4.0/Windows 2000 Driver `ohdl

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

ڎ

1.      Tv
2.      
3.      vO\
4.      `oht@X
4.1.    {`oh
4.1.1.  Apci8304GetVersion
4.1.2.  Apci8304Create
4.1.3.  Apci8304Close
4.1.4.  Apci8304GetResource
4.2.    VAʐM`oh
4.2.1.  Apci8304SioStart
4.2.2.  Apci8304SioGetStatus
4.2.3.  Apci8304SioRead
4.2.4.  Apci8304SioWrite
4.2.5.  Apci8304SioReset
4.2.6.  Apci8304SioStop
4.3.    ̑̂`oh
4.3.1.  Apci8304GetSwitchValue
4.3.2.  Apci8304GetLastError
5.      萔
5.1.    G[R[h
5.2.    VAʐMp萔

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

1.Tv

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

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

2.

  {Œ` API ́AWindows 9x/Windows NT4.0/Windows 2000 
  ő 16 ܂ł aPCI-8304 (ȉufoCXv) 𐧌䂢܂B

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

3.vO\

  {Œ` API ̓foCXhCo
@Eapci8304.vxd (Windows 9x)
@Eapci8304.sys (Windows NT4.0)
  Eapci8304.sys (Windows 2000)
@ƁALhCoΉ_Ci~bNNCu
@Eapci8304.dll (Windows 9x)
@Eapci8304.dll (Windows NT4.0)
  Eapci8304.dll (Windows 2000)
@ɂ܂B

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

4.`oht@X

  `oh͈ȉ̂悤ɑʂĂ܂B
@@1. {`oh
@@2. VAʐMp`oh
@@3. ̑̂`oh

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

4.1.{`oh

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

4.1.1. Apci8304GetVersion

@\
        o[W擾

`

EVisual C++
BOOL Apci8304GetVersion(PDWORD pdwDllVersion, 
                        PDWORD pdwDrvVersion);

EVisual Basic
Function Apci8304GetVersion(ByRef pdwDllVersion As Long,
                            ByRef pdwDrvVersion As Long) As Boolean

EDelphi
Function Apci8304GetVersion(var pdwDllVer:DWORD;
                            var pdwDrvVer:DWORD):Boolean;


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

        pdwDrvVersion
            foCXhCõo[Wԍi[̈ւ̃|C^
            NULL 

o
        *pdwDllVersion
            DLL ̃o[Wԍ

        *pdwDrvVersion
            foCXhCõo[Wԍ

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


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

G[
        FALSE
            ڍׂ Win32API  GetLastError() R[ĂB
            foCXhCo DLL gݍ܂ĂȂ\
            ܂B

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

4.1.2. Apci8304Create

@\
        foCX̎gp錾

`

EVisual C++
BOOL Apci8304Create(PWORD pwLogSlot);

EVisual Basic
Function Apci8304Create(ByRef pwLogSlot As Integer) As Boolean

EDelphi
Function Apci8304Create(var pwLogSlot:WORD):Boolean;


        *pwLogSlot
            gpfoCX̘_Xbgԍw肵܂B
            Ŏw肷ԍ aPCI-8304 ̘_Xbgԍݒ
            ܂B
            _Xbgԍ 0 n܂܂B
            ܂ APCI8304_SLOT_AUTO w肵ꍇAfoCX݂
            Ă_XbgT܂BłɃAvP[Vɂ
            gpĂfoCX̓XLbv܂B

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

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

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


        Xbgɑ݂Ăł낤foCXAAvP[V
        gp邱ƂfoCXhCoɒʒm܂B
        XbgɃfoCX݂ĂȂꍇ̓G[ƂȂ܂B
        Xbg̃foCXłɑ̃AvP[VŎgp
        ꍇG[ƂȂ܂BɂA1 ̃foCX͒P
        ̃AvP[VrIɎgp܂B
        ܂AeʐM`l 1 ̃AvP[VŐL
        ƂɂȂ܂B

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

G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_NO_DEVICE
            gp\ȃfoCX܂ (APCI8304_SLOT_AUTO w肵ꍇ)B
        APCI8304_ERR_INVALID_SLOT
            w̃foCX͎gpłB
        APCI8304_ERR_INVALID_ARGUMENT
            pwLogSlot  NULL łB

         API sꍇAApci8304GetLastError()  wLogSlot
        ɂ APCI8304_SLOT_AUTO w肵ĂB

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

4.1.3.  Apci8304Close

@\
        foCX̊J

`

EVisual C++
BOOL Apci8304Close(WORD wLogSlot);

EVisual Basic
Function Apci8304Close(ByVal wLogSlot As Integer) As Boolean

EDelphi
Function Apci8304Close(wLogSlot:WORD):Boolean;


        wLogSlot
            foCX̘_Xbgԍw肵܂B

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


        AvP[VfoCX̎gpIAfoCX𑼂̃Av
        P[VɊJ邱ƂfoCXhCoɒʒm܂B
        AvP[VIOɕK API ĂяoĂ
        B

G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_INVALID_SLOT
            Ș_XbgԍłB
@@@@@  ܂̓foCXNGCgĂ܂B

         API s Apci8304GetLastError()  wLogSlot ɂ
        APCI8304_SLOT_AUTO w肵ĂB

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

4.1.4. Apci8304GetResource

@\
        \[X擾

`

EVisual C++
#define APCI8304_MAX_MEM      9
#define APCI8304_MAX_IO       20
#define APCI8304_MAX_IRQ      7
#define APCI8304_MAX_DMA      7

// \[X\
typedef struct _APCI8304_RESOURCE {
    DWORD  dwNumMemWindows;                      // س޳        gp
    DWORD  dwMemBase        [APCI8304_MAX_MEM];  // س޳ްڽ gp
    DWORD  dwMemLength      [APCI8304_MAX_MEM];  // س޳        gp
    DWORD  dwMemAttrib      [APCI8304_MAX_MEM];  // س޳      gp
    DWORD  dwNumIOPorts;                         // I/O߰Đ
    DWORD  dwIOPortBase     [APCI8304_MAX_IO];   // I/O߰ްڽ
    DWORD  dwIOPortLength   [APCI8304_MAX_IO];   // I/O߰Ē
    DWORD  dwNumIRQs;                            // IRQ
    DWORD  dwIRQRegisters   [APCI8304_MAX_IRQ];  // IRQؽ
    DWORD  dwIRQAttrib      [APCI8304_MAX_IRQ];  // IRQؽ
    DWORD  dwNumDMAs;                            // DMAِ         gp
    DWORD  dwDMALst         [APCI8304_MAX_DMA];  // DMAؽ        gp
    DWORD  dwDMAAttrib      [APCI8304_MAX_DMA];  // DMAّؽ    gp
    DWORD  dwReserved1      [3];                 // \               gp
} APCI8304_RESOURCE, *PAPCI8304R;

BOOL Apci8304GetResource(WORD wLogSlot, PAPCI8304R pRes);

EVisual Basic
Global Const APCI8304_MAX_MEM = 9
Global Const APCI8304_MAX_IO = 20
Global Const APCI8304_MAX_IRQ = 7
Global Const APCI8304_MAX_DMA = 7

Type APCI8304_RESOURCE
    dwNumMemWindows As Long                         ' EBhE
    dwMemBase(1 To APCI8304_MAX_MEM) As Long        ' EBhEJnAhX
    dwMemLength(1 To APCI8304_MAX_MEM) As Long      ' EBhE
    dwMemAttrib(1 To APCI8304_MAX_MEM) As Long      ' EBhE
    dwNumIOPorts As Long                            ' I/O|[g
    dwIOPortBase(1 To APCI8304_MAX_IO) As Long      ' I/O|[gJnAhX
    dwIOPortLength(1 To APCI8304_MAX_IO) As Long    ' I/O|[g
    dwNumIRQs As Long                               ' IRQ
    dwIRQRegisters(1 To APCI8304_MAX_IRQ) As Long   ' IRQԍ
    dwIRQAttrib(1 To APCI8304_MAX_IRQ) As Long      ' IRQ
    dwNumDMAs As Long                               ' DMA`l
    dwDMALst(1 To APCI8304_MAX_DMA) As Long         ' DMA`l
    dwDMAAttrib(1 To APCI8304_MAX_DMA) As Long      ' DMA`l
    dwReserved1(1 To 3) As Long                     ' \
End Type

Function Apci8304GetResource(ByVal wLogSlot As Integer
                             ByRef pRes As APCI8304_RESOURCE) As Boolean

EDelphi
const
  APCI8304_MAX_MEM =9;
  APCI8304_MAX_IO  =20;
  APCI8304_MAX_IRQ =7;
  APCI8304_MAX_DMA =7;
type
  TAPCI8304_RESOURCE = record
    dwNumMemWindows:                                  DWORD;  // س޳(gp)
    dwMemBase:      array [1 .. APCI8304_MAX_MEM] of  DWORD;  // س޳ްڽ(gp)
    dwMemLength:    array [1 .. APCI8304_MAX_MEM] of  DWORD;  // س޳(gp)
    dwMemAttrib:    array [1 .. APCI8304_MAX_MEM] of  DWORD;  // س޳(gp)
    dwNumIOPorts:                                     DWORD;  // I/O߰Đ
    dwIOPortBase:   array [1 .. APCI8304_MAX_IO]  of  DWORD;  // I/O߰ްڽ
    dwIOPortLength: array [1 .. APCI8304_MAX_IO]  of  DWORD;  // I/O߰Ē
    dwNumIRQs:                                        DWORD;  // IRQ
    dwIRQRegisters: array [1 .. APCI8304_MAX_IRQ] of  DWORD;  // IRQؽ
    dwIRQAttrib:    array [1 .. APCI8304_MAX_IRQ] of  DWORD;  // IRQؽ
    dwNumDMAs:                                        DWORD;  // DMAِ(gp)
    dwDMALst:       array [1 .. APCI8304_MAX_DMA] of  DWORD;  // DMAؽ(gp)
    dwDMAAttrib:    array [1 .. APCI8304_MAX_DMA] of  DWORD;  // DMAّؽ(gp)
    dwReserved1:    array [1 .. 3]                of  DWORD;  // \(gp)
  end;
  PAPCI8304R = ^TAPCI8304_RESOURCE;

Function Apci8304GetResource(wLogSlot:WORD; pRes:PAPCI8304R):Boolean;


        wLogSlot
            foCX̘_Xbgԍw

        pRes
            \[Xi[̈ւ̃|C^
            NULL ͕s

o
        *pRes
            蓖ĂĂ郊\[X̏

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


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

G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_INVALID_SLOT
            Ș_XbgԍłB
@@@@@  ܂̓foCXNGCgĂ܂B
        APCI8304_ERR_INVALID_ARGUMENT
            pRes  NULL łB

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

4.2. VAʐM`oh

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

4.2.1. Apci8304SioStart

@\
        VAʐMJn

`

EVisual C++
#define APCI8304_SIO_CB8        (BIT0 | BIT1)   // LN^ = 8bit
#define APCI8304_SIO_CB7        BIT1            // LN^ = 7bit
#define APCI8304_SIO_CB6        BIT0            // LN^ = 6bit

#define APCI8304_SIO_PNONE      0               // peB = Ȃ
#define APCI8304_SIO_PODD       BIT3            // peB = 
#define APCI8304_SIO_PEVEN      (BIT3 | BIT4)   // peB = 

#define APCI8304_SIO_S1         0               // Xgbvrbg = 1bit
#define APCI8304_SIO_S2         BIT2            // Xgbvrbg = 2bit

#define APCI8304_SIO_BPS115200  0x0001          // 115200 BPS
#define APCI8304_SIO_BPS57600   0x0002          //  57600 BPS
#define APCI8304_SIO_BPS38400   0x0003          //  38400 BPS
#define APCI8304_SIO_BPS19200   0x0006          //  19200 BPS
#define APCI8304_SIO_BPS9600    0x000c          //   9600 BPS
#define APCI8304_SIO_BPS7200    0x0010          //   7200 BPS
#define APCI8304_SIO_BPS4800    0x0018          //   4800 BPS
#define APCI8304_SIO_BPS3600    0x0020          //   3600 BPS
#define APCI8304_SIO_BPS2400    0x0030          //   2400 BPS
#define APCI8304_SIO_BPS2000    0x003a          //   2000 BPS (ݒ덷0.068%)
#define APCI8304_SIO_BPS1800    0x0040          //   1800 BPS
#define APCI8304_SIO_BPS1200    0x0060          //   1200 BPS
#define APCI8304_SIO_BPS600     0x00c0          //    600 BPS
#define APCI8304_SIO_BPS300     0x0180          //    300 BPS
#define APCI8304_SIO_BPS150     0x0300          //    150 BPS
#define APCI8304_SIO_BPS134_5   0x0359          //  134.5 BPS (ݒ덷0.058%)
#define APCI8304_SIO_BPS110     0x0417          //    110 BPS (ݒ덷0.026%)
#define APCI8304_SIO_BPS75      0x0600          //     75 BPS
#define APCI8304_SIO_BPS50      0x0900          //     50 BPS

// ʐM\
typedef struct _SIOMODE {
    WORD    Baud;                               // {[[g
    BYTE    WordSize;                           // LN^
    BYTE    Parity;                             // peB
    BYTE    StopBits;                           // Xgbvrbg
} SIOMODE, *PSIOMODE;

BOOL Apci8304SioStart(WORD wLogSlot, WORD wCh, PSIOMODE pMode);

EVisual Basic
Global Const APCI8304_SIO_CB8 = (BIT0 Or BIT1)      ' LN^ = 8bit
Global Const APCI8304_SIO_CB7 = BIT1                ' LN^ = 7bit
Global Const APCI8304_SIO_CB6 = BIT0                ' LN^ = 6bit

Global Const APCI8304_SIO_PNONE = 0                 ' peB = Ȃ
Global Const APCI8304_SIO_PODD = BIT3               ' peB = 
Global Const APCI8304_SIO_PEVEN = (BIT3 Or BIT4)    ' peB = 

Global Const APCI8304_SIO_S1 = 0                    ' Xgbvrbg = 1bit
Global Const APCI8304_SIO_S2 = BIT2                 ' Xgbvrbg = 2bit

Global Const APCI8304_SIO_BPS115200 = &H1           ' 115200 BPS
Global Const APCI8304_SIO_BPS57600 = &H2            '  57600 BPS
Global Const APCI8304_SIO_BPS38400 = &H3            '  38400 BPS
Global Const APCI8304_SIO_BPS19200 = &H6            '  19200 BPS
Global Const APCI8304_SIO_BPS9600 = &HC             '   9600 BPS
Global Const APCI8304_SIO_BPS7200 = &H10            '   7200 BPS
Global Const APCI8304_SIO_BPS4800 = &H18            '   4800 BPS
Global Const APCI8304_SIO_BPS3600 = &H20            '   3600 BPS
Global Const APCI8304_SIO_BPS2400 = &H30            '   2400 BPS
Global Const APCI8304_SIO_BPS2000 = &H3A            '   2000 BPS (ݒ덷0.068%)
Global Const APCI8304_SIO_BPS1800 = &H40            '   1800 BPS
Global Const APCI8304_SIO_BPS1200 = &H60            '   1200 BPS
Global Const APCI8304_SIO_BPS600 = &HC0             '    600 BPS
Global Const APCI8304_SIO_BPS300 = &H180            '    300 BPS
Global Const APCI8304_SIO_BPS150 = &H300            '    150 BPS
Global Const APCI8304_SIO_BPS134_5 = &H359          '  134.5 BPS (ݒ덷0.058%j
Global Const APCI8304_SIO_BPS110 = &H417            '    110 BPS (ݒ덷0.026%)
Global Const APCI8304_SIO_BPS75 = &H600             '     75 BPS
Global Const APCI8304_SIO_BPS50 = &H900             '     50 BPS

' VAʐMwp\
Type SIOMODE
    Baud As Integer                                 ' {[[g
    WordSize As Byte                                ' LN^
    Parity As Byte                                  ' peB
    StopBits As Byte                                ' Xgbvrbg
End Type

Function Apci8304SioStart(ByVal wLogSlot As Integer,
                          ByVal wCh As Integer,
                          ByRef pMode As SIOMODE) As Boolean

EDelphi
const
  APCI8304_SIO_CB8          =(BIT0 or BIT1);    // LN^ = 8bit
  APCI8304_SIO_CB7          =BIT1;              // LN^ = 7bit
  APCI8304_SIO_CB6          =BIT0;              // LN^ = 6bit

  APCI8304_SIO_PNONE        =0;                 // peB = Ȃ
  APCI8304_SIO_PODD         =BIT3;              // peB = 
  APCI8304_SIO_PEVEN        =(BIT3 or BIT4);    // peB = 

  APCI8304_SIO_S1           =0;                 // Xgbvrbg = 1bit
  APCI8304_SIO_S2           =BIT2;              // Xgbvrbg = 2bit

  APCI8304_SIO_BPS115200    =$0001;             // 115200 BPS
  APCI8304_SIO_BPS57600     =$0002;             //  57600 BPS
  APCI8304_SIO_BPS38400     =$0003;             //  38400 BPS
  APCI8304_SIO_BPS19200     =$0006;             //  19200 BPS
  APCI8304_SIO_BPS9600      =$000c;             //   9600 BPS
  APCI8304_SIO_BPS7200      =$0010;             //   7200 BPS
  APCI8304_SIO_BPS4800      =$0018;             //   4800 BPS
  APCI8304_SIO_BPS3600      =$0020;             //   3600 BPS
  APCI8304_SIO_BPS2400      =$0030;             //   2400 BPS
  APCI8304_SIO_BPS2000      =$003a;             //   2000 BPS (ݒ덷0.068%)
  APCI8304_SIO_BPS1800      =$0040;             //   1800 BPS
  APCI8304_SIO_BPS1200      =$0060;             //   1200 BPS
  APCI8304_SIO_BPS600       =$00c0;             //    600 BPS
  APCI8304_SIO_BPS300       =$0180;             //    300 BPS
  APCI8304_SIO_BPS150       =$0300;             //    150 BPS
  APCI8304_SIO_BPS134_5     =$0359;             //  134.5 BPS (ݒ덷0.058%)
  APCI8304_SIO_BPS110       =$0417;             //    110 BPS (ݒ덷0.026%)
  APCI8304_SIO_BPS75        =$0600;             //     75 BPS
  APCI8304_SIO_BPS50        =$0900;             //     50 BPS

type
  TSIOMODE = record
    Baud:      WORD;                            // {[[g
    WordSize:  BYTE;                            // LN^
    Parity:    BYTE;                            // peB
    StopBits:  BYTE;                            // Xgbvrbg
  end;
  PSIOMODE = ^TSIOMODE;

function Apci8304SioStart(wLogSlot:WORD; wCh:WORD; pMode:PSIOMODE):Boolean;


        wLogSlot
            foCX̘_Xbgԍw

        wCh
            Ώۂ̃`lw

        pMode
            ʐMi[Ă\̂̃|C^
            NULL ͕s

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


        wLogSlot Ŏw肳ꂽfoCX wCh Ŏw肳ꂽ`l
        SIOMODE \̂Ɏw肳ꂽŃVAʐMJn܂B

G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_INVALID_SLOT
            Ș_XbgԍłB
@@@@@  ܂̓foCXNGCgĂ܂B
        APCI8304_ERR_INVALID_ARGUMENT
            pMode  NULL łB܂́A`lsłB
        APCI8304_ERR_BUSY
            w`lł͂łɒʐMJnĂ܂B
        APCI8304_ERR_NOT_ENOUGH_MEM
@@@@@@ʐMobt@mۂs܂B
        APCI8304_ERR_INVALID_PARAM
            ʐMsłB

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

4.2.2. Apci8304SioGetStatus

@\
        ʐMXe[^X擾

`

EVisual C++
typedef struct _SIOSTATUS {
    WORD    RxSize;                 // Mf[^
} SIOSTATUS, *PSIOSTATUS;

BOOL Apci8304SioGetStatus(WORD wLogSlot, WORD wCh, PSIOSTATUS pStatus);

EVisual Basic
Type SIOSTATUS
    RxSize As Integer               ' Mf[^
End Type

Function Apci8304SioGetStatus(ByVal wLogSlot As Integer,
                              ByVal wCh As Integer,
                              ByRef pStatus As SIOSTATUS) As Boolean

EDelphi
type
TSIOSTATUS = record
  RxSize:  WORD;                    // Mf[^
end;
PSIOSTATUS = ^TSIOSTATUS;

function Apci8304SioGetStatus(wLogSlot:WORD; wCh:WORD;
                              pStatus:PSIOSTATUS):Boolean;


        wLogSlot
            foCX̘_Xbgԍw

        wCh
            Ώۂ̃`lw

        pStatus
            ʐMXe[^Xi[̈̃|C^

o
        *pStatus
            ʐMXe[^X

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


        wLogSlot Ŏw肳ꂽfoCX wCh Ŏw肳ꂽ`l
        ʐMXe[^X擾܂B

G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_INVALID_SLOT
            Ș_XbgԍłB
@@@@@  ܂̓foCXNGCgĂ܂B
        APCI8304_ERR_INVALID_ARGUMENT
            pStatus  NULL łB܂́A`lsłB
        APCI8304_ERR_NO_ACTIVE
            w`l͒ʐMJnĂ܂B

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

4.2.3. Apci8304SioRead

@\
        Mobt@f[^擾

`

EVisual C++
BOOL Apci8304SioRead(WORD wLogSlot, WORD wCh, PBYTE pbData, DWORD dwDataSize);

EVisual Basic
Function Apci8304SioRead(ByVal wLogSlot As Integer,
                         ByVal wCh As Integer,
                         ByRef pbData As Byte,
                         ByVal dwDataSize As Long) As Boolean

EDelphi
function Apci8304SioRead(wLogSlot:WORD; wCh:WORD;
                          var pbData:array of BYTE; dwDataSize:DWORD):Boolean;


        wLogSlot
            foCX̘_Xbgԍw

        wCh
            Ώۂ̃`lw

        pbData
            Mf[^i[̈̃|C^

        dwDataSize
            Mf[^

o
        *pbData
            Mf[^

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


        wLogSlot Ŏw肳ꂽfoCX wCh Ŏw肳ꂽ`l
        Mobt@ɒ~ςꂽf[^擾܂B
        Mobt@I[o[t[ꍇAf[^擾̃^C~
        O𑬂铙΍ƂKv܂B

G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_INVALID_SLOT
            Ș_XbgԍłB
@@@@@  ܂̓foCXNGCgĂ܂B
        APCI8304_ERR_INVALID_ARGUMENT
            pbData  NULL łB܂́A`lsłB
        APCI8304_ERR_NO_ACTIVE
            w`l͒ʐMJnĂ܂B
        APCI8304_ERR_NO_DATA
            Mobt@̃f[^ dwDataSize Ŏw肳ĂlɒB
            Ă܂B
        APCI8304_ERR_BUFFER_OVER
            Mobt@I[o[t[Ă܂B

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

4.2.4. Apci8304SioWrite

@\
        Mobt@f[^擾

`

EVisual C++
BOOL Apci8304SioWrite(WORD wLogSlot, WORD wCh, PBYTE pbData, DWORD dwDataSize); 

EVisual Basic
Function Apci8304SioWrite(ByVal wLogSlot As Integer,
                          ByVal wCh As Integer,
                          ByRef pbData As Byte,
                          ByVal dwDataSize As Long) As Boolean

EDelphi
function Apci8304SioWrite(wLogSlot:WORD; wCh:WORD; var pbData:array of BYTE;
                           dwDataSize:DWORD):Boolean;


        wLogSlot
            foCX̘_Xbgԍw

        wCh
            Ώۂ̃`lw

        pbData
            Mf[^i[Ă̈̃|C^

        dwDataSize
            Mf[^

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


        wLogSlot Ŏw肳ꂽfoCX wCh Ŏw肳ꂽ`l
        dwDataSize Ŏw肵 pbData Ɋi[Ăf[^
        M܂B^CAEgꍇAƂĒʐMx
        [ɒx铙̉\܂̂ŁAʐMx铙̑
        ƂKv܂B

G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_INVALID_SLOT
            Ș_XbgԍłB
@@@@@  ܂̓foCXNGCgĂ܂B
        APCI8304_ERR_INVALID_ARGUMENT
            pbData  NULL łB܂́A`lsłB
        APCI8304_ERR_NO_ACTIVE
            w`l͒ʐMJnĂ܂B
        APCI8304_ERR_TIMEOUT
            ݎɃ^CAEg܂B

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

4.2.5. Apci8304SioReset

@\
        Mobt@Zbg

`

EVisual C++
BOOL Apci8304SioReset(WORD wLogSlot, WORD wCh);

EVisual Basic
Function Apci8304SioReset(ByVal wLogSlot As Integer,
                          ByVal wCh As Integer) As Boolean

EDelphi
function Apci8304SioReset(wLogSlot:WORD; wCh:WORD):Boolean;


        wLogSlot
            foCX̘_Xbgԍw

        wCh
            Ώۂ̃`lw

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


        wLogSlot Ŏw肳ꂽfoCX wCh Ŏw肳ꂽ`l
        Mobt@NA܂B

G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_INVALID_SLOT
            Ș_XbgԍłB
@@@@@  ܂̓foCXNGCgĂ܂B
        APCI8304_ERR_INVALID_ARGUMENT
            `lsłB
        APCI8304_ERR_NO_ACTIVE
            w`l͒ʐMJnĂ܂B

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

4.2.6. Apci8304SioStop

@\
        VAʐM~

`

EVisual C++
BOOL Apci8304SioStop(WORD wLogSlot, WORD wCh);

EVisual Basic
Function Apci8304SioStop(ByVal wLogSlot As Integer,
                          ByVal wCh As Integer) As Boolean

EDelphi
function Apci8304SioStop(wLogSlot:WORD; wCh:WORD):Boolean;


        wLogSlot
            foCX̘_Xbgԍw

        wCh
            Ώۂ̃`lw

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


        wLogSlot Ŏw肳ꂽfoCX wCh Ŏw肳ꂽ`l
        ʐM~܂B
        
G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_INVALID_SLOT
            Ș_XbgԍłB
@@@@@  ܂̓foCXNGCgĂ܂B
        APCI8304_ERR_INVALID_ARGUMENT
            `lsłB
        APCI8304_ERR_NO_ACTIVE
            w`l͒ʐMJnĂ܂B

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

4.3. ̑̂`oh

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

4.3.1.  Apci8304GetSwitchValue

@\
        armXCb`l擾

`

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

EVisual Basic
Function Apci8304GetSwitchValue(ByVal wLogSlot As Integer,
                                ByRef pdwSwitchValue As Long) As Boolean

EDelphi
function Apci8304GetSwitchValue(wLogSlot:WORD; var pdwSwitchValue:DWORD):Boolean;


        wLogSlot
            foCX̘_Xbgԍw

        pdwSwitchValue
            armXCb`li[̈̃|C^

o
        *pdwSwitchValue
            armXCb`l

߂l
        API IAsԂ܂B
            FALSE s
            TRUE  I


        wLogSlot Ŏw肳ꂽfoCX̂armXCb`ɐݒ肳Ă
        l擾܂B

G[
        APCI8304_ERR_SYSTEM
            Windows  GetLastError() R[ĂB
        APCI8304_ERR_INVALID_SLOT
            Ș_XbgԍłB
@@@@@  ܂̓foCXNGCgĂ܂B
        APCI8304_ERR_INVALID_ARGUMENT
            pdwSwitchValue  NULL łB

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

4.3.2.  Apci8304GetLastError

@\
        G[擾

`

EVisual C++
DWORD Apci8304GetLastError(WORD wLogSlot);

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

EDelphi
function Apci8304GetLastError(wLogSlot:WORD):DWORD;


        wLogSlot
            foCX̘_Xbgԍw

߂l
        G[R[h


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

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

5. 萔

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

5.1.    G[R[h

#define APCI8304_SUCCESS                0       // ُȂ (I)
#define APCI8304_ERR_SYSTEM             1       // Windows  GetLastError() R[Ă
                                                // ɃhCo[hĂȂ\܂
#define APCI8304_ERR_NO_DEVICE          2       // gp\ȃfoCX܂
#define APCI8304_ERR_IN_USE             3       // w̃foCX͎gpł
#define APCI8304_ERR_INVALID_SLOT       4       // Ș_\Pbgł
#define APCI8304_ERR_RESOURCE           5       // \[XG[
#define APCI8304_ERR_INVALID_ARGUMENT   6       // p[^s

#define APCI8304_ERR_BUSY               10      // w`l͉ғł
#define APCI8304_ERR_NO_ACTIVE          11      // w`l͓삵Ă܂
#define APCI8304_ERR_NOT_ENOUGH_MEM     12      // ʐMobt@mێs
#define APCI8304_ERR_INVALID_CH         13      // sȃ`llł
#define APCI8304_ERR_TIMEOUT            14      // ^CAEg
#define APCI8304_ERR_NO_DATA            15      // f[^w萔~ςĂ܂
#define APCI8304_ERR_BUFFER_OVER        16      // ʐMobt@I[o[t[
#define APCI8304_ERR_INVALID_PARAM      17      // ʐMw肪s

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

5.2.    VAʐMp萔

enum BIT {  BIT0=0x1, BIT1=0x2, BIT2=0x4, BIT3=0x8,
            BIT4=0x10,BIT5=0x20,BIT6=0x40,BIT7=0x80 };

#define APCI8304_SIO_CH1        0               // `l 1
#define APCI8304_SIO_CH2        1               // `l 2
#define APCI8304_SIO_CH3        2               // `l 3
#define APCI8304_SIO_CH4        3               // `l 4

#define APCI8304_SIO_CB8        (BIT0 | BIT1)   // LN^ = 8bit
#define APCI8304_SIO_CB7        BIT1            // LN^ = 7bit
#define APCI8304_SIO_CB6        BIT0            // LN^ = 6bit

#define APCI8304_SIO_PNONE      0               // peB = Ȃ
#define APCI8304_SIO_PODD       BIT3            // peB = 
#define APCI8304_SIO_PEVEN      (BIT3 | BIT4)   // peB = 

#define APCI8304_SIO_S1         0               // Xgbvrbg = 1bit
#define APCI8304_SIO_S2         BIT2            // Xgbvrbg = 2bit

#define APCI8304_SIO_BPS115200  0x0001          // 115200 BPS
#define APCI8304_SIO_BPS57600   0x0002          //  57600 BPS
#define APCI8304_SIO_BPS38400   0x0003          //  38400 BPS
#define APCI8304_SIO_BPS19200   0x0006          //  19200 BPS
#define APCI8304_SIO_BPS9600    0x000c          //   9600 BPS
#define APCI8304_SIO_BPS7200    0x0010          //   7200 BPS
#define APCI8304_SIO_BPS4800    0x0018          //   4800 BPS
#define APCI8304_SIO_BPS3600    0x0020          //   3600 BPS
#define APCI8304_SIO_BPS2400    0x0030          //   2400 BPS
#define APCI8304_SIO_BPS2000    0x003a          //   2000 BPS (ݒ덷0.068%)
#define APCI8304_SIO_BPS1800    0x0040          //   1800 BPS
#define APCI8304_SIO_BPS1200    0x0060          //   1200 BPS
#define APCI8304_SIO_BPS600     0x00c0          //    600 BPS
#define APCI8304_SIO_BPS300     0x0180          //    300 BPS
#define APCI8304_SIO_BPS150     0x0300          //    150 BPS
#define APCI8304_SIO_BPS134_5   0x0359          //  134.5 BPS (ݒ덷0.058%)
#define APCI8304_SIO_BPS110     0x0417          //    110 BPS (ݒ덷0.026%)
#define APCI8304_SIO_BPS75      0x0600          //     75 BPS
#define APCI8304_SIO_BPS50      0x0900          //     50 BPS

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