OpenCores
URL https://opencores.org/ocsvn/funbase_ip_library/funbase_ip_library/trunk

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [soc/] [hibi_pe_dma_example_1/] [1.0/] [src/] [cpu1/] [hpd_macros.h] - Blame information for rev 145

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 145 lanttu
/**
2
 * @file   hpd_macros.h
3
 * @author Lasse Lehtonen
4
 * @date   2012-02-28
5
 *
6
 * @brief Platform independent C macros.
7
 *
8
 * @details This file introduces necessary platform independed macros
9
 * for configuring HIBI_PE_DMA.
10
 *
11
 * @par Copyright
12
 * Funbase IP library Copyright (C) 2012 TUT Department of
13
 * Computer Systems
14
 * @par
15
 * This file is part of HIBI_PE_DMA
16
 * @par
17
 * This source file may be used and distributed without
18
 * restriction provided that this copyright statement is not
19
 * removed from the file and that any derivative work contains
20
 * the original copyright notice and the associated disclaimer.
21
 * This source file is free software; you can redistribute it
22
 * and/or modify it under the terms of the GNU Lesser General
23
 * Public License as published by the Free Software Foundation;
24
 * either version 2.1 of the License, or (at your option) any
25
 * later version.
26
 * @par
27
 * This source is distributed in the hope that it will be
28
 * useful, but WITHOUT ANY WARRANTY; without even the implied
29
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
30
 * PURPOSE.  See the GNU Lesser General Public License for more
31
 * details.
32
 * @par
33
 * You should have received a copy of the GNU Lesser General
34
 * Public License along with this source; if not, download it
35
 * from http://www.opencores.org/lgpl.shtml
36
 *
37
 */
38
 
39
 
40
#ifndef HPD_MACROS_H
41
#define HPD_MACROS_H
42
 
43
 
44
/**
45
 * @def HPD_RX_HIBI_ADDR(chan, haddr, base)
46
 * Set channel chan to receive from HIBI address haddr.
47
 * @hideinitializer
48
 */
49
 
50
/**
51
 * @def HPD_RX_MEM_ADDR(chan, addr, base)
52
 * Set channel chan to write received data to memory starting from addr.
53
 * @hideinitializer
54
 */
55
 
56
/**
57
 * @def HPD_RX_WORDS(chan, words, base)
58
 * Set channel chan to receive words amount of words.
59
 * @hideinitializer
60
 */
61
 
62
/**
63
 * @def HPD_RX_INIT(chan, base)
64
 * Set channel chan to receive data with previously set configuration
65
 * @hideinitializer
66
 */
67
 
68
 
69
/**
70
 * @def HPD_IRQ_ENA(base)
71
 * Enable interrupts.
72
 * @hideinitializer
73
 */
74
 
75
/**
76
 * @def HPD_IRQ_DIS(base)
77
 * Disable interrupts.
78
 * @hideinitializer
79
 */
80
 
81
/**
82
 * @def HPD_GET_CONF_REG(var, base)
83
 * Return configuration register in var.
84
 * @hideinitializer
85
 */
86
 
87
/**
88
 * @def HPD_RX_GET_WORDS(var, chan, base)
89
 * Return the amount of words stream channel has received since last
90
 * acknowledge in var.
91
 * @hideinitializer
92
 */
93
 
94
/**
95
 * @def HPD_GET_IRQ_REG(var, base)
96
 * Return interrupt register in var.
97
 * @hideinitializer
98
 */
99
 
100
/**
101
 * @def HPD_CLEAR_IRQ_CHAN(chan, base)
102
 * Clear interrupts for channel chan.
103
 * @hideinitializer
104
 */
105
 
106
/**
107
 * @def HPD_CLEAR_IRQ_REG(mask, base)
108
 * Clear interrupts for high bits in mask.
109
 * @hideinitializer
110
 */
111
 
112
/**
113
 * @def HPD_TX_MEM_ADDR(addr, base)
114
 * Set memory address where the packet to be sent begins.
115
 * @hideinitializer
116
 */
117
 
118
/**
119
 * @def HPD_TX_WORDS(words, base)
120
 * Set amount of words to be sent.
121
 * @hideinitializer
122
 */
123
 
124
/**
125
 * @def HPD_TX_HIBI_ADDR(haddr, base)
126
 * Set target HIBI address.
127
 * @hideinitializer
128
 */
129
 
130
/**
131
 * @def HPD_TX_CMD(comm, base)
132
 * Set HIBI command to use for the transaction
133
 * @hideinitializer
134
 */
135
 
136
/**
137
 * @def HPD_TX_CMD_WRITE(base)
138
 * Use normal WRITE HIBI command for sending.
139
 * @hideinitializer
140
 */
141
 
142
/**
143
 * @def HPD_TX_CMD_READ(base)
144
 * Use normal READ HIBI command for sending.
145
 * @hideinitializer
146
 */
147
 
148
/**
149
 * @def HPD_TX_CMD_WRITE_MSG(base)
150
 * Use message priority WRITE HIBI command for sending.
151
 * @hideinitializer
152
 */
153
 
154
/**
155
 * @def HPD_TX_START(base)
156
 * Start the transfer with previously set configuration.
157
 * @hideinitializer
158
 */
159
 
160
/**
161
 * @def HPD_TX_GET_DONE(var, base)
162
 * Poll if previous transfer has completed, var is 1 if true.
163
 * @hideinitializer
164
 */
165
 
166
/**
167
 * @def HPD_RX_HIBI_DATA(var, base)
168
 * Returns current value on hibi bus in \e var.
169
 * @hideinitializer
170
 */
171
 
172
 
173
#define HPD_RX_INIT(chan, base)                 \
174
  {                                             \
175
    volatile int * apu = (int*)base + 0; \
176
    *apu = 1 << (chan);                         \
177
  }
178
 
179
 
180
#define HPD_GET_CONF_REG(var, base)             \
181
  {                                             \
182
    volatile int * apu = (int*)base + 1;        \
183
    var = *apu;                                 \
184
  }
185
 
186
#define HPD_IRQ_ENA(base)                       \
187
  {                                             \
188
    volatile int * apu = (int*)base + 1;        \
189
    *apu = *apu | 0x2;                          \
190
  }
191
 
192
#define HPD_IRQ_DIS(base)                       \
193
  {                                             \
194
    volatile int * apu = (int*)base + 1;        \
195
    *apu = *apu & 0xfffffffd;                   \
196
  }
197
 
198
#define HPD_TX_START(base)                      \
199
  {                                             \
200
    volatile int * apu = (int*)base + 1;        \
201
    *apu = *apu | 0x1;                          \
202
  }
203
 
204
#define HPD_TX_GET_DONE(var, base)              \
205
  {                                             \
206
    volatile int * apu = (int*)(base) + 1;      \
207
    var = *apu >> 16;                           \
208
    var = var & 0x1;                            \
209
  }
210
 
211
 
212
#define HPD_GET_IRQ_REG(var, base)              \
213
  {                                             \
214
    volatile int * apu = (int*)base + 2;        \
215
    var = *apu;                                 \
216
  }
217
 
218
#define HPD_CLEAR_IRQ_CHAN(chan, base)          \
219
  {                                             \
220
  volatile int * apu = (int*)base + 2;          \
221
    *apu = 1 << (chan);                         \
222
  }
223
 
224
 
225
#define HPD_CLEAR_IRQ_REG(mask, base)           \
226
  {                                             \
227
  volatile int * apu = (int*)base + 2;          \
228
    *apu = mask;                                \
229
  }
230
 
231
 
232
#define HPD_TX_MEM_ADDR(addr, base)             \
233
  {                                             \
234
    volatile int * apu = (int*)base + 3;        \
235
    *apu = addr;                                \
236
  }
237
 
238
 
239
#define HPD_TX_WORDS(words, base)               \
240
  {                                             \
241
    volatile int * apu = (int*)base + 4;        \
242
    *apu = words;                               \
243
  }
244
 
245
 
246
#define HPD_TX_CMD(comm, base)                  \
247
  {                                             \
248
    volatile int * apu = (int*)base + 5;        \
249
    *apu = comm;                                \
250
  }
251
 
252
#define HPD_TX_CMD_WRITE(base)                  \
253
  {                                             \
254
    volatile int * apu = (int*)base + 5;        \
255
    *apu = 2;                                   \
256
  }
257
 
258
#define HPD_TX_CMD_READ(base)                   \
259
  {                                             \
260
    volatile int * apu = (int*)base + 5;        \
261
    *apu = 4;                                   \
262
  }
263
 
264
#define HPD_TX_CMD_WRITE_MSG(base)              \
265
  {                                             \
266
    volatile int * apu = (int*)base + 5;        \
267
    *apu = 3;                                   \
268
  }
269
 
270
 
271
#define HPD_TX_HIBI_ADDR(haddr, base)           \
272
  {                                             \
273
    volatile int * apu = (int*)base + 6;        \
274
    *apu = haddr;                               \
275
  }
276
 
277
 
278
#define HPD_RX_HIBI_DATA(var, base)             \
279
  {                                             \
280
    volatile int* apu = (int*)base + 7;         \
281
    var = *apu;                                 \
282
  }
283
 
284
 
285
#define HPD_RX_MEM_ADDR(chan, addr, base)       \
286
  {                                             \
287
    volatile int * apu = (int*)base + 8;        \
288
    apu = apu + ((chan) << 4);                  \
289
    *apu = addr;                                \
290
  }
291
 
292
 
293
 
294
#define HPD_RX_GET_WORDS(var, chan, base)       \
295
  {                                             \
296
  volatile int* apu = (int*)base + 9            \
297
    + ((chan) << 4);                            \
298
  var = *apu;                                   \
299
  }
300
 
301
 
302
#define HPD_RX_WORDS(chan, words, base)         \
303
  {                                             \
304
    volatile int * apu = (int*)base + 9;        \
305
    apu = apu + ((chan) << 4);                  \
306
    *apu = words;                               \
307
  }
308
 
309
 
310
#define HPD_RX_HIBI_ADDR(chan, haddr, base)     \
311
  {                                             \
312
    volatile int * apu = (int*)base + 10;       \
313
    apu = apu + ((chan) << 4);                  \
314
    *apu = haddr;                               \
315
  }
316
 
317
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.