Lines Matching refs:PortP
80 static void RIOClearUp(struct Port *PortP);
83 int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg);
93 struct Port *PortP; /* pointer to the port structure */
129 PortP = p->RIOPortp[SysPort]; /* Get control struc */
130 rio_dprintk(RIO_DEBUG_TTY, "PortP: %p\n", PortP);
131 if (!PortP->Mapped) { /* we aren't mapped yet! */
141 tty->driver_data = PortP;
143 PortP->gs.port.tty = tty;
144 PortP->gs.port.count++;
146 rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
148 retval = gs_init_port(&PortP->gs);
150 PortP->gs.port.count--;
157 if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) {
173 while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
174 if (!PortP->WaitUntilBooted) {
184 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
196 rio_spin_lock_irqsave(&PortP->portSem, flags);
206 while ((PortP->State & RIO_CLOSING) && !p->RIOHalted) {
210 RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
214 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
215 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
216 rio_spin_lock_irqsave(&PortP->portSem, flags);
220 rio_spin_lock_irqsave(&PortP->portSem, flags);
223 if (!PortP->Mapped) {
225 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
242 if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
243 PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW);
246 if (!(PortP->firstOpen)) { /* First time ? */
250 PortP->firstOpen++;
251 PortP->CookMode = 0;
252 PortP->InUse = NOT_INUSE;
254 /* PortP->gs.xmit_cnt = 0; */
256 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
262 RIOParam(PortP, RIOC_OPEN, 1, OK_TO_SLEEP); /* Open the port */
263 rio_spin_lock_irqsave(&PortP->portSem, flags);
268 while (!(PortP->PortState & PORT_ISOPEN) && !p->RIOHalted) {
269 rio_dprintk(RIO_DEBUG_TTY, "Waiting for PORT_ISOPEN-currently %x\n", PortP->PortState);
270 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
271 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
273 RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
277 rio_spin_lock_irqsave(&PortP->portSem, flags);
283 /* RIOClearUp( PortP ); */
284 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
295 if ((PortP->gs.port.tty->termios->c_cflag & CLOCAL) ||
296 (PortP->ModemState & RIOC_MSVR1_CD)) {
302 PortP->State |= RIO_CARR_ON;
303 wake_up_interruptible(&PortP->gs.port.open_wait);
306 while (!(PortP->gs.port.tty->termios->c_state & CARR_ON) &&
309 while (!(PortP->State & RIO_CARR_ON) && !(filp->f_flags & O_NONBLOCK) && !p->RIOHalted) {
312 PortP->gs.port.tty->termios->c_state |= WOPEN;
314 PortP->State |= RIO_WOPEN;
315 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
316 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
317 rio_spin_lock_irqsave(&PortP->portSem, flags);
324 RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
328 PortP->State &= ~RIO_WOPEN;
329 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
333 rio_spin_lock_irqsave(&PortP->portSem, flags);
335 PortP->State &= ~RIO_WOPEN;
340 PortP->State |= RIO_MOPEN;
350 if (PortP->statsGather)
351 PortP->opens++;
353 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
367 struct Port *PortP = ptr; /* pointer to the port structure */
377 rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum);
379 /* PortP = p->RIOPortp[SysPort]; */
380 rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP);
381 /* tp = PortP->TtyP; *//* Get tty */
382 tty = PortP->gs.port.tty;
385 if (PortP->gs.closing_wait)
386 end_time = jiffies + PortP->gs.closing_wait;
390 rio_spin_lock_irqsave(&PortP->portSem, flags);
396 PortP->State |= RIO_CLOSING;
398 if ((PortP->State & RIO_DELETED)) {
404 RIOClearUp(PortP);
413 PortP->State &= ~RIO_MOPEN;
414 PortP->State &= ~RIO_CARR_ON;
415 PortP->ModemState &= ~RIOC_MSVR1_CD;
423 if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
428 rio_dprintk(RIO_DEBUG_TTY, "Channel %d still open !\n", PortP->PortNum);
429 PortP->State &= ~RIO_CLOSING;
430 if (PortP->firstOpen)
431 PortP->firstOpen--;
432 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
438 PortP->State &= ~RIO_DYNOROD;
448 while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) {
452 RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
456 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
457 if (RIODelay_ni(PortP, HUNDRED_MS * 10) == RIO_FAIL) {
460 rio_spin_lock_irqsave(&PortP->portSem, flags);
463 rio_spin_lock_irqsave(&PortP->portSem, flags);
466 PortP->TxBufferIn = PortP->TxBufferOut = 0;
469 PortP->InUse = 0;
470 if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
475 rio_dprintk(RIO_DEBUG_TTY, "Channel %d re-open!\n", PortP->PortNum);
476 PortP->State &= ~RIO_CLOSING;
477 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
478 if (PortP->firstOpen)
479 PortP->firstOpen--;
484 RIOClearUp(PortP);
489 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
491 if (RIOShortCommand(p, PortP, RIOC_CLOSE, 1, 0) == RIO_FAIL) {
492 RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
493 rio_spin_lock_irqsave(&PortP->portSem, flags);
498 while (try && (PortP->PortState & PORT_ISOPEN)) {
502 RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
505 rio_dprintk(RIO_DEBUG_TTY, "Close: PortState:ISOPEN is %d\n", PortP->PortState & PORT_ISOPEN);
508 RIOClearUp(PortP);
509 rio_spin_lock_irqsave(&PortP->portSem, flags);
512 if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
514 RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE);
518 rio_spin_lock_irqsave(&PortP->portSem, flags);
521 /* RIOPreemptiveCmd(p, PortP, RIOC_FCLOSE); */
527 PortP->Config &= ~(RIO_CTSFLOW | RIO_RTSFLOW);
532 if (PortP->statsGather)
533 PortP->closes++;
536 PortP->State &= ~(RIO_CLOSING | RIO_DELETED);
537 if (PortP->firstOpen)
538 PortP->firstOpen--;
539 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
546 static void RIOClearUp(struct Port *PortP)
549 PortP->Config = 0; /* Direct semaphore */
550 PortP->PortState = 0;
551 PortP->firstOpen = 0;
552 PortP->FlushCmdBodge = 0;
553 PortP->ModemState = PortP->CookMode = 0;
554 PortP->Mapped = 0;
555 PortP->WflushFlag = 0;
556 PortP->MagicFlags = 0;
557 PortP->RxDataStart = 0;
558 PortP->TxBufferIn = 0;
559 PortP->TxBufferOut = 0;
571 int RIOShortCommand(struct rio_info *p, struct Port *PortP, int command, int len, int arg)
579 if (PortP->State & RIO_DELETED) {
583 rio_spin_lock_irqsave(&PortP->portSem, flags);
589 while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted) {
591 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
595 if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) {
598 rio_spin_lock_irqsave(&PortP->portSem, flags);
600 if (PortP->State & RIO_DELETED) {
602 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
606 while (!can_add_transmit(&PacketP, PortP) && !p->RIOHalted) {
608 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
613 if (RIODelay_ni(PortP, HUNDRED_MS) == RIO_FAIL) {
616 rio_spin_lock_irqsave(&PortP->portSem, flags);
620 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
637 add_transmit(PortP);
641 if (PortP->statsGather)
642 PortP->txchars += len;
644 rio_spin_unlock_irqrestore(&PortP->portSem, flags);