RTEMS 6.1-rc7
Loading...
Searching...
No Matches
tm27.h
1/*
2 * @file
3 * @ingroup sh_gensh4
4 * @brief Implementations for interrupt mechanisms for Time Test 27
5 */
6
7/*
8 * The license and distribution terms for this file may be
9 * found in the file LICENSE in this distribution or at
10 * http://www.rtems.org/license/LICENSE.
11 */
12
13#ifndef _RTEMS_TMTEST27
14#error "This is an RTEMS internal file you must not include directly."
15#endif
16
17#ifndef __tm27_h
18#define __tm27_h
19
20/*
21 * Stuff for Time Test 27
22 */
23
24#define MUST_WAIT_FOR_INTERRUPT 1
25
26#ifndef SH7750_EVT_WDT_ITI
27# error "..."
28#endif
29
30#define TM27_USE_VECTOR_HANDLER
31
32#define Install_tm27_vector( handler ) \
33{ \
34 rtems_isr_entry old_handler; \
35 rtems_status_code status; \
36 status = rtems_interrupt_catch( (handler), \
37 SH7750_EVT_TO_NUM(SH7750_EVT_WDT_ITI), &old_handler); \
38 if (status != RTEMS_SUCCESSFUL) \
39 printf("Status of rtems_interrupt_catch = %d", status); \
40}
41
42#define Cause_tm27_intr() \
43{ \
44 *(volatile uint16_t*)SH7750_IPRB |= 0xf000; \
45 *(volatile uint16_t*)SH7750_WTCSR = SH7750_WTCSR_KEY; \
46 *(volatile uint16_t*)SH7750_WTCNT = SH7750_WTCNT_KEY | 0xfe; \
47 *(volatile uint16_t*)SH7750_WTCSR = \
48 SH7750_WTCSR_KEY | SH7750_WTCSR_TME; \
49}
50
51#define Clear_tm27_intr() \
52{ \
53 *(volatile uint16_t*)SH7750_WTCSR = SH7750_WTCSR_KEY; \
54}
55
56#define Lower_tm27_intr() \
57{ \
58 sh_set_interrupt_level((SH7750_IPRB & 0xf000) << SH4_SR_IMASK_S); \
59}
60
61#endif