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

4.104.114.84.95
Last change on this file since 9c448e1 was 9c448e1, checked in by Joel Sherrill <joel.sherrill@…>, on 02/19/99 at 00:22:33

BSP for Vista Score603e added.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*  FPGA.c
2 *
3 *  COPYRIGHT (c) 1989-1997.
4 *  On-Line Applications Research Corporation (OAR).
5 *  Copyright assigned to U.S. Government, 1994.
6 *
7 *  The license and distribution terms for this file may in
8 *  the file LICENSE in this distribution or at
9 *  http://www.OARcorp.com/rtems/license.html.
10 *
11 *  $Id:
12 */
13#include <bsp.h>
14#include <rtems/libio.h>
15
16#include <libcsupport.h>
17
18#include <string.h>
19#include <fcntl.h>
20#include <assert.h>
21
22/*
23 *  initialize FPGA
24 */
25void initialize_PCI_bridge ()
26{
27#if (!SCORE603E_USE_DINK)
28  rtems_unsigned16 mask, shift, data;
29
30  shift = SCORE603E_85C30_0_IRQ - Score_IRQ_First;
31  mask = 1 << shift;
32
33  shift = SCORE603E_85C30_1_IRQ - Score_IRQ_First;
34  mask  = mask & (1 << shift);
35
36  data = *SCORE603E_FPGA_MASK_DATA;
37  data = ~mask;
38
39  *SCORE603E_FPGA_MASK_DATA = data;
40#endif
41
42}
43
44void set_irq_mask(
45  rtems_unsigned16 value
46)
47{
48  rtems_unsigned16  *loc;
49
50  loc = (rtems_unsigned16  *)SCORE603E_FPGA_MASK_DATA;
51
52  *loc = value;
53}
54
55rtems_unsigned16 get_irq_mask()
56{
57  rtems_unsigned16  *loc;
58  rtems_unsigned16  value;
59
60  loc =  (rtems_unsigned16  *)SCORE603E_FPGA_MASK_DATA;
61
62  value = *loc;
63
64  return value;
65}
66
67void unmask_irq(
68  rtems_unsigned16 irq_idx
69)
70{
71  rtems_unsigned16 value;
72  rtems_unsigned32 mask_idx = irq_idx;
73
74  value = get_irq_mask();
75
76#if (HAS_PMC_PSC8)
77  switch (irq_idx + Score_IRQ_First ) {
78    case SCORE603E_85C30_4_IRQ:
79    case SCORE603E_85C30_2_IRQ:
80    case SCORE603E_85C30_5_IRQ:
81    case SCORE603E_85C30_3_IRQ:
82      mask_idx = SCORE603E_PCI_IRQ_0 - Score_IRQ_First;
83      break;
84    default:
85      break;
86  }
87#endif
88
89  value &= (~(0x1 << mask_idx));
90  set_irq_mask( value );
91}
92
93
94void init_irq_data_register()
95{
96  rtems_unsigned32 index;
97  rtems_unsigned32 i;
98
99#if (SCORE603E_USE_DINK)
100  set_irq_mask( 0xffff );
101#endif
102
103  /*
104   * Clear any existing interupts from the vector data register.
105   */
106  for (i=0; i<20; i++) {
107    index =  (*SCORE603E_FPGA_VECT_DATA);
108    if ( (index&0x10) != 0x10 )
109      break;
110  }
111}
112
113rtems_unsigned16 read_and_clear_PMC_irq(
114  rtems_unsigned16    irq
115)
116{
117  rtems_unsigned16    status_word = irq;
118
119  status_word = (*SCORE603E_PMC_STATUS_ADDRESS);
120
121  return status_word;
122}
123
124rtems_boolean Is_PMC_IRQ(
125  rtems_unsigned32   pmc_irq,
126  rtems_unsigned16   status_word
127)
128{
129  rtems_boolean   result= FALSE;
130
131  switch(pmc_irq) {
132    case SCORE603E_85C30_4_IRQ:
133      result = Is_PMC_85C30_4_IRQ( status_word );
134      break;
135    case SCORE603E_85C30_2_IRQ:
136      result = Is_PMC_85C30_2_IRQ( status_word );
137      break;
138    case SCORE603E_85C30_5_IRQ:
139      result = Is_PMC_85C30_5_IRQ( status_word );
140      break;
141    case SCORE603E_85C30_3_IRQ:
142      result = Is_PMC_85C30_3_IRQ( status_word );
143      break;
144    default:
145      assert( 0 );
146      break;
147  }
148
149  return result;
150}
151
152rtems_unsigned16 read_and_clear_irq()
153{
154  rtems_unsigned16    irq;
155
156  irq = (*SCORE603E_FPGA_VECT_DATA);
157
158  if ((irq & 0xffff0) != 0x10) {
159    DEBUG_puts( "ERROR:: no irq data\n");   
160    return (irq | 0x80);
161  }
162
163  irq &=0xf;
164
165  return irq;
166}
167
168
169
170
171
172
173
174
175
176
177
178
Note: See TracBrowser for help on using the repository browser.