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

Last change on this file was 80cf60e, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 15, 2020 at 7:48:32 AM

Canonicalize config.h include

Use the following variant which was already used by most source files:

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 * Copyright (c) 2011, 2016 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 ((level & NIOS2_STATUS_IL_MASK) >> NIOS2_STATUS_IL_OFFSET) == 0;
27    case NIOS2_ISR_STATUS_MASK_EIC_RSIE:
28      return (level & NIOS2_STATUS_RSIE) != 0;
29    default:
30      return (level & 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, 0xdeadbeef );
52      break;
53  }
54
55  return level;
56}
Note: See TracBrowser for help on using the repository browser.