static int lp_reset(int target) { register struct lp_info *lpp; register char *tmpp; #ifdef BIOS_PORTS lpp = &ports[target]; #else lpp = &ports[port_order[target]]; #endif LP_CONTROL(LP_SELECT, lpp); tmpp = (char *)LP_RESET_WAIT; do { } while((int)(--tmpp)); LP_CONTROL(LP_SELECT | LP_INIT, lpp); return LP_STATUS(lpp); }
int lp_reset(int target) { register struct lp_info *lpp; register char *tmpp; #ifndef BIOS_PORTS target = port_order[target]; #endif lpp = &ports[target]; LP_CONTROL(LP_SELECT, lpp); tmpp = 0; while (((int)tmpp) != LP_RESET_WAIT) tmpp++; LP_CONTROL(LP_SELECT | LP_INIT, lpp); return LP_STATUS(lpp); }
static int lp_char_polled(char c, unsigned int target) { int wait; register struct lp_info *lpp; #ifdef BIOS_PORTS lpp = &ports[target]; #else lpp = &ports[port_order[target]]; #endif { register char *statusp; /* safety checks */ statusp = (char *) LP_STATUS(lpp); /* safety checks, note that LP_ERROR and LP_SELECTED * are inverted signals */ if (((int)statusp) & LP_OUTOFPAPER) { /* printer out of paper */ printk("lp%d: out of paper\n", target); return 0; } #if 0 if (!(((int)statusp) & LP_SELECTED)) { /* printer offline */ printk("lp%d: printer offline\n", target); return 0; } #else wait = LP_CHAR_WAIT + 1; while (!(((int)(statusp = (char *)LP_STATUS(lpp))) & LP_SELECTED)) /* while not ready do busy loop */ { if(!--wait) { printk("lp%d: timed out\n", target); return 0; } #if NEED_RESCHED if (need_resched) schedule(); #endif } #endif if (!(((int)statusp) & LP_ERROR)) { /* printer error */ printk("lp%d: printer error\n", target); return 0; } } /* send character to port */ outb_p((unsigned char) c, lpp->io); { register char *waitp; /* 5 us delay */ waitp = 0; while (((int)(waitp++)) != LP_STROBE_WAIT) /* Do nothing */ ; /* strobe high */ LP_CONTROL(LP_SELECT | LP_INIT | LP_STROBE, lpp); /* strobe low */ LP_CONTROL(LP_SELECT | LP_INIT, lpp); /* 5 us delay */ while (waitp--) /* Do nothing */ ; } return 1; }