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