source: rtems/c/src/lib/libbsp/sparc/leon3/startup/bspstart.c @ 9460333e

5
Last change on this file since 9460333e was 9460333e, checked in by Sebastian Huber <sebastian.huber@…>, on 06/20/16 at 08:08:39

sparc: Rework CPU counter support

Rework CPU counter support to enable use of the GR740 up-counter via
%asr22 and %asr23.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 *  This set of routines starts the application.  It includes application,
3 *  board, and monitor specific initialization and configuration.
4 *  The generic CPU dependent initialization has been performed
5 *  before any of these are invoked.
6 *
7 *  COPYRIGHT (c) 1989-2013.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  Modified for LEON3 BSP.
11 *  COPYRIGHT (c) 2004.
12 *  Gaisler Research.
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#include <bsp.h>
20#include <leon.h>
21#include <bsp/bootcard.h>
22#include <rtems/sysinit.h>
23
24#if defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING)
25/* Irq used by shared memory driver and for inter-processor interrupts.
26 * Can be overridden by being defined in the application.
27 */
28const unsigned char LEON3_mp_irq __attribute__((weak)) = 14;
29#endif
30
31/*
32 * Tells us if data cache snooping is available
33 */
34int CPU_SPARC_HAS_SNOOPING;
35
36/* Index of CPU, in an AMP system CPU-index may be non-zero */
37uint32_t LEON3_Cpu_Index = 0;
38
39/*
40 * set_snooping
41 *
42 * Read the cache control register to determine if
43 * bus snooping is available and enabled. This is needed for some
44 * drivers so that they can select the most efficient copy routines.
45 *
46 */
47
48static inline int set_snooping(void)
49{
50  return (leon3_get_cache_control_register() >> 23) & 1;
51}
52
53/*
54 *  bsp_start
55 *
56 *  This routine does the bulk of the system initialization.
57 */
58void bsp_start( void )
59{
60  CPU_SPARC_HAS_SNOOPING = set_snooping();
61}
62
63static void leon3_cpu_index_init(void)
64{
65  /* Get the LEON3 CPU index, normally 0, but for MP systems we do
66   * _not_ assume that this is CPU0. One may run another OS on CPU0
67   * and RTEMS on this CPU, and AMP system with mixed operating
68   * systems
69   */
70  LEON3_Cpu_Index = _LEON3_Get_current_processor();
71}
72
73RTEMS_SYSINIT_ITEM(
74  leon3_cpu_index_init,
75  RTEMS_SYSINIT_BSP_START,
76  RTEMS_SYSINIT_ORDER_FIRST
77);
Note: See TracBrowser for help on using the repository browser.