1 | /* scv64.c |
---|
2 | * |
---|
3 | * This set of routines control the scv64 chip on the DMV177 board. |
---|
4 | * |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * All rights assigned to U.S. Government, 1994. |
---|
9 | * |
---|
10 | * $Id$ |
---|
11 | */ |
---|
12 | |
---|
13 | #include <rtems.h> |
---|
14 | #include <bsp.h> |
---|
15 | |
---|
16 | typedef struct { |
---|
17 | /* DARF Registers */ |
---|
18 | volatile rtems_unsigned32 DMALAR; /* 0x00 */ |
---|
19 | volatile rtems_unsigned32 DMAVAR; /* 0x04 */ |
---|
20 | volatile rtems_unsigned32 DMATC; /* 0x08 */ |
---|
21 | volatile rtems_unsigned32 DCSR; /* 0x0c */ |
---|
22 | volatile rtems_unsigned32 VMEBAR; /* 0x10 */ |
---|
23 | volatile rtems_unsigned32 RXDATA; /* 0x14 */ |
---|
24 | volatile rtems_unsigned32 RXADDR; /* 0x18 */ |
---|
25 | volatile rtems_unsigned32 RXCTL; /* 0x1c */ |
---|
26 | volatile rtems_unsigned32 BUSSEL; /* 0x20 */ |
---|
27 | volatile rtems_unsigned32 IVECT; /* 0x24 */ |
---|
28 | volatile rtems_unsigned32 APBR; /* 0x28 */ |
---|
29 | volatile rtems_unsigned32 TXDATA; /* 0x2c */ |
---|
30 | volatile rtems_unsigned32 TXADDR; /* 0x30 */ |
---|
31 | volatile rtems_unsigned32 TXCTL; /* 0x34 */ |
---|
32 | volatile rtems_unsigned32 LMFIFO; /* 0x38 */ |
---|
33 | volatile rtems_unsigned32 MODE; /* 0x3c */ |
---|
34 | volatile rtems_unsigned32 SA64BAR; /* 0x40 */ |
---|
35 | volatile rtems_unsigned32 MA64BAR; /* 0x44 */ |
---|
36 | volatile rtems_unsigned32 LAG; /* 0x48 */ |
---|
37 | volatile rtems_unsigned32 DMAVTC; /* 0x4c */ |
---|
38 | |
---|
39 | /* Reserved */ |
---|
40 | volatile rtems_unsigned32 reserved_50_7F[12]; |
---|
41 | |
---|
42 | /* ACC Registers */ |
---|
43 | volatile rtems_unsigned8 STAT0_pad[3]; /* 0x80 */ |
---|
44 | volatile rtems_unsigned8 STAT0; |
---|
45 | volatile rtems_unsigned8 STAT1_pad[3]; /* 0x84 */ |
---|
46 | volatile rtems_unsigned8 STAT1; |
---|
47 | volatile rtems_unsigned8 GENCTL_pad[3]; /* 0x88 */ |
---|
48 | volatile rtems_unsigned8 GENCTL; |
---|
49 | volatile rtems_unsigned8 VINT_pad[3]; /* 0x8c */ |
---|
50 | volatile rtems_unsigned8 VINT; |
---|
51 | volatile rtems_unsigned8 VREQ_pad[3]; /* 0x90 */ |
---|
52 | volatile rtems_unsigned8 VREQ; |
---|
53 | volatile rtems_unsigned8 VARB_pad[3]; /* 0x94 */ |
---|
54 | volatile rtems_unsigned8 VARB; |
---|
55 | volatile rtems_unsigned8 ID_pad[3]; /* 0x98 */ |
---|
56 | volatile rtems_unsigned8 ID; |
---|
57 | volatile rtems_unsigned8 NA_pad[3]; /* 0x9c */ |
---|
58 | volatile rtems_unsigned8 NA; |
---|
59 | volatile rtems_unsigned8 _7IS_pad[3]; /* 0xa0 */ |
---|
60 | volatile rtems_unsigned8 _7IS; |
---|
61 | volatile rtems_unsigned8 LIS_pad[3]; /* 0xa4 */ |
---|
62 | volatile rtems_unsigned8 LIS; |
---|
63 | volatile rtems_unsigned8 UIE_pad[3]; /* 0xa8 */ |
---|
64 | volatile rtems_unsigned8 UIE; |
---|
65 | volatile rtems_unsigned8 LIE_pad[3]; /* 0xac */ |
---|
66 | volatile rtems_unsigned8 LIE; |
---|
67 | volatile rtems_unsigned8 VIE_pad[3]; /* 0xb0 */ |
---|
68 | volatile rtems_unsigned8 VIE; |
---|
69 | volatile rtems_unsigned8 IC10_pad[3]; /* 0xb4 */ |
---|
70 | volatile rtems_unsigned8 IC10; |
---|
71 | volatile rtems_unsigned8 IC32_pad[3]; /* 0xb8 */ |
---|
72 | volatile rtems_unsigned8 IC32; |
---|
73 | volatile rtems_unsigned8 IC54_pad[3]; /* 0xbc */ |
---|
74 | volatile rtems_unsigned8 IC54; |
---|
75 | /* Utility Registers */ |
---|
76 | volatile rtems_unsigned32 MISC; |
---|
77 | volatile rtems_unsigned32 delay_line[3]; |
---|
78 | volatile rtems_unsigned32 MBOX0; |
---|
79 | volatile rtems_unsigned32 MBOX1; |
---|
80 | volatile rtems_unsigned32 MBOX2; |
---|
81 | volatile rtems_unsigned32 MBOX3; |
---|
82 | } SCV64_Registers; |
---|
83 | |
---|
84 | /* |
---|
85 | * LIE Register |
---|
86 | */ |
---|
87 | #define LOCAL_INTERRUPT_ENABLE_0 0x01 |
---|
88 | #define LOCAL_INTERRUPT_ENABLE_1 0x02 |
---|
89 | #define LOCAL_INTERRUPT_ENABLE_2 0x04 |
---|
90 | #define LOCAL_INTERRUPT_ENABLE_3 0x08 |
---|
91 | #define LOCAL_INTERRUPT_ENABLE_4 0x10 |
---|
92 | #define LOCAL_INTERRUPT_ENABLE_5 0x20 |
---|
93 | |
---|
94 | /* |
---|
95 | * IC54 Register |
---|
96 | */ |
---|
97 | #define AUTOVECTOR_5 0x80 |
---|
98 | |
---|
99 | |
---|
100 | /* |
---|
101 | * Set the registers pointer to the base address of the SCV64 |
---|
102 | */ |
---|
103 | SCV64_Registers *SCV64 = (void *)DMV170_SCV64_BASE_ADDRESS; |
---|
104 | |
---|
105 | /* |
---|
106 | * SCV64_Initialize |
---|
107 | * |
---|
108 | * This routine initializes the SCV64. |
---|
109 | */ |
---|
110 | void SCV64_Initialize() { |
---|
111 | SCV64->LIE = 0; |
---|
112 | } |
---|
113 | |
---|
114 | /* |
---|
115 | * SCV64_Generate_DUART_Interrupts |
---|
116 | * |
---|
117 | * This sets the SCV64 to generate duart interrupts for |
---|
118 | * the DMV177 board. |
---|
119 | */ |
---|
120 | void SCV64_Generate_DUART_Interrupts() { |
---|
121 | |
---|
122 | rtems_unsigned8 data; |
---|
123 | |
---|
124 | /* |
---|
125 | * Set Local Interrupt 5 enable |
---|
126 | */ |
---|
127 | data = SCV64->LIE; |
---|
128 | data |= LOCAL_INTERRUPT_ENABLE_5; |
---|
129 | SCV64->LIE = data; |
---|
130 | |
---|
131 | /* |
---|
132 | * Set Autovector. |
---|
133 | */ |
---|
134 | data = SCV64->IC54; |
---|
135 | data |= AUTOVECTOR_5; |
---|
136 | SCV64->IC54 = data; |
---|
137 | } |
---|
138 | |
---|
139 | /* |
---|
140 | * SCV64_Get_Interrupt |
---|
141 | * |
---|
142 | * This routine returns the SCV64 status register. |
---|
143 | */ |
---|
144 | rtems_unsigned32 SCV64_Get_Interrupt() |
---|
145 | { |
---|
146 | rtems_unsigned8 data; |
---|
147 | |
---|
148 | /* |
---|
149 | * Put the LIS data into the lower byte of the result |
---|
150 | */ |
---|
151 | data = SCV64->LIS; |
---|
152 | |
---|
153 | return data; |
---|
154 | } |
---|
155 | |
---|
156 | /* |
---|
157 | * SCV64_Get_Interrupt_Enable |
---|
158 | * |
---|
159 | * This routine returns the interrupt enable mask. |
---|
160 | */ |
---|
161 | rtems_unsigned32 SCV64_Get_Interrupt_Enable() |
---|
162 | { |
---|
163 | /* |
---|
164 | * Return the set of interrupts enabled. |
---|
165 | */ |
---|
166 | return SCV64->LIE; |
---|
167 | } |
---|