source: rtems/c/src/lib/libbsp/powerpc/score603e/irq/FPGA.c @ 978eba3

4.9
Last change on this file since 978eba3 was 978eba3, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 30, 2008 at 11:17:15 PM

2008-09-30 Jennifer Averett <jennifer.averett@…>

  • Makefile.am, preinstall.am, PCI_bus/universe.c, console/console.c, include/bsp.h, irq/FPGA.c, irq/irq.c, startup/Hwr_init.c, startup/bspstart.c, startup/vmeintr.c: Modifications required to run on hardware. Some cleanup.
  • include/irq-config.h: New file.
  • startup/spurious.c: Removed.
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*  FPGA.c -- Bridge for second and subsequent generations
2 *
3 *  COPYRIGHT (c) 1989-2001.
4 *  On-Line Applications Research Corporation (OAR).
5 *
6 *  The license and distribution terms for this file may in
7 *  the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#include <bsp.h>
14#include <string.h>
15#include <fcntl.h>
16#include <assert.h>
17
18#include <rtems/libio.h>
19#include <rtems/libcsupport.h>
20#include <rtems/bspIo.h>
21
22/*
23 *  initialize FPGA
24 */
25void initialize_PCI_bridge (void)
26{
27  /* Note: Accept DINKs setup of the PCI Bridge and don't
28   *       change anything.
29   */
30  printk("initialize_PCI_bridge: \n");
31}
32
33void set_irq_mask(
34  uint16_t         value
35)
36{
37  uint16_t          *loc;
38
39  loc = (uint16_t*)SCORE603E_FPGA_MASK_DATA;
40
41  *loc = value;
42}
43
44uint16_t         get_irq_mask(voi)
45{
46  uint16_t          *loc;
47  uint16_t          value;
48
49  loc =  (uint16_t*)SCORE603E_FPGA_MASK_DATA;
50
51  value = *loc;
52
53  return value;
54}
55
56void unmask_irq(
57  uint16_t         irq_idx
58)
59{
60  uint16_t         value;
61  uint32_t         mask_idx = irq_idx;
62
63  value = get_irq_mask();
64
65#if (HAS_PMC_PSC8)
66  switch (irq_idx + Score_IRQ_First ) {
67    case SCORE603E_85C30_4_IRQ:
68    case SCORE603E_85C30_2_IRQ:
69    case SCORE603E_85C30_5_IRQ:
70    case SCORE603E_85C30_3_IRQ:
71      mask_idx = SCORE603E_PCI_IRQ_0 - Score_IRQ_First;
72      break;
73    default:
74      break;
75  }
76#endif
77
78  value &= (~(0x1 << mask_idx));
79  set_irq_mask( value );
80}
81
82void init_irq_data_register(void)
83{
84  uint32_t         index;
85  uint32_t         i;
86
87  set_irq_mask( 0xffff );
88
89  /*
90   * Clear any existing interupts from the vector data register.
91   */
92  for (i=0; i<20; i++) {
93    index =  (*SCORE603E_FPGA_VECT_DATA);
94    if ( (index&0x10) != 0x10 )
95      break;
96  }
97}
98
99uint16_t         read_and_clear_PMC_irq(
100  uint16_t            irq
101)
102{
103  uint16_t            status_word = irq;
104
105  status_word = (*BSP_PMC_STATUS_ADDRESS);
106
107  return status_word;
108}
109
110bool Is_PMC_IRQ(
111  uint32_t           pmc_irq,
112  uint16_t           status_word
113)
114{
115  bool result = false;
116
117  switch(pmc_irq) {
118    case SCORE603E_85C30_4_IRQ:
119      result = Is_PMC_85C30_4_IRQ( status_word ) ? true : false;
120      break;
121    case SCORE603E_85C30_2_IRQ:
122      result = Is_PMC_85C30_2_IRQ( status_word ) ? true : false;
123      break;
124    case SCORE603E_85C30_5_IRQ:
125      result = Is_PMC_85C30_5_IRQ( status_word ) ? true : false;
126      break;
127    case SCORE603E_85C30_3_IRQ:
128      result = Is_PMC_85C30_3_IRQ( status_word ) ? true : false;
129      break;
130    default:
131      assert( 0 );
132      break;
133  }
134
135  return result;
136}
137
138uint16_t         read_and_clear_irq(void)
139{
140  uint16_t            irq;
141
142  irq = (*SCORE603E_FPGA_VECT_DATA);
143
144  if ((irq & 0xffff0) != 0x10) {
145    printk( "ERROR:: no irq data\n");
146    return (irq | 0x80);
147  }
148
149  irq &=0xf;
150
151  return irq;
152}
Note: See TracBrowser for help on using the repository browser.