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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [mips/] [arch/] [current/] [include/] [hal_intr.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_HAL_HAL_INTR_H
2
#define CYGONCE_HAL_HAL_INTR_H
3
 
4
//==========================================================================
5
//
6
//      hal_intr.h
7
//
8
//      HAL Interrupt and clock support
9
//
10
//==========================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
12
// -------------------------------------------                              
13
// This file is part of eCos, the Embedded Configurable Operating System.   
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under    
17
// the terms of the GNU General Public License as published by the Free     
18
// Software Foundation; either version 2 or (at your option) any later      
19
// version.                                                                 
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT      
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
24
// for more details.                                                        
25
//
26
// You should have received a copy of the GNU General Public License        
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
29
//
30
// As a special exception, if other files instantiate templates or use      
31
// macros or inline functions from this file, or you compile this file      
32
// and link it with other works to produce a work based on this file,       
33
// this file does not by itself cause the resulting work to be covered by   
34
// the GNU General Public License. However the source code for this file    
35
// must still be made available in accordance with section (3) of the GNU   
36
// General Public License v2.                                               
37
//
38
// This exception does not invalidate any other reasons why a work based    
39
// on this file might be covered by the GNU General Public License.         
40
// -------------------------------------------                              
41
// ####ECOSGPLCOPYRIGHTEND####                                              
42
//==========================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):    nickg
46
// Contributors: nickg, jskov,
47
//               gthomas, jlarmour
48
// Date:         1999-02-16
49
// Purpose:      Define Interrupt support
50
// Description:  The macros defined here provide the HAL APIs for handling
51
//               interrupts and the clock.
52
//              
53
// Usage:
54
//              #include <cyg/hal/hal_intr.h>
55
//              ...
56
//              
57
//
58
//####DESCRIPTIONEND####
59
//
60
//==========================================================================
61
 
62
#include <pkgconf/hal.h>
63
 
64
#include <cyg/infra/cyg_type.h>
65
#include <cyg/hal/hal_io.h>
66
 
67
#include <cyg/hal/var_intr.h>
68
 
69
//--------------------------------------------------------------------------
70
// MIPS vectors. 
71
 
72
// These are the exception codes presented in the Cause register and
73
// correspond to VSRs. These values are the ones to use for HAL_VSR_GET/SET
74
 
75
// External interrupt
76
#define CYGNUM_HAL_VECTOR_INTERRUPT            0
77
// TLB modification exception
78
#define CYGNUM_HAL_VECTOR_TLB_MOD              1
79
// TLB miss (Load or IFetch)
80
#define CYGNUM_HAL_VECTOR_TLB_LOAD_REFILL      2
81
// TLB miss (Store)
82
#define CYGNUM_HAL_VECTOR_TLB_STORE_REFILL     3
83
// Address error (Load or Ifetch)
84
#define CYGNUM_HAL_VECTOR_LOAD_ADDRESS         4
85
// Address error (store)
86
#define CYGNUM_HAL_VECTOR_STORE_ADDRESS        5
87
// Bus error (Ifetch)
88
#define CYGNUM_HAL_VECTOR_IBE                  6
89
// Bus error (data load or store)
90
#define CYGNUM_HAL_VECTOR_DBE                  7
91
// System call
92
#define CYGNUM_HAL_VECTOR_SYSTEM_CALL          8
93
// Break point
94
#define CYGNUM_HAL_VECTOR_BREAKPOINT           9
95
// Reserved instruction
96
#define CYGNUM_HAL_VECTOR_RESERVED_INSTRUCTION 10
97
// Coprocessor unusable
98
#define CYGNUM_HAL_VECTOR_COPROCESSOR          11
99
// Arithmetic overflow
100
#define CYGNUM_HAL_VECTOR_OVERFLOW             12
101
// Reserved
102
#define CYGNUM_HAL_VECTOR_RESERVED_13          13
103
// Division-by-zero [reserved vector]
104
// This is caused by 'trap 0x7' which GCC puts in the code to check
105
// for division by zero. The break_vsr_springboard in vectors.S is the
106
// only caller of this vector.
107
#define CYGNUM_HAL_VECTOR_DIV_BY_ZERO          14
108
// Floating point exception
109
#ifdef  CYGHWR_HAL_MIPS_FPU
110
#define CYGNUM_HAL_VECTOR_FPE                  15
111
#endif
112
 
113
#define CYGNUM_HAL_VSR_MIN                     CYGNUM_HAL_VECTOR_INTERRUPT
114
#ifdef CYGNUM_HAL_VECTOR_FPE
115
#define CYGNUM_HAL_VSR_MAX                     CYGNUM_HAL_VECTOR_FPE
116
#else
117
#define CYGNUM_HAL_VSR_MAX                     CYGNUM_HAL_VECTOR_DIV_BY_ZERO
118
#endif
119
#define CYGNUM_HAL_VSR_COUNT                   (CYGNUM_HAL_VSR_MAX-CYGNUM_HAL_VSR_MIN+1)
120
 
121
// Exception vectors. These are the values used when passed out to an
122
// external exception handler using cyg_hal_deliver_exception()
123
 
124
#define CYGNUM_HAL_EXCEPTION_DATA_TLBERROR_ACCESS CYGNUM_HAL_VECTOR_TLB_MOD
125
#define CYGNUM_HAL_EXCEPTION_DATA_TLBMISS_ACCESS \
126
          CYGNUM_HAL_VECTOR_TLB_LOAD_REFILL
127
#define CYGNUM_HAL_EXCEPTION_DATA_TLBMISS_WRITE \
128
          CYGNUM_HAL_VECTOR_TLB_STORE_REFILL
129
#define CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_ACCESS \
130
          CYGNUM_HAL_VECTOR_LOAD_ADDRESS
131
#define CYGNUM_HAL_EXCEPTION_DATA_UNALIGNED_WRITE \
132
          CYGNUM_HAL_VECTOR_STORE_ADDRESS
133
#define CYGNUM_HAL_EXCEPTION_CODE_ACCESS    CYGNUM_HAL_VECTOR_IBE
134
#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS    CYGNUM_HAL_VECTOR_DBE
135
#define CYGNUM_HAL_EXCEPTION_SYSTEM_CALL    CYGNUM_HAL_VECTOR_SYSTEM_CALL
136
#define CYGNUM_HAL_EXCEPTION_INSTRUCTION_BP CYGNUM_HAL_VECTOR_BREAKPOINT
137
#define CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION \
138
          CYGNUM_HAL_VECTOR_RESERVED_INSTRUCTION
139
#define CYGNUM_HAL_EXCEPTION_COPROCESSOR    CYGNUM_HAL_VECTOR_COPROCESSOR
140
#define CYGNUM_HAL_EXCEPTION_OVERFLOW       CYGNUM_HAL_VECTOR_OVERFLOW
141
#define CYGNUM_HAL_EXCEPTION_DIV_BY_ZERO    CYGNUM_HAL_VECTOR_DIV_BY_ZERO
142
#ifdef  CYGHWR_HAL_MIPS_FPU
143
#define CYGNUM_HAL_EXCEPTION_FPU            CYGNUM_HAL_VECTOR_FPE 
144
#endif
145
 
146
#define CYGNUM_HAL_EXCEPTION_INTERRUPT      CYGNUM_HAL_VECTOR_BREAKPOINT
147
 
148
#ifdef CYGHWR_HAL_MIPS_FPU
149
// decoded exception vectors
150
#define CYGNUM_HAL_EXCEPTION_FPU_INEXACT     (-1)
151
#define CYGNUM_HAL_EXCEPTION_FPU_DIV_BY_ZERO (-2)
152
#define CYGNUM_HAL_EXCEPTION_FPU_OVERFLOW    (-3)
153
#define CYGNUM_HAL_EXCEPTION_FPU_UNDERFLOW   (-4)
154
#define CYGNUM_HAL_EXCEPTION_FPU_INVALID     (-5)
155
#endif
156
 
157
// Min/Max exception numbers and how many there are
158
#ifdef CYGNUM_HAL_EXCEPTION_FPU_INVALID
159
#define CYGNUM_HAL_EXCEPTION_MIN                CYGNUM_HAL_EXCEPTION_FPU_INVALID
160
#else
161
#define CYGNUM_HAL_EXCEPTION_MIN                CYGNUM_HAL_VSR_MIN
162
#endif
163
#define CYGNUM_HAL_EXCEPTION_MAX                CYGNUM_HAL_VSR_MAX
164
 
165
#define CYGNUM_HAL_EXCEPTION_COUNT           \
166
                 ( CYGNUM_HAL_EXCEPTION_MAX - CYGNUM_HAL_EXCEPTION_MIN + 1 )
167
 
168
 
169
#ifndef CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED
170
 
171
// the default for all MIPS variants is to use the 6 bits
172
// in the cause register.
173
 
174
#define CYGNUM_HAL_INTERRUPT_0                0
175
#define CYGNUM_HAL_INTERRUPT_1                1
176
#define CYGNUM_HAL_INTERRUPT_2                2
177
#define CYGNUM_HAL_INTERRUPT_3                3
178
#define CYGNUM_HAL_INTERRUPT_4                4
179
#define CYGNUM_HAL_INTERRUPT_5                5
180
 
181
// Min/Max ISR numbers and how many there are
182
#define CYGNUM_HAL_ISR_MIN                     0
183
#define CYGNUM_HAL_ISR_MAX                     5
184
#define CYGNUM_HAL_ISR_COUNT                   6
185
 
186
// The vector used by the Real time clock. The default here is to use
187
// interrupt 5, which is connected to the counter/comparator registers
188
// in many MIPS variants.
189
 
190
#ifndef CYGNUM_HAL_INTERRUPT_RTC
191
#define CYGNUM_HAL_INTERRUPT_RTC            CYGNUM_HAL_INTERRUPT_5
192
#endif
193
 
194
#define CYGHWR_HAL_INTERRUPT_VECTORS_DEFINED
195
 
196
#endif
197
 
198
//--------------------------------------------------------------------------
199
// Static data used by HAL
200
 
201
// ISR tables
202
externC volatile CYG_ADDRESS    hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT];
203
externC volatile CYG_ADDRWORD   hal_interrupt_data[CYGNUM_HAL_ISR_COUNT];
204
externC volatile CYG_ADDRESS    hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT];
205
 
206
// VSR table
207
externC volatile CYG_ADDRESS    hal_vsr_table[CYGNUM_HAL_VSR_MAX+1];
208
 
209
//--------------------------------------------------------------------------
210
// Default ISR
211
// The #define is used to test whether this routine exists, and to allow
212
// us to call it.
213
 
214
externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data);
215
 
216
#define HAL_DEFAULT_ISR hal_default_isr
217
 
218
//--------------------------------------------------------------------------
219
// Interrupt state storage
220
 
221
typedef cyg_uint32 CYG_INTERRUPT_STATE;
222
 
223
//--------------------------------------------------------------------------
224
// Interrupt control macros
225
// Beware of nops in this code. They fill delay slots and avoid CP0 hazards
226
// that might otherwise cause following code to run in the wrong state or
227
// cause a resource conflict.
228
#ifndef CYGHWR_HAL_INTERRUPT_ENABLE_DISABLE_RESTORE_DEFINED
229
 
230
#define HAL_DISABLE_INTERRUPTS(_old_)           \
231
{                                               \
232
    asm volatile (                              \
233
        "mfc0   $8,$12; nop;"                   \
234
        "move   %0,$8;"                         \
235
        "and    $8,$8,0XFFFFFFFE;"              \
236
        "mtc0   $8,$12;"                        \
237
        "nop; nop; nop;"                        \
238
        "and    %0,%0,0X1;"                     \
239
        : "=r"(_old_)                           \
240
        :                                       \
241
        : "$8"                                  \
242
        );                                      \
243
}
244
 
245
#define HAL_ENABLE_INTERRUPTS()                 \
246
{                                               \
247
    asm volatile (                              \
248
        "mfc0   $8,$12; nop;"                   \
249
        "or     $8,$8,1;"                       \
250
        "mtc0   $8,$12;"                        \
251
        "nop; nop; nop;"                        \
252
        :                                       \
253
        :                                       \
254
        : "$8"                                  \
255
        );                                      \
256
}
257
 
258
#define HAL_RESTORE_INTERRUPTS(_old_)           \
259
{                                               \
260
    asm volatile (                              \
261
        "mfc0   $8,$12; nop;"                   \
262
        "and    %0,%0,0x1;"                     \
263
        "or     $8,$8,%0;"                      \
264
        "mtc0   $8,$12;"                        \
265
        "nop; nop; nop;"                        \
266
        :                                       \
267
        : "r"(_old_)                            \
268
        : "$8"                                  \
269
        );                                      \
270
}
271
 
272
#define HAL_QUERY_INTERRUPTS( _state_ )         \
273
{                                               \
274
    asm volatile (                              \
275
        "mfc0   %0,$12; nop;"                   \
276
        "and    %0,%0,0x1;"                     \
277
        : "=r"(_state_)                         \
278
        :                                       \
279
        : "$8"                                  \
280
        );                                      \
281
}
282
 
283
#endif // CYGHWR_HAL_INTERRUPT_ENABLE_DISABLE_RESTORE_DEFINED
284
 
285
//--------------------------------------------------------------------------
286
// Routine to execute DSRs using separate interrupt stack
287
 
288
#ifdef  CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
289
externC void hal_interrupt_stack_call_pending_DSRs(void);
290
#define HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() \
291
    hal_interrupt_stack_call_pending_DSRs()
292
 
293
// these are offered solely for stack usage testing
294
// if they are not defined, then there is no interrupt stack.
295
#define HAL_INTERRUPT_STACK_BASE cyg_interrupt_stack_base
296
#define HAL_INTERRUPT_STACK_TOP  cyg_interrupt_stack
297
// use them to declare these extern however you want:
298
//       extern char HAL_INTERRUPT_STACK_BASE[];
299
//       extern char HAL_INTERRUPT_STACK_TOP[];
300
// is recommended
301
#endif
302
 
303
//--------------------------------------------------------------------------
304
// Vector translation.
305
// For chained interrupts we only have a single vector though which all
306
// are passed. For unchained interrupts we have a vector per interrupt.
307
 
308
#ifndef HAL_TRANSLATE_VECTOR
309
 
310
#if defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN)
311
 
312
#define HAL_TRANSLATE_VECTOR(_vector_,_index_) (_index_) = 0
313
 
314
#else
315
 
316
#define HAL_TRANSLATE_VECTOR(_vector_,_index_) (_index_) = (_vector_)
317
 
318
#endif
319
 
320
#endif
321
 
322
//--------------------------------------------------------------------------
323
// Interrupt and VSR attachment macros
324
 
325
#define HAL_INTERRUPT_IN_USE( _vector_, _state_)                          \
326
    CYG_MACRO_START                                                       \
327
    cyg_uint32 _index_;                                                   \
328
    HAL_TRANSLATE_VECTOR ((_vector_), _index_);                           \
329
                                                                          \
330
    if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR ) \
331
        (_state_) = 0;                                                    \
332
    else                                                                  \
333
        (_state_) = 1;                                                    \
334
    CYG_MACRO_END
335
 
336
#define HAL_INTERRUPT_ATTACH( _vector_, _isr_, _data_, _object_ )           \
337
{                                                                           \
338
    cyg_uint32 _index_;                                                     \
339
    HAL_TRANSLATE_VECTOR( _vector_, _index_ );                              \
340
                                                                            \
341
    if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR )   \
342
    {                                                                       \
343
        hal_interrupt_handlers[_index_] = (CYG_ADDRESS)_isr_;               \
344
        hal_interrupt_data[_index_] = (CYG_ADDRWORD)_data_;                 \
345
        hal_interrupt_objects[_index_] = (CYG_ADDRESS)_object_;             \
346
    }                                                                       \
347
}
348
 
349
#define HAL_INTERRUPT_DETACH( _vector_, _isr_ )                         \
350
{                                                                       \
351
    cyg_uint32 _index_;                                                 \
352
    HAL_TRANSLATE_VECTOR( _vector_, _index_ );                          \
353
                                                                        \
354
    if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)_isr_ )         \
355
    {                                                                   \
356
        hal_interrupt_handlers[_index_] = (CYG_ADDRESS)HAL_DEFAULT_ISR; \
357
        hal_interrupt_data[_index_] = 0;                                \
358
        hal_interrupt_objects[_index_] = 0;                             \
359
    }                                                                   \
360
}
361
 
362
#define HAL_VSR_GET( _vector_, _pvsr_ )                 \
363
    *(_pvsr_) = (void (*)())hal_vsr_table[_vector_];
364
 
365
 
366
#define HAL_VSR_SET( _vector_, _vsr_, _poldvsr_ ) CYG_MACRO_START         \
367
    if( (void*)_poldvsr_ != NULL)                                         \
368
        *(CYG_ADDRESS *)_poldvsr_ = (CYG_ADDRESS)hal_vsr_table[_vector_]; \
369
    hal_vsr_table[_vector_] = (CYG_ADDRESS)_vsr_;                         \
370
CYG_MACRO_END
371
 
372
// This is an ugly name, but what it means is: grab the VSR back to eCos
373
// internal handling, or if you like, the default handler.  But if
374
// cooperating with GDB and CygMon, the default behaviour is to pass most
375
// exceptions to CygMon.  This macro undoes that so that eCos handles the
376
// exception.  So use it with care.
377
 
378
externC void __default_exception_vsr(void);
379
externC void __default_interrupt_vsr(void);
380
externC void __break_vsr_springboard(void);
381
 
382
#define HAL_VSR_SET_TO_ECOS_HANDLER( _vector_, _poldvsr_ ) CYG_MACRO_START  \
383
    HAL_VSR_SET( _vector_, _vector_ == CYGNUM_HAL_VECTOR_INTERRUPT          \
384
                              ? (CYG_ADDRESS)__default_interrupt_vsr        \
385
                              : _vector_ == CYGNUM_HAL_VECTOR_BREAKPOINT    \
386
                                ? (CYG_ADDRESS)__break_vsr_springboard      \
387
                                : (CYG_ADDRESS)__default_exception_vsr,     \
388
                 _poldvsr_ );                                               \
389
CYG_MACRO_END
390
 
391
//--------------------------------------------------------------------------
392
// Interrupt controller access
393
// The default code here simply uses the fields present in the CP0 status
394
// and cause registers to implement this functionality.
395
// Beware of nops in this code. They fill delay slots and avoid CP0 hazards
396
// that might otherwise cause following code to run in the wrong state or
397
// cause a resource conflict.
398
 
399
#ifndef CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED
400
 
401
#define HAL_INTERRUPT_MASK( _vector_ )          \
402
CYG_MACRO_START                                 \
403
    asm volatile (                              \
404
        "mfc0   $3,$12\n"                       \
405
        "la     $2,0x00000400\n"                \
406
        "sllv   $2,$2,%0\n"                     \
407
        "nor    $2,$2,$0\n"                     \
408
        "and    $3,$3,$2\n"                     \
409
        "mtc0   $3,$12\n"                       \
410
        "nop; nop; nop\n"                       \
411
        :                                       \
412
        : "r"(_vector_)                         \
413
        : "$2", "$3"                            \
414
        );                                      \
415
CYG_MACRO_END
416
 
417
#define HAL_INTERRUPT_UNMASK( _vector_ )        \
418
CYG_MACRO_START                                 \
419
    asm volatile (                              \
420
        "mfc0   $3,$12\n"                       \
421
        "la     $2,0x00000400\n"                \
422
        "sllv   $2,$2,%0\n"                     \
423
        "or     $3,$3,$2\n"                     \
424
        "mtc0   $3,$12\n"                       \
425
        "nop; nop; nop\n"                       \
426
        :                                       \
427
        : "r"(_vector_)                         \
428
        : "$2", "$3"                            \
429
        );                                      \
430
CYG_MACRO_END
431
 
432
#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ )   \
433
CYG_MACRO_START                                 \
434
    asm volatile (                              \
435
        "mfc0   $3,$13\n"                       \
436
        "la     $2,0x00000400\n"                \
437
        "sllv   $2,$2,%0\n"                     \
438
        "nor    $2,$2,$0\n"                     \
439
        "and    $3,$3,$2\n"                     \
440
        "mtc0   $3,$13\n"                       \
441
        "nop; nop; nop\n"                       \
442
        :                                       \
443
        : "r"(_vector_)                         \
444
        : "$2", "$3"                            \
445
        );                                      \
446
CYG_MACRO_END
447
 
448
#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ )
449
 
450
#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ )
451
 
452
#define CYGHWR_HAL_INTERRUPT_CONTROLLER_ACCESS_DEFINED
453
 
454
#endif
455
 
456
//--------------------------------------------------------------------------
457
// Clock control.
458
// This code uses the count and compare registers that are present in many
459
// MIPS variants.
460
// Beware of nops in this code. They fill delay slots and avoid CP0 hazards
461
// that might otherwise cause following code to run in the wrong state or
462
// cause a resource conflict.
463
 
464
#ifndef CYGHWR_HAL_CLOCK_CONTROL_DEFINED
465
 
466
externC CYG_WORD32 cyg_hal_clock_period;
467
#define CYGHWR_HAL_CLOCK_PERIOD_DEFINED
468
 
469
#define HAL_CLOCK_INITIALIZE( _period_ )        \
470
CYG_MACRO_START                                 \
471
    asm volatile (                              \
472
        "mtc0 $0,$9\n"                          \
473
        "nop; nop; nop\n"                       \
474
        "mtc0 %0,$11\n"                         \
475
        "nop; nop; nop\n"                       \
476
        :                                       \
477
        : "r"(_period_)                         \
478
        );                                      \
479
    cyg_hal_clock_period = _period_;            \
480
CYG_MACRO_END
481
 
482
#define HAL_CLOCK_RESET( _vector_, _period_ )   \
483
CYG_MACRO_START                                 \
484
    asm volatile (                              \
485
        "mtc0 $0,$9\n"                          \
486
        "nop; nop; nop\n"                       \
487
        "mtc0 %0,$11\n"                         \
488
        "nop; nop; nop\n"                       \
489
        :                                       \
490
        : "r"(_period_)                         \
491
        );                                      \
492
CYG_MACRO_END
493
 
494
#define HAL_CLOCK_READ( _pvalue_ )              \
495
CYG_MACRO_START                                 \
496
    register CYG_WORD32 result;                 \
497
    asm volatile (                              \
498
        "mfc0   %0,$9\n"                        \
499
        : "=r"(result)                          \
500
        );                                      \
501
    *(_pvalue_) = result;                       \
502
CYG_MACRO_END
503
 
504
#define CYGHWR_HAL_CLOCK_CONTROL_DEFINED
505
 
506
#endif
507
 
508
#if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && \
509
    !defined(HAL_CLOCK_LATENCY)
510
#define HAL_CLOCK_LATENCY( _pvalue_ )                   \
511
CYG_MACRO_START                                         \
512
    register CYG_WORD32 _cval_;                         \
513
    HAL_CLOCK_READ(&_cval_);                            \
514
    *(_pvalue_) = _cval_ - cyg_hal_clock_period;        \
515
CYG_MACRO_END
516
#endif
517
 
518
 
519
//--------------------------------------------------------------------------
520
// Microsecond delay function provided in hal_misc.c
521
externC void hal_delay_us(int us);
522
 
523
#define HAL_DELAY_US(n)          hal_delay_us(n)
524
 
525
//--------------------------------------------------------------------------
526
#endif // ifndef CYGONCE_HAL_HAL_INTR_H
527
// End of hal_intr.h

powered by: WebSVN 2.1.0

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