Beispiel #1
0
void ambapp_print(struct ambapp_bus *abus, int show_depth)
{
  struct ambapp_dev_print_arg arg;
  arg.show_depth = show_depth;
  ambapp_for_each(abus, (OPTIONS_ALL_DEVS|OPTIONS_ALL|OPTIONS_DEPTH_FIRST), -1,
                  -1, ambapp_dev_print, &arg);
}
Beispiel #2
0
/* Find all UARTs */
static void leon3_console_scan_uarts(void)
{
  memset(apbuarts, 0, sizeof(apbuarts));

  /* Find APBUART cores */
  ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_APB_SLVS), VENDOR_GAISLER,
                  GAISLER_APBUART, find_matching_apbuart, NULL);
}
Beispiel #3
0
int rtems_leon_open_eth_driver_attach(
  struct rtems_bsdnet_ifconfig *config,
  int attach
)
{
  unsigned int base_addr = 0; /* avoid warnings */
  unsigned int eth_irq = 0;   /* avoid warnings */
  struct ambapp_dev *adev;
  struct ambapp_ahb_info *ahb;

  /* Scan for MAC AHB slave interface */
  adev = (void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_AHB_SLVS),
                                 VENDOR_OPENCORES, OPENCORES_ETHMAC,
                                 ambapp_find_by_idx, NULL);
  if (!adev) {
    adev = (void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_AHB_SLVS),
                                   VENDOR_GAISLER, GAISLER_ETHAHB,
                                   ambapp_find_by_idx, NULL);
  }

  if (adev)
  {
    ahb = DEV_TO_AHB(adev);
    base_addr = ahb->start[0];
    eth_irq = ahb->irq;

    /* clear control register and reset NIC */
    *(volatile int *) base_addr = 0;
    *(volatile int *) base_addr = 0x800;
    *(volatile int *) base_addr = 0;
    leon_open_eth_configuration.base_address = base_addr;
    leon_open_eth_configuration.vector = eth_irq + 0x10;
    leon_open_eth_configuration.txd_count = TDA_COUNT;
    leon_open_eth_configuration.rxd_count = RDA_COUNT;
    /* enable 100 MHz operation only if cpu frequency >= 50 MHz */
    if (LEON3_Timer_Regs->scaler_reload >= 49)
      leon_open_eth_configuration.en100MHz = 1;
    if (rtems_open_eth_driver_attach( config, &leon_open_eth_configuration )) {
      LEON_Clear_interrupt(eth_irq);
      LEON_Unmask_interrupt(eth_irq);
    }
  }
  return 0;
}
/* Initialize the BSP system debug console layer. It will scan AMBA Plu&Play
 * for a debug APBUART and enable RX/TX for that UART.
 */
int bsp_debug_uart_init(void)
{
  int i;
  struct ambapp_dev *adev;
  struct ambapp_apb_info *apb;

  /* Update debug_uart_index to index used as debug console.
   * Let user select Debug console by setting debug_uart_index. If the
   * BSP is to provide the default UART (debug_uart_index==0):
   *   non-MP: APBUART[0] is debug console
   *   MP: LEON CPU index select UART
   */
  if (debug_uart_index == 0) {
#if defined(RTEMS_MULTIPROCESSING)
    debug_uart_index = LEON3_Cpu_Index;
#else
    debug_uart_index = 0;
#endif
  } else {
    debug_uart_index = debug_uart_index - 1; /* User selected dbg-console */
  }

  /* Find APBUART core for System Debug Console */
  i = debug_uart_index;
  adev = (void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
                                 VENDOR_GAISLER, GAISLER_APBUART,
                                 ambapp_find_by_idx, (void *)&i);
  if (adev) {
    /* Found a matching debug console, initialize debug uart if present
     * for printk
     */
    apb = (struct ambapp_apb_info *)adev->devinfo;
    dbg_uart = (ambapp_apb_uart *)apb->start;
    dbg_uart->ctrl |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
    dbg_uart->status = 0;
    return 1;
  } else
    return 0;
}