Minor cleanup.

This commit is contained in:
mycroft 1994-07-17 19:35:32 +00:00
parent ee120821cf
commit 10e27106d0
1 changed files with 43 additions and 36 deletions

View File

@ -20,7 +20,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pms.c,v 1.10 1994/07/17 19:24:40 mycroft Exp $
* $Id: pms.c,v 1.11 1994/07/17 19:35:32 mycroft Exp $
*/
/*
@ -108,41 +108,48 @@ struct cfdriver pmscd = {\
#define PMSUNIT(dev) (minor(dev))
static inline void
pms_flush(int ioport)
pms_flush(iobase)
u_short iobase;
{
u_char c;
while (c = inb(ioport+PMS_STATUS) & 0x03)
while (c = inb(iobase+PMS_STATUS) & 0x03)
if ((c & PMS_OBUF_FULL) == PMS_OBUF_FULL) {
/* XXX - delay is needed to prevent some keyboards from
wedging when the system boots */
delay(6);
(void) inb(ioport+PMS_DATA);
(void) inb(iobase+PMS_DATA);
}
}
static inline void
pms_dev_cmd(int ioport, u_char value)
pms_dev_cmd(iobase, value)
u_short iobase;
u_char value;
{
pms_flush(ioport);
outb(ioport+PMS_CNTRL, 0xd4);
pms_flush(ioport);
outb(ioport+PMS_DATA, value);
pms_flush(iobase);
outb(iobase+PMS_CNTRL, 0xd4);
pms_flush(iobase);
outb(iobase+PMS_DATA, value);
}
static inline void
pms_aux_cmd(int ioport, u_char value)
pms_aux_cmd(iobase, value)
u_short iobase;
u_char value;
{
pms_flush(ioport);
outb(ioport+PMS_CNTRL, value);
pms_flush(iobase);
outb(iobase+PMS_CNTRL, value);
}
static inline void
pms_pit_cmd(int ioport, u_char value)
pms_pit_cmd(iobase, value)
u_short iobase;
u_char value;
{
pms_flush(ioport);
outb(ioport+PMS_CNTRL, 0x60);
pms_flush(ioport);
outb(ioport+PMS_DATA, value);
pms_flush(iobase);
outb(iobase+PMS_CNTRL, 0x60);
pms_flush(iobase);
outb(iobase+PMS_DATA, value);
}
int
@ -152,14 +159,14 @@ pmsprobe(parent, self, aux)
{
struct isa_attach_args *ia = aux;
u_short iobase = ia->ia_iobase;
u_char c;
u_char x;
pms_dev_cmd(iobase, PMS_RESET);
pms_aux_cmd(iobase, PMS_MAGIC_1);
pms_aux_cmd(iobase, PMS_MAGIC_2);
c = inb(iobase+PMS_DATA);
x = inb(iobase+PMS_DATA);
pms_pit_cmd(iobase, PMS_INT_DISABLE);
if (c & 0x04)
if (x & 0x04)
return 0;
ia->ia_iosize = PMS_NPORTS;
@ -178,7 +185,7 @@ pmsattach(parent, self, aux)
printf("\n");
/* Save I/O base address. */
/* Other initialization was done by pmsprobe. */
sc->sc_iobase = iobase;
sc->sc_state = 0;
@ -283,10 +290,10 @@ pmsread(dev, uio, flag)
if (length > sizeof(buffer))
length = sizeof(buffer);
/* Remove a small chunk from input queue. */
/* Remove a small chunk from the input queue. */
(void) q_to_b(&sc->sc_q, buffer, length);
/* Copy data to user process. */
/* Copy the data to the user process. */
if (error = uiomove(buffer, length, uio))
break;
}
@ -324,8 +331,8 @@ pmsioctl(dev, cmd, addr, flag)
if (sc->sc_y > 127)
info.ymotion = 127;
else if (sc->sc_y < -128)
info.ymotion = -128;
else if (sc->sc_y < -127)
info.ymotion = -127;
else
info.ymotion = sc->sc_y;