コード例 #1
0
ファイル: parnt.c プロジェクト: NoSuchProcess/open-watcom-v2
char *InitSys( void )
{
        static char name[] = "\\\\.\\DBGPORT1";
        int         i;

        if( !(GetVersion() & 0x80000000) ) {
                PortHdl = CreateFile( name,
                                        GENERIC_READ | GENERIC_WRITE,
                                        FILE_SHARE_READ,
                                        NULL,
                                        OPEN_EXISTING,
                                        0,
                                        NULL
                                        );
                if ( PortHdl == INVALID_HANDLE_VALUE )
                        return( TRP_ERR_cannot_access_parallel_ports );
        }
        PortsFound = 0;
        for( i = 0; i < NUM_ELTS( PortTest ); ++i ) {
                if( CheckForPort( i, 0x55 ) && CheckForPort( i, 0xaa ) ) {
                        PortAddress[ PortsFound++ ] = PortTest[ i ];
                }
        }
        return( NULL );
}
コード例 #2
0
static void InitPorts( void )
{
    int                 i;
    int                 portnum;

    portnum = 0;
    for( i = 0; i < 3; ++i ) {
        if( CheckForPort( i, 0x55 ) && CheckForPort( i, 0xaa ) ) {
            PortAddress[ portnum++ ] = PortTest[ i ];
        }
    }
}
コード例 #3
0
ファイル: parlinux.c プロジェクト: ABratovic/open-watcom-v2
char *InitSys()
{
    int i;

    PortsFound = 0;
    for( i = 0; i < NUM_ELTS( PortTest ); ++i ) {
        if (!AccessPorts(PortTest[i], PortTest[i])) {
            printf("Failed to get I/O permissions. This program must run as root!\n");
            exit(-1);
            }
        if( CheckForPort( i, 0x55 ) && CheckForPort( i, 0xaa ) ) {
            PortAddress[ PortsFound++ ] = PortTest[ i ];
        }
        FreePorts(PortTest[i], PortTest[i]);
    }
    return( NULL );
}
コード例 #4
0
char *InitSys()
{
    SEL         global;
    SEL         local;
    int         i;

    DosGetInfoSeg( &global, &local );
    GInfoSeg = MK_FP( global, 0 );

    PortsFound = 0;
    for( i = 0; i < NUM_ELTS( PortTest ); ++i ) {
        AccessPorts( PortTest[i], PortTest[i] );
        if( CheckForPort( i, 0x55 ) && CheckForPort( i, 0xaa ) ) {
            PortAddress[ PortsFound++ ] = PortTest[ i ];
        }
        FreePorts( PortTest[i], PortTest[i] );
    }
    return( 0 );
}