static int att20c490_probe(void) { unsigned char oldcomm, notcomm, oldpel, v; int flag = 0; _ramdac_dactocomm(); oldcomm = port_in(PEL_MSK); _ramdac_dactopel(); oldpel = port_in(PEL_MSK); notcomm = ~oldcomm; port_out_r(PEL_MSK, notcomm); _ramdac_dactocomm(); v = port_in(PEL_MSK); if (v != notcomm) { if ((_ramdac_setcomm(0xe0) & 0xe0) == 0xe0) { if ((_ramdac_setcomm(0x60) & 0xe0) == 0) { if ((_ramdac_setcomm(2) & 2) > 0) flag = 1; /* 20c490 */ else flag = 1; /* 20c493 */ } else { _ramdac_setcomm(oldcomm); if (port_in(PEL_MSK) == notcomm) if (_ramdac_setcomm(0xFF) == 0xFF) flag = 1; /* 20c491/20c492 */ } } } _ramdac_dactocomm(); port_out_r(PEL_MSK, oldcomm); _ramdac_dactopel(); port_out_r(PEL_MSK, oldpel); return flag; }
unsigned char _ramdac_setcomm(unsigned char data) { _ramdac_dactocomm(); port_out_r(PEL_MSK, data); _ramdac_dactocomm(); return port_in(PEL_MSK); }
static int ICW_probe(void) { unsigned char mi, di; _ramdac_dactocomm(); port_in(PEL_MSK); /* Control register 0. */ mi = port_in(PEL_MSK); /* Manufacturer ID. */ di = port_in(PEL_MSK); /* Device ID. */ if (mi == 0x84) { if (di == 0x98) return 1; fprintf(stderr,"svgalib: ICW_probe: Unknown IC Works DAC.\n"); } return 0; }