uart.c
void uart_init(int n)
{
  if (n == 0) {
    // Configure port
    set_pin_mode(PORTA, 4, 2);
  }

  // Enable clock
  if (n < 4) {
    BUS_CLK_GATING3 |= BIT(16 + n);
    BUS_SOFT_RST4 |= BIT(16 + n);
  } else {
    // XXX: S_UART?
  }

  // Configure baud rate
  UART_LCR(n) = (1 << 7) | 3;
  UART_DLL(n) = 13;
  UART_LCR(n) = 3;

  // Enable FIFO
  UART_FCR(n) = 0x00000001;

#ifdef GDBSTUB
  if (n == 0) {
    // signal UART0 interrupt as FIQ for the GDB stub
    irq_enable_fiq(32);
    UART_IER(n) |= BIT(0);
  }
#endif
}
// Set up a UART (serial port)
Set up a UART (serial port)
Set up a UART ( serial port )
void uart_init(int n)
{
  if (n == 0) {
    set_pin_mode(PORTA, 4, 2);
  }
  if (n < 4) {
    BUS_CLK_GATING3 |= BIT(16 + n);
    BUS_SOFT_RST4 |= BIT(16 + n);
  } else {
  }
  UART_LCR(n) = (1 << 7) | 3;
  UART_DLL(n) = 13;
  UART_LCR(n) = 3;
  UART_FCR(n) = 0x00000001;
#ifdef GDBSTUB
  if (n == 0) {
    irq_enable_fiq(32);
    UART_IER(n) |= BIT(0);
  }
#endif
}
void uart_init ( int n ) { if ( n == 0 ) { set_pin_mode ( PORTA , 4 , 2 ) ; } if ( n < 4 ) { BUS_CLK_GATING3 |= BIT ( 16 + n ) ; BUS_SOFT_RST4 |= BIT ( 16 + n ) ; } else { } UART_LCR ( n ) = ( 1 << 7 ) | 3 ; UART_DLL ( n ) = 13 ; UART_LCR ( n ) = 3 ; UART_FCR ( n ) = 0x00000001 ; #ifdef GDBSTUB if ( n == 0 ) { irq_enable_fiq ( 32 ) ; UART_IER ( n ) |= BIT ( 0 ) ; } #endif }
Set up a UART (serial port)
Set up a UART ( serial port )
// Configure port // Enable clock // XXX: S_UART? // Configure baud rate // Enable FIFO // signal UART0 interrupt as FIQ for the GDB stub