1 | /* |
---|
2 | * Copyright (c) 2011 embedded brains GmbH |
---|
3 | * |
---|
4 | * Copyright (c) 2006 Kolja Waschk (rtemsdev/ixo.de) |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 1989-2006 |
---|
7 | * On-Line Applications Research Corporation (OAR). |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifdef HAVE_CONFIG_H |
---|
17 | #include "config.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #include <rtems/score/cpu.h> |
---|
21 | #include <rtems/score/interr.h> |
---|
22 | #include <rtems/score/nios2-utility.h> |
---|
23 | |
---|
24 | uint32_t _Nios2_ISR_Set_level( uint32_t new_level, uint32_t status ) |
---|
25 | { |
---|
26 | switch ( _Nios2_ISR_Get_status_mask() ) { |
---|
27 | case NIOS2_ISR_STATUS_MASK_IIC: |
---|
28 | if ( new_level == 0 ) { |
---|
29 | status |= NIOS2_STATUS_PIE; |
---|
30 | } else { |
---|
31 | status &= ~NIOS2_STATUS_PIE; |
---|
32 | } |
---|
33 | break; |
---|
34 | case NIOS2_ISR_STATUS_MASK_EIC_IL: |
---|
35 | status &= ~NIOS2_STATUS_IL_MASK; |
---|
36 | status |= (new_level << NIOS2_STATUS_IL_OFFSET) & NIOS2_STATUS_IL_MASK; |
---|
37 | break; |
---|
38 | case NIOS2_ISR_STATUS_MASK_EIC_RSIE: |
---|
39 | if ( new_level == 0 ) { |
---|
40 | status |= NIOS2_STATUS_RSIE; |
---|
41 | } else { |
---|
42 | status &= ~NIOS2_STATUS_RSIE; |
---|
43 | } |
---|
44 | break; |
---|
45 | default: |
---|
46 | /* FIXME */ |
---|
47 | _Internal_error_Occurred( INTERNAL_ERROR_CORE, false, 0xdeadbeef ); |
---|
48 | break; |
---|
49 | } |
---|
50 | |
---|
51 | return status; |
---|
52 | } |
---|
53 | |
---|
54 | void _CPU_ISR_Set_level( uint32_t new_level ) |
---|
55 | { |
---|
56 | uint32_t status = _Nios2_Get_ctlreg_status(); |
---|
57 | |
---|
58 | status = _Nios2_ISR_Set_level( new_level, status ); |
---|
59 | |
---|
60 | _Nios2_Set_ctlreg_status( status ); |
---|
61 | } |
---|