source: rtems/c/src/lib/libbsp/powerpc/score603e/startup/FPGA.c @ ffe6331

4.104.114.84.95
Last change on this file since ffe6331 was b14e2f2, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/03 at 18:52:35

2003-09-04 Joel Sherrill <joel@…>

  • PCI_bus/PCI.h, clock/clock.c, console/85c30.c, console/85c30.h, console/console.c, console/consolebsp.h, console/consolereserveresources.c, console/tbl85c30.c, include/bsp.h, include/coverhd.h, include/gen2.h, include/tod.h, startup/FPGA.c, startup/bspclean.c, startup/bspstart.c, startup/genpvec.c, startup/setvec.c, startup/vmeintr.c, timer/timer.c, tod/tod.c: URL for license changed.
  • Property mode set to 100644
File size: 3.0 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
21/*
22 *  initialize FPGA
23 */
24void initialize_PCI_bridge ()
25{
26#if (!SCORE603E_USE_DINK)
27  rtems_unsigned16 mask, shift, data;
28
29  shift = SCORE603E_85C30_0_IRQ - Score_IRQ_First;
30  mask = 1 << shift;
31
32  shift = SCORE603E_85C30_1_IRQ - Score_IRQ_First;
33  mask  = mask & (1 << shift);
34
35  data = *SCORE603E_FPGA_MASK_DATA;
36  data = ~mask;
37
38  *SCORE603E_FPGA_MASK_DATA = data;
39#endif
40
41}
42
43void set_irq_mask(
44  rtems_unsigned16 value
45)
46{
47  rtems_unsigned16  *loc;
48
49  loc = (rtems_unsigned16  *)SCORE603E_FPGA_MASK_DATA;
50
51  *loc = value;
52}
53
54rtems_unsigned16 get_irq_mask()
55{
56  rtems_unsigned16  *loc;
57  rtems_unsigned16  value;
58
59  loc =  (rtems_unsigned16  *)SCORE603E_FPGA_MASK_DATA;
60
61  value = *loc;
62
63  return value;
64}
65
66void unmask_irq(
67  rtems_unsigned16 irq_idx
68)
69{
70  rtems_unsigned16 value;
71  rtems_unsigned32 mask_idx = irq_idx;
72
73  value = get_irq_mask();
74
75#if (HAS_PMC_PSC8)
76  switch (irq_idx + Score_IRQ_First ) {
77    case SCORE603E_85C30_4_IRQ:
78    case SCORE603E_85C30_2_IRQ:
79    case SCORE603E_85C30_5_IRQ:
80    case SCORE603E_85C30_3_IRQ:
81      mask_idx = SCORE603E_PCI_IRQ_0 - Score_IRQ_First;
82      break;
83    default:
84      break;
85  }
86#endif
87
88  value &= (~(0x1 << mask_idx));
89  set_irq_mask( value );
90}
91
92
93void init_irq_data_register()
94{
95  rtems_unsigned32 index;
96  rtems_unsigned32 i;
97
98#if (SCORE603E_USE_DINK)
99  set_irq_mask( 0xffff );
100#endif
101
102  /*
103   * Clear any existing interupts from the vector data register.
104   */
105  for (i=0; i<20; i++) {
106    index =  (*SCORE603E_FPGA_VECT_DATA);
107    if ( (index&0x10) != 0x10 )
108      break;
109  }
110}
111
112rtems_unsigned16 read_and_clear_PMC_irq(
113  rtems_unsigned16    irq
114)
115{
116  rtems_unsigned16    status_word = irq;
117
118  status_word = (*SCORE603E_PMC_STATUS_ADDRESS);
119
120  return status_word;
121}
122
123rtems_boolean Is_PMC_IRQ(
124  rtems_unsigned32   pmc_irq,
125  rtems_unsigned16   status_word
126)
127{
128  rtems_boolean   result= FALSE;
129
130  switch(pmc_irq) {
131    case SCORE603E_85C30_4_IRQ:
132      result = Is_PMC_85C30_4_IRQ( status_word );
133      break;
134    case SCORE603E_85C30_2_IRQ:
135      result = Is_PMC_85C30_2_IRQ( status_word );
136      break;
137    case SCORE603E_85C30_5_IRQ:
138      result = Is_PMC_85C30_5_IRQ( status_word );
139      break;
140    case SCORE603E_85C30_3_IRQ:
141      result = Is_PMC_85C30_3_IRQ( status_word );
142      break;
143    default:
144      assert( 0 );
145      break;
146  }
147
148  return result;
149}
150
151rtems_unsigned16 read_and_clear_irq()
152{
153  rtems_unsigned16    irq;
154
155  irq = (*SCORE603E_FPGA_VECT_DATA);
156
157  if ((irq & 0xffff0) != 0x10) {
158    DEBUG_puts( "ERROR:: no irq data\n");   
159    return (irq | 0x80);
160  }
161
162  irq &=0xf;
163
164  return irq;
165}
Note: See TracBrowser for help on using the repository browser.