Changeset 598f39cd in rtems


Ignore:
Timestamp:
Apr 15, 2014, 11:33:42 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
487b94e7
Parents:
509040f0
git-author:
Sebastian Huber <sebastian.huber@…> (04/15/14 11:33:42)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/16/14 07:07:33)
Message:

libchip: SMP support for NS16550

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/libchip/serial/ns16550.c

    r509040f0 r598f39cd  
    5959#endif
    6060
     61static rtems_interrupt_lock ns16550_lock =
     62  RTEMS_INTERRUPT_LOCK_INITIALIZER("NS16550");
     63
    6164/*
    6265 * Flow control is only supported when using interrupts
     
    272275  setRegister_f set = c->setRegister;
    273276  uint32_t status = 0;
    274   rtems_interrupt_level level;
     277  rtems_interrupt_lock_context lock_context;
    275278
    276279  /* Save port interrupt mask */
     
    282285  while (true) {
    283286    /* Try to transmit the character in a critical section */
    284     rtems_interrupt_disable( level);
     287    rtems_interrupt_lock_acquire(&ns16550_lock, &lock_context);
    285288
    286289    /* Read the transmitter holding register and check it */
     
    291294
    292295      /* Finished */
    293       rtems_interrupt_enable( level);
     296      rtems_interrupt_lock_release(&ns16550_lock, &lock_context);
    294297      break;
    295298    } else {
    296       rtems_interrupt_enable( level);
     299      rtems_interrupt_lock_release(&ns16550_lock, &lock_context);
    297300    }
    298301
     
    325328{
    326329  uint32_t                pNS16550;
    327   uint32_t                Irql;
     330  rtems_interrupt_lock_context lock_context;
    328331  ns16550_context        *pns16550Context;
    329332  setRegister_f           setReg;
     
    337340   * Assert RTS
    338341   */
    339   rtems_interrupt_disable(Irql);
     342  rtems_interrupt_lock_acquire(&ns16550_lock, &lock_context);
    340343  pns16550Context->ucModemCtrl|=SP_MODEM_RTS;
    341344  (*setReg)(pNS16550, NS16550_MODEM_CONTROL, pns16550Context->ucModemCtrl);
    342   rtems_interrupt_enable(Irql);
     345  rtems_interrupt_lock_release(&ns16550_lock, &lock_context);
    343346  return 0;
    344347}
     
    351354{
    352355  uint32_t                pNS16550;
    353   uint32_t                Irql;
     356  rtems_interrupt_lock_context lock_context;
    354357  ns16550_context        *pns16550Context;
    355358  setRegister_f           setReg;
     
    363366   * Negate RTS
    364367   */
    365   rtems_interrupt_disable(Irql);
     368  rtems_interrupt_lock_acquire(&ns16550_lock, &lock_context);
    366369  pns16550Context->ucModemCtrl&=~SP_MODEM_RTS;
    367370  (*setReg)(pNS16550, NS16550_MODEM_CONTROL, pns16550Context->ucModemCtrl);
    368   rtems_interrupt_enable(Irql);
     371  rtems_interrupt_lock_release(&ns16550_lock, &lock_context);
    369372  return 0;
    370373}
     
    382385{
    383386  uint32_t                pNS16550;
    384   uint32_t                Irql;
     387  rtems_interrupt_lock_context lock_context;
    385388  ns16550_context        *pns16550Context;
    386389  setRegister_f           setReg;
     
    394397   * Assert DTR
    395398   */
    396   rtems_interrupt_disable(Irql);
     399  rtems_interrupt_lock_acquire(&ns16550_lock, &lock_context);
    397400  pns16550Context->ucModemCtrl|=SP_MODEM_DTR;
    398401  (*setReg)(pNS16550, NS16550_MODEM_CONTROL, pns16550Context->ucModemCtrl);
    399   rtems_interrupt_enable(Irql);
     402  rtems_interrupt_lock_release(&ns16550_lock, &lock_context);
    400403  return 0;
    401404}
     
    408411{
    409412  uint32_t                pNS16550;
    410   uint32_t                Irql;
     413  rtems_interrupt_lock_context lock_context;
    411414  ns16550_context        *pns16550Context;
    412415  setRegister_f           setReg;
     
    420423   * Negate DTR
    421424   */
    422   rtems_interrupt_disable(Irql);
     425  rtems_interrupt_lock_acquire(&ns16550_lock, &lock_context);
    423426  pns16550Context->ucModemCtrl&=~SP_MODEM_DTR;
    424427  (*setReg)(pNS16550, NS16550_MODEM_CONTROL,pns16550Context->ucModemCtrl);
    425   rtems_interrupt_enable(Irql);
     428  rtems_interrupt_lock_release(&ns16550_lock, &lock_context);
    426429  return 0;
    427430}
     
    444447  uint32_t                baud_requested;
    445448  setRegister_f           setReg;
    446   uint32_t                Irql;
     449  rtems_interrupt_lock_context lock_context;
    447450  const console_tbl      *c = Console_Port_Tbl [minor];
    448451
     
    498501   */
    499502
    500   rtems_interrupt_disable(Irql);
     503  rtems_interrupt_lock_acquire(&ns16550_lock, &lock_context);
    501504
    502505    /*
     
    517520    (*setReg)(pNS16550, NS16550_LINE_CONTROL, ucLineControl );
    518521
    519   rtems_interrupt_enable(Irql);
     522  rtems_interrupt_lock_release(&ns16550_lock, &lock_context);
    520523
    521524  return 0;
Note: See TracChangeset for help on using the changeset viewer.