source: rtems/cpukit/score/cpu/nios2/nios2-isr-get-level.c @ 408609f6

5
Last change on this file since 408609f6 was 408609f6, checked in by Sebastian Huber <sebastian.huber@…>, on 11/10/16 at 14:17:28

score: Add _ISR_Is_enabled()

In contrast to _ISR_Get_level() the _ISR_Is_enabled() function evaluates
a level parameter and returns a boolean value.

Update #2811.

  • Property mode set to 100644
File size: 1.4 KB
Line 
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.org/license/LICENSE.
12 */
13
14#ifdef HAVE_CONFIG_H
15  #include "config.h"
16#endif
17
18#include <rtems/score/cpu.h>
19#include <rtems/score/interr.h>
20#include <rtems/score/nios2-utility.h>
21
22bool _CPU_ISR_Is_enabled( uint32_t level )
23{
24  switch ( _Nios2_ISR_Get_status_mask() ) {
25    case NIOS2_ISR_STATUS_MASK_EIC_IL:
26      return ((status & NIOS2_STATUS_IL_MASK) >> NIOS2_STATUS_IL_OFFSET) == 0;
27    case NIOS2_ISR_STATUS_MASK_EIC_RSIE:
28      return (status & NIOS2_STATUS_RSIE) != 0;
29    default:
30      return (status & NIOS2_STATUS_PIE) != 0;
31  }
32}
33
34uint32_t _CPU_ISR_Get_level( void )
35{
36  uint32_t status = _Nios2_Get_ctlreg_status();
37  uint32_t level = 0;
38
39  switch ( _Nios2_ISR_Get_status_mask() ) {
40    case NIOS2_ISR_STATUS_MASK_IIC:
41      level = (status & NIOS2_STATUS_PIE) == 0;
42      break;
43    case NIOS2_ISR_STATUS_MASK_EIC_IL:
44      level = (status & NIOS2_STATUS_IL_MASK) >> NIOS2_STATUS_IL_OFFSET;
45      break;
46    case NIOS2_ISR_STATUS_MASK_EIC_RSIE:
47      level = (status & NIOS2_STATUS_RSIE) == 0;
48      break;
49    default:
50      /* FIXME */
51      _Terminate( INTERNAL_ERROR_CORE, false, 0xdeadbeef );
52      break;
53  }
54
55  return level;
56}
Note: See TracBrowser for help on using the repository browser.