Пример #1
0
void UART0_Handler()
{
  c_pos_intEnter();

  uint32_t status;

  status = UARTIntStatus(PORTCFG_CON_USART, true);
  UARTIntClear(PORTCFG_CON_USART, status);

  if (status & UART_INT_TX)
    c_nos_putcharReady();

#if NOSCFG_FEATURE_CONIN == 1
  if (status & (UART_INT_RX | UART_INT_RT)) {

    unsigned char ch;

    while (UARTCharsAvail(PORTCFG_CON_USART)) {

      ch = UARTCharGetNonBlocking(PORTCFG_CON_USART);
      c_nos_keyinput(ch);
    }
  }
#endif


  c_pos_intExitQuick();
}
Пример #2
0
void  PORT_NAKED __attribute__((vector(_UART2_VECTOR), nomips16)) Uart2Handler(void)
{
  portSaveContext();
  c_pos_intEnter();

#if NOSCFG_FEATURE_CONIN == 1
  if (IFS1bits.U2RXIF) {

    unsigned char ch;
    ch = U2RXREG;
    IFS1CLR = _IFS1_U2RXIF_MASK;
    c_nos_keyinput(ch);
  }
#endif

  if (IFS1bits.U2TXIF) {

    IEC1CLR = _IEC1_U2TXIE_MASK;
    IFS1CLR = _IFS1_U2TXIF_MASK;
    c_nos_putcharReady();
  }

  c_pos_intExitQuick();
  portRestoreContext();
}
Пример #3
0
static void
armCpuUartIrqHandler()
{
  int reason;
  unsigned char ch;

  reason = UART0_IIR & 0xf;
  switch (reason) {
  case 0x2: // TX
#if NOSCFG_FEATURE_CONOUT == 1
    c_nos_putcharReady();
#endif
    break;

  case 0x4: // RX
    ch = UART0_RBR;
#if NOSCFG_FEATURE_CONIN == 1
    c_nos_keyinput(ch);
#endif
    break;

  case 0x6: // err
    ch= UART0_LSR;
    break;
  }
}