Changeset d17733c in rtems


Ignore:
Timestamp:
May 24, 2010, 3:05:19 PM (9 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
b450e0c
Parents:
b60473c
Message:

2010-05-24 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, amba/amba.c, console/console.c, console/debugputs.c, startup/bspstart.c: Rework initialization order so AMBA bus is scanned earlier. This lets us look for UARTs earlier and support printk as early as bsp_start() returning.
Location:
c/src/lib/libbsp/sparc/leon3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/ChangeLog

    rb60473c rd17733c  
     12010-05-24      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * Makefile.am, amba/amba.c, console/console.c, console/debugputs.c,
     4        startup/bspstart.c: Rework initialization order so AMBA bus is
     5        scanned earlier. This lets us look for UARTs earlier and support
     6        printk as early as bsp_start() returning.
     7
    182010-05-11      Sebastian Huber <sebastian.huber@embedded-brains.de>
    29
  • c/src/lib/libbsp/sparc/leon3/Makefile.am

    rb60473c rd17733c  
    4040libbsp_a_SOURCES += ../../shared/bspclean.c ../../shared/bsplibc.c \
    4141    ../../shared/bsppost.c ../../shared/bootcard.c startup/bspstart.c \
    42     ../../sparc/shared/bsppretaskinghook.c \
     42    ../../sparc/shared/bsppretaskinghook.c ../../shared/bsppredriverhook.c \
    4343    ../../sparc/shared/bspgetworkarea.c ../../shared/sbrk.c startup/setvec.c \
    4444    startup/spurious.c startup/bspidle.S
  • c/src/lib/libbsp/sparc/leon3/amba/amba.c

    rb60473c rd17733c  
    2525
    2626/*
    27  *  bsp_predriver_hook
     27 *  amba_initialize
    2828 *
    29  *  BSP predriver hook.  Called just before drivers are initialized.
     29 *  Must be called just before drivers are initialized.
    3030 *  Used to scan system bus. Probes for AHB masters, AHB slaves and
    3131 *  APB slaves. Addresses to configuration areas of the AHB masters,
     
    4444
    4545extern rtems_configuration_table Configuration;
     46extern int scan_uarts(void);
    4647
    47 void bsp_predriver_hook(void)
     48void amba_initialize(void)
    4849{
    4950  int i;
     
    7273  }
    7374
     75  /* find UARTS */
     76  scan_uarts();
    7477}
  • c/src/lib/libbsp/sparc/leon3/console/console.c

    rb60473c rd17733c  
    7777 */
    7878int uarts = 0;
    79 static int isinit = 0;
    8079volatile LEON3_UART_Regs_Map *LEON3_Console_Uart[LEON3_APBUARTS];
    81 
    82 int scan_uarts(void) {
    83   int i;
    84   amba_apb_device apbuarts[LEON3_APBUARTS];
    85 
    86   if (isinit == 0) {
    87     i = 0;
    88     uarts = 0;
    89 
    90     uarts = amba_find_apbslvs(
    91       &amba_conf, VENDOR_GAISLER, GAISLER_APBUART, apbuarts, LEON3_APBUARTS);
    92     for(i=0; i<uarts; i++) {
    93       LEON3_Console_Uart[i] = (volatile LEON3_UART_Regs_Map *)apbuarts[i].start;
    94     }
    95     isinit = 1;
    96   }
    97   return uarts;
    98 }
    9980
    10081rtems_device_driver console_initialize(
     
    11091  rtems_termios_initialize();
    11192
    112   /* Find UARTs */
    113   scan_uarts();
    114 
    115   /* default to zero and override if multiprocessing */
     93  /* default console to zero and override if multiprocessing */
    11694  uart0 = 0;
    11795  #if defined(RTEMS_MULTIPROCESSING)
     
    12199
    122100  /*  Register Device Names */
    123 
    124   if (uarts && (uart0 < uarts))
    125   {
     101  if (uarts && (uart0 < uarts)) {
    126102    status = rtems_io_register_name( "/dev/console", major, 0 );
    127103    if (status != RTEMS_SUCCESSFUL)
     
    129105
    130106    strcpy(console_name,"/dev/console_a");
    131     for (i = uart0+1; i < uarts; i++)
    132     {
     107    for (i = uart0+1; i < uarts; i++) {
    133108      console_name[13]++;
    134109      status = rtems_io_register_name( console_name, major, i);
    135110    }
    136111  }
    137 
    138112
    139113  /*
  • c/src/lib/libbsp/sparc/leon3/console/debugputs.c

    rb60473c rd17733c  
    2727 */
    2828extern int uarts;
     29
     30static int isinit = 0;
     31
     32/*
     33 *  Scan for UARTS in configuration
     34 */
     35int scan_uarts(void)
     36{
     37  int i;
     38  amba_apb_device apbuarts[LEON3_APBUARTS];
     39
     40  if (isinit == 0) {
     41    i = 0;
     42    uarts = 0;
     43
     44    uarts = amba_find_apbslvs(
     45      &amba_conf, VENDOR_GAISLER, GAISLER_APBUART, apbuarts, LEON3_APBUARTS);
     46    for(i=0; i<uarts; i++) {
     47      LEON3_Console_Uart[i] = (volatile LEON3_UART_Regs_Map *)apbuarts[i].start;
     48    }
     49
     50    /* initialize uart 0 if present for printk */
     51    if ( uarts ) {
     52      LEON3_Console_Uart[0]->ctrl |=
     53        LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
     54      LEON3_Console_Uart[0]->status = 0;
     55    }
     56    isinit = 1;
     57  }
     58
     59  return uarts;
     60}
    2961
    3062/*
  • c/src/lib/libbsp/sparc/leon3/startup/bspstart.c

    rb60473c rd17733c  
    2828int CPU_SPARC_HAS_SNOOPING;
    2929
     30extern void amba_initialize(void);
     31
    3032/*
    3133 * set_snooping
     
    5557{
    5658  CPU_SPARC_HAS_SNOOPING = set_snooping();
     59
     60  /* Find UARTs */
     61  amba_initialize();
    5762}
Note: See TracChangeset for help on using the changeset viewer.