Changeset 605b4b64 in rtems


Ignore:
Timestamp:
Apr 19, 2012, 1:21:24 PM (8 years ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
4.11, master
Children:
5d48037
Parents:
5903484
git-author:
Daniel Hellstrom <daniel@…> (04/19/12 13:21:24)
git-committer:
Gedare Bloom <gedare@…> (04/19/12 16:34:21)
Message:

LEON3: debugputs removed pointless isinit code, invoked only once

Signed-off-by: Daniel Hellstrom <daniel@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/leon3/console/debugputs.c

    r5903484 r605b4b64  
    2121#include <assert.h>
    2222#include <stdio.h>
    23 
    24 static int isinit = 0;
    2523
    2624/* Let user override which on-chip APBUART will be debug UART
     
    5149  struct ambapp_apb_info *apb;
    5250
    53   if (isinit == 0) {
    54     /* Update debug_uart_index to index used as debug console.
    55      * Let user select Debug console by setting debug_uart_index. If the
    56      * BSP is to provide the default UART (debug_uart_index==0):
    57      *   non-MP: APBUART[0] is debug console
    58      *   MP: LEON CPU index select UART
    59      */
    60     if (debug_uart_index == 0) {
     51  /* Update debug_uart_index to index used as debug console.
     52   * Let user select Debug console by setting debug_uart_index. If the
     53   * BSP is to provide the default UART (debug_uart_index==0):
     54   *   non-MP: APBUART[0] is debug console
     55   *   MP: LEON CPU index select UART
     56   */
     57  if (debug_uart_index == 0) {
    6158#if defined(RTEMS_MULTIPROCESSING)
    62       debug_uart_index = LEON3_Cpu_Index;
     59    debug_uart_index = LEON3_Cpu_Index;
    6360#else
    64       debug_uart_index = 0;
     61    debug_uart_index = 0;
    6562#endif
    66     } else {
    67       debug_uart_index = debug_uart_index - 1; /* User selected dbg-console */
    68     }
    69 
    70     /* Find APBUART core for System Debug Console */
    71     i = debug_uart_index;
    72     adev = (void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
    73                                    VENDOR_GAISLER, GAISLER_APBUART,
    74                                    ambapp_find_by_idx, (void *)&i);
    75     if (adev) {
    76       /* Found a matching debug console, initialize debug uart if present
    77        * for printk
    78        */
    79       apb = (struct ambapp_apb_info *)adev->devinfo;
    80       dbg_uart = (ambapp_apb_uart *)apb->start;
    81       dbg_uart->ctrl |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
    82       dbg_uart->status = 0;
    83     }
    84     isinit = 1;
     63  } else {
     64    debug_uart_index = debug_uart_index - 1; /* User selected dbg-console */
    8565  }
    8666
    87   if (dbg_uart == NULL)
     67  /* Find APBUART core for System Debug Console */
     68  i = debug_uart_index;
     69  adev = (void *)ambapp_for_each(&ambapp_plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
     70                                 VENDOR_GAISLER, GAISLER_APBUART,
     71                                 ambapp_find_by_idx, (void *)&i);
     72  if (adev) {
     73    /* Found a matching debug console, initialize debug uart if present
     74     * for printk
     75     */
     76    apb = (struct ambapp_apb_info *)adev->devinfo;
     77    dbg_uart = (ambapp_apb_uart *)apb->start;
     78    dbg_uart->ctrl |= LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE;
     79    dbg_uart->status = 0;
     80    return 1;
     81  } else
    8882    return 0;
    89   else
    90     return 1;
    9183}
    9284
Note: See TracChangeset for help on using the changeset viewer.