Lines Matching full:scp

138 pbinb(struct pbio_softc *scp, int off)  in pbinb()  argument
141 return (bus_read_1(scp->res, off)); in pbinb()
145 pboutb(struct pbio_softc *scp, int off, uint8_t val) in pboutb() argument
148 bus_write_1(scp->res, off, val); in pboutb()
155 struct pbio_softc *scp = device_get_softc(dev); in pbioprobe() local
163 scp->res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, in pbioprobe()
165 if (scp->res == NULL) in pbioprobe()
175 pboutb(scp, PBIO_CFG, 0x80); in pbioprobe()
177 rman_get_start(scp->res), pbinb(scp, PBIO_CFG)); in pbioprobe()
178 pboutb(scp, PBIO_PORTA, 0xa5); in pbioprobe()
179 val = pbinb(scp, PBIO_PORTA); in pbioprobe()
185 pboutb(scp, PBIO_PORTA, 0x5a); in pbioprobe()
186 val = pbinb(scp, PBIO_PORTA); in pbioprobe()
195 /* pboutb(scp, PBIO_CFG, 0x9b); */ in pbioprobe()
196 bus_release_resource(dev, SYS_RES_IOPORT, rid, scp->res); in pbioprobe()
246 struct pbio_softc *scp; in pbioioctl() local
251 scp = pbio_addr(dev); in pbioioctl()
252 sx_xlock(&scp->lock); in pbioioctl()
255 scp->pd[port].diff = *(int *)data; in pbioioctl()
258 scp->pd[port].ipace = *(int *)data; in pbioioctl()
261 scp->pd[port].opace = *(int *)data; in pbioioctl()
264 *(int *)data = scp->pd[port].diff; in pbioioctl()
267 *(int *)data = scp->pd[port].ipace; in pbioioctl()
270 *(int *)data = scp->pd[port].opace; in pbioioctl()
275 sx_xunlock(&scp->lock); in pbioioctl()
282 struct pbio_softc *scp; in pbioopen() local
287 scp = pbio_addr(dev); in pbioopen()
296 ocfg = scp->iomode; in pbioopen()
299 sx_xlock(&scp->lock); in pbioopen()
302 pboutb(scp, PBIO_CFG, scp->iomode = (ocfg & (~portbit))); in pbioopen()
305 pboutb(scp, PBIO_CFG, scp->iomode = (ocfg | portbit)); in pbioopen()
308 sx_xunlock(&scp->lock); in pbioopen()
318 portval(int port, struct pbio_softc *scp, char *val) in portval() argument
325 *val = pbinb(scp, PBIO_PORTA); in portval()
328 *val = pbinb(scp, PBIO_PORTB); in portval()
331 *val = (pbinb(scp, PBIO_PORTC) >> 4) & 0xf; in portval()
334 *val = pbinb(scp, PBIO_PORTC) & 0xf; in portval()
340 if (scp->pd[port].diff) { in portval()
341 if (*val != scp->pd[port].oldval) { in portval()
342 scp->pd[port].oldval = *val; in portval()
345 err = pause_sig("pbiopl", max(1, scp->pd[port].ipace)); in portval()
356 struct pbio_softc *scp; in pbioread() local
361 scp = pbio_addr(dev); in pbioread()
364 sx_xlock(&scp->lock); in pbioread()
367 if ((err = uiomove(scp->pd[port].buff, toread, uio)) != 0) in pbioread()
370 if ((err = portval(port, scp, &val)) != 0) in pbioread()
372 scp->pd[port].buff[i] = val; in pbioread()
373 if (!scp->pd[port].diff && scp->pd[port].ipace) in pbioread()
374 pause_sig("pbioip", scp->pd[port].ipace); in pbioread()
377 sx_xunlock(&scp->lock); in pbioread()
384 struct pbio_softc *scp; in pbiowrite() local
389 scp = pbio_addr(dev); in pbiowrite()
392 sx_xlock(&scp->lock); in pbiowrite()
395 if ((ret = uiomove(scp->pd[port].buff, towrite, uio)) != 0) in pbiowrite()
398 val = scp->pd[port].buff[i]; in pbiowrite()
401 pboutb(scp, PBIO_PORTA, val); in pbiowrite()
404 pboutb(scp, PBIO_PORTB, val); in pbiowrite()
407 oval = pbinb(scp, PBIO_PORTC); in pbiowrite()
410 pboutb(scp, PBIO_PORTC, val | oval); in pbiowrite()
413 oval = pbinb(scp, PBIO_PORTC); in pbiowrite()
416 pboutb(scp, PBIO_PORTC, oval | val); in pbiowrite()
419 if (scp->pd[port].opace) in pbiowrite()
420 pause_sig("pbioop", scp->pd[port].opace); in pbiowrite()
423 sx_xunlock(&scp->lock); in pbiowrite()