RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 Install_tm27_vector( handler ) \
31{ \
32 rtems_isr_entry old_handler; \
33 rtems_status_code status; \
34 status = rtems_interrupt_catch( (handler), \
35 SH7750_EVT_TO_NUM(SH7750_EVT_WDT_ITI), &old_handler); \
36 if (status != RTEMS_SUCCESSFUL) \
37 printf("Status of rtems_interrupt_catch = %d", status); \
38}
39
40#define Cause_tm27_intr() \
41{ \
42 *(volatile uint16_t*)SH7750_IPRB |= 0xf000; \
43 *(volatile uint16_t*)SH7750_WTCSR = SH7750_WTCSR_KEY; \
44 *(volatile uint16_t*)SH7750_WTCNT = SH7750_WTCNT_KEY | 0xfe; \
45 *(volatile uint16_t*)SH7750_WTCSR = \
46 SH7750_WTCSR_KEY | SH7750_WTCSR_TME; \
47}
48
49#define Clear_tm27_intr() \
50{ \
51 *(volatile uint16_t*)SH7750_WTCSR = SH7750_WTCSR_KEY; \
52}
53
54#define Lower_tm27_intr() \
55{ \
56 sh_set_interrupt_level((SH7750_IPRB & 0xf000) << SH4_SR_IMASK_S); \
57}
58
59#endif