source: rtems/c/src/lib/libbsp/sparc/leon3/amba/amba.c @ 29b2b3e

Last change on this file since 29b2b3e was 29b2b3e, checked in by Daniel Hellstrom <daniel@…>, on 04/05/12 at 15:23:20

LEON3: halt boot if IRQ controller not found

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

  • Property mode set to 100644
File size: 1.8 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/* GRLIB extended IRQ controller register */
22extern void leon3_ext_irq_init(void);
23
24/* Pointers to Interrupt Controller configuration registers */
25volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs;
26
27/*
28 *  amba_initialize
29 *
30 *  Must be called just before drivers are initialized.
31 *  Used to scan system bus. Probes for AHB masters, AHB slaves and
32 *  APB slaves. Addresses to configuration areas of the AHB masters,
33 *  AHB slaves, APB slaves and APB master are storeds in
34 *  amba_ahb_masters, amba_ahb_slaves and amba.
35 */
36
37extern int scan_uarts(void);
38
39void amba_initialize(void)
40{
41  int i;
42  amba_apb_device dev;
43
44  /* Scan the AMBA Plug&Play info at the default LEON3 area */
45  amba_scan(&amba_conf,LEON3_IO_AREA,NULL);
46
47  /* Find LEON3 Interrupt controller */
48  i = amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_IRQMP,&dev);
49  if (i <= 0){
50    /* PANIC IRQ controller not found!
51     *
52     *  What else can we do but stop ...
53     */
54    asm volatile( "mov 1, %g1; ta 0x0" );
55  }
56
57  LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *) dev.start;
58
59  /* Init Extended IRQ controller if available */
60  leon3_ext_irq_init();
61
62  /* find GP Timer */
63  i = amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_GPTIMER,&dev);
64  if ( i > 0 ){
65    LEON3_Timer_Regs = (volatile LEON3_Timer_Regs_Map *) dev.start;
66  }
67
68  /* find UARTS */
69  scan_uarts();
70}
Note: See TracBrowser for help on using the repository browser.