1 /*******************************************************************************
2  * Copyright 2019-2020 Microchip FPGA Embedded Systems Solutions.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * MPFS HAL Embedded Software
7  *
8  */
9 /***************************************************************************//**
10  *
11  * Legacy interrupt control functions for the Microchip driver library hardware
12  * abstraction layer.
13  *
14  */
15 #include <stdio.h>
16 #include "hal/hal.h"
17 #include "mpfs_hal/common/mss_util.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /*------------------------------------------------------------------------------
24  *
25  */
HAL_enable_interrupts(void)26 void HAL_enable_interrupts(void) {
27     __enable_irq();
28 }
29 
30 /*------------------------------------------------------------------------------
31  *
32  */
HAL_disable_interrupts(void)33 psr_t HAL_disable_interrupts(void) {
34     psr_t psr;
35     psr = read_csr(mstatus);
36     __disable_irq();
37     return(psr);
38 }
39 
40 /*------------------------------------------------------------------------------
41  *
42  */
HAL_restore_interrupts(psr_t saved_psr)43 void HAL_restore_interrupts(psr_t saved_psr) {
44     write_csr(mstatus, saved_psr);
45 }
46 
47 #ifdef __cplusplus
48 }
49 #endif
50 
51