summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/score603e/startup/82378zb.c
blob: f3b1b314e2672f8479a5cf1900ab6dfbecafbfba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*  82378zb.c
 *
 *  COPYRIGHT (c) 1989-1997.
 *  On-Line Applications Research Corporation (OAR).
 *  Copyright assigned to U.S. Government, 1994.
 *
 *  The license and distribution terms for this file may in
 *  the file LICENSE in this distribution or at
 *  http://www.OARcorp.com/rtems/license.html.
 *
 *  $Id: 
 */
#include <bsp.h>
#include <rtems/libio.h>

#include <libcsupport.h>

#include <string.h>
#include <fcntl.h>
#include <assert.h>
/*
 * initialize 82378zb
 */
void initialize_PCI_bridge ()
{

  /*
   * INT CNTRL-1 ICW1
   *            LTIM and ICW4 
   */
  Write_82378ZB( 0x20, 0x19);
  
  /*
   * INT CNTRL-1 ICW 2
   *     Sets 5 msbs of the base address in the interrupt vector table 
   *     for the vector  routines to  0100 0 ??
   */
  Write_82378ZB( 0x21, 0x40 );
  
  /*
   * INT CNTRL-1 ICW 3
   *     Cascade CNTRL-2 INT output to IRQ[2] input of CNTRL-1
   */
  Write_82378ZB( 0x21, 0x04 );
  
  /*
   * INT CNTRL-1 ICW 4
   *     Set Microprocessor mode for 80x86 system.
   */
  Write_82378ZB( 0x21, 0x01 );
  
  /*
   * INT CNTRL-1 OCW 2  
   *     Set Non-specific EOI command
   */
  Write_82378ZB( 0x20, 0x20 );
  
  /*
   * INT CNTRL-1 OCW 3  
   *     Interrupt controller in normal mask mode.
   *     Disable Poll mode command
   *     Read IRQ register.
   */
  Write_82378ZB( 0x20, 0x2a );
  
  /*
   * INT CNTRL-1 OCW 1
   *     Write Interrupt Request mask for IRQ[7:0].  An interrupt request for
   *     a masked IRQ will not set the interrupt request register (IRR) bit for
   *     that channel.
   *
   *     XXXX - Was 0xfd Only allowing Timer interrupt through changed to 
   *            0xe1.
   */
  Write_82378ZB( 0x21, 0xe1 );
  
  /*
   * INT CNTRL-2 ICW 1
   *            LTIM and ICW4 
   */
  Write_82378ZB( 0xa0, 0x19 );
  
  /*
   * INT CNTRL-2 ICW 2
   *     Sets 5 msbs of the base address in the interrupt vector table 
   *     for the vector  routines to  0100 1 ??
   */
  Write_82378ZB( 0xa1, 0x48 );
  
  /*
   * INT CNTRL-1 ICW 3
   *     Slave Identification Code (Must be intialized to 2).
   */
  Write_82378ZB( 0xa1, 0x02 );
  
  /*
   * INT CNTRL-1 ICW 4
   *     Set Microprocessor mode for 80x86 system.
   */
  Write_82378ZB( 0xa1, 0x01 );
  
  /*
   * INT CNTRL-1 OCW 2  
   *     Set Non-specific EOI command
   */
  Write_82378ZB( 0xa0, 0x20 );
  
  /*
   * INT CNTRL-1 OCW 3  
   *     Interrupt controller in normal mask mode.
   *     Disable Poll mode command
   *     Read IRQ register.
   */
  Write_82378ZB( 0xa0, 0x2a );
  
  /*
   * INT CNTRL-1 OCW 1
   *     Write Interrupt Request mask for IRQ[7:0].  An interrupt request for
   *     a masked IRQ will not set the interrupt request register (IRR) bit for
   *     that channel.
   *
   *     XXXX - All interrupts masked.
   */
  Write_82378ZB( 0xa1, 0xff );
}


rtems_unsigned16 read_and_clear_irq ()
{
  rtems_unsigned16 irq;

  /* 
   * XXX - Fix this for all interrupts later 
   */

  Write_82378ZB( 0x20, 0x0c);
  Read_82378ZB( 0x20, irq );
  irq &= 0x7;  
  Write_82378ZB( 0x20, 0x20 );
  
  return irq;
}

void init_irq_data_register()
{
  assert (0);
}
rtems_unsigned16 get_irq_mask()
{
  assert (0);
  return 0;
}
void set_irq_mask(
  rtems_unsigned16 value
)
{
  assert (0);
}