Lines Matching defs:msd

254 static void	msflush(struct msdata *msd);
255 static void msinput(/* struct msdata *msd, char c */); /* XXX */
285 register struct msdata *msd;
301 msd = kmem_zalloc(sizeof (struct msdata), KM_SLEEP);
307 q->q_ptr = msd;
308 WR(q)->q_ptr = msd;
320 kmem_free(msd, sizeof (struct msdata));
332 kmem_free(msd, sizeof (struct msdata));
354 msd->msd_flags |= MS_IOCWAIT; /* indicate that we're waiting for */
355 msd->msd_iocid = iocb->ioc_id; /* this response */
356 msd->msd_baud_rate = B9600;
357 msd->msd_rcnt_baud_chng = 1;
358 msd->msd_data_pkt_cnt = 0;
359 msd->msd_qenable_more = 0;
360 msd->msd_hold_baud_stup = MS_HOLD_BAUD_STUP;
363 ms = &msd->msd_softc;
368 while (msd->msd_flags & MS_IOCWAIT) {
374 if ((error = msd->msd_iocerror) != 0)
380 msd->msd_state = MS_WAIT_BUTN;
381 msd->msd_readq = q;
382 msd->msd_iocpending = NULL;
395 msflush(msd);
398 msd->msd_flags = MS_OPEN;
409 kmem_free(msd, sizeof (struct msdata));
424 register struct msdata *msd = (struct msdata *)q->q_ptr;
438 msd->msd_flags = 0;
440 if (msd->msd_jitter) {
441 (void) quntimeout(q, msd->msd_timeout_id);
442 msd->msd_jitter = 0;
444 if (msd->msd_reioctl_id) {
445 qunbufcall(q, msd->msd_reioctl_id);
446 msd->msd_reioctl_id = 0;
448 if (msd->msd_resched_id) {
449 qunbufcall(q, msd->msd_resched_id);
450 msd->msd_resched_id = 0;
452 if (msd->msd_iocpending != NULL) {
459 freemsg(msd->msd_iocpending);
460 msd->msd_iocpending = NULL;
462 ms = &msd->msd_softc;
467 kmem_free((void *)msd, sizeof (*msd));
479 struct msdata *msd = (struct msdata *)q->q_ptr;
491 if (!(msd->msd_flags & MS_OPEN)) {
495 ms = &msd->msd_softc;
497 if (msd->msd_rcnt_baud_chng && ms->ms_oldoff != b->mb_off) {
501 if (no_pkt < msd->msd_hold_baud_stup) {
502 msd->msd_qenable_more = 1;
508 for (i = 0; i < msd->msd_hold_baud_stup; i++) {
514 msd->msd_rcnt_baud_chng = 0;
515 msd->msd_data_pkt_cnt = 0;
516 msd->msd_qenable_more = 0;
539 if (msd->msd_resched_id)
540 qunbufcall(q, msd->msd_resched_id);
541 msd->msd_resched_id = qbufcall(q, 3, BPRI_HI,
542 msresched, msd);
543 if (msd->msd_resched_id == 0)
588 if (msd->msd_resched_id)
589 qunbufcall(q, msd->msd_resched_id);
590 msd->msd_resched_id = qbufcall(q,
592 BPRI_HI, msresched, msd);
593 if (msd->msd_resched_id == 0)
616 if (msd->msd_resched_id)
617 qunbufcall(q, msd->msd_resched_id);
618 msd->msd_resched_id = qbufcall(q,
620 BPRI_HI, msresched, msd);
621 if (msd->msd_resched_id == 0)
643 if (msd->msd_resched_id)
644 qunbufcall(q, msd->msd_resched_id);
645 msd->msd_resched_id = qbufcall(q,
647 BPRI_HI, msresched, msd);
648 if (msd->msd_resched_id == 0)
681 struct msdata *msd = msdptr;
683 msd->msd_resched_id = 0;
684 if ((q = msd->msd_readq) != 0)
723 struct msdata *msd = msdptr;
727 msd->msd_reioctl_id = 0;
728 q = msd->msd_readq;
729 if ((mp = msd->msd_iocpending) != NULL) {
730 msd->msd_iocpending = NULL; /* not pending any more */
740 struct msdata *msd;
748 msd = (struct msdata *)q->q_ptr;
749 if (msd == NULL) {
753 ms = &msd->msd_softc;
772 msflush(msd);
854 if (msd->msd_iocpending != NULL)
855 freemsg(msd->msd_iocpending);
856 msd->msd_iocpending = mp;
857 if (msd->msd_reioctl_id)
858 qunbufcall(q, msd->msd_reioctl_id);
859 msd->msd_reioctl_id = qbufcall(q, ioctlrespsize, BPRI_HI,
860 msreioctl, msd);
884 msflush(msd)
885 register struct msdata *msd;
887 register struct ms_softc *ms = &msd->msd_softc;
894 msd->msd_oldbutt = ms->ms_prevbuttons;
895 if ((q = msd->msd_readq) != NULL && q->q_next != NULL)
908 register struct msdata *msd = (struct msdata *)q->q_ptr;
917 if (msd == 0)
933 if (msd->msd_flags & MS_IOCTOSS) {
938 if (msd->msd_rcnt_baud_chng && msd->msd_data_pkt_cnt == 0) {
950 if (msd->msd_rcnt_baud_chng) {
951 switch (msd->msd_baud_rate) {
953 msd->msd_hold_baud_stup = MS_HOLD_BAUD_STUP/2;
954 msd->msd_baud_rate = B4800;
958 if (msd->msd_data_pkt_cnt <= MS_CNT_TOB1200) {
959 msd->msd_hold_baud_stup =
961 msd->msd_baud_rate = B1200;
963 msd->msd_hold_baud_stup =
965 msd->msd_baud_rate = B9600;
971 msd->msd_hold_baud_stup = MS_HOLD_BAUD_STUP;
972 msd->msd_baud_rate = B9600;
976 msd->msd_hold_baud_stup = MS_HOLD_BAUD_STUP;
977 msd->msd_baud_rate = B9600;
998 cb->c_cflag = CREAD|CS8|msd->msd_baud_rate;
1006 msd->msd_flags |= MS_IOCTOSS|MS_IOCWAIT;
1007 msd->msd_iocid = iocb->ioc_id;
1008 msflush(msd);
1012 msd->msd_rcnt_baud_chng = 1;
1013 msd->msd_data_pkt_cnt = 0;
1015 printf("baud %x\n", msd->msd_baud_rate);
1027 if (!(msd->msd_flags & MS_IOCWAIT) ||
1028 iocp->ioc_id != msd->msd_iocid) {
1034 msd->msd_flags &= ~MS_IOCWAIT;
1035 msd->msd_iocerror = iocp->ioc_error;
1040 if (msd->msd_flags & MS_IOCTOSS) {
1041 msd->msd_flags &= ~MS_IOCTOSS;
1042 msflush(msd);
1050 if ((msd->msd_flags & MS_IOCTOSS) ||
1051 !(msd->msd_flags & MS_OPEN)) {
1067 if (msd->msd_rcnt_baud_chng)
1068 msd->msd_data_pkt_cnt++;
1069 msinput(msd, *readp++);
1098 msinput(msd, c)
1099 register struct msdata *msd;
1108 ms = &msd->msd_softc;
1115 switch (msd->msd_state) {
1122 if (msd->msd_rcnt_baud_chng) {
1123 msflush(msd);
1124 flushq(msd->msd_readq, FLUSHALL);
1125 msd->msd_hold_baud_stup++;
1180 if (msd->msd_state == MS_WAIT_Y2)
1181 msd->msd_state = MS_WAIT_BUTN; /* BONG. Start again. */
1183 msd->msd_state += 1;
1187 if (msd->msd_jitter) {
1188 (void) quntimeout(msd->msd_readq, msd->msd_timeout_id);
1189 msd->msd_jitter = 0;
1192 if (mi->mi_buttons == msd->msd_oldbutt) {
1213 msd->msd_jitter = 1;
1214 msd->msd_timeout_id = qtimeout(msd->msd_readq,
1215 msincr, msd, msjittertimeout);
1219 msd->msd_oldbutt = mi->mi_buttons;
1220 msincr(msd);
1230 struct msdata *msd = arg;
1231 register struct ms_softc *ms = &msd->msd_softc;
1243 msd->msd_jitter = 0;
1284 msflush(msd);
1293 if (wake || msd->msd_qenable_more)
1294 qenable(msd->msd_readq); /* run the service procedure */