int cbmarch_iec_wait(CBM_FILE HandleDevice, int Line, int State) { FUNC_ENTER(); if (State) { while(!cbm_iec_get(HandleDevice, Line)) arch_usleep(10); } else { while(cbm_iec_get(HandleDevice, Line)) arch_usleep(10); } FUNC_LEAVE_INT(cbmarch_iec_poll(HandleDevice)); }
static int pp_read(CBM_FILE fd, unsigned char *c1, unsigned char *c2) { pp_check_direction(PP_READ); #ifndef USE_CBM_IEC_WAIT while(!cbm_iec_get(fd, IEC_DATA)); #else cbm_iec_wait(fd, IEC_DATA, 1); #endif *c1 = cbm_pp_read(fd); cbm_iec_release(fd, IEC_CLOCK); #ifndef USE_CBM_IEC_WAIT while(cbm_iec_get(fd, IEC_DATA)); #else cbm_iec_wait(fd, IEC_DATA, 0); #endif *c2 = cbm_pp_read(fd); cbm_iec_set(fd, IEC_CLOCK); return 0; }
static int pp_write(CBM_FILE fd, char c1, char c2) { pp_check_direction(PP_WRITE); #ifndef USE_CBM_IEC_WAIT while(!cbm_iec_get(fd, IEC_DATA)); #else cbm_iec_wait(fd, IEC_DATA, 1); #endif cbm_pp_write(fd, c1); cbm_iec_release(fd, IEC_CLOCK); #ifndef USE_CBM_IEC_WAIT while(cbm_iec_get(fd, IEC_DATA)); #else cbm_iec_wait(fd, IEC_DATA, 0); #endif cbm_pp_write(fd, c2); cbm_iec_set(fd, IEC_CLOCK); return 0; }
static void read_line_status(CBM_FILE fd) { int data, clock, atn, reset, pp; FUNC_ENTER(); data = cbm_iec_get(fd, IEC_DATA); clock = cbm_iec_get(fd, IEC_CLOCK); atn = cbm_iec_get(fd, IEC_ATN); reset = cbm_iec_get(fd, IEC_RESET); pp = cbm_pp_read(fd); DBG_PRINT((DBG_PREFIX "READ: DATA = %s, CLOCK = %s, ATN = %s, RESET = %s, PP = $%02x", data ? "TRUE " : "FALSE", clock ? "TRUE " : "FALSE", atn ? "TRUE " : "FALSE", reset ? "TRUE " : "FALSE", pp)); FUNC_LEAVE(); }