1 | /* lm32.h |
---|
2 | * |
---|
3 | * This file sets up basic CPU dependency settings based on |
---|
4 | * compiler settings. For example, it can determine if |
---|
5 | * floating point is available. This particular implementation |
---|
6 | * is specified to the NO CPU port. |
---|
7 | * |
---|
8 | * |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | * |
---|
16 | * $Id$ |
---|
17 | * |
---|
18 | * Jukka Pietarinen <jukka.pietarinen@mrf.fi>, 2008, |
---|
19 | * Micro-Research Finland Oy |
---|
20 | */ |
---|
21 | |
---|
22 | #ifndef _RTEMS_SCORE_LM32_H |
---|
23 | #define _RTEMS_SCORE_LM32_H |
---|
24 | |
---|
25 | #ifdef __cplusplus |
---|
26 | extern "C" { |
---|
27 | #endif |
---|
28 | |
---|
29 | /* |
---|
30 | * This file contains the information required to build |
---|
31 | * RTEMS for a particular member of the NO CPU family. |
---|
32 | * It does this by setting variables to indicate which |
---|
33 | * implementation dependent features are present in a particular |
---|
34 | * member of the family. |
---|
35 | * |
---|
36 | * This is a good place to list all the known CPU models |
---|
37 | * that this port supports and which RTEMS CPU model they correspond |
---|
38 | * to. |
---|
39 | */ |
---|
40 | |
---|
41 | #if defined(rtems_multilib) |
---|
42 | /* |
---|
43 | * Figure out all CPU Model Feature Flags based upon compiler |
---|
44 | * predefines. |
---|
45 | */ |
---|
46 | |
---|
47 | #define CPU_MODEL_NAME "rtems_multilib" |
---|
48 | #define LM32_HAS_FPU 0 |
---|
49 | |
---|
50 | #elif defined(__lm32__) |
---|
51 | |
---|
52 | #define CPU_MODEL_NAME "lm32" |
---|
53 | #define LM32_HAS_FPU 0 |
---|
54 | |
---|
55 | #else |
---|
56 | |
---|
57 | #error "Unsupported CPU Model" |
---|
58 | |
---|
59 | #endif |
---|
60 | |
---|
61 | /* |
---|
62 | * Define the name of the CPU family. |
---|
63 | */ |
---|
64 | |
---|
65 | #define CPU_NAME "LM32" |
---|
66 | |
---|
67 | #ifdef __cplusplus |
---|
68 | } |
---|
69 | #endif |
---|
70 | |
---|
71 | #define lm32_disable_interrupts( _level ) \ |
---|
72 | do { register uint32_t ie; \ |
---|
73 | asm volatile ("rcsr %0,ie":"=r"(ie)); \ |
---|
74 | _level = ie; \ |
---|
75 | ie &= (~0x0001); \ |
---|
76 | asm volatile ("wcsr ie,%0"::"r"(ie)); \ |
---|
77 | } while (0) |
---|
78 | |
---|
79 | #define lm32_enable_interrupts( _level ) \ |
---|
80 | asm volatile ("wcsr ie,%0"::"r"(_level)); |
---|
81 | |
---|
82 | #define lm32_flash_interrupts( _level ) \ |
---|
83 | do { register uint32_t ie; \ |
---|
84 | asm volatile ("wcsr ie,%0"::"r"(_level)); \ |
---|
85 | ie = _level & (~0x0001); \ |
---|
86 | asm volatile ("wcsr ie,%0"::"r"(ie)); \ |
---|
87 | } while (0) |
---|
88 | |
---|
89 | #define lm32_interrupt_unmask( _mask ) \ |
---|
90 | do { register uint32_t im; \ |
---|
91 | asm volatile ("rcsr %0,im":"=r"(im)); \ |
---|
92 | im |= _mask; \ |
---|
93 | asm volatile ("wcsr im,%0"::"r"(im)); \ |
---|
94 | } while (0) |
---|
95 | |
---|
96 | #define lm32_interrupt_mask( _mask ) \ |
---|
97 | do { register uint32_t im; \ |
---|
98 | asm volatile ("rcsr %0,im":"=r"(im)); \ |
---|
99 | im &= ~_mask; \ |
---|
100 | asm volatile ("wcsr im,%0"::"r"(im)); \ |
---|
101 | } while (0) |
---|
102 | |
---|
103 | #define lm32_interrupt_ack( _mask ) \ |
---|
104 | do { register uint32_t ip = _mask; \ |
---|
105 | asm volatile ("wcsr ip,%0"::"r"(ip)); \ |
---|
106 | } while (0) |
---|
107 | |
---|
108 | #endif /* _RTEMS_SCORE_LM32_H */ |
---|