source: rtems/c/src/lib/libbsp/sparc/leon3/amba/amba.c @ 9c8527b9

4.104.115
Last change on this file since 9c8527b9 was 9c8527b9, checked in by Ralf Corsepius <ralf.corsepius@…>, on 10/30/09 at 12:33:11

Re-add tmp.

  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*
2 *  AMBA Plag & Play Bus Driver
3 *
4 *  This driver hook performs bus scanning.
5 *
6 *  COPYRIGHT (c) 2004.
7 *  Gaisler Research
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#include <bsp.h>
17
18/* Structure containing address to devices found on the Amba Plug&Play bus */
19amba_confarea_type amba_conf;
20
21/* Pointers to Interrupt Controller configuration registers */
22volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs;
23
24int LEON3_Cpu_Index = 0;
25
26/*
27 *  bsp_predriver_hook
28 *
29 *  BSP predriver hook.  Called just before drivers are initialized.
30 *  Used to scan system bus. Probes for AHB masters, AHB slaves and
31 *  APB slaves. Addresses to configuration areas of the AHB masters,
32 *  AHB slaves, APB slaves and APB master are storeds in
33 *  amba_ahb_masters, amba_ahb_slaves and amba.
34 */
35
36unsigned int getasr17(void);
37
38asm(" .text  \n"
39    "getasr17:   \n"
40    "retl \n"
41    "mov %asr17, %o0\n"
42);
43
44
45extern rtems_configuration_table Configuration;
46
47void bsp_predriver_hook(void)
48{
49  int i;
50  amba_apb_device dev;
51
52  /* Scan the AMBA Plug&Play info at the default LEON3 area */
53  amba_scan(&amba_conf,LEON3_IO_AREA,NULL);
54
55  /* Find LEON3 Interrupt controler */
56  i = amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_IRQMP,&dev);
57  if ( i > 0 ){
58    /* Found APB IRQ_MP Interrupt Controller */
59    LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *) dev.start;
60#if defined(RTEMS_MULTIPROCESSING)
61      if (rtems_configuration_get_user_multiprocessing_table() != NULL) {
62        unsigned int tmp = getasr17();
63        LEON3_Cpu_Index = (tmp >> 28) & 3;
64      }
65#endif
66  }
67 
68  /* find GP Timer */
69  i = amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_GPTIMER,&dev);
70  if ( i > 0 ){
71    LEON3_Timer_Regs = (volatile LEON3_Timer_Regs_Map *) dev.start;
72  }
73
74}
Note: See TracBrowser for help on using the repository browser.